Skip to content

fix(cli): scan/diff --pr stamp the PR number in the diff manifest (#668) - #675

Merged
gadievron merged 3 commits into
masterfrom
fix/668-scan-pr-number
Sep 24, 2026
Merged

gadievron merged 3 commits into
masterfrom
fix/668-scan-pr-number

Conversation

@gadievron

@gadievron gadievron commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

What

openant scan --pr N and openant diff --pr N now emit pr_number: N in diff_manifest.json, matching openant parse --pr N which already did. Closes #668.

The bug

selectMode resolved the PR but returned a modeDecision carrying only Base/Scope — the PR number was dropped at the struct boundary. scan.go's manifestOpts never set pr, so prepareDiffManifest's PR branch never fired on the scan path. Downstream: reporter.py's PR banner never printed and pipeline_output.json.diff.pr_number was null.

The fix

Two lines: modeDecision gains PR int; scan.go passes it to manifestOpts. The omitempty on the JSON field keeps non-PR runs unchanged.

Fixes #668

Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d

How (corrected 2026-09-22)

The shipped mechanism is a stamp-only prNumber: diff_shared.go records the PR number into the diff manifest at construction (:94-98) and scan.go:242 threads it — no second fetch, no manifestOpts.pr re-resolution. (An earlier revision of this body described setting manifestOpts.pr; that was not the shipped fix.)

The scan path's prepareDiffManifest never fired its PR branch (the
modeDecision struct carried only Base/Scope — the PR number that drove
FetchPR was dropped at the struct boundary), so scan --pr and diff --pr
emitted diff_manifest.json with no pr_number while parse --pr (which
sets it via resolveStepDiffOpts) stamped it correctly. Downstream:
reporter.py's PR banner never printed and pipeline_output.json.diff.pr_number
was null.

Fix: modeDecision carries PR; scan.go passes it to manifestOpts. The
manifest's PR branch now fires on the scan path exactly as it does on
the parse path — one field, one assignment.

Fixes #668

Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d
@gadievron

Copy link
Copy Markdown
Collaborator Author

Status: ON HOLD — do not merge.

The adversarial review (2026-09-22) found defects in this PR that need rewriting before it can merge. The specific finding is in the review record. The PR is being rewritten; the current branch and all evidence are preserved.

Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d

Gadi Evron added 2 commits September 22, 2026 14:16
…668)

Rewrite of the previous attempt (which set BOTH opts.pr and opts.base —
triggering the mutual-exclusivity validation and making scan --pr exit 2).

The correct fix: modeDecision carries PR (the resolved number);
manifestOpts carries it as prNumber — a STAMP-ONLY field excluded from
validate()/isSet() (which mean 'the user requested a fetch'), and
excluded from the fetch branch (which re-fetches). BuildManifest receives
firstNonZero(opts.pr, opts.prNumber): the user-facing --pr sets opts.pr
(the fetch path), the resolved decision sets prNumber (the stamp path).

Fixes #668

Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d
Agent: ISSUES-TO-PR ses_f3e7372a5ffe3b2I6lP4Wm3w2d
@gadievron

Copy link
Copy Markdown
Collaborator Author

Hold lifted at 9f795ac — with a body correction from the verification pass: the shipped fix is a stamp-only prNumber (diff_shared.go:94-98, scan.go:242 — no second fetch), while the body's How section still describes setting manifestOpts.pr. The How section is corrected below; the code is what was reviewed and CI'd (19/19).

@gadievron
gadievron merged commit b7bf3f5 into master Sep 24, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scan/diff --pr drop the PR number from the diff manifest while parse --pr keeps it — the scan path's manifest cannot say which PR it analyzed

1 participant