fix/tier-preserving-begin-run #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/tier-preserving-begin-run"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Per OG (2026-08-01): tapping the visibility (eye) button hides the entire top-right button cluster — DEV, End Run, Reset Save — in addition to the HUD readout. The eye itself stays visible so the player can re-tap to bring the buttons back. Implementation: - DevPanel.js: subscribe to EV.HUD_TOGGLE. Toggle the DEV button and force-close the dev menu. Apply initial hudVisible on mount (covers the save-load case where the player previously toggled the HUD off). - RunControls.js: same pattern for the run-controls panel. - Hud.js: unchanged. The eye button itself and the HUD readout already follow the toggle. The 'eye always visible' rule prevents a soft-lock: the player can never get stuck with no way to restore the buttons. Headless E2E (5/5 pass on the live URL): Test 1: default state, all four buttons visible Test 2: tap eye → HUD + DEV + End Run + Reset Save hide, eye stays visible Test 3: tap eye again → all restored Test 4: dev menu open + eye tap → menu hides, doesn't auto- reopen on next eye tap Test 5: save-load with hudVisible=false → buttons start hidden on mount, eye still visible Verification detail: getComputedStyle(child).display returns inline-block for a <button> even when the parent is display:none. We use getBoundingClientRect() (returns 0x0 for hidden elements) to detect actual visibility rather than trusting the child's own display value.Per OG (2026-08-01): the eye toggle has two states (HUD visible, HUD hidden). On beacon death: - HUD visible: WAIT at the Beacon Out screen. Player taps Begin New Run / Change Tiers / Profile manually. - HUD hidden: AUTO-RUN after 5 seconds. Calls __spire_startNewRun() with no arg — tier-preserving, same path as the manual Begin New Run button (commit563420a). The eye stays clickable on the Beacon Out screen (z=19, above the modal at z=18) so the player can re-toggle the HUD during the 5s window to cancel the auto-restart. Implementation: - PrestigeManager._checkAutoRestart(): single source of truth for the 5s timer. Re-evaluates from scratch on every call: cancels any pending timer, checks hudVisible===false and modal up, schedules a fresh 5s setTimeout. The callback re-checks both conditions at fire time (defense in depth). - PrestigeManager constructor: registers bus.on(EV.HUD_TOGGLE) → _checkAutoRestart. Any HUD toggle (visible↔hidden) while the modal is up re-evaluates. - PrestigeManager._showRunEndModal: calls _checkAutoRestart after the modal mounts. If HUD is already hidden, timer starts immediately. If visible, no timer. - Hud.js: bumped eye z-index from 11 to 19 (above modal at 18, below Shop at 30). The eye is the only way to cancel the auto-restart while the modal is up — it must be reachable. Tests: - tests/auto_restart_afk.mjs (new, 16 assertions): unit-level coverage of all trigger/cancel paths. - /tmp/spire-defense-auto-restart-verify.mjs: live E2E (9 assertions) on the real URL — actually waits the 5s. Test status: 16/16 unit + 9/9 E2E pass. Pre-existing tests (begin_run_tier_preservation.mjs, milestone_gate_audit.mjs) still pass.