Repository navigation
Description
Overview
has_child is NodeSpace's universal outline/hierarchy edge — any node can nest under any other via the same mechanism the whole tree-of-nodes UI already uses (packages/core/src/behaviors/mod.rs, packages/core/src/services/node_service/hierarchy.rs's get_children/get_parent). A task (or any extends-descendant of task, once extends lands — see Dependencies) nested under another task via has_child is already, structurally, a sub-task/sub-issue today: no schema work is required for hierarchy itself. What's missing is the one behavior every flat/Jira/Linear-style methodology assumes exists: when every child of a parent task reaches a "done" state, the parent should complete too.
This is not methodology-specific — it doesn't reference any Linear-recipe concept (cycle, issue, backlog) — so it belongs as a core, unconditionally-seeded Play, not something bundled into a specific methodology recipe's install flow.
Problem Statement
Today, nothing keeps a parent task's status in sync with its children's completion. A user (or an installed recipe like the Linear-style one) has no way to get "closing the last sub-task auto-closes the parent" without hand-authoring a Play from scratch, and no existing Play or documented convention already does this — confirmed via search of ../nodespace-docs/decisions/, ../nodespace-docs/architecture/, ../nodespace-docs/components/ for has_child combined with parent/completion terms.
Proposed Solution
A single core-seeded Play (node_type: "play", always installed, not tied to any recipe/bundle):
- Trigger: a node's
statusproperty changes to a "done" category value (see../nodespace-docs/decisions/078-schema-extends-relationship-for-field-composition.md, ADR-078, for what "done category" resolves to once an extending schema likeissuehas a richer status vocabulary — this Play must readstatusattaskscope via that ADR's scope-relative resolution, not assume the literal stored value is alwaysdone). - Condition: the changed node has a parent (via
has_child's reverse direction — this node is the child), and every one of that parent'shas_childchildren is itself in a "done" category status. - Action: set the parent's
statustodone.
This issue is now purely a Play definition — trigger, condition, action, seeded as data. It carries no engine work of its own: the two capabilities it depends on (a real reverse name for has_child, and a resolver that can walk it from a Play condition) are tracked as their own general-purpose issues, since both turned out to be needed by other consumers too (assignee/project/creator lookups for a forthcoming Linear-style recipe), not just this one Play. Once both land, this issue is exactly as much work as any other seeded core Play — author it, install it unconditionally.
Architecture Impact
No existing ADR documents parent/child task auto-completion — this is new behavior, not a reversal of a prior decision. This issue depends on scope-relative status resolution (../nodespace-docs/decisions/078-schema-extends-relationship-for-field-composition.md, ADR-078's "Enum-value extension on an inherited field" section) to correctly treat an extended status value (e.g. issue's backlog) as its task-scope "done"-category equivalent when deciding whether a child is complete — this Play is exactly the kind of base-scoped consumer that section's maps_to resolution exists to keep working unmodified across extends.
Acceptance Criteria
- Core Play seeded unconditionally (not gated behind any methodology recipe's install flow) that sets a parent task's
statustodonewhen everyhas_childchild reaches a done-category status - Play correctly treats an extended descendant's richer status vocabulary (e.g.
issue.status: backlog) via ADR-078's scope-relative resolution, not just the literaltask.statusenum values - Play does not fire/no-op correctly when a parent has zero children (must not auto-complete an empty task)
- Test coverage for multi-level nesting (does completing a parent cascade to check the grandparent too, or stop at one level — decide and document during implementation)
- Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
packages/core/src/playbook/graph_resolver.rs— reverse traversal forhas_child/child_ofbecomes usable here once Store relationship_type's reverse name as a queryable column on the relationship edge table #2638/Make graph_resolver.rs direction-aware so Play conditions can walk any relationship's reverse side #2641 land; no changes needed in this issue itselfpackages/core/src/services/node_service/hierarchy.rs—get_parent(~line 191),get_children(~line 33) — existing reverse/forwardhas_childtraversal at the service layer, precedent for correctness../nodespace-docs/decisions/078-schema-extends-relationship-for-field-composition.md(ADR-078) — scope-relativestatusresolution this Play must use
Dependencies
- Store relationship_type's reverse name as a queryable column on the relationship edge table #2638 (store reverse relationship name as a queryable column) — required first;
has_child's reverse name (child_of) must exist as real data - Make graph_resolver.rs direction-aware so Play conditions can walk any relationship's reverse side #2641 (make
graph_resolver.rsdirection-aware) — required so the Play's condition can actually walkhas_child's reverse direction; the resolver-level fix turned out to be general-purpose (also needed for assignee/project/creator lookups), so it is tracked there rather than here - Implement extends schema relationship with real node_type subtype identity #2598 (implement
extendsschema relationship with realnode_typesubtype identity) — required so this Play's status-category check is correct against anytask-extending schema, not just literaltasknodes. The Play is still meaningful against plaintasknodes without this dependency, but should not be considered complete/correct for extended types until it lands.
Related Issues
- Add methodology recipe mechanism (TS source, generated CLI reference doc) with Linear-style as first recipe #2596 (Linear-style methodology recipe) — this Play is a prerequisite/complement, not part of that recipe's install; the Linear recipe's sub-issue support relies on this behavior existing already, rather than reinventing it
Non-Goals
- Any Linear/Jira-specific behavior (cycle reassignment, priority propagation, etc.) — this Play is purely
has_child+status, methodology-agnostic - A configurable opt-in/opt-out toggle for this behavior — ship it as always-on core behavior for this issue; a future issue can add per-node/per-parent opt-out if a real need surfaces
- Reverse relationship traversal as a general engine capability — tracked in Store relationship_type's reverse name as a queryable column on the relationship edge table #2638/Make graph_resolver.rs direction-aware so Play conditions can walk any relationship's reverse side #2641, not this issue
Activity
malibio commentedon Sep 17, 2026
Baseline (worktree issue-2636-parent-task-completion-play @ abc7a5f): Frontend 5213 passed, 1 failed (256 test files). Sole failure is a pre-existing perf-threshold flake unrelated to this work: architecture-benchmarks.test.ts 'bulk structural operations (100 indent/outdent) complete in <40ms' measured 43.35ms. No source changes made at baseline time.
Address ADR-078 cleanup items 1, 2, 3 and 5 (#2747) (#2750)