[P1] Test the untested attribution cores (Observe, block ledger, poison proration) + golden event-sequence replay #262

Closed
opened 2026-07-03 09:33:40 -07:00 by nelsong6 · 1 comment
nelsong6 commented 2026-07-03 09:33:40 -07:00 (Migrated from github.com)

Priority: P1. From the 2026-07-02 uncapped audit pass. Covers load-bearing untested cores (distinct from the #257 test-fidelity hygiene). Depends on the CI-gate issue to be protective.

Untested attribution cores

  • Observe() — the master routing point for every combat-history entry — has zero tests (#116). It should have a table-driven test feeding each entry type and asserting the right Record* path fires.
  • Player block provenance ledger (FIFO/LIFO chunks, absorb-vs-waste) has zero tests and no conservation-invariant check (#115): assert gained == absorbed + wasted + remaining across a scripted sequence.
  • TryRecordPoisonTickDamage fractional-share proration across multiple owners is untested (#117).

Flake time-bomb (fix now-ish)

CombatEndingDamageTests mutates the shared _observedDamageResults static with no xUnit [Collection] serialization (#118) — two test classes touching that static can race under parallel execution and abort the hard unit-test gate. Add a [Collection("RunTrackerState")] / DisableParallelization collection around the tests that touch mutable RunTracker statics.

Highest-leverage new artifact — golden event-SEQUENCE replay harness (#150)

Every lifecycle-ordering bug this codebase has hit (killing-blow suppression, Continue re-fire, loss-before-CombatEnded, CardEnterDeckPatch-before-RunStarted) was found in live play because the tests pin methods, never orderings. Build a harness that replays a recorded sequence of CombatHistoryEntry / lifecycle events through Observe + the lifecycle handlers and asserts the final RunData. Extract the testable cores behind internal seams (InternalsVisibleTo is already granted). Record each discovered ordering trap as a replayable fixture — SchemaLoadingTests does this for shapes; this does it for time.

Findings: #116, #115, #117, #118, #150.

**Priority: P1.** From the 2026-07-02 uncapped audit pass. Covers load-bearing untested cores (distinct from the #257 test-fidelity hygiene). Depends on the CI-gate issue to be protective. ## Untested attribution cores - **`Observe()`** — the master routing point for every combat-history entry — has **zero** tests (#116). It should have a table-driven test feeding each entry type and asserting the right `Record*` path fires. - **Player block provenance ledger** (FIFO/LIFO chunks, absorb-vs-waste) has zero tests and no conservation-invariant check (#115): assert `gained == absorbed + wasted + remaining` across a scripted sequence. - **`TryRecordPoisonTickDamage`** fractional-share proration across multiple owners is untested (#117). ## Flake time-bomb (fix now-ish) `CombatEndingDamageTests` mutates the shared `_observedDamageResults` static with no xUnit `[Collection]` serialization (#118) — two test classes touching that static can race under parallel execution and **abort the hard unit-test gate**. Add a `[Collection("RunTrackerState")]` / `DisableParallelization` collection around the tests that touch mutable `RunTracker` statics. ## Highest-leverage new artifact — golden event-SEQUENCE replay harness (#150) Every lifecycle-ordering bug this codebase has hit (killing-blow suppression, Continue re-fire, loss-before-CombatEnded, CardEnterDeckPatch-before-RunStarted) was found in **live play** because the tests pin *methods*, never *orderings*. Build a harness that replays a recorded sequence of `CombatHistoryEntry` / lifecycle events through `Observe` + the lifecycle handlers and asserts the final `RunData`. Extract the testable cores behind internal seams (`InternalsVisibleTo` is already granted). Record each discovered ordering trap as a replayable fixture — `SchemaLoadingTests` does this for shapes; this does it for time. Findings: #116, #115, #117, #118, #150.
nelsong6 commented 2026-07-05 15:44:55 -07:00 (Migrated from github.com)

Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.

Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.
Sign in to join this conversation.
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#262
No description provided.