From a32cb177d89ea96bddc6b6213c8256dd61be32fb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 11 Jun 2026 03:11:15 +0000 Subject: [PATCH 1/2] =?UTF-8?q?test(helix):=20PROBE-MANTISSA-FILL=20+=20PR?= =?UTF-8?q?OBE-PHASE-1=20=E2=80=94=20Wave-0=20probes,=204/4=20green?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two probes from OGAR/docs/INTEGRATION-TEST-PLAN.md Wave 0, run against SHIPPED code only (zero non-test changes): PROBE-MANTISSA-FILL (gate for the volumetric/field-edge proposal): does the shipped golden-mantissa generator (HemispherePoint::lift, azimuth n*phi, equal-area r=sqrt(u)) place k implicit centroids over a 256x256 tile more uniformly than seeded uniform-random on the same disk support? Metric: occupied in-disk bins (16x16) + max bin count; golden must beat ALL THREE independent baseline seeds on BOTH metrics at BOTH k=256 and k=1024 — no cherry-picking. RESULT — GREEN: k=256: golden occupied=192 max_bin=3 vs random 141-150 / 5-6 k=1024: golden occupied=208 max_bin=7 vs random 205-206 / 11 plus: zero empty interior bins (bin-center radius <= 0.9) at k=1024. PROBE-PHASE-1 (Wave-0 row 1; D-QUANTGATE integer phase walk): RESULT — GREEN: CurveRuler regeneration bit-exact across independent constructions (20 (path,depth) pairs incl. u64::MAX); the stride-4-over-17 arc is a full permutation from every one of the 17 start offsets. Kill-conditions were declared before running (per the probe-first plan): a red MANTISSA-FILL would have demoted the golden-placement leg to an explicit centroid grid. It is green; the leg is measured. Board hygiene: EPIPHANIES E-PROBE-MANTISSA-1 prepended in this commit (numbers + the three remaining gates before VolumetricField leaves [H]). https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY --- .claude/board/EPIPHANIES.md | 60 +++++++ crates/helix/tests/probe_mantissa_fill.rs | 205 ++++++++++++++++++++++ 2 files changed, 265 insertions(+) create mode 100644 crates/helix/tests/probe_mantissa_fill.rs diff --git a/.claude/board/EPIPHANIES.md b/.claude/board/EPIPHANIES.md index 67895390..8a4b6487 100644 --- a/.claude/board/EPIPHANIES.md +++ b/.claude/board/EPIPHANIES.md @@ -1,3 +1,63 @@ +## 2026-06-10 — E-PROBE-MANTISSA-1 — golden-mantissa centroid placement measured: beats uniform-random on coverage AND pile-up; PHASE-1 bit-exactness green + +**Status:** FINDING (probes run first-hand: `crates/helix/tests/probe_mantissa_fill.rs`, 4/4 green) +**Confidence:** High — three independent baseline seeds, golden wins all, both metrics, both sample counts. + +Wave-0 receipts (per `OGAR/docs/INTEGRATION-TEST-PLAN.md` §1; the +volumetric-field-edge proposal's first gate): + +- **PROBE-MANTISSA-FILL GREEN.** Shipped `HemispherePoint::lift` (azimuth + `n·φ`, equal-area `r=√u`) placing k implicit centroids over a 256×256 + tile (16×16 in-disk bins) vs seeded uniform-random on the same disk + support: k=256 → golden occupied **192** vs random 141–150, max-bin + **3** vs 5–6 (≈half the pile-up); k=1024 → occupied **208** vs 205–206, + max-bin **7** vs **11**; zero empty interior bins (r ≤ 0.9) at k=1024. + The "golden mantissa places implicit centroids pairwise-uniformly" leg + of the volumetric/field-edge proposal is now measured, not asserted. +- **PROBE-PHASE-1 GREEN.** `CurveRuler` regeneration is bit-exact across + independent constructions (20 (path,depth) pairs incl. `u64::MAX`), and + the stride-4-over-17 arc is a full permutation from every one of the 17 + offsets — the D-QUANTGATE-mandated integer phase walk holds. + +Remaining gates before the VolumetricField edge-layout leaves `[H]`: +PROBE-ATTN-EDGE (LUT weight ↔ edge-strength ρ vs Pflug anchors), +PROBE-SPLAT-PSD (EWA Σ composition), PROBE-CASCADE-SPARSITY (HHTL +skip-ratio ≥90% on the volumetric workload). Canon pin: `OGAR/CLAUDE.md` +schema-driven block (PR #51). + +## 2026-06-09 — E-MINT-TRACE-1 — the live mint is already global (registry.rs:476); the "namespace-local" doc is stale; dedup is net-new; the bijection IS the dedup + +**Status:** FINDING (traced, ratified: `entity_type` = global shared template id) +**Confidence:** High (read the mint, not the doc comment) + +**Trace before change paid twice.** (1) `namespace.rs:12` documents `entity_type_id` as "dense **within the namespace**" — but the actual mint is `registry.rs:476 entity_type_id = (rows.len()+1)`: **global append-order across all namespaces**. The doc comment is stale; the GLOBAL semantics DECISION-2/3 want are already the live behavior. (2) It corrected this session's own claim, minutes old: the registry is **not** template-deduped — every append mints a fresh id (`enumerate_first_with_entity_type_id` is defensive, not reuse evidence). Frugal dedup + the `entity_type↔NiblePath` pairing are net-new. + +**Blast radius traced benign:** ~16 `entity_type_id()` readers store-as-column-value or compare; none dense-index an array BY entity_type. Global/sparse ids break nothing. Dedup consequence: per-id row lookup becomes namespace-ambiguous ⇒ resolve by `(namespace, entity_type)`. + +**The synthesis that shrinks Phase B:** the bijection IS the dedup. One pair table `NiblePath ↔ entity_type` in the registry: path present ⇒ reuse the template id (new row, new namespace); absent ⇒ mint fresh (monotone, never reused) + record the pair. The pair table is simultaneously the template registry, the dedup index, and the bijection witness the round-trip test proves. Moves 1+2 of the Phase B seam are one mechanism. + +**Process lesson (generalizes):** doc comments describe intent at write-time; the mint line is the contract. For any "is this id local or global / dense or sparse" question, read the assignment site and grep for dense-indexing consumers before believing prose. + +**Cross-ref:** identity-architecture plan DECISION-3 + Phase B grounded seam (CORRECTION block); E-OGAR-NORTHSTAR-1 (Status updated); I-LEGACY-API-FEATURE-GATED (the positional `contract/ontology.rs:85` helper is the v1 path to gate). + +## 2026-06-09 — E-ANCESTRY-TRINITY-1 — NiblePath::is_ancestor_of is ONE bit-shift read three ways: subClassOf = supervision-edge = north-star template specialization + +**Status:** FINDING (cross-session convergence — OGAR/SurrealDB session + identity-contract session, independently) +**Confidence:** High + +**The convergence.** A parallel CCA2A session (OGAR / nexgen op-surreal-ast / SurrealDB RecordId) pulled #480 and independently re-derived the OGAR↔lance-graph membrane as **"the registry mint of `(entity_type, NiblePath)` per class"** — exactly DECISION-2 (OGAR mirror) committed from this side in #481. Two sessions, opposite directions, same membrane. + +**The new synthesis it surfaces:** `NiblePath::is_ancestor_of` (a single HHTL bit-shift on the GUID routing prefix) is simultaneously THREE relations: +- **OWL `subClassOf`** (ontology inheritance) — OGAR-AST-CONTRACT §1. +- **OTP supervision edge** (ractor parent-routing / delegation through `OrchestrationBridge`) — the other session's "supervisor-edge is now [G] mechanical" finding. +- **North-star template specialization** (a domain class descends from its shared template) — E-OGAR-NORTHSTAR-1. + +They are the SAME relation: the north-star template hierarchy IS the routing/supervision hierarchy IS the subClass hierarchy — one bit-shift, three names. Consequence: reusing a template (inherit + switch namespace), being-supervised-by, and being-a-subclass-of are the same arithmetic; there is no separate routing structure to maintain. + +**Coordination:** the OGAR session is on #480 (Phase A); #481 carries the OGAR-side answer it needs — OGAR = OGIT mirror, immutable ClassIds, north-star spine, `namespace`=domain. Its proposed `D-IDENT` paired-note + `D-IDENTITY-PIN` should absorb the `namespace`=domain + north-star framing on next pull. + +**Cross-ref:** E-OGAR-NORTHSTAR-1; E-IDENTITY-WHITEBOX-1; identity-architecture DECISION-2 + north-star guard; `hhtl.rs::is_ancestor_of`. + ## 2026-06-09 — E-OGAR-NORTHSTAR-1 — ontology cache = OGAR mirror with a reusable north-star template spine (namespace specializes, entity_type is shared) **Status:** DECISION (OGAR mirror RATIFIED via decision-gate; north-star template model RATIFIED 2026-06-09 "frugal it is"; `entity_type` = GLOBAL shared template id RATIFIED via decision-gate) diff --git a/crates/helix/tests/probe_mantissa_fill.rs b/crates/helix/tests/probe_mantissa_fill.rs new file mode 100644 index 00000000..b336ac8d --- /dev/null +++ b/crates/helix/tests/probe_mantissa_fill.rs @@ -0,0 +1,205 @@ +//! PROBE-MANTISSA-FILL + PROBE-PHASE-1 — Wave-0 probes against shipped code. +//! +//! Per `OGAR/docs/INTEGRATION-TEST-PLAN.md` §1 (the probe-first rule: no +//! integration brick lands before its probe is green) and the +//! volumetric-field-edge proposal (implicit centroids placed by the golden +//! mantissa, pairwise-weighted by the 256×256 attention LUT, splat-ranked). +//! +//! ## PROBE-MANTISSA-FILL +//! +//! Question: does the shipped golden-mantissa generator +//! ([`HemispherePoint::lift`] — azimuth `n·φ`, equal-area `r = √u`) place k +//! implicit centroids over a 256×256 tile MORE uniformly than seeded +//! uniform-random placement on the same support (the unit disk)? +//! +//! Metric (discrepancy proxy, 16×16 binning over the tile, in-disk bins only): +//! - `occupied`: distinct in-disk bins hit (higher = better coverage) +//! - `max_bin`: worst-case pile-up (lower = better spread) +//! +//! PASS: at k ∈ {256, 1024}, golden beats EVERY one of three independently +//! seeded uniform-random baselines on BOTH metrics (no cherry-picked seed). +//! +//! KILL (per the proposal's kill-condition): golden loses → the "golden +//! mantissa places implicit centroids" leg falls back to an explicit grid. +//! +//! ## PROBE-PHASE-1 (regeneration determinism) +//! +//! Question: is the deterministic-phase generator bit-exact — same address ⟹ +//! same sequence, across independent constructions? ([`CurveRuler`] is the +//! D-QUANTGATE-mandated coprime-integer walk; a float recurrence could drift, +//! an integer walk must not.) +//! +//! PASS: two independent `CurveRuler`s from the same `(path, depth)` produce +//! identical full arcs; the arc is a full permutation of 0..17; and the +//! permutation property holds for every one of the 17 possible offsets. + +use helix::{CurveRuler, HemispherePoint}; + +const TILE: usize = 256; +const BINS: usize = 16; // 16×16 bins over the 256×256 tile +const BIN_W: usize = TILE / BINS; + +/// xorshift64 — the workspace's zero-dep seeded RNG test pattern. +struct XorShift64(u64); +impl XorShift64 { + fn next(&mut self) -> u64 { + let mut x = self.0; + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + self.0 = x; + x + } + /// Uniform f64 in [0, 1). + fn unit(&mut self) -> f64 { + (self.next() >> 11) as f64 / (1u64 << 53) as f64 + } +} + +/// Map a unit-disk point (x, z ∈ [-1, 1]) to a tile bin index, or None if the +/// pixel falls outside the 256×256 tile after scaling. +fn disk_to_bin(x: f64, z: f64) -> Option { + let ux = (x + 1.0) / 2.0; + let uz = (z + 1.0) / 2.0; + if !(0.0..1.0).contains(&ux) || !(0.0..1.0).contains(&uz) { + return None; + } + let px = (ux * TILE as f64) as usize; + let pz = (uz * TILE as f64) as usize; + Some((pz / BIN_W) * BINS + (px / BIN_W)) +} + +/// Whether a bin's center lies inside the unit disk (both generators share +/// the disk as support; corner bins are unreachable for both, so the metric +/// only counts bins both COULD hit). +fn bin_in_disk(bin: usize) -> bool { + let bx = (bin % BINS) as f64; + let bz = (bin / BINS) as f64; + let cx = (bx + 0.5) / BINS as f64 * 2.0 - 1.0; + let cz = (bz + 0.5) / BINS as f64 * 2.0 - 1.0; + cx * cx + cz * cz <= 1.0 +} + +/// (occupied in-disk bins, max single-bin count) for a set of disk points. +fn fill_metrics(points: impl Iterator) -> (usize, usize) { + let mut counts = [0usize; BINS * BINS]; + for (x, z) in points { + if let Some(b) = disk_to_bin(x, z) { + counts[b] += 1; + } + } + let occupied = (0..BINS * BINS) + .filter(|&b| bin_in_disk(b) && counts[b] > 0) + .count(); + let max_bin = counts.iter().copied().max().unwrap_or(0); + (occupied, max_bin) +} + +fn golden_points(k: usize) -> Vec<(f64, f64)> { + (0..k) + .map(|n| { + let p = HemispherePoint::lift(n, k); + let (x, z, _y) = p.cartesian(); + (x, z) + }) + .collect() +} + +fn random_disk_points(k: usize, seed: u64) -> Vec<(f64, f64)> { + // Rejection-sample uniform points in the unit disk (same support as the + // golden generator) so the comparison is geometry-fair. + let mut rng = XorShift64(seed); + let mut out = Vec::with_capacity(k); + while out.len() < k { + let x = rng.unit() * 2.0 - 1.0; + let z = rng.unit() * 2.0 - 1.0; + if x * x + z * z < 1.0 { + out.push((x, z)); + } + } + out +} + +#[test] +fn probe_mantissa_fill_golden_beats_uniform_random() { + // Three independent baseline seeds — golden must beat ALL of them on + // BOTH metrics at BOTH sample counts; no cherry-picking. + const SEEDS: [u64; 3] = [0x9E37_79B9_7F4A_7C15, 0xD1B5_4A32_D192_ED03, 0x2545_F491_4F6C_DD1D]; + + for &k in &[256usize, 1024] { + let (g_occ, g_max) = fill_metrics(golden_points(k).into_iter()); + for &seed in &SEEDS { + let (r_occ, r_max) = fill_metrics(random_disk_points(k, seed).into_iter()); + assert!( + g_occ >= r_occ, + "k={k} seed={seed:#x}: golden occupied {g_occ} < random {r_occ} — \ + MANTISSA-FILL RED: golden mantissa does not out-cover uniform random" + ); + assert!( + g_max <= r_max, + "k={k} seed={seed:#x}: golden max-bin {g_max} > random {r_max} — \ + MANTISSA-FILL RED: golden mantissa piles up worse than uniform random" + ); + } + // Print the receipt numbers so the probe run is quotable. + println!("MANTISSA-FILL k={k}: golden occupied={g_occ} max_bin={g_max}"); + for &seed in &SEEDS { + let (r_occ, r_max) = fill_metrics(random_disk_points(k, seed).into_iter()); + println!(" random seed={seed:#x}: occupied={r_occ} max_bin={r_max}"); + } + } +} + +#[test] +fn probe_mantissa_fill_no_empty_inner_region_at_1024() { + // Stronger coverage claim at k=1024: every in-disk bin whose center is + // comfortably interior (radius ≤ 0.9) must be occupied by golden points. + let mut counts = [0usize; BINS * BINS]; + for (x, z) in golden_points(1024) { + if let Some(b) = disk_to_bin(x, z) { + counts[b] += 1; + } + } + for b in 0..BINS * BINS { + let bx = (b % BINS) as f64; + let bz = (b / BINS) as f64; + let cx = (bx + 0.5) / BINS as f64 * 2.0 - 1.0; + let cz = (bz + 0.5) / BINS as f64 * 2.0 - 1.0; + if cx * cx + cz * cz <= 0.81 { + assert!( + counts[b] > 0, + "interior bin {b} (center {cx:.2},{cz:.2}) EMPTY at k=1024 — \ + golden mantissa leaves interior holes" + ); + } + } +} + +#[test] +fn probe_phase1_curve_ruler_regeneration_is_bit_exact() { + // Same address ⟹ same sequence, across independent constructions. + for path in [0u64, 1, 0x1234, u64::MAX, 0xDEAD_BEEF_CAFE_F00D] { + for depth in [0u8, 1, 7, 16] { + let a = CurveRuler::from_hhtl(path, depth); + let b = CurveRuler::from_hhtl(path, depth); + assert_eq!(a.arc(), b.arc(), "regeneration drift at ({path:#x},{depth})"); + } + } +} + +#[test] +fn probe_phase1_full_permutation_for_every_offset() { + // The stride-4-over-17 arc must be a full permutation of 0..17 from every + // possible start offset (coprimality must hold everywhere, not just at 0). + for place in 0u64..17 { + let ruler = CurveRuler::from_place(place); + let arc = ruler.arc(); + let mut seen = [false; 17]; + for &v in &arc { + assert!(v < 17, "residue {v} out of range"); + assert!(!seen[v as usize], "residue {v} repeated at place {place}"); + seen[v as usize] = true; + } + assert!(seen.iter().all(|&s| s), "incomplete permutation at place {place}"); + } +} From 4ca547ecb851f139937ec84d956a438dbbcddf51 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 12 Jun 2026 19:49:55 +0000 Subject: [PATCH 2/2] test(helix): MANTISSA-FILL gate strict (Codex P2 on #485) Codex caught the wording-vs-code mismatch: PR body + EPIPHANIES say golden 'beats' every seed, but the asserts used >=/<= so a tie would pass while being reported as a win. Tightening to strict > and < matches the prose. The measured numbers (k=256: 192 vs 141-150, 3 vs 5-6; k=1024: 208 vs 205-206, 7 vs 11) strictly satisfy the strict form, so the receipt is unchanged. A future regression that merely ties would now correctly RED the probe. Inline comment cites the Codex review + EPIPHANIES for the audit trail. https://claude.ai/code/session_01PBTGaPCSnnt6u3pjXpbLwY --- crates/helix/tests/probe_mantissa_fill.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/helix/tests/probe_mantissa_fill.rs b/crates/helix/tests/probe_mantissa_fill.rs index b336ac8d..abfaf9cb 100644 --- a/crates/helix/tests/probe_mantissa_fill.rs +++ b/crates/helix/tests/probe_mantissa_fill.rs @@ -130,15 +130,22 @@ fn probe_mantissa_fill_golden_beats_uniform_random() { let (g_occ, g_max) = fill_metrics(golden_points(k).into_iter()); for &seed in &SEEDS { let (r_occ, r_max) = fill_metrics(random_disk_points(k, seed).into_iter()); + // STRICT inequalities — Codex P2 on #485 caught the wording mismatch: + // the doc says golden BEATS every seed, but `>=`/`<=` silently + // admit ties; a future regression that merely ties would still + // pass under the loose form and be reported as a win. Strict + // gate matches the prose. (The measured numbers strictly + // satisfy this form, so tightening loses no data — see receipts + // in EPIPHANIES E-PROBE-MANTISSA-1.) assert!( - g_occ >= r_occ, - "k={k} seed={seed:#x}: golden occupied {g_occ} < random {r_occ} — \ - MANTISSA-FILL RED: golden mantissa does not out-cover uniform random" + g_occ > r_occ, + "k={k} seed={seed:#x}: golden occupied {g_occ} did not STRICTLY beat random {r_occ} — \ + MANTISSA-FILL RED: golden mantissa does not strictly out-cover uniform random" ); assert!( - g_max <= r_max, - "k={k} seed={seed:#x}: golden max-bin {g_max} > random {r_max} — \ - MANTISSA-FILL RED: golden mantissa piles up worse than uniform random" + g_max < r_max, + "k={k} seed={seed:#x}: golden max-bin {g_max} did not STRICTLY beat random {r_max} — \ + MANTISSA-FILL RED: golden mantissa does not strictly out-spread uniform random" ); } // Print the receipt numbers so the probe run is quotable.