Repository navigation
Description
Overview
Four latent defects found during the code review of #2777 (PR #2777), deliberately skipped there as unreachable today. Filed so they are recorded somewhere a future reader will look, rather than only in a merged PR thread.
None is a live bug. Each becomes one under a specific, foreseeable change.
1. is_already_exists matches on error-message text
packages/core/src/methodology/install.rs
Collision detection during a methodology install decides "this id is taken" by substring-matching "already exists" in the error's Display output. That is the only signal available today — the schema layer reports both an id collision and other failures through one error type.
Becomes a bug when: any other schema error grows that phrase. add_field_values already rejects a duplicate enum value; if its message is ever reworded to contain "already exists", a genuine value collision is misread as an id collision and the install silently proceeds under a suffixed id.
Fix: a structured variant (SchemaError::AlreadyExists { id }) the installer can match on.
2. create_node_resolving_collisions has a TOCTOU, and swallows read errors
packages/core/src/methodology/install.rs
The node path checks get_node(&id) for existence, then creates. Two installs racing can both see "free". It also treats a read error as "does not exist", so a transient failure produces a create attempt rather than a reported problem.
Notably inconsistent with the schema path directly above it, which deliberately lets the write path be the authority and reads the collision out of the rejection.
Fix: mirror the schema path — attempt the create, detect the collision from its rejection.
3. validate_schema_path tries reverse before forward, inverting the resolver's precedence
packages/core/src/playbook/validation.rs
rel_ops::resolve_relationship_name documents and implements forward-first: a forward name always wins over a same-spelled reverse name on another schema. Play path validation checks reverse first.
Becomes a bug when: one schema's forward relationship name equals another's reverse name. No core pair collides today, but #2777 adds cycle.tasks as a third declarer of tasks (alongside project and person), so the namespace is getting denser.
Fix: swap the order so validation and runtime agree.
4. Play path validation issues several uncached queries per segment
packages/core/src/playbook/validation.rs
resolve_reverse_segment and resolve_forward_segment each resolve the type chain and fetch schemas per path segment, with no shared cache — and resolve_reverse_segment is the more expensive of the two while being the only one that takes no schema_cache parameter.
Save-time only, so no user-visible latency today. Partly overtaken by measurement: get_extends_parent_map is a single indexed SELECT, not the full scan an earlier review pass assumed.
Fix: thread the existing schema_cache through both helpers.
Acceptance Criteria
-
is_already_existsreplaced with a structured error match - Node-collision path detects collisions from the write rejection, consistent with the schema path
- Forward resolution precedes reverse in
validate_schema_path, matchingresolve_relationship_name - Both validation helpers share the existing
schema_cache - A test pins the forward-over-reverse precedence with a deliberately colliding name pair
Activity
Actually apply the rollover fix, and close the gap that hid its absence
mstomar125 commentedon Sep 22, 2026
Frontend: 5240 passed (260 test files, 68.72s)
mstomar125 commentedon Sep 22, 2026
PR #2796 merged into
issue-2596-methodology-recipes(#2777). Fix reachesmainonce #2777 itself merges. Marking status Done here since the fix work is complete; the issue itself can be closed once #2777 lands.mstomar125 commentedon Sep 22, 2026
Merged in PR #2796 (commit 87afc00 on
issue-2596-methodology-recipes). Important: this branch is #2777's — the fix only reachesmainonce PR #2777 itself merges, not before. All four acceptance criteria implemented and covered by tests: structuredMarkdownError::AlreadyExistsreplaces the substring match;create_node_resolving_collisionsnow attempts the create first and reads the id's occupancy to interpret a rejection rather than checking-then-creating;validate_schema_pathchecks forward before reverse;resolve_reverse_segmentnow sharesschema_cache; andtest_forward_relationship_wins_over_colliding_reverse_namepins the precedence (verified it fails under the old reverse-first order). A pragmatic-code-review round (10 finder angles, posted inline to the PR) surfaced 13 further findings; 2 small ones were fixed pre-merge (an overclaiming doc comment, a duplicate error-match collapsed into the existing shared helper). The rest trace back to one root cause — NodeServiceError has no structured duplicate-id signal, so schema-collision detection still rests on a pre-write existence check rather than the write's own rejection, same as the node path did before this issue — already tracked as a deliberate non-goal in core#2798, updated with two more concrete instances (hierarchy.rs VERSION_CONFLICT, desktop-app's Tauri status mapping) found by this round. One more small fix (a missing debug log in resolve_reverse_segment matching its sibling ensure_schema_cached) was implemented, tested and pushed but landed just after the merge went out from under it — not resurrecting it as its own PR for one log line; whoever next touches that function or core#2798 can pick it up.Actually apply the rollover fix, and close the gap that hid its absence
Add the Linear-style methodology recipe, installable from onboarding …
malibio commentedon Sep 22, 2026
Landed on
mainvia #2796, which merged into #2777's branch and reached main with that PR's squash (14d8ae99).Staying open was a mechanical artifact rather than a signal: the closing keyword lived in the individual commit message, which the squash collapsed. Verified all four acceptance criteria against
mainbefore closing:AlreadyExistsreplaces substring matching —MarkdownError::AlreadyExistsinmethodology/install.rsandmarkdown/error.rs.create_node_resolving_collisionsattempts the create rather than pre-checking existence; theget_nodepre-check is gone, so the write path is the authority and a read failure is reported rather than read as "not found".validate_schema_path— forward lookup atvalidation.rs:914,resolve_reverse_segmentfallback at:950, matchingrel_ops::resolve_relationship_name's documented precedence.schema_cachethreaded through both resolution helpers.Thanks @mstomar125 — item 3 also closed a gap I had skipped as latent in the round-1 review of #2777.