Skip to content

Count checkboxes under an Acceptance Criteria heading in the checklist rules - #4402

Merged
mstomar125 merged 1 commit into
mainfrom
issue-4396-ac-heading
Nov 27, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-4396-ac-heading

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

NodeSpace task: "The checklist rules count checkboxes under an Acceptance Criteria heading, so a task's criteria can sit in a section of their own" (migrated issue 4396).

What changed and why

The checklist rules read a task's direct children only, so a criterion under a heading (a grandchild) was not counted and a task could be finished with criteria open.

  • Engine: a collection rooted at the iteration variable of an enclosing comprehension is resolved for each item, one further level: node.has_child.exists(h, h.has_child.exists(c, ...)). Path extraction records the enclosing collection (CollectionPath.enclosing). The nested relationship is followed from all items at once. Every item gets an entry, an empty list when it has no children, so one childless heading does not fail the whole condition.
  • Validation: the nested path is validated at save as the path it is from node (misspelt relationship, derived attribute on the wrong type are refused). A collection nested deeper than one level is refused rather than saved to never match.
  • Rules (core_plays.rs): a criterion is a checkbox that is a direct child, or a child of a direct child header whose text matches ^#+\s*(acceptance criteria|ac)\s*$ case-insensitively. Used by "Require a completed checklist before finishing a task" (both rules) and "Require success criteria before approving a spec". Refusal messages name the ## Acceptance Criteria heading.
  • Roll-up: read against the change, unchanged. Its condition reads sub-tasks, not checkboxes; the parent's own checklist is held by the criteria rule, which now counts the heading. Comment added.
  • Issue findings rule: read against the change, unchanged. A finding is a checkbox directly under the issue (ADR-092 §8), and an open finding still holds the issue open through the task criteria rule. Comment records why.
  • Guidance: section-create, checkbox-item-create (both forms) and the skills Writing a Spec, Splitting into Issues, Creating a Task, Completing a Task, Implementing a Task, Instrumenting a Change say criteria go under ## Acceptance Criteria.

Shape record

Two seeded Plays change config (shape-record/current.json regenerated) with one change-log entry. Class is reconcile, not additive: these are existing seeded Plays whose config changes, which the seed system covers (an unedited Play is replaced on open; a user-edited one is kept and the change is recorded for them). additive is for a new shape absent from an older database. Entry says editedUsersAffected: true, userProducible: true. shape:check, node-types:check pass.

Tests and mutation results

New tests (each mutation-checked individually, reverted afterwards):

  • an_unchecked_checkbox_under_an_acceptance_criteria_heading_holds_a_task_open (also asserts the refusal names the heading): fails when the nested read is dropped from has_unchecked_criterion, when the nested read is not attached, when (?i) is dropped, when the enclosing link is dropped.
  • the_acceptance_criteria_heading_matches_at_any_level_and_case (levels, case, AC, other headings and Acceptance Criteria Draft/ACs not counted): fails when (?i) is dropped and when the end anchor is dropped.
  • criteria_directly_under_a_task_and_under_the_heading_both_count: passes with the production code, guards the direct-child path and other-heading exclusion together with the tests above.
  • a_checkbox_under_the_heading_satisfies_the_need_for_criteria and a_spec_with_a_checkbox_under_the_heading_can_be_approved: fail when the nested read is dropped from has_no_criterion, and when the nested read is not attached.
  • a_collection_is_followed_one_level_from_its_items_in_one_statement_per_level (resolver): fails when the nested read is not attached, when the unchecked nested read is dropped, when the enclosing link is dropped.
  • a_collection_rooted_at_an_iteration_variable_records_its_enclosing_collection (extractor): fails when enclosing is not recorded.
  • a_collection_read_from_an_items_relationship_is_validated: fails when nested collections are not validated.
  • a_collection_two_levels_down_from_its_items_is_refused: fails when the depth check is disabled.

Cost of the nested read

On a task with 42 children (40 notes, 2 headers) the whole read is 3 statements: one for the children, then one per child node type among them (text, header) for what is under them. The batched walk runs one statement per node type for all roots of that type, so it does not grow with the number of children, but it is per level and per child type, not strictly one per level. Asserted in the resolver test.

Follow-up commit: review fixes

  • Collision fixed: a collection path shared by several comprehensions is resolved once and nested reads attach by enclosing path, so node.has_child.exists(c, ...) and node.has_child.exists(h, h.has_child...) work in either order. Test with the clauses swapped added (a_collection_is_followed_one_level...). Mutation: restoring the iteration-variable match fails it only together with removing the dedupe; the original-order tests fail with the iteration-variable match alone.
  • Older build (verified against git show v0.3.14): v0.3.14 graph_resolver.rs skips any collection not rooted at node and its extractor does not link a nested collection to its enclosing one, so an item has no has_child; the nested read raises a missing-key error, which cel.rs maps to Fail. A failed condition means the reject rule does not fire: an older daemon running the new Plays fails open (does not crash), for a task or spec that has a header child and no directly-unchecked criterion. An older build also replaces an unedited new Play back to its old config on open (seed ping-pong), and edited-Play users keep the old rule. All recorded in the change-log entry. I read the tag source; I did not build or run v0.3.14.
  • Ready-task search: the query filters are AND-only (no OR), so it cannot match a checkbox directly under the task or under the heading. Not feasible with the engine; recorded as a known limit in the change log and the guidance. Creating-a-task and Splitting-into-Issues now say the creation calls write checkboxes directly under the task (what the search lists), and the checkbox rule says both places count for the rules but the ready search lists direct checkboxes only. The create_task tool is unchanged.
  • Roll-up: new test a_parent_with_an_open_criterion_under_the_heading_stays_open (fails when the nested unchecked read is dropped). A met item under the heading not excusing an open direct one is covered by criteria_directly_under_a_task_and_under_the_heading_both_count (fails when the direct read is dropped).
  • Docs/goldens: stale skill_rules.rs comment fixed. The skill-retrieval golden digest covers only use_for/not_for, which were not touched; the_recorded_matrix_is_of_the_seeded_text passes in test:changed.

Second follow-up: wording and one test

  • Plain statement: a v0.3.14 daemon lets a task be finished, or a spec approved, whose only open items sit under an Acceptance Criteria (or AC) header; the new Plays are not enforced there.
  • Fail-open condition, verified against core_plays.rs: the missing-key error is reached only for a task or spec with a header child named Acceptance Criteria or AC, because 'header' in h.type_chain && h.content.matches(...) is evaluated before h.has_child is read, so a header with any other name evaluates false first. Clause order is the direct read first, then the heading read: the finishing rule's unchecked condition is direct unchecked || heading unchecked, so a directly unchecked checkbox is still refused on an older daemon (the || short-circuits before the heading clause), and it fails open only when no direct checkbox is unchecked and an AC header exists; the no-criteria condition is no children || (no direct checkbox && none under the heading), so it fails open only with no direct checkbox and an AC header. The change-log entry now says this.
  • Dedupe comment corrected: the enclosing-path match is the guard; skipping a repeated path only saves resolving it again.
  • New test (in the resolver test): two comprehensions over node.has_child under different variables (g reading mentions, h reading has_child). Mutation checks: restricting nested attachment to the iteration variable fails it, and restricting it to nested variable h fails it.
  • Goldens/snapshots: no regeneration needed. The skill-retrieval digest (current.sha256) is computed from skill titles, use_for, not_for and the matrix requests only; none changed, and the_recorded_matrix_is_of_the_seeded_text passes. shape:check passes against the committed current.json (only the two Play configVersions changed, regenerated earlier, with the change-log entry).

Not covered / follow-ups

  • The saved query "Needs shaping" (open task with no checkbox child) and other readers of a task's direct checkboxes (context reads, create_task tool writes its checklist as direct children) are not changed: a task whose only criteria sit under the heading may still be listed as needing shaping. Worth a follow-up.
  • Nothing is security-sensitive.

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

Merge queue: #4402 was taken out of the queue — it conflicts with main in: packages/agent/src/seeds/rules/skill-md/section-create.md. Merge or rebase origin/main, resolve the conflicts, push, and re-run bun run merge 4402.

@mstomar125
mstomar125 force-pushed the issue-4396-ac-heading branch from 904132a to 3ff1e2d Compare November 27, 2026 08:29
@mstomar125
mstomar125 merged commit db8d2b1 into main Nov 27, 2026
@mstomar125
mstomar125 deleted the issue-4396-ac-heading branch November 27, 2026 08:29
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.

1 participant