š fix: a merged pull request closes the State it names
Builds State #224 of P-07: a merged pull request closes the State it names, and the work rules make sure a fix names one.
Why
Five States stayed open after the pull requests that delivered them merged: #176 (#177), #171 (#172), #161 (#162), #198 (#199) and #195 (#196). The coordinator closed each by hand; until then they showed in the owner's Needs you view. Each was a fix, filed as the README says as a State under a slice that was closed already. Each pull request named the slice with Slice: #N and the State only in prose ("Builds State #176 of P-40", "State #195 of P-11 (#33)"). The merged job reads Slice: lines alone, so it commented on the closed slice, and nothing named the State.
What changes
State: #Nline (statesNamedinsrc/work.ts), the same shape asSlice: #N: a number or an issue link, one per line.pr-mergedcloses each State aState:line names as completed, with the slice'sBuilt in #PR, merged into main.comment, posted once. A State is closed only when its parent is a slice the pull request names. A State closed as not planned is left alone, and so is anything that isn't a State. If GitHub closed it already through "Closes #N", it still gets the comment. If its parent can't be read, the job fails. The comment-and-close code is shared with slices (closeBuilt), and the error messages are the same as before.- Work rules (
pr-work-rules) refuse two things. The first is aState:line naming anything but a State sub-issue of the slice. The second is an agent pull request for a closed slice (a fix) that names no open State of it. Pre-push is unchanged: only a pull request's description carriesState:lines. - README (work rules list, "The board follows the work.", "What needs the owner."),
docs/decisions.md, thechecks.ymlstep comment andpr-merged's help line say so. Onboard's client workflow template is left alone, so clients get no repin diff from this.
Behaviour change for adopting repos
Once a client repins to a release with this, an agent pull request for a closed slice is refused unless it names its open State with State: #N. Slice briefs should tell agents to add that line. The decision and the options rejected (closing every open State of the slice, parsing prose, relying on "Closes #N") are in docs/decisions.md.
Not live until the next release
This repo's process-rules.yml pins a release, so this PR's own merge runs the pinned CLI and won't close #224. The coordinator closes it, as before. The version is not bumped here.
Evidence
pnpm check passes: 1134 tests, coverage 99.48% lines and 97.42% branches. The new tests are in src/work.test.ts and use the fake Sys and GitHub:
prMergedāŗ the States it names: closes a named State with the comment; leaves a State named only in prose open (the five cases); comments once on a State GitHub closed already; leaves a not-planned State, one under another slice or with no parent, and a non-State alone; fails on an unreadable parent or a refused close.prWorkRules: passes a fix naming its open State; refuses a fix naming no State or only a delivered one; refuses aState:line for a non-State or a non-sub-issue; passes an open slice with or without aState:line.statesNamed: reads lines by number or link, without repeats, and ignores prose.
š¤ Generated with Claude Code
Summary by cubic
Fixes States staying open after the pull requests that delivered them merged: a merged pull request now closes each State it names with a line State: #N, and the work rules require fixes to name the open State they are filed as. Five States had to be closed by hand after their PRs merged because they were named only in prose.
What changes
- The merged job closes each State under a slice the pull request names, with the slice's "Built in #PR" comment posted once.
- A not-planned State, one under a slice the pull request doesn't name, and a non-State are left alone; a State GitHub closed already still gets the comment.
- The work rules refuse a
State:line naming anything but a State sub-issue of the slice, and a fix that names no open State of its closed slice.
Behavior change for adopting repos
- Once a client re-pins to a release with this, an agent PR for a closed slice is refused unless it names its open State with
State: #N; slice briefs should tell agents to add that line. - This repo's
process-rules.ymlpins a release, so this PR's own merge won't close #224; the coordinator closes it as before.