Skip to content

fix(undo): reject impossible snapshot dates and document the name filter - #76

Merged
abogartz merged 1 commit into
abogartz:mainfrom
WhollyMindless:fix/undo-snapshot-dates
Oct 24, 2026
Merged

abogartz merged 1 commit into
abogartz:mainfrom
WhollyMindless:fix/undo-snapshot-dates

Conversation

@WhollyMindless

@WhollyMindless WhollyMindless commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

The two nits from your #63 review. #63 merged before I pushed them.

Change:

  • Snapshot names must carry a real calendar date: a UTC round-trip, so leap years count and timezones don't matter. 123-2026-13-45.logfmt and 124-2026-02-29.logfmt are rejected with the existing invalid snapshot name error and hidden from listSnapshots(). 125-2028-02-29.logfmt is listed and restores. No name snapshotFiles() mints is affected.
  • The memory_undo tool description and the README say that non-standard files in snapshots/ (e.g. an old <stamp>-canonical.logfmt) aren't listed or restorable, so someone mid-recovery knows why a file is missing.

Tests (test/undo.test.ts): impossible dates are rejected and not listed, and a real leap day restores. With the source change reverted, the test fails.

Checks (Linux, Bun 1.4.4, on 0.8.4): bun test ./test/ 303 pass, 4 skip, 0 fail. bun run test:e2e against opencode 2.0.26: 9 pass. tsc --noEmit is clean, and biome lint exits 0 with warnings unchanged from main. Nothing here is platform-specific.

Merge order: independent of #62, #66, #67 and #77. I merged all of them together on 0.8.4 and they apply cleanly.

🤖 Generated with Claude Code

Review follow-up for abogartz#63: snapshot names must carry a real calendar date
(UTC round-trip, leap years included), and the tool description and README
now say that non-standard files in snapshots/ are not listed or restorable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@abogartz abogartz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Verified independently on the merged batch (all five applied cleanly onto 0.8.4):

  • listSnapshots() hides 1000-2026-02-29.logfmt and 1002-2026-13-45.logfmt; restoreSnapshot() on the impossible name throws invalid snapshot name: ….
  • 1001-2028-02-29.logfmt is listed and restores — the UTC round-trip (setUTCFullYear + three-field compare) gets leap years right without timezone drift, which is the detail most date-grammar checks fumble.
  • The README line ("only lists and restores its own <stamp>-YYYY-MM-DD.logfmt snapshots; any other file in snapshots/ is ignored") says exactly what someone mid-recovery needs to know.

Combined-batch gates: 324 pass / 4 skip / 0 fail, tsc --noEmit clean, biome exit 0.

@abogartz
abogartz merged commit 06d23fb into abogartz:main Oct 24, 2026
3 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.8.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@WhollyMindless
WhollyMindless deleted the fix/undo-snapshot-dates branch October 26, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants