Audit fixes (consolidated): killing-blow, stranding, STS2-update survival, data-loss, drift guardrail + more #267

Merged
nelsong6 merged 11 commits from claude/audit-consolidated into main 2026-07-03 11:44:22 -07:00
nelsong6 commented 2026-07-03 10:33:24 -07:00 (Migrated from github.com)

Single mergeable branch with the full audit body of work, rebased onto current main and merged past #247. Supersedes the now-conflicting stacked PRs #246 / #248 / #264 / #265 / #266 (please close those in favor of this).

Verified: 250/250 tests pass, and the consolidated build was hot-reloaded into a live game running the current STS2 version — Patch install: 86 classes patched, 0 failed/skipped, run resumed cleanly.

What's included

Attribution correctness

  • Killing-blow damage capture (game suppresses the fatal hit's DamageReceivedEntry; recovered via Hook.AfterDamageGiven).
  • Poison killing-tick effective damage (was unblocked - overkill, zeroing every poison kill); routed through the one canonical ComputeEnemyDamageTotals.
  • Osty phantom enemy aggregate (RecordEnemyDamage now gates on Receiver.IsPlayer).
  • Block-clear-on-retain (Barricade/Blur/Sturdy Clamp no longer report retained block as wasted).
  • Pre-existing doubled relic Activations (merge consolidated).
  • RecordPowerReceived amount>0 guard (Artifact-zeroed / negative deltas no longer counted).

Run integrity

  • Continue-stranding resume + loss-combat promotion + lazy-run GameStartTime stamping + RecordUpgrade phantom-run guard.
  • Healing-finalize race (lost-healing tail no longer discarded into a resurrected buffer).
  • Save durability: ordered single-writer chain + atomic temp+rename writes.
  • RemovedSnapshot data-loss (IncludeFields=true).

Resilience (survives the STS2 update that removed Hook.AfterTurnEnd)

  • Per-class Harmony install isolation (one broken patch can't kill all tracking) + Prepare()-based clean skip for the removed hook.
  • Exception guards on the run-end funnel and lifecycle handlers.

Guardrails

  • Reflection-exhaustive AggregateDriftTests (catches omission and double-add on merge/clone — it validated this very merge by confirming #247's new relic fields are all merged).
  • New .github/workflows/dotnet-quality.yml running the suite headless (233/233 against the stubs; 11 live-game-only tooltip tests tagged & filtered).
  • Removed permanent "temporary" draw diagnostics (the one unlocked static + per-event log spam).

Runtime facts recorded in docs/sts2-runtime-primer.md and AGENTS.md. Full backlog (attribution-window registry, MP scoping, relic-gate fidelity, etc.) tracked in #249–#263.

🤖 Generated with Claude Code

**Single mergeable branch** with the full audit body of work, rebased onto current main and merged past #247. Supersedes the now-conflicting stacked PRs #246 / #248 / #264 / #265 / #266 (please close those in favor of this). Verified: **250/250 tests** pass, and the consolidated build was **hot-reloaded into a live game** running the current STS2 version — `Patch install: 86 classes patched, 0 failed/skipped`, run resumed cleanly. ## What's included **Attribution correctness** - Killing-blow damage capture (game suppresses the fatal hit's `DamageReceivedEntry`; recovered via `Hook.AfterDamageGiven`). - Poison killing-tick effective damage (was `unblocked - overkill`, zeroing every poison kill); routed through the one canonical `ComputeEnemyDamageTotals`. - Osty phantom enemy aggregate (`RecordEnemyDamage` now gates on `Receiver.IsPlayer`). - Block-clear-on-retain (Barricade/Blur/Sturdy Clamp no longer report retained block as wasted). - Pre-existing doubled relic `Activations` (merge consolidated). - `RecordPowerReceived` `amount>0` guard (Artifact-zeroed / negative deltas no longer counted). **Run integrity** - Continue-stranding resume + loss-combat promotion + lazy-run `GameStartTime` stamping + `RecordUpgrade` phantom-run guard. - Healing-finalize race (lost-healing tail no longer discarded into a resurrected buffer). - Save durability: ordered single-writer chain + atomic temp+rename writes. - `RemovedSnapshot` data-loss (`IncludeFields=true`). **Resilience (survives the STS2 update that removed `Hook.AfterTurnEnd`)** - Per-class Harmony install isolation (one broken patch can't kill all tracking) + `Prepare()`-based clean skip for the removed hook. - Exception guards on the run-end funnel and lifecycle handlers. **Guardrails** - Reflection-exhaustive `AggregateDriftTests` (catches omission *and* double-add on merge/clone — it validated this very merge by confirming #247's new relic fields are all merged). - New `.github/workflows/dotnet-quality.yml` running the suite headless (233/233 against the stubs; 11 live-game-only tooltip tests tagged & filtered). - Removed permanent "temporary" draw diagnostics (the one unlocked static + per-event log spam). Runtime facts recorded in `docs/sts2-runtime-primer.md` and `AGENTS.md`. Full backlog (attribution-window registry, MP scoping, relic-gate fidelity, etc.) tracked in #249–#263. 🤖 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!267
No description provided.