Skip to content

feat(review-anvil): per-finding context as a validated sidecar - #10

Merged
mrshu merged 9 commits into
mainfrom
review-anvil-finding-context
Oct 27, 2026
Merged

mrshu merged 9 commits into
mainfrom
review-anvil-finding-context

Conversation

@mrshu

@mrshu mrshu commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Builds on #9 by @vidriduch: keeps the per-finding context data, drops the viewer. The earlier commits are #9's, rebased onto main; the last commit is the rework.

Why

Each finding should record where its evidence lives, pinned to the commit that was reviewed, so a human reviewer can retrace it and later tools can build on it. #9 showed that reviewers fill this in readily. This PR makes that data a stable interface and leaves rendering for later.

What changes

  • One schema end to end. Reviewers return context on every finding ([] if the anchor is enough): {kind: file, label, path, lines: [[start, end]], repo?, commit?} or {kind: pr, label, number, repo?}, at most 8. A file in another repository requires a full 40-char commit. Versioned schema in references/report-artifacts.md.
  • A context file, not hidden markdown. The engine writes <report_path>.context.json with {v: 1, findings: [{id, revision?, items}]}. revision is the commit that finding's round reviewed. Context never goes through the clarity or action-lock passes.
  • pr-helper.sh embed-context validates every record and adds one hidden line per finding the posted report still lists, at the end of the top-level report before the footer: <!-- review-anvil: context={"v":1,"id":…,"revision":…,"items":[…]} -->. The report is the only place context is posted. It covers every finding, including low/nit findings and review-anvil-improve-pr runs; inline comments are left unchanged. revision is left out when there's no commit to pin to (an uncommitted working tree).
  • The helper is careful with that line:
    • Re-running replaces earlier lines instead of stacking them, and code blocks are left alone.
    • Every - that comes before another - is escaped, so the hidden comment can't end early.
    • Context never blocks a post: a missing or bad file, an over-size report, or a helper failure just means posting without it.
  • Within the pipeline: reproduction verifiers start from the context locations, and the history parser ignores context lines.
  • Removed: the review-anvil-context and review-anvil-comments skills, and the local .review-anvil/report-*.md files, so read-only runs stay side-effect free.

Deliberately not included

  • Context isn't copied onto inline comments. The report already covers every finding, and a second copy needed its own matching, cleanup, and size handling (cut after a Codex simplification review).
  • Context isn't fed into the PR-history list that the next run's reviewers read: old context goes stale and makes every prompt bigger.
  • No visible links: the format comes first. A renderer (GitHub links, an editor plugin, a revived viewer) can read the hidden lines or .context.json.

Testing

  • test-pr-helper.sh has 4 new tests: validation and re-running, never blocking a post, the full post path, and the history parser.
  • All review-anvil suites pass.
  • A full post through the fake gh shows the hidden lines at the end of the report, with artifacts cleaned up afterwards.

vidriduch and others added 9 commits October 6, 2026 14:32
* review-anvil-context: tmux + fzf + bat pane with a finding's code context
* review-anvil-comments: PR review comment list that opens each context
* context-helper.sh reads hidden context lines, validates every item
* other-repo files fetched from GitHub at a full SHA, cached read-only
* README, plugin and marketplace descriptions list both skills
* reviewer schema gains optional context locations per finding
* synthesis merges, checks and passes context to .inline.json
* pr-helper embeds a hidden review-anvil context line before the id marker
* other-repo entries need a full SHA; invalid entries dropped with a warning
* test covers marker placement, encoding and rejected entries
* shared jq marker def: last non-empty body line, whole-line match only
* finding_of, resolve_finding and the comment list use the same rule
* quoted markers in prose or suggestions no longer change a comment's ID
* sanitize_context rejects an empty-string repo, like the writer
* plugin.json and marketplace.json both at 0.17.0
* ships the context and comments viewer skills and reviewer context
* report ends with a hidden context block: one line per finding, with commit
* pr-helper validates and re-encodes the block inside process-inline
* local runs keep the report in .review-anvil/report-<UTC>.md
* viewer reads PR reports and inline comments, or a local report (--local)
* findings pinned to their reviewed commit; ranges highlighted as ranges
* chat copy of the final report drops review-anvil-report markers
* context block lines left out of the chat copy too
* report file keeps every marker for helpers and viewers
* readonly and improve-pr presets surface the chat copy
Drop the tmux/fzf context viewer and local report persistence. Reviewers
return a structured context list per finding; the engine writes
<report_path>.context.json (versioned schema in report-artifacts.md) and
pr-helper.sh embed-context validates it and embeds one hidden line per
finding in inline comments and the report. Context never blocks a post.
Reproduction verifiers start from the context locations.
Inline comments no longer get context lines: the report block already
covers every finding. Trim item validation to the record contract, omit
an unknown revision instead of using null, reject a boolean schema
version, and always clear stale context lines on retry.
…context

# Conflicts:
#	plugins/review-anvil/skills/review-anvil/references/reproduction-prompt.md
@mrshu
mrshu merged commit 16ecc01 into main Oct 27, 2026
1 check 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.

2 participants