josh b6cc9000c3 feat(01-03): save envelope + canonical-JSON CRC32 + synthetic v0->v1 migration [GREEN]
- checksum.ts: crc32hex (8-char lowercase hex of CRC-32, signed->unsigned via >>>0)
  + canonicalJSON (recursive object-key sort, arrays preserved) per Pitfall 3
- envelope.ts: wrap/unwrap with SaveCorruptError on checksum mismatch + Zod
  SaveEnvelopeSchema accepting nonnegative schemaVersion (allows synthetic v0)
- migrations.ts: forward-only registry with migrations[1] producing the v1
  shape from CONTEXT D-04 (garden.tiles, plants, harvestedFragmentIds,
  lastTickAt, settings); throws on negative or future-version inputs

Removes src/save/.gitkeep firewall marker (real source files now live here).

Tests: 21/21 pass (npx vitest run src/save/checksum.test.ts
src/save/envelope.test.ts src/save/migrations.test.ts).
TypeScript-strict; no 'any' in production code (CLAUDE.md).
2026-05-08 23:28:56 -04:00
2026-05-08 21:37:11 -04:00
S
Description
No description provided
1.4 MiB
Languages
TypeScript 91.2%
JavaScript 6.7%
Ink 1.8%
CSS 0.2%
HTML 0.1%