fix(implement): count checkbox markers outside code fences only (#4272) - #4313
fix(implement): count checkbox markers outside code fences only (#4272)#4313ntdatt812 wants to merge 1 commit into
Conversation
The checklist gate counted every `- [ ]` / `- [x]` line in every checklist file, fenced blocks included. A checklist that documents the checkbox format with an example fence therefore reported unchecked items nobody can ever tick, and /speckit-implement stops on a non-zero unchecked count -- so writing down the format blocked implementation. /speckit-clarify already scopes its scan to markers outside code fences, so this was also the two commands disagreeing about what a checklist item is. They now state the same rule. Closes github#4272
There was a problem hiding this comment.
🟡 Changes recommended
The contract regex misses checked-only scan instructions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Aligns implementation checklist scanning with clarify by excluding fenced examples.
Changes:
- Clarifies checklist counting rules.
- Adds a cross-template contract test.
File summaries
| File | Description |
|---|---|
templates/commands/implement.md |
Excludes fenced checkbox examples. |
tests/unit/test_checklist_scan_contract.py |
Enforces scan wording across templates. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| # The instruction that tells the agent which lines are checkbox markers. Written to catch | ||
| # the phrasing both commands use rather than one exact sentence. | ||
| SCAN_INSTRUCTION = re.compile(r"lines matching\s+`- \[ \]`", re.IGNORECASE) |
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback. If not applicable, please explain why
|
Closing in favour of #4520, which consolidates this with #4314 and #4330 as asked on #4460. This fix is carried over unchanged, in its own commits. Copilot's point is addressed there: the scan-instruction pattern only recognised a definition whose first marker is unchecked, so the AI disclosure, per CONTRIBUTING: this comment and the changes it describes were written with Claude Code as a coding agent. |
Closes #4272.
templates/commands/implement.mdtold the agent to count checkbox markers like this:Every line, fenced blocks included. So a checklist that documents the checkbox format — an example fence showing what
- [ ]looks like — reported unchecked items that no reviewer can ever tick, and the gate stops on a non-zero unchecked count. Writing down the format blocked implementation.templates/commands/clarify.mdalready had the right rule and the right words for it:So this was also two commands disagreeing about what a checklist item is, which is the part worth fixing rather than just the count.
Only
templates/commands/implement.mdneeded the change:grepfor the scan instruction acrosstemplates/commands/andpresets/*/commands/returns exactly these two files, and the lean preset'sspeckit.implement.mddoes not carry a counting block.Test
tests/unit/test_checklist_scan_contract.pyturns the rule into a contract rather than a one-time edit. It walks every command template, finds each line that defines what counts as a checkbox marker, and asserts that line also excludes code fences. It is parametrized per instruction, so the failure names the file, the line number and the offending text:Two details that make it a real guard rather than a passing test:
test_the_contract_is_actually_stated_somewherefails if the regex ever matches nothing, so deleting or rewording the scan instruction cannot make the suite green by making the parametrization empty;presets/*/commandstoo, so a preset that grows its own counting block is held to the same rule.Mutation-checked — restoring the old wording in
implement.mdfails exactly one case, the implement one, and the other three stay green:No behaviour outside the checklist scan changes: the per-checklist total/checked/unchecked reporting and the status table are untouched.