Skip to content

feat(tools): expose the suspect commit in get_issue_details - #1339

Merged
betegon merged 4 commits into
getsentry:mainfrom
hasnaintypes:feat/1249-suspect-commit
Sep 28, 2026
Merged

betegon merged 4 commits into
getsentry:mainfrom
hasnaintypes:feat/1249-suspect-commit

Conversation

@hasnaintypes

@hasnaintypes hasnaintypes commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1249 by calling the events/committers endpoint using the event ID already fetched and exposing the suspect commit in both structured and Markdown responses from get_issue_details.

Key Changes

  • Added getEventCommitters to the API client, backed by CommitterSchema and CommittersResponseSchema.
  • Include the suspect commit's SHA, message, author, and source in structured output and the Markdown fallback, including explicit event lookups.
  • Keep commit lookup optional: unavailable commit data does not prevent issue details from loading, while unexpected server or response-validation failures are reported to Sentry.
  • Cover both output formats, event selection, absent commits, and expected and unexpected lookup failures with regression tests.

Breaking Changes

  • None

get_issue_details already fetches the event, so its ID is in hand for
the events/committers endpoint. Surface the first commit's id, message,
author, and suspectCommitType in the structured payload instead of
requiring a separate analyze_issue_with_seer call for a question the
API already answers.
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 25, 2026
betegon and others added 3 commits September 25, 2026 12:55
Render the suspect commit in Markdown as well as structured responses. Report unexpected commit lookup failures while keeping issue details available, and cover output modes and failure handling with regression tests.

Co-Authored-By: GPT-6 <noreply@openai.com>
Reuse the structured-content test helper, consolidate lookup failure cases, and remove redundant absence checks and an unused type. Bind event fixtures to the requested endpoint with a unique ID so event-selection regressions cannot use shared fallback data.

Co-Authored-By: GPT-6 <noreply@openai.com>
Replace unreachable transaction success cases with the actual lookup failure in the existing transaction test. Cover the commit author email fallback and nullable message with a realistic response, and clarify that lookup returns the current issue suspect commit.

Co-Authored-By: GPT-6 <noreply@openai.com>
@betegon
betegon merged commit 6494584 into getsentry:main Sep 28, 2026
13 of 14 checks passed
BYK pushed a commit that referenced this pull request Sep 30, 2026
…ags patch (#1340)

Global flags before the subcommand (`sentry --verbose issue list`) used
to be relocated to the tail of argv by `argv-hoist.ts`, because Stricli
only parses flags at the leaf command and treats a global flag in a
route position as an unknown subcommand.

This teaches Stricli's route scanner about a fixed allow-list of Sentry
global flags via the existing `@stricli/core` patch (same mechanism as
the `-H` removal), so `buildRouteScanner` recognizes `--verbose`,
`--json`, `--org`, `--project`, `--log-level`, `--fields` (and the `-v`
alias, plus `=`-inline/value forms) at any route depth and forwards them
to the leaf command instead of failing route resolution. The patch also
drops Stricli's built-in `-v`=version alias so `-v` stays the CLI's
`--verbose` alias at every position; `--version` remains the version
flag.

`argv-hoist.ts` is deleted. The two transforms Stricli can't do at
arbitrary route depth stay as thin app-boundary glue in `argv-glue.ts`:
`--version` normalization (Stricli only prints it at argv[0]) and the
`--help --json` rewrite to the `help` command (Stricli intercepts
`--help` and ignores `--json`).

**Scope note:** the last checklist item from the issue — upstreaming the
top-level-flags behavior to Stricli — is intentionally left out of this
PR; the local patch stays until/unless accepted.

## Testing
- `pnpm exec vitest run test/lib/argv-glue.test.ts
test/lib/argv-glue.integration.test.ts test/commands/help.test.ts
test/commands/bash-hook.test.ts` (77 passed)
- `pnpm run check:patches`, `tsc --noEmit`, `biome check` on changed
files — all clean
- Manual smoke via `run(app, preprocessArgv(argv))`: `issue list --help
--json` and `--help --json` emit structured JSON; `cli --version` and
`--version` print the version; `--verbose/--org/-v` before or between
route segments reach the leaf; `-- passthru` is not consumed as a global
flag

Closes #1339

<!--
## Plan
Root cause: the argv-hoist preprocessor exists only because Stricli
parses flags
at the leaf level and rejects global flags placed before the subcommand
as
unknown route segments. buildRouteScanner already special-cases
--help/--helpAll/--version while walking the route tree, so it's the
natural hook
for a global-flag allow-list.

Changes:
1. @stricli/core patch, regenerated via `pnpm patch`, edits both
   dist/index.js and dist/index.cjs: add SENTRY_TOP_LEVEL_*_FLAGS sets +
matchSentryTopLevelFlag(); in scanner.next(), before route resolution,
push a
recognized global flag to unprocessedInputs (value flags latch the next
token
as their value). Placed after the --help interception; guarded by
!target so
leaf/-- handling is unchanged. Also drop the built-in -v=version alias
in
runApplication. The token set is hardcoded (minified dist can't import
   GLOBAL_FLAGS); global-flags.ts documents the coupling.
2. check-patches.ts: add requiredMarker (presence) support; assert
matchSentryTopLevelFlag present and the stale -v version check gone in
both
   bundles.
3. Delete argv-hoist.ts. New argv-glue.ts keeps isVersionRequest +
rewriteHelpJsonRequest and a thin preprocessArgv (no hoisting). Wire
cli.ts,
   rename hoistedArgs -> normalizedArgs, update global-flags.ts docs.
4. Tests: delete the two argv-hoist test files; add argv-glue.test.ts
and
argv-glue.integration.test.ts (run(app,...), hermetic via bash-hook and
   `cli defaults`).
-->

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
mr-danya pushed a commit to mr-danya/sentry-mcp that referenced this pull request Oct 6, 2026
…ags patch (getsentry#1340)

Global flags before the subcommand (`sentry --verbose issue list`) used
to be relocated to the tail of argv by `argv-hoist.ts`, because Stricli
only parses flags at the leaf command and treats a global flag in a
route position as an unknown subcommand.

This teaches Stricli's route scanner about a fixed allow-list of Sentry
global flags via the existing `@stricli/core` patch (same mechanism as
the `-H` removal), so `buildRouteScanner` recognizes `--verbose`,
`--json`, `--org`, `--project`, `--log-level`, `--fields` (and the `-v`
alias, plus `=`-inline/value forms) at any route depth and forwards them
to the leaf command instead of failing route resolution. The patch also
drops Stricli's built-in `-v`=version alias so `-v` stays the CLI's
`--verbose` alias at every position; `--version` remains the version
flag.

`argv-hoist.ts` is deleted. The two transforms Stricli can't do at
arbitrary route depth stay as thin app-boundary glue in `argv-glue.ts`:
`--version` normalization (Stricli only prints it at argv[0]) and the
`--help --json` rewrite to the `help` command (Stricli intercepts
`--help` and ignores `--json`).

**Scope note:** the last checklist item from the issue — upstreaming the
top-level-flags behavior to Stricli — is intentionally left out of this
PR; the local patch stays until/unless accepted.

## Testing
- `pnpm exec vitest run test/lib/argv-glue.test.ts
test/lib/argv-glue.integration.test.ts test/commands/help.test.ts
test/commands/bash-hook.test.ts` (77 passed)
- `pnpm run check:patches`, `tsc --noEmit`, `biome check` on changed
files — all clean
- Manual smoke via `run(app, preprocessArgv(argv))`: `issue list --help
--json` and `--help --json` emit structured JSON; `cli --version` and
`--version` print the version; `--verbose/--org/-v` before or between
route segments reach the leaf; `-- passthru` is not consumed as a global
flag

Closes getsentry#1339

<!--
## Plan
Root cause: the argv-hoist preprocessor exists only because Stricli
parses flags
at the leaf level and rejects global flags placed before the subcommand
as
unknown route segments. buildRouteScanner already special-cases
--help/--helpAll/--version while walking the route tree, so it's the
natural hook
for a global-flag allow-list.

Changes:
1. @stricli/core patch, regenerated via `pnpm patch`, edits both
   dist/index.js and dist/index.cjs: add SENTRY_TOP_LEVEL_*_FLAGS sets +
matchSentryTopLevelFlag(); in scanner.next(), before route resolution,
push a
recognized global flag to unprocessedInputs (value flags latch the next
token
as their value). Placed after the --help interception; guarded by
!target so
leaf/-- handling is unchanged. Also drop the built-in -v=version alias
in
runApplication. The token set is hardcoded (minified dist can't import
   GLOBAL_FLAGS); global-flags.ts documents the coupling.
2. check-patches.ts: add requiredMarker (presence) support; assert
matchSentryTopLevelFlag present and the stale -v version check gone in
both
   bundles.
3. Delete argv-hoist.ts. New argv-glue.ts keeps isVersionRequest +
rewriteHelpJsonRequest and a thin preprocessArgv (no hoisting). Wire
cli.ts,
   rename hoistedArgs -> normalizedArgs, update global-flags.ts docs.
4. Tests: delete the two argv-hoist test files; add argv-glue.test.ts
and
argv-glue.integration.test.ts (run(app,...), hermetic via bash-hook and
   `cli defaults`).
-->

---------

Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Actions — 4fea93fc Deployed Sep 28, 2026 by betegon via eval #1135
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.

feat(get_issue_details): expose the suspect commit

2 participants