8000 feat: report a review run's findings as validated JSON by dominikwozniak · Pull Request #30 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat: report a review run's findings as validated JSON - #30

Merged
dominikwozniak merged 2 commits into
mainfrom
feat/7-structured-findings
Sep 16, 2026
Merged

dominikwozniak merged 2 commits into
mainfrom
feat/7-structured-findings

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

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 it
Loading

The 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:

{ verdict: clean | findings,
  findings: [{ file, line, severity: error | warning | info, summary }] }

A runner that grades in a persona's own words is read anyway: Critical and Required weigh as error, Optional as warning, Nit and FYI as info. 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_only globs 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 under structured_output, beside the usual result. Both turns are driven end to end from fixture CLI output through the spawner seam.

Left to their own tickets

  • path_instructions on the second turn, which docs/v1-design.md places here. Nothing in Review run, second turn: structured findings #7 asks for them and their phrasing is not decided.
  • A first turn that exits badly still records nothing: it has no session and no report to record. The pull request stays in Needs review run, so such a run is never read as clean.

Closes #7

🤖 Generated with Claude Code

dominikwozniak and others added 2 commits September 16, 2026 18:08
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>
@dominikwozniak
dominikwozniak merged commit 9e1f277 into main Sep 16, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the feat/7-structured-findings branch September 16, 2026 16:23
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.

Review run, second turn: structured findings

1 participant

0