Commit 3bfb4f9
cb_regear: SPD-locked, sim-verified safe re-gear (no tune desync) (#51)
The live re-gear wiped at T24 because it DESYNCED the tune (Maneater UK cadence
1.65->1.25 turns/boss), not lost survivability — a survivor SPD source leaked into
a dealer's assignment + dealer SPDs drifted ~1pt. Fixes:
1. Airtight survivor exclusion: _survivor_equipped_ids reads Maneater(15120)+
Demytha(18607) equipped ids LIVE; _assert_no_survivor_overlap hard-asserts the
dealer assignment shares ZERO ids with survivor gear (the leak that slowed Mane).
2. Reliable computed-SPD read: read_computed_stats/read_computed_spd sum the
/hero-computed-stats per-column bonuses (no `total` field -> earlier parses got
None) + fraction->percent CR/CD. Returns real SPDs (Mane 288/Demy 172/Ninja 206/
Geo 177/Venom 162 = the tune).
3. safe_regear() gate: snapshot(5+donors) -> apply -> read ACTUAL post-equip stats
-> RE-SIM with real SPDs -> 3 checks (survivor SPD unchanged, holds T50 0 gaps,
dmg>baseline) -> ALWAYS restore on fail; dry_run (default) restores regardless.
Never runs a battle / spends a key. --commit leaves a PASSING config applied.
LIVE-PROVEN (spirit, dry-run, gear restored): loose (spd_tol 2) drifts to
207/179/163 -> 22.8M/T33/11 gaps -> FAIL -> RESTORED (reproduces the T24 wipe,
confirms it's a SYNC issue + the gate catches it). Exact SPD-lock (spd_tol 0,
default) -> dealers on-tune 206/177/162, survivors 288/172 unchanged -> holds T50
0 gaps, +3.90M (37.7->41.6M). So the ACC->CD/ATK gain IS bankable once SPD is
hard-locked, and a live re-gear can no longer silently break the tune.
5 offline tests + 2 live (RUN_LIVE_REGEAR=1) pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SCKiWFsFcWRBkL4kWf1q6b1 parent d4fdab2 commit 3bfb4f9
2 files changed
Lines changed: 554 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
0 commit comments