Card transformation on upgrade (new ref, orphans stats) #18
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#18
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?
Observation
Hovering an upgraded Astral Pulse (Regent card, "Deal 14 damage to ALL enemies" base, +4 on upgrade) showed:
Before the upgrade there was ONE Astral Pulse in the deck, tracked as `#1`. After a single campfire upgrade it jumped to `#2` — implying a fresh CardModel ref was created during the upgrade rather than the existing one being mutated in place.
Stats on `#1` are now orphaned (card no longer in the deck under that id), and the user sees a fresh-looking `#2` aggregate.
Contrast: Shining Strike campfire upgrade (confirmed working)
Same test with Shining Strike #1 at a campfire:
```
card_upgraded: CARD.SHINING_STRIKE#1 level=1 floor=9 rawHash=45035823 canonicalHash=45035823 deckVerNull=True inDeck=True floorAddedToDeck=2
```
Same ref before/after, stayed `#1`. Works as expected.
Hypothesis: card-specific transformation behavior
Both `AstralPulse.cs` and `ShiningStrike.cs` have identical `OnUpgrade` structure (just `DynamicVars.Damage.UpgradeValueBy(N)`). So the new-ref creation isn't visible in the card-level source. It's likely triggered by a command/flow somewhere in the campfire code path for specific cards.
Data we need to catch it
Next time this happens, the `card_upgraded` log line (diagnostic already always-on) will include:
A reproduction of the bug should show a `#N` jump AND a specific combination of these fields that differs from the Shining Strike control case.
Fix sketch (when reproducible)
Priority
Medium. Most cards upgrade in-place (confirmed via Shining Strike). Transformation-on-upgrade is card-specific and relatively rare. Stats don't migrate cleanly for those cards currently, but they're still tracked (just under a new instance number).
Closing this as resolved.
This no longer reproduces after the per-instance identity refactor shipped in commit
9a4a44e3f5ae5583083f3821ff4e4ca5b2b3dd35(Add per-card stats tooltip and removed card tracking).What changed:
RunTracker.RecordUpgradeAt this point the upgrade-transform case is behaving correctly in current testing, so there is no active orphaned-stats issue to chase here.