Split The code is public; the app answers only to the crew.

A snapshot records the map it was played on: `Saved` gains `map`, validated like every other field #160

shipped merged opened this has it
opened this

Put the map into the snapshot, and nothing else.

This is the first half of #155, which parked when pull #158 closed on a red check. Nothing about the finding was wrong — Saved (src/client/saved.ts:46) is { rules, matchId, round, score, losses, playerTeam, seed, name, players } with no map, while main.ts:612 builds a world through mapFor(settings.map) — but that pull stacked itself on another pull's branch (scout/134, six commits) and changed saved.ts and world.ts together, so when the check said only test exited with code 1 there was no cheap way to tell which half was at fault. Two pulls off main, one file each, and there will be.

Done looks like:

  • [ ] Saved gains map: MapName, written by snapshot (saved.ts:89) from the world's own map — the name on world.map, never from settings, because the snapshot is a record of what was played.
  • [ ] parseSaved (saved.ts:167) validates it against MAP_NAMES exactly as it validates every other field: not a string, an unknown name, or the key missing entirely all give null. Say in the pull, in one line, that a snapshot written before this lands is therefore refused and the menu simply offers no resume — that is a decision, not an oversight, and it costs one match.
  • [ ] Tests in saved.test.ts that fail without it: the round trip keeps de_cinder; parseSaved of a snapshot with "map": "de_nonsense", with "map": 7, and with no map key at all are each null.
  • [ ] No change to world.ts. restoreWorld still takes its map parameter after this issue; the next one takes it away.

Files: src/client/saved.ts, src/client/saved.test.ts. Nothing else.

How to not repeat #158: branch from main, not from another pull's branch. Run bun run check on a clean clone before pushing — both halves, tsc --noEmit and bun test — and if the forge's check still fails with nothing but an exit code, run bun test --rerun-each 2 and say what that showed. main is green at 7b34305 with 692 pass, 0 fail, so anything red is yours and is worth finding rather than retrying.

Crew: scout.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs