[P1] Repair path zeroes damage aggregates the writer stamped with a null Receiver #254
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#254
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. Confirmed.
Problem
RepairOffensiveDamageAggregatesFromEvents(RunTracker.cs:~5486) zeroes all offensive aggregates and rebuilds them only fromdamage_receivedevents whoseReceiverstarts with"MONSTER.". But the writer,RecordDamageFromCard, stampsReceiver = entry.Receiver.Monster?.Id— which is null when the receiver has noMonster— whileGetEnemyIduses aMONSTER.UNKNOWNfallback. The two paths disagree.This repair runs on every hot-reload / continue (
AdoptRunLocked(..., repairAggregates: true)), so a card that damaged aMonster-null creature has its damage and kills permanently wiped on the next resume — the exact stat-stranding class the recent adoption work set out to fix.Fix
Receivervia the sameMONSTER.UNKNOWNfallback thatGetEnemyIduses (or, alternatively, skip the repair entirely when anydamage_receivedevent lacks aReceiver, so it can't silently drop data).Test
Add a fixture to
RunTrackerRepairTestswith aMonster-null-receiverdamage_receivedevent and assert the repair preserves (does not wipe) the aggregate's damage/kills.Uncapped audit pass — sibling of the null-Receiver bug (confirmed):
FinalizeRelicHealingruns on aTaskScheduler.DefaultContinueWithracing the main-threadCombatEndedpromotion; if promotion wins,GetOrCreateRelicAggregateForHealingLockedresurrects a fresh_pendingCombat(RunTracker.cs:3200) and theTotalHealingLosttail is silently discarded at the nextOnCombatSetUp— stranded permanently on the run's final victorious combat (#50). Fix: route by live_pendingCombat==nullto the committed run aggregate; persist when the tail landed in the run.Addressed in #265: GetOrCreateRelicAggregateForHealingLocked now routes to the committed run aggregate (GetOrCreateRelicAggregateForCurrentContextLocked) instead of GetOrCreateRelicAggregateLocked, which did
_pendingCombat ??= newand resurrected an orphan buffer when the pool-thread finalize lost the race with combat-end promotion. The late direct-to-run write is now persisted. The broader repair-path Receiver asymmetry (#4/#12) remains open here.Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.