feat(snapshots): Add download command for baseline snapshots#3310
feat(snapshots): Add download command for baseline snapshots#3310NicoHinderling wants to merge 1 commit into
Conversation
|
f391865 to
affb90b
Compare
affb90b to
8783c35
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8783c35. Configure here.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8783c35 to
a218cba
Compare
cameroncooke
left a comment
There was a problem hiding this comment.
sentry-cli snapshots download returns 404 when using an org auth token
The snapshots download command fails with No baseline snapshot found even when a base snapshot clearly exists in the UI.
Root cause: The endpoint GET /api/0/organizations/{org}/preprodartifacts/snapshots/latest-base/ calls get_filter_params(), which — when no project= query param is supplied — falls back to "projects the caller is a member of." Org auth tokens (sntrys_*) aren't associated with a user, so they have no project membership, and the call short-circuits to NoProjects → 404. The user never sees a distinct error; it looks identical to "snapshot doesn't exist."
Confirmed: Adding &project=<id> to the same request returns the snapshot successfully — org tokens satisfy has_project_access via their scopes, just not the membership path.
Fix options:
- CLI side: Add a
--projectflag tosentry-cli snapshots downloadand forward it asproject=<id>. Matches
the convention used bybuild uploadand other commands. Smallest change, works in CI. - Server side: When no
project=is supplied, fall back to scoping byorganization_idonly (the endpoint already orders by-date_addedand filters byapp_id). Risk:app_idcollisions across projects within an org become possible.
|
Just wondering if we can add support to include JSON sidecar files too? |

Summary
sentry-cli snapshots downloadcommand for downloading baseline snapshot images from Sentry's preprod system to a local directory--app-id(resolves latest baseline snapshot) or--snapshot-id(direct artifact ID), with optional--branchfilter--outputdirectory (default./snapshots-base/)get_latest_base_snapshotanddownload_snapshot_zipUsage
Test plan
cargo clippy -- -Dwarningspasses cleancargo fmt --checkpassescargo test snapshots— all 4 integration tests pass (including new download help test)sentry-cli snapshots download --app-id sentry-frontendagainst real Sentry org🤖 Generated with Claude Code