Commit a075e12
committed
fix(codec): delete BASIN_NONE sentinel — restore full 4096-entry HHTL codebook
PR #195's follow-up commit 2423298 resolved the BASIN_NONE/MAX_BASIN_IDX
collision by shrinking MAX_BASIN_IDX to 4094 with BASIN_NONE = 4095 as a
distinct sentinel. The shrink was the wrong fix — the sentinel itself
was the bug.
Reference (the authoritative source the code drifted from):
src/hpc/ogit_bridge/assets/cognitive/entities/Leaf.ttl — the HHTL
ontology defines the codebook as 16 Hips × 16 Twigs × 16 Leaves =
4096 Leaves per Heel, every Leaf carrying a real basinSignature.
No slot is reserved for absence; the ontology forbids "no basin".
What BASIN_NONE actually was: authoring-time epistemic uncertainty
("encoder hasn't decided yet for this cell") smuggled into wire-format
ontological uncertainty ("this cell exists but has no basin"). A
category error — Rust's idiom would have surfaced this as Option<u16>
in the encoder's transient scratch state and a plain u16 on the
persistent record. The sentinel value bypassed that hygiene by hiding
optionality inside a magic u16, invisible to the typechecker.
Confirmation that the sentinel was load-bearing for nothing: full audit
of BASIN_NONE producers across src/ found zero — no LeafCu::skip(...),
no basin_idx: BASIN_NONE anywhere. The only references were the const
definition, a re-export, one regression test that constructed it, and
predict.rs:is_no_basin (a predicate with no callers that emit
BASIN_NONE leaves). Defensive infrastructure for a feature the
ontology forbids and the implementation never used.
Changes:
- mode.rs: MAX_BASIN_IDX = (1 << 12) - 1 = 4095 (full 12-bit range,
4096 real basins). BASIN_NONE deleted. The 2 sentinel-distinctness
regression tests replaced with one test asserting the full range.
Docs reframed around the HHTL ontology + the Option<u16>
scratch-state contract.
- predict.rs: is_no_basin deleted; its only doctest+test deleted.
BASIN_NONE import dropped.
- mod.rs: BASIN_NONE and is_no_basin removed from re-exports.
- pr-x12-codec-cognitive-substrate-mapping.md §4.1/§4.3/§10.1/§12:
framing updated. §4.3 now records the full arc (collision → shrink
→ delete) as design archeology rather than as an open issue.
Validation:
- cargo check --features codec --lib → clean
- cargo clippy --features codec --lib -- -D warnings → clean
- cargo test --features codec --lib hpc::codec → 54 tests pass
- cargo test --features codec --doc hpc::codec → 13 doctests pass
Net diff: -77, +38 lines. Pure subtraction modulo doc reframe.1 parent 4d0ec96 commit a075e12
4 files changed
Lines changed: 38 additions & 77 deletions
File tree
- .claude/knowledge
- src/hpc/codec
Lines changed: 14 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| |||
300 | 307 | | |
301 | 308 | | |
302 | 309 | | |
303 | | - | |
304 | | - | |
305 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
306 | 313 | | |
307 | 314 | | |
308 | 315 | | |
| |||
451 | 458 | | |
452 | 459 | | |
453 | 460 | | |
454 | | - | |
| 461 | + | |
455 | 462 | | |
456 | 463 | | |
457 | 464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
66 | 65 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
78 | 77 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 78 | + | |
92 | 79 | | |
93 | 80 | | |
94 | | - | |
95 | | - | |
96 | 81 | | |
97 | 82 | | |
98 | 83 | | |
| |||
442 | 427 | | |
443 | 428 | | |
444 | 429 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
453 | 436 | | |
454 | 437 | | |
455 | 438 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
465 | 442 | | |
466 | 443 | | |
467 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
293 | 292 | | |
294 | 293 | | |
295 | 294 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | 295 | | |
312 | 296 | | |
313 | 297 | | |
| |||
478 | 462 | | |
479 | 463 | | |
480 | 464 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | 465 | | |
489 | 466 | | |
490 | 467 | | |
| |||
0 commit comments