Convert the planner's soft comment-text guideline into a plan-write-time HARD GATE. When an acceptance criterion negative-greps for a literal (`grep -c 'LIT' file == 0`) and that same literal appears verbatim in an `<action>` body (JSDoc samples, head-comment references, "what NOT to do" snippets), the executor's commit-time verify gate later fails on the comment echo rather than a real regression — wasting cycles and training the executor to distrust the gate. `verify.plan-structure` (the `validate_plan` step) now scans for this: - confidently-extracted (quoted) negative-grep literal echoed in an <action> → error (valid:false), failing plan creation - unquoted/ambiguous grep target → warning (fallback policy) - `<!-- planner-discipline-allow: LIT -->` escape hatch skips a literal - positive-count gates (`== N`) and `!= 0`/`>= 0` are out of scope Adds the `<comment_text_discipline>` block to gsd-planner.md, the full rules + allowlist example to planner-antipatterns.md, and regression fixtures for downstream incidents 12-04, 11-04, 12-02 (plus a boundary case proving positive-count gate 11-02 is not flagged). Closes #429 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -87,3 +87,44 @@ A plan should not interleave multiple checkpoint types with implementation tasks
|
||||
- "will be wired later", "dynamic in future phase", "skip for now"
|
||||
|
||||
If a decision from CONTEXT.md says "display cost calculated from billing table in impulses", the plan must deliver exactly that. Not "static label /min" as a "v1". If the phase is too complex, recommend a phase split instead of silently reducing scope.
|
||||
|
||||
## Comment-Text Discipline (HARD GATE)
|
||||
|
||||
> Enforced at plan-write time by `verify.plan-structure` (the `validate_plan` step). Issue #429.
|
||||
|
||||
When an `<acceptance_criteria>` or `<verify>` block uses a **negative grep** — `grep -c 'LITERAL' file == 0`, meaning "this literal must NOT appear in the file" — that same `LITERAL` must not appear verbatim anywhere in an `<action>` body. Verbatim code blocks, JSDoc samples, head-comment references, and "what NOT to do" illustrations get echoed into the file the executor writes, so the executor's commit-time gate fails on the *comment text*, not on a real code regression. The work is correct; the gate output is semantically wrong; the executor wastes cycles and learns to distrust the gate.
|
||||
|
||||
**The gate:** plan creation FAILS (error, `valid: false`) when a confidently-extracted (quoted) negative-grep literal also appears in an `<action>` block. When the grep literal is unquoted and cannot be extracted unambiguously, the gate WARNS instead of failing (so you still get the plan, with the risk surfaced).
|
||||
|
||||
### Bad — JSDoc sample echoes the forbidden literal
|
||||
|
||||
```xml
|
||||
<task>
|
||||
<action>
|
||||
Add a `?from=` query param to the share link. Do NOT reintroduce the old
|
||||
`?from=` referrer hack the JSDoc warned about. <!-- echoes ?from= -->
|
||||
</action>
|
||||
<verify><automated>grep -c '?from=' src/animal-detail.tsx == 0</automated></verify>
|
||||
</task>
|
||||
```
|
||||
|
||||
### Good — rephrase the comment by concept
|
||||
|
||||
```xml
|
||||
<task>
|
||||
<action>
|
||||
Add the share-link query param. Do NOT reintroduce the legacy referrer hack.
|
||||
</action>
|
||||
<verify><automated>grep -c '?from=' src/animal-detail.tsx == 0</automated></verify>
|
||||
</task>
|
||||
```
|
||||
|
||||
### Allowlist escape hatch
|
||||
|
||||
When the literal MUST appear in the plan body verbatim — e.g. the plan documents the test file that exercises the gate itself, or the literal is part of the verification command's own grep regex — add a marker on its own line so the gate skips that literal:
|
||||
|
||||
```
|
||||
<!-- planner-discipline-allow: ?from= -->
|
||||
```
|
||||
|
||||
One marker per literal. The marker exempts only the exact literal it names.
|
||||
|
||||
Reference in New Issue
Block a user