Reclaim orphaned instance numbers instead of minting a generation #302
No reviewers
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!302
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/fix-instance-generations"
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?
SpireLens tags each physical card with an instance number. A deck card not covered by the saved
instance_numbers_by_defqueue minted a fresh number, orphaning the stats already recorded against that card. Every Continue and every Core reload repopulates the deck, so orphans accumulated into whole generations per definition — and the deck viewer shows only the live generation, so those cards read low.Observed on a floor-49 run: 124 tracked instances for a 33-card deck, with 21% of recorded plays on numbers no live card was bound to.
PruneGhostAggregatescannot clean these: it skips any number at or below the last saveddef_countersvalue, which every accumulated generation is.Fix
Before minting,
GetOrAssignNumbertakes the lowest number this run already tracks for the definition that no live card is bound to, is not waiting in the snapshot queue, and is not marked removed. The snapshot queue stays authoritative; this is only the fallback for what it does not cover.Out of combat only — combat-generated copies route through the same primitive, and letting an ephemeral card claim a deck card's identity is the hazard the queue already avoids by clearing at combat setup.
Selection is a pure function (
SelectOrphanedInstanceNumber) with 9 tests: deck-rank order across successive cards, removed cards never reclaimed, bound and queued numbers skipped, other definitions ignored, and minting still reached when every tracked number is accounted for.Scope
Fixes runs from here on. Does not repair runs already split — nothing in the data says which orphan belonged to which surviving copy (all the Strikes share
floor_added: 1), so a retroactive merge would be invented attribution rather than recovered data.Full suite 2051/2053; the two failures fail identically on
main. No new Harmony targets.