[P1] Unify run/API JSON wire format + fix RemovedSnapshot props data-loss (IncludeFields) #259
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#259
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 uncapped audit pass. Contains an actual data-loss member. No existing issue owns storage/API serialization coherence.
Data loss — RemovedSnapshot props (finding #94, confirmed)
RunStorage.Options(Core/RunStorage.cs:29-34) does not setIncludeFields = true.SerializableCard.SavedPropertiesstores its data in public fields, so a removed card's props/enchantment serialize as{}and rehydrate empty on reload — the removed-card overlay loses upgrade/enchant state. Fix:IncludeFields = true(matches the game'sMegaCritSerializerContext). No fixture pins theremoved_snapshotround-trip (#95, #119) — which is exactly why this went unnoticed; add one that carries non-empty props.Wire-format divergence — public API (findings #96, #86, confirmed)
SpireLensApiRegistry.cs:20serializes with a barenew JsonSerializerOptions()→ PascalCase, nulls written — a shape incompatible with every on-disk run file and every test option set (all snake_case +WhenWritingNull). Any API consumer reads a different shape than the run files. It also serializes liveRunDatawithout holding_lock, racingOnCombatEndedpromotion (#86).Fix: expose one canonical
RunStorage.Options(internal static) and route the API through a lock-heldRunTracker.SerializeCurrentRunJson().Secondary hardening (same file, lower severity)
ReadHeaderfull-file-parses per probe on the main thread (#97).RunsDirhas no test seam;SaveAsync's synchronous serialize sits outside the try/catch (#98).0as fact on pre-instance_numbers_by_deffiles (#99) — consider nullable for genuinely-absent fields.<run_id>.jsonas recoverable from a leftover.json.tmp(pairs with the atomic-write change already in PR #248).Addressed in #264: RunStorage.Options now sets IncludeFields=true (SerializableCard stores data in public fields, so removed-card props/enchantment were serializing as {} and rehydrating empty), and Options is now internal so tests consume the canonical config. The public-API wire-format unification (#96/#86) and the ReadHeader/RunsDir hardening remain open here.
Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.