Reclaim orphaned instance numbers instead of minting a generation #302

Merged
nelsong6 merged 1 commit from claude/fix-instance-generations into main 2026-08-08 11:57:29 -07:00
nelsong6 commented 2026-08-08 11:57:21 -07:00 (Migrated from github.com)

SpireLens tags each physical card with an instance number. A deck card not covered by the saved instance_numbers_by_def queue 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.

CARD.STRIKE_DEFECT   all floor_added: 1
  #1-4    3,5,5,3 plays   played, then orphaned
  #5-8    0 plays         minted and immediately superseded
  #9-11   7,14,4 plays    the live generation — all the viewer shows
  #12     6 plays         removed

PruneGhostAggregates cannot clean these: it skips any number at or below the last saved def_counters value, which every accumulated generation is.

Fix

Before minting, GetOrAssignNumber takes 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.

SpireLens tags each physical card with an instance number. A deck card not covered by the saved `instance_numbers_by_def` queue 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. ``` CARD.STRIKE_DEFECT all floor_added: 1 #1-4 3,5,5,3 plays played, then orphaned #5-8 0 plays minted and immediately superseded #9-11 7,14,4 plays the live generation — all the viewer shows #12 6 plays removed ``` `PruneGhostAggregates` cannot clean these: it skips any number at or below the last saved `def_counters` value, which every accumulated generation is. ## Fix Before minting, `GetOrAssignNumber` takes 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.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
romaine-life/spirelens!302
No description provided.