* test(#2567): add failing regression for stale state field overwrites
buildStateFrontmatter extracts Last Activity and Paused At from the full
STATE.md body via stateExtractField, which matches the first 'Field:' line
anywhere. Historical archive sections containing stale field-shaped lines
silently overwrite the correct frontmatter value on every sync, and because
the poisoning line stays in the body it regresses on the next write.
Same divergence class as Bug #2444 (which scoped Stopped At to ## Session
but did not propagate). Failing-first: all three tests reproduce the bug
on unmodified next (verified via the dedicated red run on the test-only
commit).
* fix(#2567): scope Paused At to ## Session + guard Last Activity date
Two complementary fixes for the stale-archive-overwrites-frontmatter bug
class, chosen per field semantics:
- Paused At is a session field: scope extraction to ## Session (via the
existing matchSessionSection helper), exactly mirroring the #2444 fix for
Stopped At. A stale 'Paused At:' line in an archive section can no longer
win over the current value. Falls back to full body when no ## Session.
- Last Activity has no single canonical section (it appears in the
preamble, ## Configuration, and ## Current Position across STATE.md
layouts), so a section scope cannot reliably exclude archive copies.
Instead guard the information-losing direction: when the body-derived
date is OLDER than the existing frontmatter date, keep the existing
value and description (preferNewerLastActivity). Applied at both the
write seam (syncStateFrontmatter) and the read seam (cmdStateJson) so
they agree. Non-date values pass through unchanged.
A first attempt scoped ALL current-state fields to the body preamble, but
that broke STATE.md variants where the fields legitimately live inside
## Configuration / ## Current Position (regressed 4 frontmatter.test.cjs
suites). This minimal fix targets only the two fields the issue names.
* docs(#2567): add changeset fragment for stale state field overwrite fix
* docs(#2567): backfill PR number in changeset fragment