Fix USE/RUN dictionary shadowing: remove dead lib.4th aliases

capsules/lib.4th:13-14 defined ": USE ( addr u -- ) EXEC ;" and the
same for RUN, shadowing the C-registered mama_word_use()/RUN primitives
(CLAUDE.md names both, with BIRTH, as untouchable C primitives) with an
unrelated "load/exec a capsule" meaning. This broke the interactive
USE-based VM-redirect (S" Artemis" USE printed "EXEC: failed: Artemis"
instead of redirecting), discovered while chasing FABRIC-3.md's
live-MIGRATE verification.

Traced every real caller before touching anything: RUN's alias was
dead code, never called anywhere as bare RUN. USE's alias had exactly
one real caller -- capsules/hermes/init.4th:397, intentionally
exploiting the shadow to load common:msg.4th right after lib.4th
itself loaded. Both aliases were pure EXEC wrappers with zero added
behavior, so this deletes both definitions outright and switches the
one real call site (plus its matching doc comment in
capsules/common/msg.4th) to call EXEC directly. No new names invented,
the C primitives untouched.

Verified live: Hermes still births and her COMMON-CH-eviction
self-test (depends on common:msg.4th having loaded) still passes;
interactively, S" Artemis" USE now correctly redirects the REPL and
prints "USE: now using Artemis". mkcapsule --lint clean (31/31).
Clean compile and clean boot with Stadium conservation intact
(resident_sum + reservoir == Q48_ONE) on all three architectures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXjAPTEKrgY2Mrk25KoLDn
This commit is contained in:
Robert Allan James
2026-08-26 01:01:26 -04:00
co-authored by Claude Sonnet 5
parent 0f683c15fd
commit af1eb0ca2d
12 changed files with 27184 additions and 62 deletions
+25 -14
View File
@@ -334,20 +334,31 @@ other three become honest, explicit punch-list items instead of being touched sp
to it directly is invented, not pulled; harmless here since Artemis is killed and her whole
economy discarded immediately after, and Hera's own conservation was independently confirmed
back at the normal 43691/21845/65536 baseline afterward.)
- [x] **Bug found and reported, not fixed (2026-08-26): `capsules/lib.4th:13` shadows the C
primitive `USE`.** While chasing the live-MIGRATE test above, `S" Artemis" USE` (meant to
redirect the REPL into Artemis's own vocabulary, `mama_word_use()`) instead printed `EXEC:
failed: Artemis`. Root cause: `capsules/lib.4th:13` defines `: USE ( addr u -- ) EXEC ;` — a
FORTH word with the same name but a completely different meaning ("load/exec a capsule"),
which shadows the C-registered `USE` in dictionary search order since `lib.4th` loads after
primitive registration. `lib.4th:14` does the identical thing to `RUN` (`: RUN ( addr u -- )
EXEC ;`), which CLAUDE.md also names as an untouchable C primitive ("BIRTH, RUN, USE are
primitives — registered in C exactly like DUP, BYE, EXEC"). Same bug class as the K-PUSH
dictionary-shadowing issue (`docs/working/architecture/K-PUSH-DICTIONARY-SHADOWING-BUG-
20260704.md`). Per CLAUDE.md's rule against unrequested fixes, this is reported here, not
patched — `lib.4th`'s `USE`/`RUN` were presumably meant as private helpers for
`doe-campaign.4th`-style capsules and never intended to collide with the REPL primitives of
the same name.
- [x] **Bug found, reported, then fixed on request (2026-08-25/26): `capsules/lib.4th:13-14`
shadowed the C primitives `USE`/`RUN`.** While chasing the live-MIGRATE test above,
`S" Artemis" USE` (meant to redirect the REPL into Artemis's own vocabulary,
`mama_word_use()`) instead printed `EXEC: failed: Artemis`. Root cause: `capsules/lib.4th:13`
defined `: USE ( addr u -- ) EXEC ;` — a FORTH word with the same name but a completely
different meaning ("load/exec a capsule"), which shadowed the C-registered `USE` in
dictionary search order since `lib.4th` loads after primitive registration. `lib.4th:14` did
the identical thing to `RUN`, which CLAUDE.md also names as an untouchable C primitive
("BIRTH, RUN, USE are primitives — registered in C exactly like DUP, BYE, EXEC"). Same bug
class as the K-PUSH dictionary-shadowing issue
(`docs/working/architecture/K-PUSH-DICTIONARY-SHADOWING-BUG-20260704.md`). Reported first
per CLAUDE.md's rule against unrequested fixes; Captain Bob then explicitly asked for the fix.
**Fix:** traced every real caller before touching anything — `RUN`'s alias was dead (never
called anywhere as bare `RUN`); `USE`'s alias had exactly one real caller,
`capsules/hermes/init.4th:397` (`S" common:msg.4th" USE`, intentionally exploiting the shadow
to load that capsule right after `lib.4th` itself loaded). Both aliases were pure
`EXEC` wrappers with zero added behavior, so the fix deleted both definitions from `lib.4th`
outright and changed the one real call site plus its matching doc comment
(`capsules/common/msg.4th:4`) to call `EXEC` directly — no new names invented, the C
primitives untouched, `mkcapsule --lint` clean (31/31 pass). **Verified live:** rebuilt and
booted amd64 — Hermes still births and her `COMMON-CH`-eviction self-test (which depends on
`common:msg.4th` having loaded) still passes exactly as before; interactively, `S" Artemis"
USE` now correctly prints `USE: now using Artemis` and switches the REPL's console-name
coloring, confirming the C primitive runs unshadowed. Clean compile and clean boot with
conservation intact on all three architectures (amd64/aarch64/riscv64).
- [ ] Scope VM-`COOL`: confirm whether `capsule_vm_kill()`/Tripod's existing VM lifecycle has
any real hook point equivalent to `stadium_evict()`, or needs the same kind of admission
work `MIGRATE` needs. **Deferred (2026-08-25)** per the user's own "we're going to have to
+44 -44
View File
@@ -1,5 +1,5 @@
# Capsule Block Manifest — Auto-generated
<!-- Generated by mkcapsule --manifest 2026-08-26T03:26:40Z -->
<!-- Generated by mkcapsule --manifest 2026-08-26T04:59:35Z -->
<!-- DO NOT EDIT — re-run mkcapsule --manifest to refresh. -->
<!-- Hand-written justifications and immutability notes live -->
<!-- in MANIFEST.md alongside this auto-generated index. -->
@@ -10,12 +10,12 @@
|---------|----------------|----------|
| `ACL.4th` | 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4015 | `0xd781d22148ff171d` |
| `artemis:init.4th` | 4110, 4111, 4112, 4113, 4122, 4123, 4124, 4125, 4126, 4127, 4128, 4129, 4130, 4131, 4132, 4133, 4134, 4135, 4136, 4137, 4138, 4139, 4140, 4141, 4160, 4161, 4162, 4163, 4164, 4165, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4177, 4178, 4179, 4180, 4181, 4182, 4851, 4852 | `0x1859f0148048a2c1` |
| `common:msg.4th` | 4055 | `0xa99c5bcd3877f80e` |
| `common:msg.4th` | 4055 | `0x850a0382344ea6c4` |
| `doe-campaign.4th` | 4060, 4061, 4062, 4063, 4064, 4065 | `0x3d4549142d91ec20` |
| `doe.4th` | 2100, 2101, 2102, 2103, 2104, 2105, 2106, 2107 | `0xf154616d248e861f` |
| `fabric.4th` | 4900, 4901, 4902, 4903, 4904, 4905, 4906, 4907, 4908, 4909, 4910, 4911, 4912, 4913, 4914, 4915, 4916, 4917, 4918, 4919, 4920, 4921, 4922, 4923, 4924, 5000, 5001, 5002 | `0x9b1d061339cea98d` |
| `font.4th` | 4925, 4926, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4936, 4937, 4938, 4939, 4940, 4941, 4942, 4943, 4944, 4945, 4946, 4947, 4948, 4949, 4950, 4951, 4952, 4953, 4954, 4955, 4956, 4957, 4958, 4959, 4960, 4961, 4962, 4963, 4964, 4965, 4966, 4967, 4968, 4969, 4970, 4971, 4972, 4973, 4974, 4975, 4976, 4977, 4978, 4979, 4980, 4981, 4982, 4983, 4984, 4985 | `0x720792b4fc758156` |
| `hermes:init.4th` | 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4175, 4176 | `0x85c7b311d1e5bf97` |
| `hermes:init.4th` | 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4142, 4143, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4151, 4152, 4153, 4154, 4155, 4156, 4157, 4158, 4159, 4175, 4176 | `0xfbb1208133abbeef` |
| `init-0.4th` | 2200, 2201 | `0xd0a9550baf786bb3` |
| `init-1.4th` | 4406, 4415, 4425, 4435 | `0x63e251adb0a03613` |
| `init-2.4th` | 4506, 4515, 4525, 4535, 4545 | `0xf113b3d0bcccae47` |
@@ -33,7 +33,7 @@
| `init-l8-transition.4th` | 4840, 4841, 4842 | `0xbcc1a81976f0a4c9` |
| `init-l8-volatile.4th` | 4810, 4811, 4812, 4813 | `0x98caabbbd92abac4` |
| `init.4th` | 2049, 2050, 2057 | `0x214d424abd382707` |
| `lib.4th` | 4050 | `0x20625ebf1276c239` |
| `lib.4th` | 4050 | `0x1c77d7c9562a5b62` |
| `process.4th` | 4300, 4301 | `0x781afc1dbd0294f7` |
| `sdk.4th` | 5109, 5110, 5111, 5112, 5113, 5114, 5115 | `0x008fdbbb62c94a3a` |
| `turtle.4th` | 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108 | `0x4d470418ca543365` |
@@ -106,36 +106,36 @@
| 4016 | `zuse.4th` | `0x12f38ec782434a77` | ok |
| 4017 | `zuse.4th` | `0x12f38ec782434a77` | ok |
| 4018 | `zuse.4th` | `0x12f38ec782434a77` | ok |
| 4050 | `lib.4th` | `0x20625ebf1276c239` | ok |
| 4055 | `common:msg.4th` | `0xa99c5bcd3877f80e` | ok |
| 4050 | `lib.4th` | `0x1c77d7c9562a5b62` | ok |
| 4055 | `common:msg.4th` | `0x850a0382344ea6c4` | ok |
| 4060 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4061 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4062 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4063 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4064 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4065 | `doe-campaign.4th` | `0x3d4549142d91ec20` | ok |
| 4100 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4101 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4102 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4103 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4104 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4105 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4106 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4107 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4108 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4109 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4100 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4101 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4102 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4103 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4104 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4105 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4106 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4107 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4108 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4109 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4110 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4111 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4112 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4113 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4114 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4115 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4116 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4117 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4118 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4119 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4120 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4121 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4114 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4115 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4116 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4117 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4118 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4119 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4120 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4121 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4122 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4123 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4124 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
@@ -156,24 +156,24 @@
| 4139 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4140 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4141 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4142 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4143 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4144 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4145 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4146 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4147 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4148 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4149 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4150 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4151 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4152 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4153 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4154 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4155 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4156 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4157 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4158 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4159 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4142 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4143 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4144 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4145 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4146 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4147 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4148 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4149 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4150 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4151 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4152 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4153 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4154 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4155 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4156 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4157 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4158 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4159 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4160 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4161 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4162 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
@@ -189,8 +189,8 @@
| 4172 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4173 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4174 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4175 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4176 | `hermes:init.4th` | `0x85c7b311d1e5bf97` | ok |
| 4175 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4176 | `hermes:init.4th` | `0xfbb1208133abbeef` | ok |
| 4177 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4178 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
| 4179 | `artemis:init.4th` | `0x1859f0148048a2c1` | ok |
+1 -1
View File
@@ -1,7 +1,7 @@
Block 4055
( common:msg.4th — Hermes participant interface )
( Load into every messaging VM at birth: )
( S" common:msg.4th" USE )
( S" common:msg.4th" EXEC )
: HERMES-ACK ( -- )
LOG-DEBUG" msg: ACK sent"
S" MSG-ACK-LAST" S" Hermes" VM-EXEC ;
+1 -1
View File
@@ -394,7 +394,7 @@ Block 4120
COMMON-INIT
VM-NAMES-INIT
S" lib.4th" EXEC
S" common:msg.4th" USE
S" common:msg.4th" EXEC
LOG-INFO" Hermes: ready" ;
Block 4121
( Hermes v1 — ACK/NACK server )
-2
View File
@@ -10,5 +10,3 @@ Block 4050
: CSV-COL ( n -- ) N. COMMA ;
: CSV-LAST ( n -- ) N. CRLF ;
: Q.SHOW ( q -- ) Q.PRINT CR ;
: USE ( addr u -- ) EXEC ;
: RUN ( addr u -- ) EXEC ;
BIN
View File
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff