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
+18 -49
View File
@@ -32,7 +32,6 @@ import movements/wave_surfer
import movements/learned_surfer
import guns/tm_horizon
import guns/lead_gain
import guns/bitbrain_net
import guns/pattern_matcher
import vbullet_draw
import geo_overlay
@@ -66,7 +65,6 @@ type
disabledGuns*: HashSet[int]
tmHorizon*: TmHorizonGun
leadGain*: LeadGainGun
bitbrainNet*: BitbrainNetGun
patternMatcher*: PatternMatcherGun
# ── helpers ──────────────────────────────────────────────────────────────────
@@ -117,8 +115,8 @@ proc sourceOfPresence(name: string): string =
proc legacyNameFor(name: string): string =
## The legacy `TR_BITBRAIN_<X>` alias for a `TR_LEADGAIN_<X>` knob, or "" when
## the knob has no legacy name / the namespace now belongs to the new gun.
if netSwitchOwnsBitbrainName(): return ""
## the knob has no legacy name. This gun is the sole owner of the
## `TR_BITBRAIN_*` prefix (the ADE+SBC gun that briefly shared it was retired).
if not name.startsWith(NewPrefix): return ""
let suffix = name[NewPrefix.len .. ^1]
for s in LegacyKnobEnvNames:
@@ -141,9 +139,6 @@ proc sourceOfLgPresence(name: string): string =
else:
sourceOfPresence(name)
proc sbcModeName(m: SbcMode): string {.inline.} =
(if m == smCounted: "counted" else: "bitset")
proc disabledGunsString(guns: HashSet[int]): string =
if guns.len == 0: return "none"
var ids: seq[int]
@@ -425,40 +420,12 @@ proc printEffectiveValues(ctx: EnvReportContext) =
emit("TR_LEADGAIN_SEED", $lg.seed, sourceOfLg(LG_SEED_ENV))
emit("TR_LEADGAIN_RESET_ON_TARGET", onOff(lg.resetOnTarget),
sourceOfLg(LG_RESET_ON_TARGET_ENV))
# The disambiguation switch + the deprecation line it gates, in the report so
# an owner staring at a `[depr]` line can see exactly why it fired.
emit("TR_BITBRAIN_NET", onOff(netSwitchOwnsBitbrainName()),
sourceOfPresence("TR_BITBRAIN_NET"))
# The deprecation line the legacy alias layer can print, in the report so an
# owner staring at a `[depr]` line can see exactly which knob fired.
let dep = lgDeprecationLine()
if dep.len > 0: emit("legacy TR_BITBRAIN_* aliases honoured", "yes", "legacy")
else: emit("legacy TR_BITBRAIN_* aliases honoured", "no", "default")
# ── the ADE+SBC gun (rack id 17) ─────────────────────────────────────────
# Two switches admit it, both default off: `TR_RACK_BITBRAIN` (rack table) and
# `TR_BITBRAIN_NET` (the gun's own master switch, which is also the switch
# that disowns the legacy `TR_BITBRAIN_*` aliases above).
let bbn = ctx.bitbrainNet
emit("TR_BITBRAIN_NET", onOff(bbn.enabled), sourceOfPresence(BBN_NET_ENV))
emit("TR_BITBRAIN_INPUT", $bbn.inputWidth, sourceOf(BBN_INPUT_ENV))
emit("TR_BITBRAIN_FEATURES", bbn.features, sourceOf(BBN_FEATURES_ENV))
emit("TR_BITBRAIN_NCLASSES", $bbn.nClasses, sourceOf(BBN_CLASSES_ENV))
emit("TR_BITBRAIN_NADES", $bbn.nAde, sourceOf(BBN_NADES_ENV))
emit("TR_BITBRAIN_WIDTHS", bbn.widths.join(","), sourceOf(BBN_WIDTHS_ENV))
emit("TR_BITBRAIN_SPAN", $bbn.maxDeg, sourceOf(BBN_SPAN_ENV))
emit("TR_BITBRAIN_MODE", sbcModeName(bbn.mode), sourceOf(BBN_MODE_ENV))
emit("TR_BITBRAIN_DECAY_EVERY", $bbn.decayEvery, sourceOf(BBN_DECAY_EVERY_ENV))
emit("TR_BITBRAIN_DECAY_SHIFT", $bbn.decayShift, sourceOf(BBN_DECAY_SHIFT_ENV))
emit("TR_BITBRAIN_MINOBS", $bbn.minObs, sourceOf(BBN_MINOBS_ENV))
emit("TR_BITBRAIN_ADAPT_EVERY", $bbn.adaptEvery, sourceOf(BBN_ADAPT_ENV))
emit("TR_BITBRAIN_TARGET", $bbn.targetRate, sourceOf(BBN_TARGET_ENV))
emit("TR_BITBRAIN_NETSEED", $bbn.seed, sourceOf(BBN_SEED_ENV))
emit("TR_BITBRAIN_NETLOG", onOff(bbn.logEnabled),
sourceOfPresence(BBN_LOG_ENV))
emit("bitbrain_net.ram", $bbn.networkBytes, "default") ## 0 until the lazy build
emit("bitbrain_net.admitted", onOff(bbn.gunAdmitted(
ActiveRackMembership[17] != rmOff)),
"default") ## rack table AND TR_BITBRAIN_NET; both default off
# ── Pattern match-shape + radial knobs ────────────────────────────────────
# These are resolved lazily inside `predict` (which has not run at boot), so
# unless something already forced them we report the raw env value and say so.
@@ -514,7 +481,7 @@ proc printModules(ctx: EnvReportContext) =
# mode = enabled in that rack.
for i in 0..<len(RackGunNames):
var src = sourceOf(RackEnvPrefix & RackGunNames[i])
if src == "default" and not netSwitchOwnsBitbrainName():
if src == "default":
for (key, gid) in RackLegacyAlias:
if gid == i and getEnv(key, "").len > 0:
src = if isFromEnvFile(key): "legacy/.env" else: "legacy"
@@ -621,26 +588,28 @@ proc knownEnvNames*(): seq[string] =
TMH_RETRAIN_EVERY_ENV, TMH_EPOCHS_ENV,
LG_MEM_ENV, LG_GAINS_ENV, LG_N_ENV, LG_NADE_ENV, LG_RANGE_ENV, LG_LOG_ENV,
LG_MIN_OBS_ENV, LG_WARMUP_ENV, LG_ADAPT_ENV, LG_CALIB_ENV, LG_DECAY_ENV,
LG_DECAY_FRAC_ENV, LG_SEED_ENV, LG_RESET_ON_TARGET_ENV, LG_NET_SWITCH_ENV,
# LEGACY aliases of the corrector knobs above (honoured while
# LG_NET_SWITCH_ENV is off). Registered so the tree-scan guard does not
# flag the owner's pre-rename .env as unknown.
LG_DECAY_FRAC_ENV, LG_SEED_ENV, LG_RESET_ON_TARGET_ENV,
# LEGACY aliases of the corrector knobs above, honoured UNCONDITIONALLY
# (this gun is the sole owner of the `TR_BITBRAIN_*` prefix). Registered so
# the tree-scan guard does not flag the owner's pre-rename .env as unknown.
"TR_BITBRAIN_GAINS", "TR_BITBRAIN_MEM", "TR_BITBRAIN_MIN_OBS",
"TR_BITBRAIN_DECAY", "TR_BITBRAIN_DECAY_FRAC", "TR_BITBRAIN_LOG",
"TR_BITBRAIN_RESET_ON_TARGET", "TR_BITBRAIN_N", "TR_BITBRAIN_NADE",
"TR_BITBRAIN_RANGE", "TR_BITBRAIN_WARMUP", "TR_BITBRAIN_ADAPT",
"TR_BITBRAIN_CALIB", "TR_BITBRAIN_SEED",
# common_libs/bitbrain (counted-SBC library) reads these inline; job j102
# common_libs/bitbrain (the SBC LIBRARY, which STAYS — `learned_surfer`
# imports bitbrain/sbc) reads these three inline; they are the library's own
# knobs, not the retired ADE+SBC gun's (that gun, rack id 17, was removed).
"TR_BITBRAIN_MODE", "TR_BITBRAIN_DECAY_EVERY", "TR_BITBRAIN_DECAY_SHIFT",
]
# the ADE+SBC gun (rack id 17) owns the rest of the TR_BITBRAIN_* namespace
for n in BitbrainNetEnvNames: result.add n
# rack names are constructed from the prefix + gun table, not spelled out
for g in RackGunNames:
result.add RackEnvPrefix & g
# NOTE: the legacy rack alias `TR_RACK_BITBRAIN` needs no extra entry — it is
# the CURRENT name of rack id 17, so the RackGunNames loop above already
# registers it. See gun_harness/selector's RackLegacyAlias for how it is
# routed to LEADGAIN while LG_NET_SWITCH_ENV is off.
# the legacy rack alias `TR_RACK_BITBRAIN` is no longer in `RackGunNames`
# (it is LEADGAIN's old name), so register it explicitly. See
# gun_harness/selector's RackLegacyAlias.
for (key, _) in RackLegacyAlias:
result.add key
# inline reads with no exported constant (the guard test scans for these)
for n in [
"GUN_SELECTOR_WINDOW", "GUN_SELECTOR_MINOBS", "GUN_SELECTOR_TIE",