You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drift Foundry: derive RunPhase from the shared run loop readout (adoption cleanup) #2352
drift-foundry/src/game/run/session.ts keeps RunPhase = "start" | "running" | "won" | "crushed" beside createRunLoop, which already answers the same question through loop.read() (RunReadout). The game settles through loop.settle(...) and saves loop.snapshot(), so the phase is a second copy of state the shared loop owns, and a lane reading the phase cannot tell which one is authoritative.
Fix:
derive the won/crushed state from loop.read() instead of the local phase;
keep the title-vs-running distinction only if the shared readout cannot express it, and say why in one comment.
No engine change unless deriving the phase needs a field the readout lacks; if it does, name that field here and this becomes a small engine gap.
bun run check:framework does not flag this: a module that imports @jgengine/core/run/runLoop is composing the shared loop, and the duplicate state is tracked here instead of as a gate red.
Done in jgengine-games#206 (Drift Foundry: the pit is the shared game menu). session.ts no longer stores a phase: won/crushed now come from the outcome the shared run loop returns from settle(...) (the readout has no outcome field, and banked/lost totals cannot tell a zero-haul escape from a zero-haul wreck); start-vs-running is the one retained bit, because the loop opens a run at the pit before the engine starts, and the comment says so. No engine change needed.
Activity
Noisemaker111 commentedon Oct 24, 2026
Done in jgengine-games#206 (Drift Foundry: the pit is the shared game menu). session.ts no longer stores a phase: won/crushed now come from the outcome the shared run loop returns from settle(...) (the readout has no outcome field, and banked/lost totals cannot tell a zero-haul escape from a zero-haul wreck); start-vs-running is the one retained bit, because the loop opens a run at the pit before the engine starts, and the comment says so. No engine change needed.