[P1] Run-identity stamping/reset gaps on lazy-create, upgrade-deserialize, and abandon paths #255
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens#255
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Priority: P1. From the 2026-07-02 audit. Several paths re-trigger the run-stranding / phantom-run class the repo recently fixed for the main Continue path. Verify each against current code before fixing (some were not re-verified due to a verification cap).
GameStartTime(RunTracker.cs:~1246): the_currentRun ??= new RunDatainOnCombatEndedomitsGameStartTime, so a later continue can't match it and mints a fresh parallel run._currentRun ??= new(RunTracker.cs:~3625) can mint a junk run during save deserialization thatOnRunStartedthen finalizes and saves as a phantomin_progressfile. Move theTryGetInstanceIdgate above the mint; auditRecordShivGeneratedfor the same shape.RunHistoryUtilitiesCreateEntryPatchdiscards itsSerializableRunparameter (patch:32), soOnRunEndedstamps whatever_currentRunhappens to be in memory. The main-menu Abandon path never stamps outcome (defeats issue #10), and a cross-run abandon can corrupt a resumable run. Bind the run identity throughOnRunEndedand stamp by identity match / on-disk lookup._pendingRelicHeals/_pendingWhiteBeastPotionRewards— out-of-combat relic state leaks across runs.Each is a small, localized fix; group them because they share the "run identity is stamped/reset inconsistently across lazy-create, deserialize, and abandon paths" root cause. Add fixtures pinning: a continue after a lazy combat-end resumes rather than strands; a deserialize-triggered upgrade does not create a phantom saved run; abandon stamps the correct run's outcome.
Uncapped audit pass — additional confirmed lifecycle paths:
OnCombatEnded's mid-run lazyRunDatanever stampsGameStartTime, re-triggering stranding on Continue/hot-reload and lettingSaveCurrentRun's freeze guard absorb a new run's deck (#11, HIGH).RecordUpgrade/RecordShivGenerated's_currentRun ??= new RunDatamints a junk run during save-deserialization thatOnRunStartedfinalizes and SAVES as a phantomin_progressfile (#58, HIGH) — replace withif (_currentRun==null) return.RunHistoryUtilitiesCreateEntryPatch.Postfixdiscards theSerializableRunidentity, so main-menu Abandon stamps the wrong/no run (#67, #70, HIGH) — threadrun.StartTimethroughOnRunEndedand stamp the abandoned file directly.FindByGameStartTimehave zero tests (#114).Addressed in #265: lazy run creation now stamps GameStartTime via a shared EnsureLazyCurrentRunLocked() helper (all 8 sites), and RecordUpgrade gates on TryGetInstanceId before minting so a template card during save deserialization can't create a phantom run. Remaining in this issue: RecordShivGenerated/SovereignBlade generated paths (same shape, lower frequency — now GameStartTime-stamped but not gate-reordered) and the RunHistoryUtilitiesCreateEntryPatch SerializableRun identity thread-through (#67), and adoption/FindByGameStartTime test coverage (#114).
Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.