j140 fix: a pre-rename .env must not admit the disabled BitBrain net gun
TR_RACK_BITBRAIN=both is what the owner's live .env carries, and with the new ADE+SBC gun registered at id 17 under the SAME rack name that value was also landing on id 17 - so a gun that was not enabled (TR_BITBRAIN_NET unset) was admitted into the rack and its placeholder predictions were pushed into the shared VirtualTracker ring, which shifts every other gun's learning order. While the namespace is LEGACY, loadRackMembership now skips id 17's TR_RACK_BITBRAIN entirely, so that value addresses ONLY the gun it always addressed (LEADGAIN, id 16). ModularBot additionally gates admission on BitbrainNetGun.gunAdmitted(), and test_bitbrain_net pins the truth table: over 6 (rack, switch) settings there is NO configuration that admits the gun while leaving it disabled. Guards: test_env_report 25, test_rack_membership 49 (was 48; the revert one-liner now sets TR_BITBRAIN_NET=1 and one truth-table check was added), test_tm_pattern_registration 20, test_bitbrain 56, test_gun_harness 39, test_tfil_commit_env 30, test_lead_gain_registration 13, test_lead_gain_legacy 24, test_bitbrain_net 44. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,9 @@ proc check(name: string, ok: bool) =
|
||||
|
||||
proc clearEnv() =
|
||||
for n in BitbrainNetEnvNames: delEnv(n)
|
||||
# the master switch is shared with LEADGAIN, so it is NOT in
|
||||
# BitbrainNetEnvNames and must be cleared explicitly here
|
||||
delEnv("TR_BITBRAIN_NET")
|
||||
for n in RackGunNames: delEnv("TR_RACK_" & n)
|
||||
|
||||
proc mkState(t: int, ex, ey, sx, sy, eh: float): WorldState =
|
||||
@@ -80,6 +83,33 @@ proc testRackEnv() =
|
||||
check "env: TR_RACK_BITBRAIN=both + TR_BITBRAIN_NET=1 admits id 17",
|
||||
m[BitbrainNetId] == rmBoth and
|
||||
vBulletAdmitted(BitbrainNetId, rm1v1, m, true)
|
||||
# A pre-rename .env carries TR_RACK_BITBRAIN=both WITHOUT the master switch.
|
||||
# That must not admit the gun: a disabled gun's placeholder predictions would
|
||||
# enter the shared VirtualTracker ring and shift every other gun's learning
|
||||
# order, i.e. it would break the default path.
|
||||
clearEnv()
|
||||
putEnv("TR_RACK_BITBRAIN", "both") # exactly what a pre-rename .env carries
|
||||
let mLegacy = loadRackMembership()
|
||||
check "env: TR_RACK_BITBRAIN with the switch OFF still means LEADGAIN (id 16)",
|
||||
mLegacy[BitbrainNetId] == rmOff and mLegacy[16] == rmBoth
|
||||
# TR_RACK_BITBRAIN and TR_BITBRAIN_NET are gated by the SAME switch, so there
|
||||
# is no env configuration that admits the gun without enabling it. Pin that:
|
||||
# a disabled gun must never reach the shared VirtualTracker ring, because its
|
||||
# placeholder predictions would shift every other gun's learning order.
|
||||
var consistent = true
|
||||
for (rackVal, netVal) in [("both", ""), ("both", "0"), ("both", "1"),
|
||||
("off", "1"), ("1v1", "1"), ("1v1", "")]:
|
||||
clearEnv()
|
||||
putEnv("TR_RACK_BITBRAIN", rackVal)
|
||||
if netVal.len > 0: putEnv(BBN_NET_ENV, netVal)
|
||||
let mm = loadRackMembership()
|
||||
let inRack = mm[BitbrainNetId] != rmOff
|
||||
let admitted = initBitbrainNetGun().gunAdmitted(inRack)
|
||||
if inRack != admitted: consistent = false
|
||||
if admitted and not initBitbrainNetGun().enabled: consistent = false
|
||||
check "env: TR_RACK_BITBRAIN alone can NEVER admit a disabled id 17 (6 settings)",
|
||||
consistent
|
||||
clearEnv()
|
||||
clearEnv()
|
||||
|
||||
# ── the knobs really resolve ─────────────────────────────────────────────────
|
||||
|
||||
@@ -204,9 +204,14 @@ proc testRevertOverrideRestoresFullRack() =
|
||||
## stays `off`). This must reproduce the old full rack without a rebuild.
|
||||
clearRackEnv()
|
||||
putEnv("TR_RACK_PATTERN", "both")
|
||||
# The ADE+SBC gun (id 17) additionally needs TR_BITBRAIN_NET=1; without the
|
||||
# switch TR_RACK_BITBRAIN is the LEGACY name for LEADGAIN (id 16), so the
|
||||
# documented one-liner has to flip the namespace over as well.
|
||||
putEnv("TR_BITBRAIN_NET", "1")
|
||||
for name in RackGunNames:
|
||||
if name != "TMPATTERN": putEnv("TR_RACK_" & name, "both")
|
||||
let m = loadRackMembership()
|
||||
delEnv("TR_BITBRAIN_NET")
|
||||
var full = true
|
||||
for i in 0..<RackGunNames.len:
|
||||
let want = if i == 14: rmOff else: rmBoth
|
||||
@@ -214,6 +219,8 @@ proc testRevertOverrideRestoresFullRack() =
|
||||
check "revert: the documented one-liner restores the all-`both` full rack", full
|
||||
check "revert: 1v1 rack admits every gun again (TMPATTERN excluded)",
|
||||
admittedGuns(18, rm1v1, m) == @[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17]
|
||||
check "revert: the legacy TR_RACK_BITBRAIN alone still selects LEADGAIN only",
|
||||
loadRackMembership()[17] == rmOff
|
||||
clearRackEnv()
|
||||
|
||||
proc testEnvOverrides() =
|
||||
|
||||
Reference in New Issue
Block a user