Skip to content

fix(cli): support multiple fully-qualified log paths in log view - #1463

Open
sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/cli-log-view-multi-path
Open

sentry[bot] wants to merge 2 commits into
mainfrom
seer/fix/cli-log-view-multi-path

Conversation

@sentry

@sentry sentry Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

When a user or AI coding agent invoked sentry log view <org>/<project>/<id1> <org>/<project>/<id2>, parsePositionalArgs treated the entire first argument as the target (targetArg = "<org>/<project>/<id1>") and forwarded the second argument unstripped to ID validation, where it failed hex validation and triggered a ResolutionError.

Changes

  • Add splitFullLogPath to detect <org>/<project>/<32-hex-id> arguments in commands/log/view.ts.
  • When the first argument is a full log path, split all arguments into their shared target and bare log IDs, allowing combinations of full paths and bare IDs.
  • Throw a clear ValidationError when multiple full paths reference different project targets.
  • Strip redundant <target>/ prefixes when the target is explicitly provided followed by prefixed log IDs (sentry log view org/proj org/proj/<id>).
  • Add unit tests covering multi-path invocation, mixed full/bare IDs, mismatched projects, and redundant target prefixes.

Fixes CLI-1XC

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 10, 2026
Replace org/project slugs copied from production telemetry with the
generic placeholders used by the rest of the suite.

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me at d3376d73. I pushed one test-only change.

Evidence: I sampled the 10 most recent CLI-1XC events, from releases 0.29.1 through 0.38.0. Every one has the same shape. The first org/project/<log-id> argument was used whole as the target, and the second fully-qualified path then failed hex validation with a ResolutionError. parsePositionalArgs on main still does exactly this (args.slice(1) with the first argument as the target). So the bug is real and still present.

The fix: splitting the first argument only happens when it has two or more slashes and ends in a 32-char hex ID. The existing single-arg, swapped-arg, and short-ID paths are unchanged, and mixed projects now get a clear ValidationError instead of an invalid-ID error. The org/proj org/proj/<id> prefix strip isn't in the captured events, but it's the same mistake with the target given separately, and it costs little.

My change (d3376d73): the first new test used the org/project slugs from the production event. I replaced them with the my-org/frontend placeholders used elsewhere in the suite.

Tests: all 75 tests in view.test.ts, view.func.test.ts, and view.property.test.ts pass. With main's view.ts, all 4 new tests fail. Oxlint and oxfmt are clean on both files.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants