8000 feat(review): label my own PR with the review run by dominikwozniak · Pull Request #135 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat(review): label my own PR with the review run - #135

Merged
dominikwozniak merged 1 commit into
mainfrom
feat/134-review-label
Sep 22, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
feat/134-review-label

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

A review run's verdict lives only on this machine, so a teammate who opens one of my pull requests cannot tell whether its head was reviewed or what the review found. A repository that turns on labels.enabled has my pull requests carry the review label for their current head: approved when the review found nothing blocking, changes when it found a blocker. A sweep takes the label off once the head moves, because a label on code nobody has read is worse than no label. ADR 0012 records why this one write is allowed despite ADR 0002.

Closes #134

What changes

  • src/domain/label.ts holds the rule. The label follows the review run at the current head, judged at stamp.blocks_on. A head with no run, or only a failed one, carries neither label. Every label that is not one of the two configured names is left alone.
  • src/cli/sweep.ts and src/cli/review.ts apply the rule through src/cli/label.ts. review touches only a pull request I author.
    • A label the repository does not define is skipped. The command prints gh label create under "Could not label", once per repository.
    • A write that fails costs the pull request nothing.
  • src/adapters/label.ts writes through REST (gh api -X POST|DELETE …/issues/N/labels), never gh pr edit. no-gh-writes admits exactly those two vectors.
  • labels: { enabled, approved, changes } in config.yaml is off by default and set per repository.
  • ADR 0012 records the decision. ADR 0002, ADR 0008 and ADR 0005, CONTEXT.md (a new term, Review label; Sweep), v1-design.md, configuration.md and the dw-mc skill agree with it.

How it flows

flowchart LR
  sweep[sweep / review] --> runs[review run at head]
  runs --> rule{blocking findings?}
  rule -- none --> approved[approved]
  rule -- some --> changes[changes]
  rule -- no run at head --> none[neither]
  approved & changes & none --> diff[diff with PR labels] --> gh[POST / DELETE]
Loading

Test plan

  • pnpm check: pass, 856 tests.
  • src/domain/label.test.ts covers approved, changes, a stale head, no run, labelling off, a label already right, and someone else's label.
  • src/cli/status.test.ts covers the sweep: it adds the label, removes it after a push, swaps the verdict, writes nothing when the label is already right, and never creates a label, with the hint printed once.
  • src/cli/review.test.ts covers labelling my own PR and leaving someone else's alone.
  • no-gh-writes.test.ts accepts the two label writes and refuses PUT, an extra field, a POST to comments, label creation, an endpoint it cannot read, and pr edit --add-label.
  • By hand: create review: approved and review: changes in this repo, turn on labels.enabled, then run node dist/bin.js review <this PR>. Check that the label appears, push a commit, and check that sweep takes it off.

Risk

A mistake here leaves a wrong label on one of my own pull requests. Turning labels.enabled off stops every write, and a label is one click to remove. No other write changes.

🤖 Generated with Claude Code

A review run's verdict only lived on this machine, so nobody reading one of
my pull requests could tell whether its head had been reviewed. A repository
can now turn on labels.enabled, and my PRs there carry the approved or
changes label that matches the run at the current head. A sweep takes the
label off once the head moves, because a label on code nobody read is worse
than no label. ADR 0012 records the carve-out from ADR 0002, and
no-gh-writes admits exactly the two REST calls that move the label.

Closes #134

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit b057f08 into main Sep 22, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the feat/134-review-label branch September 22, 2026 13: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.

feat(review): label my own PR with the review run

1 participant

0