cmdPhasesClear hard-deleted committed phase directories (rmSync) with no archive, so browsable phase history was silently lost at a milestone switch. The #1447 dirty-tree guard was a no-op for the common committed case (a clean tree passes the guard, then rmSync destroyed the dirs, leaving orphaned uncommitted deletions and no archive). Archive-then-remove: move each non-999 phase dir to milestones/<version>-phases/ (version from getMilestoneInfo; timestamp fallback; collision-safe) using retryRenameSync — mirroring the existing archivePhases path in cmdMilestoneComplete. The #1447 uncommitted-changes guard is retained as a secondary backstop. Tests in tests/new-milestone-clear-phases.test.cjs updated: phase content is asserted to SURVIVE in milestones/*-phases/ (archived), not be destroyed — including the committed-dirs case that previously codified the no-op. Closes #1871
557 B
557 B
type, pr
| type | pr |
|---|---|
| Fixed | 1919 |
phases clear archives phase directories instead of destroying them — at a milestone switch, committed phase directories were hard-deleted (rmSync) with no archive, silently losing browsable phase history (the #1447 dirty-tree guard was a no-op for the common committed case). Phase directories are now moved to milestones/<version>-phases/ (collision-safe; timestamp fallback when no version resolves), so history survives the switch. The #1447 uncommitted-changes guard is retained as a secondary backstop. (#1871)