renumber: STATE cursor on a decimal phase is silently shifted onto a nonexistent phase #37
Labels
No labels
already-shipped
bug
documentation
duplicate
enhancement
good first issue
help wanted
in progress
invalid
needs-decision
proposal
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: crenshawdev/cadence#37
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?
Severity: medium · Area: renumber · surfaced in the post-v1.2.0 cross-model review sweep (reproduced with a fixture). Sibling of #36.
What happens
renumbertreats decimal insertion phases (e.g.2.1) as never-shifted everywhere — the ROADMAP tokens (shiftPhaseTokens) and the phase directories both skip them, and they are reported back so the caller re-places them by hand. The STATE cursor update is the one place that carve-out was not applied. When your cursor sits on a decimal phase, renumber applies the integer delta to it anyway, moving the cursor onto a phase number that exists in neither the ROADMAP nor the directory tree — and it does so with no warning.Mechanism (verified against source)
cadence-core/bin/planning.mjs:644:if (cursor.phase >= shiftFrom) newCursor.phase = cursor.phase + delta;applies the delta whether or notcursor.phaseis an integer.planning.mjs:645-646) only fires whencursor.phase === at(the exact removed integer phase); the decimal-desync case produces nowarnin the output.Reproduction
STATE cursor on phase
2.1, thenrenumber remove --n 1(orinsert --at ≤ 2):Phase: 1.1 of 3.2.1.1.1, which exists nowhere. No warning is emitted.Fix direction
Apply the same decimal carve-out to the cursor: skip the shift when
cursor.phaseis not an integer, and emit awarntelling the caller to re-point it (mirroring the existing removed-phase warn). Pairs naturally with the fix for #36.