Backlog burndown: repair-254 data-loss, PatchGuard, hygiene, block-ledger coverage (#254/#261/#257/#262) #269

Merged
nelsong6 merged 4 commits from claude/backlog-burndown into main 2026-07-03 12:55:20 -07:00
nelsong6 commented 2026-07-03 12:43:22 -07:00 (Migrated from github.com)

Burns down the safe/verifiable subset of the audit backlog. Every change is headless-tested; the full suite is 264 passing (Category!=RequiresLiveGame). Live-only items are deferred (see below), not silently dropped.

What landed

repair-254 (Part A) — real data-loss fix. A card's damage + kills were silently wiped on every adopt/Continue rebuild whenever an enemy hit had no Monster ref: the writer stamped a null Receiver, and the aggregate-repair pass drops null / non-MONSTER. receivers. The writer now uses the GetEnemyId → "MONSTER.UNKNOWN" fallback (and splits the per-branch CombatEvents.Add), and the repair now recovers a null/empty Receiver as enemy damage while still excluding genuine self-damage ("PLAYER" fallback keeps it out of the MONSTER. bucket). +2 RunTrackerRepairTests.

patchguard-261 — visible, throttled patch errors. New Core/PatchGuard.cs wraps a Harmony patch body so a throw never reaches the game loop. It logs at always-on Error level (most patches buried failures in the debug-gated LogDebug) and rate-limits per call site so a wedged per-frame hook can't flood godot.log. Converted the 3 template patches (combat-history master hook, run-end funnel, Akabeko prefix). +5 PatchGuardTests incl. a source-scan convention check.

hygiene-257 (safe subset) — dead code + tooltip hardening. Deleted 8 unreachable Record*Gained methods, DisarmGremlinHornEnergyAttributionLocked, 4 fully-dead fields (Orichalcum/TheAbacus block bools + both dead Gremlin lists), and the vestigial BlockChunk.Sequence / PendingCombat.NextBlockSequence (#44). Added StatsTooltip.EscapeBbcode and applied it at all 7 tooltip sites where a game/data-derived display name flows into BBCode, so a name containing [ can't break tooltip rendering. +5 EscapeBbcode tests.

testcov-262 — block-ledger conservation (#115) + flake guard (#118). New RunTracker.RunBlockLedgerForTest seam runs the real gain→absorb→clear pipeline against a throwaway pending combat (saving+restoring live _pendingCombat under _lock). BlockLedgerConservationTests pins the issue #6 invariant: absorbed = FIFO TotalBlockEffective, cleared-unused = LIFO TotalBlockWasted, each card's gained == effective + wasted, unattributed (relic) chunks mint no phantom aggregate. CombatEndingDamageTests now runs in a serialized RunTrackerState collection so a future class touching the shared observed-result static can't interleave.

Deferred (live-combat verification required — not dropped)

  • repair-254 Part B (#41): routing Osty/IsPet receivers away from the offensive branch — no headless fixture for a live pet Creature.
  • relic-fidelity-256: all six relic gate fixes depend on live ICombatState/Creature/CardModel.
  • hygiene-257 3 disarm→registry conversions: change live disarm/window-close timing.
  • testcov-262 ClassifyEntry hot-path refactor + #116 routing test: the game's *Entry types can't be constructed headless, so that test can't feed real inputs; rewriting the busiest code path for an infeasible test is the wrong trade. Poison-tick math (#117) is already pinned by ComputeEnemyDamageTotals' lethal-overkill test.

🤖 Generated with Claude Code

Burns down the safe/verifiable subset of the audit backlog. Every change is headless-tested; the full suite is **264 passing** (`Category!=RequiresLiveGame`). Live-only items are deferred (see below), not silently dropped. ## What landed **repair-254 (Part A) — real data-loss fix.** A card's damage + kills were silently wiped on every adopt/Continue rebuild whenever an enemy hit had no `Monster` ref: the writer stamped a null `Receiver`, and the aggregate-repair pass drops null / non-`MONSTER.` receivers. The writer now uses the `GetEnemyId` → `"MONSTER.UNKNOWN"` fallback (and splits the per-branch `CombatEvents.Add`), and the repair now recovers a null/empty `Receiver` as enemy damage while still excluding genuine self-damage (`"PLAYER"` fallback keeps it out of the `MONSTER.` bucket). +2 `RunTrackerRepairTests`. **patchguard-261 — visible, throttled patch errors.** New `Core/PatchGuard.cs` wraps a Harmony patch body so a throw never reaches the game loop. It logs at always-on Error level (most patches buried failures in the debug-gated `LogDebug`) and rate-limits per call site so a wedged per-frame hook can't flood `godot.log`. Converted the 3 template patches (combat-history master hook, run-end funnel, Akabeko prefix). +5 `PatchGuardTests` incl. a source-scan convention check. **hygiene-257 (safe subset) — dead code + tooltip hardening.** Deleted 8 unreachable `Record*Gained` methods, `DisarmGremlinHornEnergyAttributionLocked`, 4 fully-dead fields (Orichalcum/TheAbacus block bools + both dead Gremlin lists), and the vestigial `BlockChunk.Sequence` / `PendingCombat.NextBlockSequence` (#44). Added `StatsTooltip.EscapeBbcode` and applied it at all 7 tooltip sites where a game/data-derived display name flows into BBCode, so a name containing `[` can't break tooltip rendering. +5 EscapeBbcode tests. **testcov-262 — block-ledger conservation (#115) + flake guard (#118).** New `RunTracker.RunBlockLedgerForTest` seam runs the real gain→absorb→clear pipeline against a throwaway pending combat (saving+restoring live `_pendingCombat` under `_lock`). `BlockLedgerConservationTests` pins the issue #6 invariant: absorbed = FIFO `TotalBlockEffective`, cleared-unused = LIFO `TotalBlockWasted`, each card's gained == effective + wasted, unattributed (relic) chunks mint no phantom aggregate. `CombatEndingDamageTests` now runs in a serialized `RunTrackerState` collection so a future class touching the shared observed-result static can't interleave. ## Deferred (live-combat verification required — not dropped) - **repair-254 Part B (#41):** routing Osty/`IsPet` receivers away from the offensive branch — no headless fixture for a live pet `Creature`. - **relic-fidelity-256:** all six relic gate fixes depend on live `ICombatState`/`Creature`/`CardModel`. - **hygiene-257 3 disarm→registry conversions:** change live disarm/window-close timing. - **testcov-262 ClassifyEntry hot-path refactor + #116 routing test:** the game's `*Entry` types can't be constructed headless, so that test can't feed real inputs; rewriting the busiest code path for an infeasible test is the wrong trade. Poison-tick math (#117) is already pinned by `ComputeEnemyDamageTotals`' lethal-overkill test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!269
No description provided.