feat(review): offline --local-range mode for pre-submission review (#357 follow-on)#369
Conversation
Add --allow-closed (review closed/merged items: fixtures, hypothetical re-review), --body-file (substitute a hypothetical PR body to exercise the proof/mantis decision, and to feed the body to engines that cannot fetch it live), and --additional-policy (layer a repo-specific policy file). All route through additionalPrompt + the one selection gate, so they apply to every engine uniformly.
Synthesize the Item + ItemContext from the local git range (merge-base(--base, HEAD)..HEAD) so the full review — real-behavior proof and mantis decision — runs BEFORE a PR exists and WITHOUT a GitHub fetch. The diff comes from `git diff`, the body from the commit message (or --body-file), so it works offline and on fork checkouts that the gh-fetch path rejects.
Add buildLocalRangeReviewForTest + a temp-git-repo test asserting the synthetic PR item, the commit-message body, and the git-diff pullFiles are built offline, and that an empty range throws.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 10:55 PM ET / 02:55 UTC. Summary Reproducibility: yes. for the review findings: source inspection shows the new Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Either fold committed-range pre-PR review into the existing hardened Do we have a high-confidence way to reproduce the issue? Yes for the review findings: source inspection shows the new Is this the best way to solve the issue? No. The narrower maintainable path is to reuse the existing hardened local-review implementation or intentionally duplicate all of its offline protections, then fix synthetic metadata and diff parsing before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 323f7bdf7236. Label changesLabel justifications:
Evidence reviewedSecurity concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
#357 added
review --local-onlyfor advisory review before submitting a PR — but itstill requires the issue/PR to already be open on GitHub: it fetches the item, diff,
body, and comments via the API (
--item-number), and rejects closed items. So you can'tactually review your work before opening the PR, which is the stated goal.
This adds
--local-range: review the local git range(
merge-base(--base, HEAD)..HEAD) with no GitHub fetch. TheItem+ItemContextare synthesized from
git— the diff fromgit diff, the body from the commit message(or
--body-file) — so the full review (including the real-behavior-proof and Mantisassessments) runs offline, before a PR exists, and on fork checkouts that the gh-fetch
gitInfopath rejects.It also folds in three small, related advisory-review affordances that compose with it:
--allow-closed: review closed/merged items (regression fixtures, hypothetical re-review).--body-file <file>: substitute the PR body in the prompt — to test thereal-behavior-proof / Mantis decision against a hypothetical body, or to supply the body
when reviewing a local range.
--additional-policy <file>: layer a repo-specific policy file onto the review prompt.Changes
--local-range(with--base <ref>, defaultorigin/main):buildLocalRangeReview()builds a synthetic
Item+ItemContext(pullFilesfromgit diff, body from thecommit message) and
reviewCommandbranches three points — offlinegitInfo(
{ mainSha, latestRelease: null }, no fetch), the synthetic candidate, and the syntheticcontext — and suppresses the review-start comment.
--allow-closed: relaxes the open-only selection gate inselectCandidates.--body-file: injects an authoritative PR-body section into the review prompt.--additional-policy: reads a policy file and layers it onto the review prompt.Validation
pnpm run check(build, lint, unit + repair tests, changed + full coverage, format):passes —
fail 0, format clean.Offline review of a real fork checkout (a 3-file, +113/-3 change) produced a valid
Decision with no GitHub access — the diff was read from
git diff, not the API:Scope / notes
--local-rangeimplies no GitHub writes (no startcomment, no posted review).
Authored with Claude Code.