Repository navigation
build: check_plan_ready decides /implement-plan step 2 - #2784
Merged
Merged
Conversation
`gh issue view` is GraphQL, which cloud sessions refuse with HTTP 403, so every `--issues` lookup there came back ERROR and the report never showed a closed issue. The lookup is now `gh api -X GET repos/antonsynd/sharpy/issues/N`; the REST state and state_reason are upper-cased to the values render() already filters on (CLOSED, COMPLETED). /implement-plan step 2 runs this report on every light plan, and check_plan_ready.py (next commit) runs it in-process. Measured: plan-460cbf.md --issues went from 4 lookup errors to "4 referenced; 2 CLOSED; 0 lookup errors". Mutation record (test_issue_lookup_uses_rest; break, restore with cp, checked with cmp): - argv back to `gh issue view N --json state,title,stateReason`: broken -> 1 failed / 3 passed; restored -> 0 failed / 4 passed - state not upper-cased: broken -> 1 failed / 3 passed; restored -> 0 failed / 4 passed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
The owner's ruling of 2026-11-20 ("let's go with your recs") moves
"a plan is implemented only when its stamps allow it" from prose into a
checker. `check_plan_ready.py <plan>` reads the stamp block, the DRAFT
marker, the `## Scope` Tier line, the `## Issues to Close` inputs and
the override records, and prints READY (exit 0), REFUSE (1), ASK (3) or
UNVERIFIED (4) with step 2's messages; 2 stays argparse's usage error.
- Tier: light needs an Adequacy-only (or full) stamp, PASS or CONVERGED;
absent -> REFUSE; then check_plan_refs --issues runs in-process and a
red report (its exit 1) refuses. Full: absent or DRAFT -> ASK.
- NEEDS REVISION -> REFUSE at both tiers.
- Adequacy CELL on a bug-fix plan: ASK (step 2's cell question, or the
converged question with the `### Deferred findings` rows). A bug-fix
plan is one whose `## Issues to Close` inputs (minus "stay open"
items) carry `bug` or a `lane:*` label, or say ICE/regression in the
title, read with `gh api`.
- No Adequacy line: before 2026-08-26 (on that day, by whether the
stamp's sha contains be99a0c) N/A for a feature plan, CELL for a
bug-fix plan without a Defect Class section; later -> REFUSE.
- Scope: MULTI-GROUP or Generator: MISSING -> ASK; no Scope line before
2026-09-27 (95a734e) -> ASK to derive it from the groups; later ->
REFUSE.
- Overrides answer a gate only as `Override (cell|scope): owner
YYYY-MM-DD "<words>" — <comment URL or #N comment ID>`. The comment
is read with `gh api -X GET`: author_association must be OWNER, it
must be on the cited issue or PR, and the quoted words must be in
its body; otherwise REFUSE. Unreadable -> UNVERIFIED, and under
CI=true/1 UNVERIFIED reports as REFUSE. Uncited override prose is
listed and answers nothing.
`--all` prints one row per docs/process/plans/*.md; `--offline` reads
nothing from GitHub.
Mutation record (build_tools/tests/test_check_plan_ready.py, 101
tests; each broken, then restored with cp and checked with cmp; every
restore -> 0 failed / 101 passed):
M01 Tier `light` not read: 11 failed
M02 no Tier line read as light: 14 failed
M03 full unverified -> READY: 5 failed
M04 DRAFT marker ignored: 2 failed
M05 light without adequacy pass -> ASK: 2 failed
M06 NEEDS REVISION not matched: 4 failed
M07 unreadable result line accepted: 1 failed
M08 refs exit 1 not red: 1 failed
M09 refs not run passes: 1 failed
M10 refs run on full plans: 1 failed
M11 no label makes a bug-fix plan: 24 failed
M12 title ICE/regression ignored: 2 failed
M13 "stay open" items counted as inputs: 1 failed
M14 no Issues to Close read as no input: 1 failed
M15 unreadable labels -> ASK: 3 failed
M16 CONVERGED+CELL asked as PASS: 2 failed
M17 only the first Adequacy token read: 1 failed
M18 Adequacy line without a verdict accepted: 1 failed
M19 cutoff comparison reversed: 8 failed
M20 cutoff-day sha test reversed: 2 failed
M21 Defect Class branch dropped: 1 failed
M22 missing Adequacy line after cutoff accepted: 2 failed
M23 MULTI-GROUP not matched: 2 failed
M24 Generator MISSING not matched: 2 failed
M25 pre-Scope-line derivation -> READY: 2 failed
M26 missing Scope line after cutoff accepted: 1 failed
M27 unreadable Scope line accepted: 1 failed
M28 OWNER association not checked: 5 failed
M29 cited words not checked: 2 failed
M30 comment's issue/PR not checked: 2 failed
M31 unreadable override -> READY: 1 failed
M32 repository not checked: 1 failed
M33 citation not required: 1 failed
M34 fenced override text read as a record: 1 failed
M35 legacy override text not listed: 1 failed
M36 CI does not turn UNVERIFIED into REFUSE: 2 failed
M37 CI=1 not read as CI: 1 failed
M38 ASK outranks REFUSE: 1 failed
M39 full plan with Adequacy-only stamp not noted: 1 failed
Absence checks carry positive controls: refs never run on a full plan
(test_full_plan_never_runs_refs) beside the light test that asserts the
call; overrides not read for an unhit gate
(test_overrides_are_read_only_for_a_gate_the_plan_hits) beside the
verified-override tests that read them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Step 2's decision prose (tier, stamp result, Adequacy, Scope, the light tier's check_plan_refs run, the pre-2026-08-26 and pre-2026-09-27 readings) is replaced by one pointer: run `build_tools/check_plan_ready.py <plan>` and act on READY / REFUSE / ASK / UNVERIFIED. What the checker cannot do stays as text: promotion in flight, the CONVERGED deferred rows as Phase 1's first task, the light auditor set, and a new Override bullet that names the record format the checker verifies (an OWNER comment holding the words). The Implementation Summary header is copied from the checker's `Implementation Summary header:` line. Procedure bytes 145065 -> 142472 (-2593); baseline lowered with `scorecard_metrics.py --lower`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
`build_tools` has no __init__.py, so it is a namespace package: run as a script with another checkout on PYTHONPATH (cloud sessions set it to the main checkout), `from build_tools import check_plan_refs` loaded that checkout's copy. The corpus run showed it: plan-21d2f5 reported 7 issue lookups failing through the old `gh issue view` code while this branch's check_plan_refs read all 7. The module is now loaded from the file beside check_plan_ready.py by path. Mutation record (test_script_runs_the_sibling_check_plan_refs: a decoy build_tools/check_plan_refs.py on PYTHONPATH; restore with cp, cmp): - the package-name import restored: broken -> 1 failed / 101 passed; restored -> 0 failed / 102 passed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Independent review @ 8b1df62, "merge after fixes". Its finding 1, reproduced live by the lead: a CELL plan with input #2765 and `Override (cell): owner 2026-11-21 "**" — #2487 comment 7055038414` (an unrelated drift-guard note) read READY, exit 0. - Override words: at least 3 words and 12 characters once normalised, else REFUSE as a malformed record (checked before any read). The test is textual and the docstring now says so: "do not implement it knowingly" holds "implement it knowingly"; the checker does not judge meaning. - Override date: the comment's created_at (a review's submitted_at) is the record's date ± 1 day, UTC; no readable date → REFUSE. - Override link: the cited issue or PR is a plan input, or the comment names the plan id (a whole `plan-xxxxxx` token), or the PR's files (≤ 3 pages of 100) include the plan file; else REFUSE, unreadable → UNVERIFIED. Live now: the `"**"` record reads REFUSE (malformed); words that are in 7055038414 read REFUSE (not linked to the plan). - performed_via_github_app: printed as "relayed via app <slug>" or "no app" in the NOTE and in the Implementation Summary header's Override entry; never judged (the owner's D1 is open). - A light plan's stamp must read PASS or CONVERGED; PASS WITH CORRECTIONS is REFUSE as a malformed stamp. This corrects 2e8ef0f's body, which said "light needs an Adequacy-only (or full) stamp, PASS or CONVERGED" while the code let PASS WITH CORRECTIONS through to READY. - NEEDS REVISION wins over a DRAFT marker beside it (REFUSE, both tiers). - The pre-2026-09-27 Scope ASK is addressed to the lead: derive the groups, proceed on one, ask the owner on more. - HTML comment spans (one line or several) are not read for records, Tier lines or deferred rows; the stamp lines are still read from the header. - Tier: `**light**`, `_light_`, `` `light` ``, `Tier — light`, `**Tier**: light` parse; a `## Scope` block that mentions a tier no pattern reads is REFUSE, never `full`. - `--json` carries the refs output. Corpus (75 files, GitHub reachable): 33 READY / 2 REFUSE / 40 ASK, no verdict changed. Mutation record (test_check_plan_ready.py, 138 tests; each broken, restored with cp, checked with cmp; every restore -> 0 failed / 138 passed): N01 word/character minimum dropped: 10 failed N02 character minimum dropped ("a b c"): 1 failed N03 date check dropped: 2 failed N04 date boundary ±0: 2 failed N05 missing date read as the record's: 1 failed N06 link check dropped: 3 failed N07 plan-input link dropped: 9 failed N08 plan-id link dropped: 1 failed N09 plan id not a whole token (plan-xy): 1 failed N10 PR-holds-the-plan link dropped: 2 failed N11 unreadable link -> READY: 1 failed N12 app not printed in the NOTE: 1 failed N13 app not printed in the header: 2 failed N14 light PASS WITH CORRECTIONS accepted: 2 failed N15 Scope derivation addressed to the owner: 1 failed N16 HTML comment spans read: 2 failed N17 multi-line comment closed at line end: 2 failed N18 emphasis/backticks before the Tier value: 3 failed N19 dash separator after Tier: 1 failed N20 mentioned-but-unparsed Tier read as full: 1 failed N21 DRAFT marker outranks NEEDS REVISION: 1 failed N22 --json without the refs output: 1 failed A first N18 (the second `[*_`]*`, after `tier:`) survived: that class was redundant and is removed; N18 now breaks the one that carries it. Positive controls: the same record outside a comment is read and the stamp still parses (test_override_inside_an_html_comment_is_not_a_record); a Scope block with no tier mention reads full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Review round 1, findings 4–6. /implement-plan step 2 now says: - a REFUSE on an override record means correct or delete the record; - "proceed or stop" and "which inputs?" are answered in chat with no plan record (the inputs go in the Implementation Summary); - with no Scope line the lead derives the scope and proceeds on one group; only more than one needs the owner; - the owner posts the override words on the plan's pull request or an input issue, and a chat `override` counts only once posted; - the two §11 clauses the checker does not check (a layout-changing phase sharing a gate; a generator-required group without stage 0 or its generator first) are the lead's, and are the scope question. /verify-plan's One-group row and Scope stamp line, and /create-plan's scope-exception sentence and `## Scope` template, name the `Override (scope)` record instead of `override: <owner's words>`. Procedure bytes 142472 -> 142675 (+203, after trimming this change's own wording). The baseline is NOT raised: scorecard_metrics.py --check and test_repository_matches_its_baseline are red by 203 until the lead trims elsewhere or the owner rules a raise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Net against dev: procedure_bytes 145065 -> 142675 (-2390). The branch's intermediate baseline of 142472 (the --lower in 31ee14c) was never a dev value: review round 1's step-2 sentences (af93aed) added 203 bytes on top of it, which is still a net lowering against dev. The baseline file was reset to dev's copy (cp of `git show origin/dev:build_tools/scorecard-baseline.json`) and `scorecard_metrics.py --lower` wrote 142675; no other row changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
The owner ruled on D1-D4 in chat on 2026-11-21: "2) accept and label" (D1)
and "yes to all thtree" (D2 refuse, D3 as built, D4 no record as built).
- D2: a full-tier plan whose stamp is Adequacy-only is REFUSE as a malformed
stamp ("a full plan needs a full /verify-plan pass; re-run /verify-plan"),
unless its Tier line says `promoted at /implement-plan` (the 3eba57 case,
unchanged). This replaces the NOTE that accepted it.
- D1, D3, D4: no code change. The docstring now states them as ruled:
relayed comments are accepted and labelled (the app is printed, not
judged); `lane:tooling` and `lane:message` make a bug-fix plan; an
unverified plan's "proceed or stop" is answered in chat with no record.
Corpus (75 files, GitHub reachable): 33 READY / 2 REFUSE / 40 ASK, no row
changed (3eba57 stays ASK on its CONVERGED + CELL gate).
Mutation record (test_check_plan_ready.py, 138 tests; broken, restored with
cp, checked with cmp; each restore -> 0 failed / 138 passed):
- D2a the full-plan Adequacy-only refusal dropped: 1 failed / 137 passed
- D2b the promotion exemption dropped: 2 failed / 136 passed
Positive control: the promoted, CONVERGED shape reads READY with header
`CLASS (converged)` in the same test that pins the refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Review round 2 on the plan-readiness checker: 1. The quoted words of an override record, and the owner comment they come from, must hold the whole word `override` (case-folded), on top of the 3-word / 12-character rule. The docstring states the limit: this is evidence, not authentication (D1: relayed comments are accepted and labelled), and meaning is not judged. 2. MSG_CELL, MSG_SCOPE and MSG_CONVERGED_CELL ask the owner to post `override` and a one-line reason on the plan's PR or an input issue. The docstring examples and the create-plan template example pass. 3. The light result rule (PASS or CONVERGED only) applies to an Adequacy-only stamp. A light plan with a full stamp keeps PASS WITH CORRECTIONS, its default. 4. The NOTE spells out "no app (web or a local gh/API client; who typed it cannot be told)"; the header keeps `no app`. 5. A Tier REFUSE fires only on label-shaped mentions (`Tier:`, `Tier —`). Prose such as "Two-tier rollout" or "the tier is the owner's call" is not a label. A label with no readable value still refuses. 6. Inline-code spans are blanked before scanning for `<!--`. An HTML comment still open at end of file is a REFUSE. 7. A PR whose last page of files is full is UNVERIFIED, not "not linked". The docstring notes that the date check reads `created_at` only, and that "which inputs?" is the lead's question, answered in the Implementation Summary (also in implement-plan step 2). Procedure bytes: 142675 -> 142673 (`scorecard_metrics.py --lower`). Corpus (75 plans): 33 READY / 2 REFUSE / 40 ASK, no verdict changed. The only changed row is plan-3eba57 (the CONVERGED-CELL question text, item 2). Mutation records: each guard broken -> red, restored with cp, checked with cmp (identical) -> green, over build_tools/tests/test_check_plan_ready.py (153 tests): R01 override words must say `override` 1 failed / 152 -> 0 / 153 R02 `override` as a whole word 1 failed / 152 -> 0 / 153 R03 light result rule only on Adequacy stamp 2 failed / 151 -> 0 / 153 R04 no-app long form in the NOTE 1 failed / 152 -> 0 / 153 R05 tier mention must be label-shaped 3 failed / 150 -> 0 / 153 R06 `<!--` inside inline code is text 1 failed / 152 -> 0 / 153 R07 open comment at end of file -> REFUSE 1 failed / 152 -> 0 / 153 R08 open comment detected 1 failed / 152 -> 0 / 153 R09 PR with a full last page -> UNVERIFIED 1 failed / 152 -> 0 / 153 R10 questions ask for a posted override 1 failed / 152 -> 0 / 153 R11 `which inputs?` names the lead 1 failed / 152 -> 0 / 153 Guards: pytest build_tools/tests 2437 passed / 0 failed / 1 skipped; scorecard --check OK; check_skill_refs OK (0 broken of 1021); process_index --check up to date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Narrow check of 8652b0f: the label-shaped TIER_WORD_RE stopped catching lines such as `- Tier = light`, `- **Tier (contract §12):** light`, `- Tier is light` and `- **Tier** light — charter`. Each read `tier: full` with no message, so a light plan with a full stamp and a red refs report read READY: the refs check was skipped. A list item that starts with the label (TIER_ITEM_RE, `^\s{0,3}[-*+]\s+[*_]*tier(?![\w-])`) now also counts as a mention. Such a line is REFUSE as unreadable unless TIER_RE reads it. Prose still reads full: "- Two-tier rollout", "- the tier-1 seam stays", "- tier-1 seams stay", "The tier is the owner's call.". `Tier: n/a` still refuses, and `- **Tier:** light`, `- Tier — light` and `* Tier: light (…)` read light. Corpus (75 plans): 33 READY / 2 REFUSE / 40 ASK, no changed rows. Mutation records: each guard broken -> red, restored with cp, checked with cmp (identical) -> green, over build_tools/tests/test_check_plan_ready.py (164 tests): R12 a list item starting with the label is a mention 4 failed / 160 -> 0 / 164 R13 `tier-1` at an item's start is prose 1 failed / 163 -> 0 / 164 Guards: pytest build_tools/tests 2448 passed / 0 failed / 1 skipped; scorecard --check OK; check_skill_refs OK (0 broken of 1021). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
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.
Why
On 2026-11-20 the owner accepted the recommendations of the rules inventory ("let's go with your recs"). One of them moves "a plan is implemented only when its stamps allow it" out of
/implement-planstep 2's prose and into a checker, after the process hooks (#2778). The weakness the inventory named was an override line written without the owner.On 2026-11-21 the owner ruled on the lane's four questions:
--adequacy) stamp is refused unless it was promoted in flight;lane:*labels, including tooling and message, make an input a defect;Change
build_tools/check_plan_ready.py <plan>(--all,--offline,--json) gives one verdict, with step 2's messages:It covers:
full; label-shaped mentions it cannot read are refused;check_plan_refs --issues, run in-process, where a red report refuses;## Issues to Closeitems.READY prints the
Implementation Summary header:line.Overrides answer a gate only as
Override (cell|scope): owner YYYY-MM-DD "override: <reason>" — <comment URL | #N comment <id>>. The comment must:OWNER;overrideand are at least 3 words.A comment posted through an app is printed as "relayed via app ". A record that cannot be verified is UNVERIFIED, which becomes REFUSE under
CI=true/1. This is evidence, not authentication. Any session holding the owner's token can post a matching comment (D1), and meaning ("do not override") is not judged. The docstring says so.check_plan_refs.py --issuesnow uses REST.gh issue view(GraphQL) returns 403 in cloud sessions, so every lookup there was an error./implement-planstep 2 now runs the checker and says who answers each verdict. Promotion in flight, the CONVERGED deferred rows, and the two §11 clauses the checker does not judge (a layout-changing phase sharing a gate; a generator group without stage 0) stay as text, for the lead.verify-planandcreate-planname theOverride (scope)record.Procedure bytes: dev's 145,065 → 142,673 (−2,392), measured; baseline lowered with
--lower.No workflow change. A CI step would turn two kinds of correct PR red: a light plan whose implementation deleted files it names, and a plan the owner said to implement unverified. So none is added.
Corpus
--allover the 75 files indocs/process/plans/gives 33 READY / 2 REFUSE / 40 ASK.REFUSE (2):
ASK (40):
The lane worker and the reviewer hand-checked 24 rows against the old prose and found no disagreement.
Mutation record
There are 79 mutations, each broken to red, restored with
cp(cmpidentical) and back to green:2e8ef0fa93f673431e8b1df626314fa7fc8802fa77f138652b0fd9f7c227b73The reviewer re-applied eight (M11, M28, M29, M34, M38, N03, N07, N16), and each did what its name says.
Gate
Local @
f7c227b73(lane worker, measured):pytest build_tools/tests2,448 passed / 0 failed / 1 skipped, of whichtest_check_plan_ready.pyis 164;scorecard_metrics --check,check_skill_refs(0 broken of 1021),process_index --checkand commit subjects all OK.The new tests pass with
CI=true,GH_TOKEN=invalidandghoff PATH: no test reads the network.CI @
f7c227b73(measured):test,hooks,dual-execute-oracle);Issues
Closes none, files none.
Independent review
Independent review @ 8652b0f: merge after fixes; 1 applied, 0 declined (reasons below); fixes 8652b0f..f7c227b read by the lead
One Opus reviewer, which wrote none of the code, ran the checker live against GitHub and on adversarial plan files. The lead reproduced each blocking finding and re-ran its repro on the fix. After the narrow check, the lead read the one-pattern fix
f7c227b73and re-ran the four Tier lines (now REFUSE as unreadable) and the prose and light controls.8b1df6263"**"against any owner comment (lead reproduced: READY, exit 0);OWNERincludes agent comments; light PASS WITH CORRECTIONS read READY; old plans' scope derivation moved to the owner; skill gaps; two lost §11 clauses; a record in a multi-line HTML comment counted; Tier spellings read as full14fa7fc88,af93aed25af93aed25"override"record was malformed although the checker's questions ask for it; a light plan with a full PASS WITH CORRECTIONS stamp refused; "no app" read as "typed"; prose tripped the Tier rule;<!--in backticks opened a comment (Tier read as full)8652b0fd98652b0fd9(narrow)- Tier = light,- **Tier (contract §12):** light) read asfull, so a light plan with a red refs report read READY (lead reproduced)f7c227b73https://claude.ai/code/session_01LGMKZYKjCq2pTmNWtKf2hy
Generated by Claude Code