Files
msd-core/.changeset/gentle-bears-wave.md
Tom Boucher 6299b9181f fix(state): preserve curated progress on body-only updates; correct percent formula (#3242) (#3252)
* test: reproduce state.update progress trampling and percent formula (#3242)

Two failing regression tests:
- Bug A: state.update "Last Activity" tramples curated progress.* frontmatter via readModifyWriteStateMd → syncStateFrontmatter
- Bug B: 12 declared ROADMAP phases / 6 realized / 6/6 plans done → percent: 100 instead of 50 (phase-fraction ignored)

* fix(state): preserve curated progress on body-only updates; correct percent formula (#3242)

Bug A: readModifyWriteStateMd now accepts { resync: false } to preserve existing
frontmatter progress.* when only body text changes. cmdStateUpdate passes this flag
since it only replaces a body field and must not trample manually-curated
cross-milestone counters.

Bug B: extract computeProgressPercent() helper — shared by buildStateFrontmatter and
cmdStateSync — that applies min(plan_fraction, phase_fraction). When ROADMAP declares
more phases than are realized on disk, phase_fraction caps percent so 22/22 plans
done with only 6/12 phases gives 50%, not a false 100%.

* changeset: pr=3252 for #3242

* fix(test): replace content.includes with structured state json assertion (#3242)
2026-05-08 08:40:47 -04:00

337 B

type, pr
type pr
Fixed 3252

state.update <field> no longer rebuilds the progress. block from disk on body-only updates* — manually-curated cross-milestone counters are preserved. Also: progress.percent now reflects the lower of plan-fraction and phase-fraction so milestones with un-planned future phases don't show false 100%.