j142 retire the ADE+SBC gun (rack id 17): the owner watched it, it does not learn, throw it away
Remove guns/bitbrain_net.nim (+README), test_bitbrain_net.nim,
measure_bitbrain_scaling.nim, rack id 17 and all of its plumbing in
selector.nim / ModularBot.nim / env_report.nim, the TR_BITBRAIN_NET switch
and the NEW-NETWORK TR_BITBRAIN_* knobs, and the BitBrainNet arm of
run_prediction_quality.nim.
With id 17 gone there is nothing to disambiguate, so the legacy namespace
becomes the ONLY one: TR_RACK_BITBRAIN always selects id 16 LEADGAIN and
every TR_BITBRAIN_<X> in the frozen 14-suffix alias set always means
TR_LEADGAIN_<X>. The alias layer and its [depr] line stay.
KEPT: the common_libs/bitbrain/ SBC library (learned_surfer imports
bitbrain/sbc), lead_gain at id 16 with env TR_LEADGAIN_* and log tag [lg],
and the c9b6753 crash fix (NumRackGuns widths + test_rack_stat_width).
Tombstone: docs/bitbrain_campaign.md ## RETIRED and one cross-reference line
in docs/gun_campaign.md. Shipped defaults unchanged: clean env -> rack
active 1v1 = PATTERN, movement default strafe.
This commit is contained in:
@@ -14,17 +14,23 @@
|
||||
## The fix derives every gun-indexed width from `NumRackGuns` (== `len(RackGunNames)`).
|
||||
## This test is the guard that would have caught it:
|
||||
##
|
||||
## A. rack table — `NumRackGuns` is 18, 18 DISTINCT names, and the
|
||||
## A. rack table — `NumRackGuns` is 17, 17 DISTINCT names, and the
|
||||
## membership table and the legacy alias target are in range;
|
||||
## B. source shape — `ModularBot.nim` contains NO literal width/loop bound
|
||||
## narrower than `NumRackGuns` for the gun-indexed
|
||||
## accounting, and sizes them with `NumRackGuns`;
|
||||
## C. accounting — an in-process replay of the real shape (`array[NumRackGuns]`
|
||||
## indexed by every admitted id) never goes out of range,
|
||||
## and gun 17 IS accounted;
|
||||
## and the newest id IS accounted, even when the rack
|
||||
## grows by one more gun;
|
||||
## D. live (opt-in) — with a rack that admits ONLY the newest id, the bot
|
||||
## selects it, fires and lands hits (skipped without JARs).
|
||||
##
|
||||
## The ADE+SBC gun (rack id 17) was later RETIRED, so the rack is back to 17 and
|
||||
## the newest id is LEADGAIN (16). The guard is unchanged in shape and in
|
||||
## strength: C3 now proves the fix survives a rack that grows again, which is
|
||||
## the general form of the bug that shipped.
|
||||
##
|
||||
## Run: nim c -r common_libs/tests/test_rack_stat_width.nim
|
||||
## Live: TR_SERVER_JAR=... TR_BATTLE_RUNNER=... nim c -r common_libs/tests/test_rack_stat_width.nim
|
||||
|
||||
@@ -41,7 +47,7 @@ const
|
||||
adversaryDir = repoRoot / "common_libs" / "test_framework" / "adversaries" / "SittingDuck"
|
||||
statsPath = "/tmp/rack_stat_width_stats.jsonl"
|
||||
PatternId = 5
|
||||
NewestId = NumRackGuns - 1 ## 17, the id that regressed
|
||||
NewestId = NumRackGuns - 1 ## 16 (LEADGAIN), the newest rack id
|
||||
LegacyLeadGainId = 16
|
||||
|
||||
var failures = 0
|
||||
@@ -53,7 +59,7 @@ proc check(name: string, ok: bool) =
|
||||
|
||||
proc testRackTable() =
|
||||
check "A1: NumRackGuns is derived from RackGunNames",
|
||||
NumRackGuns == RackGunNames.len and NumRackGuns == 18
|
||||
NumRackGuns == RackGunNames.len and NumRackGuns == 17
|
||||
check "A2: rack membership table has one entry per gun",
|
||||
DefaultRackMembership.len == NumRackGuns
|
||||
var seen = initTable[string, bool]()
|
||||
@@ -156,21 +162,31 @@ proc testAccounting() =
|
||||
if gunRealHits[NewestId] != 50: inRange = false
|
||||
check "C2: accounting stays in range and records the newest gun", inRange
|
||||
|
||||
# The bug in one line: with the OLD `array[17, int]`, `NewestId` is out of
|
||||
# range. Prove the id that regressed is exactly the one that overflowed.
|
||||
check "C3: the regressed id (17) is out of range of the old array[17, int]",
|
||||
NewestId >= 17
|
||||
# The bug in one line, in its GENERAL form: an accounting array hard-wired to
|
||||
# a literal is out of range the moment the rack grows. Prove the fix
|
||||
# (`NumRackGuns`) tracks a rack that grows by one more gun, where the id that
|
||||
# regressed in j141 (17) would be a legal, accounted index.
|
||||
var grown: array[NumRackGuns + 1, int]
|
||||
var grownOk = true
|
||||
for gid in 0 .. NumRackGuns:
|
||||
try:
|
||||
inc grown[gid]
|
||||
except IndexDefect:
|
||||
grownOk = false
|
||||
check "C3: a rack one gun WIDER is still fully covered by the NumRackGuns width",
|
||||
grownOk and grown[NumRackGuns] == 1
|
||||
|
||||
# The legacy namespace: TR_RACK_BITBRAIN with TR_BITBRAIN_NET unset addresses
|
||||
# LEADGAIN (16), and id 17 is NOT admitted.
|
||||
delEnv("TR_BITBRAIN_NET")
|
||||
# The legacy namespace: TR_RACK_BITBRAIN is now unambiguously LEADGAIN's old
|
||||
# name (the ADE+SBC gun that briefly owned it was retired), so it always
|
||||
# admits LEADGAIN (16) — the newest id — and nothing else.
|
||||
for n in RackGunNames: delEnv("TR_RACK_" & n)
|
||||
delEnv("TR_BITBRAIN_NET")
|
||||
putEnv("TR_RACK_BITBRAIN", "both")
|
||||
let legacy = loadRackMembership()
|
||||
check "C4: legacy TR_RACK_BITBRAIN admits LEADGAIN (16)",
|
||||
legacy[LegacyLeadGainId] == rmBoth
|
||||
check "C5: legacy namespace never admits id 17",
|
||||
legacy[NewestId] == rmOff
|
||||
check "C5: legacy TR_RACK_BITBRAIN alone adds LEADGAIN to the shipped Pattern",
|
||||
admittedGuns(NumRackGuns, rm1v1, legacy) == @[PatternId, LegacyLeadGainId]
|
||||
delEnv("TR_RACK_BITBRAIN")
|
||||
|
||||
# ── D. live proof, only with the JARs ────────────────────────────────────────
|
||||
@@ -203,7 +219,7 @@ proc live() =
|
||||
var linesOut: seq[string]
|
||||
for l in readFile(backup).splitLines():
|
||||
if l.strip().startsWith("GUN_STATS_PATH"): linesOut.add "GUN_STATS_PATH=" & statsPath
|
||||
elif l.strip().startsWith("TR_RACK_BITBRAIN"): linesOut.add "TR_RACK_BITBRAIN=both"
|
||||
elif l.strip().startsWith("TR_RACK_BITBRAIN"): linesOut.add "TR_RACK_LEADGAIN=both"
|
||||
else: linesOut.add l
|
||||
writeFile(dotenv, linesOut.join("\n"))
|
||||
echo "NOTE: live section wrote a temporary out/.env (backup at out/.env.j141-backup)."
|
||||
|
||||
Reference in New Issue
Block a user