v30.49: investigation sweep — rest stops, save integrity, lore clamp, dead code #7

Merged
og_arist0tle merged 1 commit from fix/investigation-sweep into main 2026-07-23 16:58:02 +00:00
Contributor

Full-fix sweep from the code/UX investigation (24 files, +578 / −1988). Every behavioral fix was done test-first: test/investigation-fixes.mjs (52 tests) failed 31-red before implementation — the failure output demonstrates each bug (15 lore fragments at 15k steps, alice loading bob's cached save, a dropped server POST).

Gameplay fixes

  • Rest stops recur after manual beacon lights (owner-confirmed intent: every spire). Both ascent paths now share handleAscent(), which resets lastStepInt / restStopActiveUntil. Previously only the auto-ascent path reset them, so a manual ascent silenced rest stops for most of the following climb.
  • Rest stops fire on 500-step boundary crossing, not exact landing (crossedRestStopBoundary in RestStops.js). At late-game light levels a 200 ms tick exceeds 1 step, and iOS catch-up ticks jump hundreds — both skipped boundaries before.
  • Lore clamps at the last authored fragment. checkLoreUnlocks was minting memory-13000+ forever: no prose, a free +5% each, and a "13/12" memory count around ascension ~39.
  • loreUnlocked sorts numerically (was lexicographic: memory-10000 before memory-2000).

Save integrity

  • Per-player localStorage cache. The single shared key meant player A could boot into player B's progress whenever the server was unreachable.
  • Overlapping server saves re-queue with the latest state instead of being silently dropped (_pushToServer pending flag).
  • Player names sanitize client-side to the server's slug rules (sanitizePlayerName, mirrors _safe_player_name). Names with spaces used to fail the boot() roster comparison and re-prompt the picker on every page load.
  • Player switch pauses the loop + autosave, closing the window where the old player's state could be POSTed under the new player's name.
  • GameState.applySnapshot()/reset() replace three copy-pasted restore blocks; explicit zero steps now restores (the old if (src.steps) falsy check skipped it).

Cleanup

  • Renderer imports loreText from LoreFragments.js — its private copy had drifted (four fragments truncated in the unlock flash).
  • Deleted 10 dead pre-v30 module dirs (generators, prestige, IAP, …) and unused vendor/break_infinity.mjs.
  • X-Dark-Spire-Build header reads the build SHA from the rendered HTML (was hardcoded v30.4); footer says "synced per player" instead of the stale "localStorage".
  • README: rAF→setInterval, whisper timing, test docs; package.json synced to 30.49.0.

Verification

  • 140/140 across smoke + new regressions; v30.0 math snapshot still byte-identical; SSR build clean.
  • Live server boot: header carries real SHA, footer updated, Test User save round-trips to Test_User.

Deliberately out of scope (design decisions, not fixes)

  • Offline progress on page reload (meta.lastSave makes it cheap if wanted).
  • Rest-stop boost size (+10% for 5 s is imperceptible at 1 step/sec).

https://claude.ai/code/session_01GXVNmgsNVqFbiAubQLiXZF

Full-fix sweep from the code/UX investigation (24 files, +578 / −1988). Every behavioral fix was done test-first: `test/investigation-fixes.mjs` (52 tests) failed 31-red before implementation — the failure output demonstrates each bug (15 lore fragments at 15k steps, alice loading bob's cached save, a dropped server POST). ## Gameplay fixes - **Rest stops recur after manual beacon lights** (owner-confirmed intent: every spire). Both ascent paths now share `handleAscent()`, which resets `lastStepInt` / `restStopActiveUntil`. Previously only the auto-ascent path reset them, so a manual ascent silenced rest stops for most of the following climb. - **Rest stops fire on 500-step boundary *crossing***, not exact landing (`crossedRestStopBoundary` in `RestStops.js`). At late-game light levels a 200 ms tick exceeds 1 step, and iOS catch-up ticks jump hundreds — both skipped boundaries before. - **Lore clamps at the last authored fragment.** `checkLoreUnlocks` was minting `memory-13000+` forever: no prose, a free +5% each, and a "13/12" memory count around ascension ~39. - **`loreUnlocked` sorts numerically** (was lexicographic: `memory-10000` before `memory-2000`). ## Save integrity - **Per-player localStorage cache.** The single shared key meant player A could boot into player B's progress whenever the server was unreachable. - **Overlapping server saves re-queue** with the latest state instead of being silently dropped (`_pushToServer` pending flag). - **Player names sanitize client-side to the server's slug rules** (`sanitizePlayerName`, mirrors `_safe_player_name`). Names with spaces used to fail the `boot()` roster comparison and re-prompt the picker on every page load. - **Player switch pauses the loop + autosave**, closing the window where the old player's state could be POSTed under the new player's name. - **`GameState.applySnapshot()`/`reset()`** replace three copy-pasted restore blocks; explicit zero steps now restores (the old `if (src.steps)` falsy check skipped it). ## Cleanup - Renderer imports `loreText` from `LoreFragments.js` — its private copy had drifted (four fragments truncated in the unlock flash). - Deleted 10 dead pre-v30 module dirs (generators, prestige, IAP, …) and unused `vendor/break_infinity.mjs`. - `X-Dark-Spire-Build` header reads the build SHA from the rendered HTML (was hardcoded `v30.4`); footer says "synced per player" instead of the stale "localStorage". - README: rAF→setInterval, whisper timing, test docs; `package.json` synced to 30.49.0. ## Verification - 140/140 across smoke + new regressions; v30.0 math snapshot still byte-identical; SSR build clean. - Live server boot: header carries real SHA, footer updated, `Test User` save round-trips to `Test_User`. ## Deliberately out of scope (design decisions, not fixes) - Offline progress on page reload (`meta.lastSave` makes it cheap if wanted). - Rest-stop boost size (+10% for 5 s is imperceptible at 1 step/sec). https://claude.ai/code/session_01GXVNmgsNVqFbiAubQLiXZF
Gameplay fixes:
- Rest stops recur after MANUAL beacon lights (shared handleAscent resets
  lastStepInt; previously only the auto-ascent path did)
- Rest stops fire on 500-step boundary CROSSING, not exact landing
  (fast climbs and iOS catch-up ticks jumped over boundaries)
- Lore unlocks clamp at the last authored fragment — no phantom
  memory-13000+ entries with no prose and free +5% boosts
- loreUnlocked sorted numerically (was lexicographic: 10000 before 2000)

Save integrity:
- localStorage cache is per-player (was one shared key — player A could
  boot into player B's progress when the server was unreachable)
- Overlapping server saves re-queue instead of silently dropping
- Player names sanitized client-side to match ssr-server.py slug rules
  (names with spaces re-prompted the picker on every load)
- Player switch pauses loop + autosave (old state could be saved under
  the new player's name mid-switch)
- GameState.applySnapshot/reset: single restore path; explicit zero
  steps restores correctly (was skipped by a falsy check)

Cleanup:
- Renderer imports loreText from LoreFragments (its private copy had
  drifted — four fragments were truncated in the unlock flash)
- Deleted 10 dead pre-v30 module dirs + unused vendor/break_infinity.mjs
- X-Dark-Spire-Build header reads the build SHA from the rendered HTML
  (was hardcoded 'v30.4'); footer no longer claims localStorage-only
- README: rAF→setInterval, whisper timing, test docs; package.json 30.49.0
- New suite: test/investigation-fixes.mjs (52 tests), wired into npm test

Claude-Session: https://claude.ai/code/session_01GXVNmgsNVqFbiAubQLiXZF
og_arist0tle approved these changes 2026-07-23 16:57:34 +00:00
Dismissed
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
og_arist0tle/dark-spire!7
No description provided.