Introduces KNOWN_TEMPLATE_DEFAULTS and KNOWN_STATUS_PATTERNS in state-document.cjs to enumerate every string a GSD handler writes. stateReplaceFieldIfTemplate consults this table and only replaces the field when the existing value is a known template default (or absent) — executor-authored values are left untouched. Wire-in: - record-session: Resume File now only overwritten when caller passes --resume-file OR existing value is 'None'. Router no longer defaults resume_file to 'None' before calling the handler. - advance-plan (both branches): Status and Last Activity guarded via stateReplaceFieldIfTemplate. - updateCurrentPositionFields: Status and Last activity in the Current Position section guarded; bare ISO date shape is the trigger for replacement, prose narrative is preserved. - planned-phase: Status and Last Activity guarded the same way. Regression tests (7 cases) in tests/bug-397-state-preserve-executor-authored.test.cjs cover each data-loss shape; all 106 existing state.test.cjs tests still pass. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
440 B
440 B
type, pr
| type | pr |
|---|---|
| Fixed | 397 |
State handlers (record-session, advance-plan, planned-phase) now preserve executor-authored STATE.md field values instead of overwriting them with template defaults. Introduces explicit field-ownership via KNOWN_TEMPLATE_DEFAULTS and stateReplaceFieldIfTemplate. Fixes a data-loss shape where hand-authored Resume File / Status / Last Activity values were silently lost on the next state-handler call.