plan-overlap and lease-check disagree on directory-lease semantics #132
Labels
No labels
already-shipped
bug
documentation
duplicate
enhancement
external-review
good first issue
help wanted
in progress
invalid
needs-decision
proposal
question
security
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: crenshawdev/cadence-archived#132
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: deep dive F2
Verdict: AGREE - high
Claim as reviewed
plan-overlapcompares declarations using exact string equality while the execution lease checker interprets a declaration ending in/as a directory prefix, so overlapping plans can pass the parallel-safety gate.At HEAD
f354864(v3.3.0)cadence-core/bin/planning.mjs:1772-1777-declared[i].files.filter((x) => declared[j].files.includes(x))- exact string intersection.cadence-core/bin/planning.mjs:2201-2207-const prefixes = declared.filter((f) => f.endsWith('/')); ... !prefixes.some((d) => p.startsWith(d))- trailing slash is a directory lease.cadence-core/workflows/execute.md:103-121requires an emptyoverlapsarray as the arithmetic half of the parallel decision.Plan 1 declaring
src/and Plan 2 declaringsrc/auth.jsproduce an empty intersection, so the phase is eligible for parallel worktree execution, whilelease-checkauthorizes both plans to stagesrc/auth.js. Nested directory declarations (src/andsrc/auth/) have the same defect.Note
Bounding fact:
cadence-core/references/plan-frontmatter.mdnever documents the trailing-slash directory form as afiles:value, so a planner is unlikely to emit one today. That limits likelihood, not validity -lease-checkhonors the form, so it is live.Fix shape: one shared lease-normalization/intersection module consumed by both
cmdPlanOverlapandcmdLeaseCheck. Two leases collide when equal, or when either is a directory lease whose prefix contains the other path.Hazard: this is the parallel-safety gate, being fixed under parallel execution
v3.5.2 pairs this with #133. The two share no files - #132 is
planning.mjs(cmdPlanOverlap,cmdLeaseCheck), #133 is ~16 workflow/reference prose files plus the flags they call - soplan-overlapwill report empty and the phase is eligible for parallel worktree execution.That is exactly the mechanism under repair here. If these run as parallel plans, the gate authorizing that parallelism is the code one of them is rewriting.
Run this milestone sequentially, or put #132 in its own phase. Not because a collision is likely, but because a green parallel run of the phase that fixes the parallel gate proves nothing about the gate.
Scope
One shared lease-normalization/intersection helper, consumed by both
cmdPlanOverlap(planning.mjs:1772-1777, currently exact.includes) andcmdLeaseCheck(:2201-2207, currently trailing-/prefix). Two leases collide when equal, when either is a directory lease whose prefix contains the other, or when they normalize to the same repo-relative path.Also decide the grammar question
cadence-core/references/plan-frontmatter.mddocuments thefiles:grammar and never mentions the trailing-slash directory form, whilecmdLeaseCheckhonours it. That gap is why this defect is unlikely to have fired yet.So there are two coherent fixes and the plan should pick one deliberately:
plan-frontmatter.md.cmdLeaseCheckstops treating trailing/as a prefix, and both sides are exact. Smaller, and consistent with a grammar that never advertised the form.Option 2 is the smaller change and closes the divergence outright. Option 1 keeps a capability nothing currently documents. Do not land a shared helper without answering which of these the grammar is supposed to say.