fix(trace): scope trace/span list by numeric project ID - #1364
fix(trace): scope trace/span list by numeric project ID#1364MathurAditya724 wants to merge 1 commit into
Conversation
`sentry traces` (and project-mode `span list`) scoped slug targets only via
`project:<slug>` search syntax on the Events API. That filter only matches
actively selected projects and otherwise returns 400 Bad Request
("Project(s) X do not exist or are not actively selected").
Resolve the slug to a numeric project ID and pass `project=<id>` instead,
mirroring the logs fix in #1318 / #1317 and the issues fix in #312.
Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
|
Jared Get this ready for merging, resolve all the issues you find in the review |
There was a problem hiding this comment.
reviewed the diff, ran the affected suites, and traced the scoping logic — this is clean and ready.
what it does: threads a numeric projectId through listTransactions/listSpans so the events query scopes via the project= param instead of query=project:<slug>, which only matches actively-selected projects and 400s otherwise. same pattern as the #1317 logs fix.
things i verified:
resolveNumericProjectIdcorrectly prefers the explicit id, falls back to an all-digits slug, and returns undefined otherwise so callers degrade to slug scoping rather than fail.- trace mode (
allProjects) skips id resolution and still sendsproject=-1— unchanged. resolveLogProjectIdre-throws user-actionableCliErrors (auth, host scope, 404) and only swallows genuinely transient failures, so a bad slug still fails loudly instead of silently degrading.- test coverage added for the new
projectIdpath in both api and command layers;test/lib/api/traces,test/commands/trace/list,test/commands/span/listall pass locally. lint clean, CI green.
no findings. couldn't do the one unchecked manual step (live call against a non-selected slug) without prod creds, but the production event and live api check in the description already confirm the query shape. i can't merge a risk:medium PR without a human approval, so this is yours to land.
Summary
sentry traces/sentry trace listfails with400 Bad Request: Project(s) <slug> do not exist or are not actively selectedbecause it scopes viaquery=project:<slug>on the Events API instead of the numericproject=param.17f982380b2649f1bebb0d1c0098c05d(sentry.org=sentry-developer-experience,sentry.project=cuzz, breadcrumbquery=project%3Acuzz, noproject=id).resolveLogProjectIdand passproject=<id>fortrace listand project-modespan list.Test plan
listTransactions/listSpansprojectId scopingprojectIdis threaded throughquery=project:cuzz)query=project:operations-bot→ 400 "not actively selected";project=<numeric-id>succeedssentry traces <org>/<project>against a non-selected project slugCloses nothing yet — tracks CLI-10 (
command:sentry.trace.list) events.Made with Cursor