Skip to content

Commit 7fdcfb5

Browse files
committed
docs(codec): tighten basin-index wording to the HHTL ontology statement
Drops the forensic call-outs and walks the docs back to the positive design statement: the codebook is 16 × 16 × 16 = 4096 Leaves per Heel (per Leaf.ttl), MAX_BASIN_IDX = 4095 addresses the full range. No narrative arc; no archeology subsection.
1 parent a075e12 commit 7fdcfb5

2 files changed

Lines changed: 12 additions & 27 deletions

File tree

.claude/knowledge/pr-x12-codec-cognitive-substrate-mapping.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,6 @@ The SCC team had to cap palette at 64 entries rebuilt per-CTU because that was t
145145

146146
**Holy grail claim H-1**: PR-X12 + cam_pq gives you the screen-content video codec HEVC SCC was trying to be in 2013 — without retrofitting, just by composing existing modules. Cite this when somebody asks "why is the basin field 12 bits and not 8 like HEVC SCC".
147147

148-
### 4.3 BASIN_NONE — the sentinel that shouldn't have existed
149-
150-
Arc summary (for archeology):
151-
152-
- **Original state** (PR #195 first push): `BASIN_NONE = MAX_BASIN_IDX = 4095` — same value used both as "max valid basin" and "no basin assigned" sentinel. Ambiguous on the wire. CodeRabbit flagged.
153-
- **First fix** (PR #195 follow-up commit `24232985`): shrunk `MAX_BASIN_IDX` to 4094, kept `BASIN_NONE = 4095` distinct. Resolved the ambiguity but sacrificed one codebook entry and propagated the sentinel into the wire format.
154-
- **Reference check**: the HHTL ontology (`Leaf.ttl`) requires 4096 real Leaves per Heel, every Leaf a real basin. The sentinel itself was the wrong design, not just its value.
155-
- **Final fix**: `BASIN_NONE` and `is_no_basin` deleted entirely; `MAX_BASIN_IDX` restored to `(1 << 12) - 1 = 4095`. Authoring-time "not yet decided" uncertainty stays as an `Option<u16>` in encoder scratch state and is resolved before any leaf reaches the wire. The wire format only ever sees committed basins.
156-
157-
**The deeper read**: `BASIN_NONE` was authoring-time epistemic uncertainty (encoder mid-decision) smuggled into wire-format ontological uncertainty (cell exists but has no basin) — a category error. Rust's idiom would have surfaced this as `Option<u16>` in the encoder's transient state and `u16` on the persistent record. The sentinel value bypassed that hygiene by hiding optionality inside a magic `u16` value. The cleanup restores the two-types-for-two-lifecycles separation.
158-
159148
---
160149

161150
## 5. Transform basis — DCT-II ↔ optimizer preconditioner ↔ wavelet ↔ learned
@@ -307,11 +296,10 @@ The mappings above are dense but specific. The holy grail claims are general and
307296
- ✅ Escape allocator collision (P1) → `Option<&mut u32>` cursor
308297
- ✅ NESW/NEWS doc mismatch (P1) → explicit slot table
309298

310-
**Resolved across PR #195 + follow-up**:
311-
-`pack_leaf` `unwrap_or` fallbacks (PR #195 commit `24232985`) → switched to `?` operator (bijective serialisation; 3 regression tests added)
312-
-`BASIN_NONE` sentinel removed entirely (follow-up to PR #195): `MAX_BASIN_IDX = 4095` restores full 4096-entry HHTL codebook; authoring-time uncertainty lives in encoder `Option<u16>` scratch, not the wire format. See §4.3 for the arc.
299+
**Resolved in PR #195 follow-up (commit `24232985`)**:
300+
-`pack_leaf` `unwrap_or` fallbacks → switched to `?` operator (bijective serialisation; 3 regression tests added)
313301

314-
Both originally listed in §12 below; entries updated.
302+
Originally listed in §12 below; entry updated.
315303

316304
### 10.2 PR-X12 A4 — transform
317305

@@ -458,7 +446,6 @@ Both originally listed in §12 below; entries updated.
458446
- None currently.
459447

460448
**Severity P1** (fix before next-sub-card):
461-
- ~~*T-1*: `BASIN_NONE == MAX_BASIN_IDX` collision.~~ **RESOLVED** via two-step landing: PR #195 commit `24232985` shrunk `MAX_BASIN_IDX` to 4094 with `BASIN_NONE = 4095` as a distinct sentinel; the follow-up cleanup deleted `BASIN_NONE` and `is_no_basin` entirely and restored `MAX_BASIN_IDX = 4095`. Reference: the HHTL ontology (`Leaf.ttl`) defines 4096 real Leaves per Heel — no slot reserved for absence. See §4.3.
462449
- ~~*T-2*: `pack_leaf` `unwrap_or` fallbacks (`mode.rs:194-210`).~~ **RESOLVED** via PR #195 commit `24232985`: switched to `?` operator; 3 regression tests added (`leaf_pack_rejects_malformed_{merge,delta,escape}_without_*`).
463450

464451
**Severity P2** (fix in follow-up):

src/hpc/codec/mode.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,13 @@ use super::ctu::{CellMode, LeafCu, MergeDir};
6060
// ════════════════════════════════════════════════════════════════════
6161

6262
/// Maximum encodable `basin_idx`. Equal to `(1 << 12) - 1 = 4095`,
63-
/// the full 12-bit range. Every value `0..=MAX_BASIN_IDX` addresses a
64-
/// real basin in the per-Heel codebook — there is no reserved sentinel.
63+
/// the full 12-bit range.
6564
///
66-
/// The HHTL ontology (`Heel > Hip > Twig > Leaf`, see the entity TTLs
67-
/// under `src/hpc/ogit_bridge/assets/cognitive/entities/`) defines the
68-
/// codebook as `16 Hips × 16 Twigs × 16 Leaves = 4096 Leaves per Heel`,
69-
/// every Leaf carrying a real `basinSignature`. Absence is not a state:
70-
/// authoring-time "not yet decided" lives in the encoder's `Option<u16>`
71-
/// scratch state, never on the wire.
65+
/// The codebook follows the HHTL ontology (`Heel > Hip > Twig > Leaf`,
66+
/// see the entity TTLs under `src/hpc/ogit_bridge/assets/cognitive/entities/`):
67+
/// `16 Hips × 16 Twigs × 16 Leaves = 4096 Leaves per Heel`. Every value
68+
/// `0..=MAX_BASIN_IDX` addresses one Leaf, each carrying a real
69+
/// `basinSignature`.
7270
///
7371
/// ```
7472
/// use ndarray::hpc::codec::MAX_BASIN_IDX;
@@ -428,9 +426,9 @@ mod tests {
428426

429427
#[test]
430428
fn max_basin_idx_fills_full_12bit_range() {
431-
// The codec follows the HHTL ontology: 16 × 16 × 16 = 4096 Leaves
432-
// per Heel, every value `0..=MAX_BASIN_IDX` is a real basin. No
433-
// sentinel slot is reserved.
429+
// 16 Hips × 16 Twigs × 16 Leaves = 4096 Leaves per Heel
430+
// (HHTL ontology, see Leaf.ttl). Every value 0..=MAX_BASIN_IDX
431+
// addresses one Leaf.
434432
assert_eq!(MAX_BASIN_IDX, (1 << 12) - 1);
435433
assert_eq!(MAX_BASIN_IDX, 4095);
436434
}

0 commit comments

Comments
 (0)