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:
2026-09-26 19:20:23 +02:00
parent c9b67530db
commit 5e32ec16df
18 changed files with 279 additions and 1732 deletions
+46 -37
View File
@@ -2,18 +2,17 @@
##
## The owner's live `.env` predates the rename and carries `TR_RACK_BITBRAIN`,
## `TR_BITBRAIN_GAINS`, `TR_BITBRAIN_MEM`, `TR_BITBRAIN_LOG`. Those names used to
## address the corrector that is now called LEADGAIN, and they MUST keep working,
## because the `TR_BITBRAIN_*` prefix now belongs to the new ADE+SBC gun
## (`guns/bitbrain_net.nim`, rack id 17). This test pins the disambiguation:
## address the corrector that is now called LEADGAIN, and they MUST keep working.
##
## * `TR_BITBRAIN_NET` unset/0 -> LEGACY MODE: every `TR_BITBRAIN_<X>` in the
## frozen `LegacyKnobEnvNames` set is an alias for `TR_LEADGAIN_<X>`, and
## `TR_RACK_BITBRAIN` still selects rack id 16.
## * `TR_BITBRAIN_NET=1` -> NEW-NETWORK MODE: the `TR_BITBRAIN_*` names
## belong to the new gun; this gun reads only `TR_LEADGAIN_<X>`.
## The ADE+SBC gun that briefly owned the `TR_BITBRAIN_*` prefix (rack id 17,
## `guns/bitbrain_net.nim`) was RETIRED and removed, so there is nothing left to
## disambiguate: this gun is the SOLE owner of that namespace and
##
## The two name sets are DISJOINT, so the mapping is total and deterministic.
## No Java, no battle, no network build.
## * every `TR_BITBRAIN_<X>` in the frozen `LegacyKnobEnvNames` set is an
## alias for `TR_LEADGAIN_<X>`, unconditionally;
## * `TR_RACK_BITBRAIN` selects rack id 16, unconditionally;
## * a stale `TR_BITBRAIN_NET=1` left in a `.env` is an unrecognised
## variable — the boot report warns about it and nothing reads it.
##
## Run: nim c -r common_libs/tests/test_lead_gain_legacy.nim
@@ -35,7 +34,7 @@ proc clearEnv() =
delEnv(NewPrefix & suffix)
delEnv(LegacyRackEnvName)
delEnv("TR_RACK_" & RackGunNames[LeadGainId])
delEnv(LG_NET_SWITCH_ENV)
delEnv("TR_BITBRAIN_NET")
# ── the alias table itself ───────────────────────────────────────────────────
@@ -61,19 +60,29 @@ proc testAliasTableIsDisjoint() =
# ── the switch ───────────────────────────────────────────────────────────────
proc testSwitch() =
proc testNamespaceIsUnconditional() =
## There is no namespace switch any more. The ADE+SBC gun is gone, so a stale
## `TR_BITBRAIN_NET` left in an old `.env` is inert: it must neither disown
## the legacy knob aliases, nor the legacy rack knob, nor the deprecation line.
clearEnv()
check "switch: unset => legacy mode (new ADE+SBC namespace disowned)",
not netSwitchOn()
putEnv(LG_NET_SWITCH_ENV, "0")
check "switch: 0 => legacy mode", not netSwitchOn()
putEnv(LG_NET_SWITCH_ENV, "1")
check "switch: 1 => new-network mode", netSwitchOn()
putEnv(LG_NET_SWITCH_ENV, "yes")
check "switch: yes => new-network mode", netSwitchOn()
putEnv(LG_NET_SWITCH_ENV, "banana")
check "switch: an unknown value is NOT new-network mode (fails safe)",
not netSwitchOn()
putEnv("TR_BITBRAIN_MEM", "decay")
putEnv("TR_BITBRAIN_LOG", "1")
putEnv(LegacyRackEnvName, "both")
var g = initLeadGainGun()
check "ns: the legacy prefix is unconditional (no switch set at all)",
g.memMode == lgDecay and g.logEnabled
putEnv("TR_BITBRAIN_NET", "1")
var g1 = initLeadGainGun()
check "ns: a stale TR_BITBRAIN_NET=1 does not disown the legacy knob names",
g1.memMode == lgDecay and g1.logEnabled
putEnv("TR_BITBRAIN_NET", "0")
var g2 = initLeadGainGun()
check "ns: a stale TR_BITBRAIN_NET=0 is equally inert", g2.memMode == lgDecay
putEnv("TR_BITBRAIN_NET", "1")
check "ns: a stale TR_BITBRAIN_NET=1 does not disown the legacy rack knob",
loadRackMembership()[LeadGainId] == rmBoth
check "ns: a stale TR_BITBRAIN_NET=1 does not suppress the deprecation line",
lgDeprecationLine().len > 0
clearEnv()
# ── knob aliasing ────────────────────────────────────────────────────────────
@@ -93,13 +102,13 @@ proc testKnobAlias() =
putEnv("TR_LEADGAIN_GAINS", "0.5,0.75")
var g2 = initLeadGainGun()
check "alias: the NEW name wins when both are set", g2.cands == @[0.5, 0.75]
# the switch disowns the whole legacy namespace
putEnv(LG_NET_SWITCH_ENV, "1")
# the legacy namespace is unconditional, even next to a stale NET switch
putEnv("TR_BITBRAIN_NET", "1")
delEnv("TR_LEADGAIN_GAINS")
var g3 = initLeadGainGun()
check "alias: TR_BITBRAIN_NET=1 makes the legacy names inert for this gun",
g3.memMode == lgPerRound and not g3.logEnabled and
g3.cands == @[0.0, 0.25, 0.5, 0.75, 1.0]
check "alias: a stale TR_BITBRAIN_NET=1 does NOT make the legacy names inert",
g3.memMode == lgDecay and g3.logEnabled and
g3.cands == @[0.25, 0.5, 1.0]
# ... and then the NEW names still work
putEnv("TR_LEADGAIN_MEM", "retained")
var g4 = initLeadGainGun()
@@ -116,10 +125,10 @@ proc testRackAlias() =
check "rack: TR_RACK_BITBRAIN=both still selects LEADGAIN (id 16)",
m[LeadGainId] == rmBoth and
vBulletAdmitted(LeadGainId, rm1v1, m, true)
putEnv(LG_NET_SWITCH_ENV, "1")
putEnv("TR_BITBRAIN_NET", "1")
let m2 = loadRackMembership()
check "rack: TR_BITBRAIN_NET=1 hands the name to the new ADE+SBC gun (id 17)",
m2[LeadGainId] == rmOff and m2.len == 18
check "rack: a stale TR_BITBRAIN_NET=1 no longer disowns the name — LEADGAIN (id 16) stays selected",
m2[LeadGainId] == rmBoth and m2.len == NumRackGuns
clearEnv()
putEnv("TR_RACK_LEADGAIN", "both")
putEnv(LegacyRackEnvName, "off")
@@ -140,9 +149,9 @@ proc testDeprecationLine() =
line.startsWith("[depr]") and
line.contains("TR_BITBRAIN_GAINS -> TR_LEADGAIN_GAINS") and
line.contains(NewPrefix)
putEnv(LG_NET_SWITCH_ENV, "1")
check "depr: the line is silent once the switch is flipped",
lgDeprecationLine().len == 0
putEnv("TR_BITBRAIN_NET", "1")
check "depr: the line still fires with a stale TR_BITBRAIN_NET=1 present",
lgDeprecationLine().len > 0
clearEnv()
# ── shipped-default parity ───────────────────────────────────────────────────
@@ -155,15 +164,15 @@ proc testDefaultParity() =
let want = if i == 5: rmBoth else: rmOff
if m[i] != want: onlyPattern = false
check "parity: a clean env still loads the shipped onlyPattern rack", onlyPattern
check "parity: the rack is still 18 guns at id 16 = LEADGAIN",
RackGunNames.len == 18 and RackGunNames[LeadGainId] == "LEADGAIN"
check "parity: the rack is still 17 guns at id 16 = LEADGAIN",
RackGunNames.len == 17 and RackGunNames[LeadGainId] == "LEADGAIN"
var g = initLeadGainGun()
check "parity: a clean env resolves the shipped candidate set",
g.cands == @[0.0, 0.25, 0.5, 0.75, 1.0] and g.memMode == lgPerRound
clearEnv()
testAliasTableIsDisjoint()
testSwitch()
testNamespaceIsUnconditional()
testKnobAlias()
testRackAlias()
testDeprecationLine()