Audit fixes batch 3: aggregate drift guardrail + RemovedSnapshot data-loss #264
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!264
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/audit-fixes-batch3"
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?
Third batch from the codebase audit. Stacks on #248. Both changes are fully verified headless (244/244 tests pass against the live game DLL).
RemovedSnapshot data-loss (#259, finding #94, confirmed)
RunStorage.Optionswas missingIncludeFields = true. The game'sSerializableCard(persisted as a removed-card snapshot) stores its data in public fields, so a removed card's props/enchantment serialized as{}and rehydrated empty — silent data loss in the removed-card overlay.Optionsis nowinternalso tests (and the future public-API layer) consume the one canonical config instead of hand-copied duplicates.Aggregate drift guardrail (#251, findings #0/#23/#144)
The recurring bug class in this codebase — the doubled relic
Activationsbug and its family — comes from hand-maintained parallel field lists. This kills the class mechanically:CloneAggregatekeeps only the 5 lineage fields and delegates the rest toMergeAggregateInto;CloneEnemyAggregateand the 26-field inlineRelicAggregateclone inGetRelicAggregatebecomenew + Merge. One field list per aggregate type now lives in theMerge*Intofunctions.AggregateDriftTests— a reflection-exhaustive guard that populates every scalar field ofCardAggregate/RelicAggregate/EnemyAggregatewith a distinct value and assertsClone(src) == srcandMerge(new, src) == src. Merge-into-empty catches both omission (field stays default) and double-add (field doubles — the exactActivationsshape). Any stat field added but not merged fails the day it's added.The inner reason/status dictionaries are excluded from the drift comparison (their merges legitimately re-key by an inner id field, and they have dedicated bucket tests); the scalar fields are where the drift class lives.
Not in this batch (deferred, with reason)
Players.Count > 1), but it's a broad behavior change I can't verify without a co-op game; deferred to its own PR.🤖 Generated with Claude Code
Superseded by #267, which consolidates this and the rest of the audit work onto current main (these branches all conflicted after #247 landed). Closing in favor of the single mergeable PR.
Pull request closed