Repository navigation
Add core task link and creator relationships (closes #2637) - #2686
Conversation
`task` had no way to declare that it blocks or is blocked by another task, no general relates-to/duplicates link, and no record of who filed it as distinct from who it is assigned to. Every mainstream work tracker treats these as first-class, so they belong on the core schemas themselves rather than behind any one methodology recipe's install. Four `SchemaRelationship` declarations, all optional, all seeded through the existing `set_schema_declarations` path — no new relationship machinery: - task: `blocks`/`blocked_by`, `relates_to`/`related_from`, `duplicates`/`duplicated_by` — self-referential and Many/Many, since a task can block several others while being blocked by several itself - person: `reported_tasks`/`creator`, mirroring the existing `tasks`/`assignee` declaration under a distinct name The self-referential shape puts both the forward and the reverse name on `task`, which resolution already handles (`adr.supersedes/superseded_by` covers the same case); the relationship viewer intentionally renders each such pair as two groups, one per side. Cycles are representable and nothing validates against them — only ADR-078's `extends` needs cycle detection. `BUILTIN_RELATIONSHIP_NAMES` needs no entry, matching `project.tasks`. Two existing assertions that `task.relationships` is empty were expressing "task's project/assignee link is a derived inverse, not its own declaration"; they now assert the absence of that specific name instead of emptiness. Tests: unit coverage pins each declaration's shape, and a new integration test exercises a seeded database end to end — declarations land as relationship rows, each pair traverses from both ends and agrees with the forward name read inbound, `creator` stays independent of `assignee`, and a blocking cycle round-trips. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Pragmatic Code Review — PR #2686Review Type: Initial Review Requirements Check (issue #2637)
Struct-literal fidelity: I diffed all four The Verification PerformedI also wrote and ran two throwaway probe tests (since deleted; worktree verified clean) to falsify two specific hypotheses — see 🟢-1 and 🟢-2. Code Review Findings🔴 Critical / BlockerNone. 🟡 Improvements🟡-1 📁 The test wires all three relationship types between the same ordered pair ( I verified the production code is in fact correct, with a three-node probe ( So this is a test-coverage gap, not a bug — the behavior is right, but nothing in the suite pins it. Adding one asymmetric case (a node that is simultaneously blocker and blocked) would convert the most valuable invariant here from "happens to work" into "regression-protected". Given that 🟡-2 📁
Narrowing from "empty" to "does not contain this specific name" was necessary and correct — The one genuine loss is 🟢 Nits / Observations🟢-1 📁 Worth recording explicitly since it looks alarming on inspection: the loop creates three edges between the same node pair without resetting state, so edges from iteration n are still present at iteration n+1. I probed this directly and all three iterations return exactly 🟢-2 📁 It asserts both 🟢-3 📁 issue #2637 Technical Specifications — the The issue explicitly asked to confirm whether these names need registering there. The answer (no) is correct but invisible — a reader six months from now re-derives it. One clause in the existing 🟢-4 📁
🟢-5 📁 The comments explain why (Many/Many because a task blocks several and is blocked by several; cycles permitted because only ADR-078's Standards Compliance (CLAUDE.md)
Architecture AssessmentThe change is atomic and additive. It introduces zero new machinery — four On the seeding note (evaluated, as requested): core-schema seeding at The author's decision not to write a backfill is correct and I endorse it. CLAUDE.md is unusually explicit that this exact question — "how do existing databases get the new shape?" — is the signal, not the task, and that a lazy on-read or startup backfill is precisely the prohibited thing even for a purely internal data-shape change. The answer is reset the database. Writing the backfill would have been the review finding; not writing it is right. I'd also note the practical stakes are near zero: these are brand-new relationship names with no existing edges, so a stale database is missing a capability, not carrying corrupt data — it degrades to "cannot create a blocks link until reset", which is the expected pre-release posture. Nothing further is needed in the PR. The one thing I'd mildly favor is a line in the PR description (not the code — a code comment explaining DB-reset mechanics would itself drift toward migration-flavored documentation) noting that a SummaryA tight, well-scoped, spec-faithful change. The implementation matches issue #2637's struct literals exactly, adds no machinery, respects every project standard, and is accompanied by genuinely useful integration tests that verify the declarations survive seeding and traverse — which is the part unit tests cannot reach. Comment quality is above average. Two hypotheses I was asked to scrutinize (loop-carried state; whether the cycle test proves a cycle) I investigated directly and disproved — the code is correct on both counts. The one real gap is 🟡-1: the traversal test cannot distinguish Neither 🟡 finding blocks merge. Both are cheap to address and would leave the suite meaningfully stronger. Recommendation: APPROVENet-positive to code health with no critical or security findings. Addressing 🟡-1 (asymmetric traversal case) and 🟡-2 (restore a length assertion on |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Both 🟡 findings from the PR #2686 review. 🟡-1 The traversal test wired all three relationship types between one ordered pair, so it could not distinguish "blocked_by resolves to the reverse edge set" from "blocked_by collapsed onto the forward edge set" — both spellings return "the other task" either way. That is the failure mode that actually matters for a self-referential pair, since both names live on `task` and the usual source_type narrowing is a no-op when the declaring and target type are the same. Rebuilt as a three-node chain (upstream -> mid -> downstream). From `mid`, the forward name must reach downstream and the reverse name upstream, so resolving the wrong direction surfaces the wrong node. Verified the new assertion has teeth by temporarily inverting it: it fails with `left: "t_upstream", right: "t_downstream"`, exactly the collapse it is meant to catch. Also asserts the chain ends see one side each. Renamed to task_link_pairs_resolve_direction_asymmetrically, which is what it now tests. 🟡-2 Restored the count assertion that the earlier edit dropped from person's test: narrowing `is_empty()` to a named-absence check was right, but `relationships.len()` also caught accidental ADDITIONS, and that drift detection was lost. Now asserted on both person (2) and task (3). 🟢-3 Documented the BUILTIN_RELATIONSHIP_NAMES verification the issue asked for, so the next reader does not have to re-derive why these names need no entry there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review addressed — commit
|
Closes #2637.
What
taskhad no way to declare that it blocks or is blocked by another task, no general relates-to/duplicates link, and no record of who filed it as distinct from who it is assigned to. Every mainstream work tracker (Jira's blocks/is-blocked-by/relates-to, Linear's issue relations and Reporter) treats these as first-class, so they belong on the core schemas rather than behind any one methodology recipe's install.Four
SchemaRelationshipdeclarations, all optional, all seeded through the existingset_schema_declarationspath — no new relationship machinery:task— self-referential,Many/Many, since a task can block several others while being blocked by several itself:blocks/blocked_byrelates_to/related_fromduplicates/duplicated_byperson— mirrors the existingtasks/assigneedeclaration under a distinct name, because a task's creator is usually not its assignee:reported_tasks/creatorNotes from implementation
BUILTIN_RELATIONSHIP_NAMESneeds no entry — the issue asked this to be verified. Confirmed:project.tasks/tasks.projecthas no entry either, and that list is only the built-in structural names (member_of,has_child,mentions,has_role) that declaration queries key off excluding.task. Name resolution already handles this —adr.supersedes/superseded_byexercises the identical case inrelationship_reverse_name_traversal_test.rs. The relationship viewer intentionally renders each such pair as two groups (one per side), which is documented behavior inrel_ops, not double-counting.extendsrequires cycle detection; general relationships permit cycles, and a blocking cycle is real data a user can enter and needs to be able to see.assignee,project).taskandperson— which already exist — are skipped, and the new declarations reach fresh databases only. PerCLAUDE.mdthis is the intended outcome, not a gap to backfill: change the shape, reset the database. No migration was written.Two existing assertions that
task.relationshipsis empty were expressing "task's project/assignee link is a derived inverse, not its own declaration". They now assert the absence of that specific name rather than emptiness, which is what they actually meant.Testing
packages/core/tests/core_task_link_relationships_test.rsexercises a seeded database end to end: declarations land as relationship rows on the right schema; each pair traverses from both ends and the reverse name agrees with the forward name readdirection: "in";creatorresolves independently ofassigneein both directions; ablockscycle round-trips.core_schemas.rspins each declaration's shape (target type, direction, both cardinalities,required: None).cargo test -p nodespace-core: 0 failures.test:all+cargo build --bin nodespaced+test:e2e): all passed.bun run quality:fix: clean — clippy-D warnings, svelte-check 0 errors, no new design-token violations.Acceptance criteria
taskdeclaresblocks/blocked_by,relates_to/related_from,duplicates/duplicated_byviaset_schema_declarationspersondeclaresreported_tasks/creatoralongside its existingtasks/assigneeNodeService::get_related_nodesrequired: Noneon every new declaration, both endsA blocks B blocks A) is representable; no new cycle detection neededbun run quality:fix🤖 Generated with Claude Code