Skip to content

Commit d272fea

Browse files
committed
docs(codec): record the no-sentinel invariant as a maintainer comment
Two-layer rule sitting above MAX_BASIN_IDX: - encoder scratch state → Option<u16> - wire format / persisted → plain u16, every value real So the next editor doesn't reach for a magic value when what they actually want is type-level optionality.
1 parent 7fdcfb5 commit d272fea

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/hpc/codec/mode.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ use super::ctu::{CellMode, LeafCu, MergeDir};
5959
// Header pack / unpack (16-bit)
6060
// ════════════════════════════════════════════════════════════════════
6161

62+
// ── Design invariant ────────────────────────────────────────────────
63+
//
64+
// The 12-bit basin field addresses exactly one of 4096 real Leaves
65+
// (HHTL ontology, see `src/hpc/ogit_bridge/assets/cognitive/entities/Leaf.ttl`:
66+
// 16 Hips × 16 Twigs × 16 Leaves per Heel, every Leaf carries a real
67+
// `basinSignature`). Do NOT reserve a value as a "no basin" /
68+
// "not yet decided" sentinel.
69+
//
70+
// Rationale: that's authoring-time uncertainty (encoder mid-decision)
71+
// leaking into wire-format ontological state. Keep optionality in the
72+
// type, not in a magic value:
73+
//
74+
// - encoder scratch state → `Option<u16>` (Some = committed, None = TBD)
75+
// - persisted / wire-format → plain `u16`, every value real
76+
//
77+
// The doubt must collapse to Some(basin) before the leaf is packed.
78+
// Once a leaf reaches the wire it has a basin, period.
79+
6280
/// Maximum encodable `basin_idx`. Equal to `(1 << 12) - 1 = 4095`,
6381
/// the full 12-bit range.
6482
///

0 commit comments

Comments
 (0)