Repository navigation
feat: report a review run's findings as validated JSON - #30
Merged
Merged
Conversation
A review run's second turn resumes the session the first one left behind and asks for the same review as structured output, held to a JSON schema derived from the schema the findings are kept under. Prose alone is not something the tool can reason about: a blocking finding is what puts a pull request in Needs me, and a fix session is handed findings rather than a report. A turn that exits badly, runs out of patience or answers in a shape that does not validate is recorded as a failure, so no run is ever read as a clean one. The re-run rule lands with it, so a typo fix does not cost a full review, and --force is the way past it. Closes #7 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ADR 0006 puts the rules in `domain/` because a rule in a command cannot be tested without the command, and four of the re-run rule's decisions had stayed behind: no run to measure from, a run that reported nothing, a comparison GitHub would not answer, and a head already reviewed. `skippedSince` now holds all of them and the command only gathers what it is asked about. A run that reported nothing is read through one place as well, so nothing can mistake a failure for a clean verdict by forgetting to look. The two turns of a runner shared most of their spawning and draining, and now share it outright, which is where the review turn picked up the timeout it never had: a review command that hangs forever is worse than one that says it failed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A review run is two turns of one session. The first writes the review as prose (#6); the second resumes that session and asks for the same review as structured output, held to a JSON schema. The tool can then reason about a review instead of reprinting it — a blocking finding is what puts a pull request in Needs me, and a fix session is handed findings rather than a report.
sequenceDiagram participant C as dw-mc review participant G as gh participant R as state directory participant A as claude C->>R: the last run on this pull request C->>G: what changed since its head Note over C: the re-run rule, before anything is cut or spawned C->>A: /code-review <effort> in the worktree A-->>C: the report, and the session it ran in C->>A: --resume <session> --json-schema <findings> A-->>C: structured_output C->>R: the run and its outcome, the report beside itThe schema handed to the runner is derived from the schema the findings are kept under, so a runner is asked for exactly the shape that is persisted:
A runner that grades in a persona's own words is read anyway:
CriticalandRequiredweigh aserror,Optionalaswarning,NitandFYIasinfo. A word nothing weighs fails the turn rather than becoming a guess.A failure is never a clean verdict
A turn that exits non-zero, runs out of patience or answers in a shape that does not validate is recorded as a failure. The report is still kept, the pull request stays in Needs review run, and the command exits non-zero. Everything that reads a run's findings reads them through one place, so nothing can mistake the one for the other by forgetting to look.
The review turn picked up the timeout it never had. A review command that hangs forever is worse than one that says it failed.
The re-run rule
A run is repeated only where files outside the repository's
docs_onlyglobs changed since the last run on that pull request, so a typo fix does not cost a full review. GitHub compares the two heads, because the commit a run was recorded against is not one the tool's own clone is promised to still have.Four things are never skipped, because the rule is there to save me a review and not to stand between me and one I asked for: a pull request with no run behind it, a run that reported nothing, a comparison GitHub would not answer, and
--force.dw-mc findings <pr>Prints what the current run found, as a table or — with
--json— as the JSON a fix session is handed and nothing else, so it pipes. A run that failed prints nothing and exits non-zero.Verified by running it
claude -p --resume <session> "…" --output-format json --json-schema <inline JSON>returns the validated object understructured_output, beside the usualresult. Both turns are driven end to end from fixture CLI output through the spawner seam.Left to their own tickets
path_instructionson the second turn, whichdocs/v1-design.mdplaces here. Nothing in Review run, second turn: structured findings #7 asks for them and their phrasing is not decided.Closes #7
🤖 Generated with Claude Code