Skip to content

Commit 0a56e48

Browse files
authored
Merge pull request #463 from AdaWorldAPI/claude/gallant-rubin-Y9pQd
fix(helix): ndarray is a mandatory git dependency (codex P2 + "ndarray is mandatory")
2 parents 42d502e + 5758926 commit 0a56e48

10 files changed

Lines changed: 71 additions & 77 deletions

File tree

.claude/board/EPIPHANIES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 2026-06-03 — E-HELIX-NDARRAY-MANDATORY — `helix` ndarray wiring: optional `path` → mandatory `git` (codex P2 + "ndarray is mandatory") — an optional path dep is a clean-checkout trap
2+
3+
**Status:** FINDING (codex P2 on #460 + user directive, 2026-06-03; fix verified — 63 unit + 6 doctests green with mandatory ndarray, clippy -D warnings + fmt clean; the git source was patched to the local `master` checkout for the in-sandbox build, github fetch deferred to CI).
4+
5+
**The trap (codex P2):** an *optional* `path` dependency does NOT make the default build self-contained. Cargo reads every dependency manifest (including optional ones) during resolution to build the lockfile, so `ndarray = { path = "../../../ndarray", optional = true }` makes a clean checkout WITHOUT the sibling fail (`failed to read .../ndarray/Cargo.toml`) *before* feature selection. The "default build needs no ndarray checkout" claim was therefore false.
6+
7+
**The fix (two directives converge):** (1) codex wants the wiring clean; (2) the user — "ndarray is mandatory for lance-graph" (it is "The Foundation"). So helix now takes ndarray as a **mandatory, non-optional git dependency**: `ndarray = { git = "https://github.com/AdaWorldAPI/ndarray.git", branch = "master", default-features = false, features = ["std"] }`. A git source resolves the manifest remotely (no sibling-checkout needed); non-optional drops the `ndarray-hpc` feature entirely; `simd.rs` is now single-impl (always `ndarray::simd`, no scalar fallback — ndarray does its own AVX-512/AVX2/scalar dispatch internally).
8+
9+
**Why git, not `[patch]`, and no cycle:** helix is standalone (own `[workspace]`, root `exclude`), so it resolves ndarray independently of the lance-graph workspace's path-based ndarray — no source-unification needed (the workspace's `[patch.crates-io] ndarray` is separately known-ineffective: the fork's 0.17.2 can't semver-satisfy the lance-index crates.io 0.16.1; PR_ARC ~line 2081). The fork is self-contained — only internal subcrate path deps (`crates/p64`, `crates/fractal`, `ndarray-rand`, `crates/ndarray-gen`) which travel with the clone — and has **no back-dependency on lance-graph**, so the git dep introduces **no import cycle**.
10+
11+
Cross-ref: PR_ARC #459 Correction; codex P2 #460; `crates/helix/Cargo.toml`; `jc::weyl` (local-const precedent).
12+
13+
---
14+
115
## 2026-06-03 — E-HELIX-OVERLAP — the `helix` Place/Residue codec is ~80% re-derivation of existing (in places CERTIFIED) primitives; shipped standalone by user directive, overlap documented not hidden
216

317
**Status:** FINDING (placement check via `encoding-ecosystem.md` + repo grep, 2026-06-03; crate shipped on claude/gallant-rubin-Y9pQd — 61 unit + 6 doctests green on the default zero-dep build AND under `--features ndarray-hpc`). User directive: "create crate crates/helix … scoped only to crate, self resolving" → after the overlap was surfaced via `AskUserQuestion`, the user ratified **Standalone helix** (vs compose-existing vs rename).

.claude/board/LATEST_STATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
1111
---
1212

13+
> **2026-06-03 — hardened (follow-up after #460)** (D-HELIX-1 wiring): `crates/helix` now takes **ndarray as a MANDATORY, non-optional git dependency** (`git = AdaWorldAPI/ndarray @ master`), replacing the optional `path` dep + `ndarray-hpc` feature. Why: (1) codex P2 — an optional *path* dep still forces Cargo to read the local sibling manifest at resolution, so a clean checkout failed before feature selection; (2) directive "ndarray is mandatory for lance-graph". `simd.rs` always uses `ndarray::simd` (no scalar fallback); the self-contained fork → no import cycle. 63 unit + 6 doctests green; clippy/fmt clean. See E-HELIX-NDARRAY-MANDATORY.
14+
>
1315
> **2026-06-03 — shipped (autoattended)** (D-HELIX-1): new standalone crate `crates/helix` — the golden-spiral **Place/Residue** codec from the user's `KNOWLEDGE.md`. HHTL = deterministic PLACE; helix = orthogonal RESIDUE. Pipeline: equal-area `√u` hemisphere placement (`HemispherePoint`) → stride-4-over-17 `CurveRuler` coupling → Fisher-Z/arctanh `Similarity` alignment → EULER_GAMMA hand-off → 256-palette `RollingFloor` quantise (occupancy-drift + version stamp) → 3-byte `ResidueEdge` endpoint pair; metric-safe L1 via 256×256 `DistanceLut` (`distance_adaptive`) + non-metric byte-Hamming `distance_heuristic`. `prove()` closes the 2-D discrepancy Open Item (companion to `jc::weyl`). Zero-dep default (`edition 2021`, empty `[workspace]`, root `exclude`); optional `ndarray-hpc` feature routes batch Fisher-Z through `ndarray::simd::simd_ln_f32`. **61 unit + 6 doctests green** on BOTH feature configs; clippy -D warnings + fmt clean. ~80% overlaps existing CERTIFIED primitives by design (clean-room, user-directed) — see `crates/helix/KNOWLEDGE.md` § Overlap & Consolidation + E-HELIX-OVERLAP + TD-HELIX-OVERLAP-1. Branch claude/gallant-rubin-Y9pQd.
1416
>
1517
> **2026-06-01 — shipped (autoattended)** (D-A3): `lance_graph_contract::atoms``I4x32::pack`/`unpack` implemented (the 2 `todo!()`s gone) + new `I4x64` (256-bit / 64 signed-i4 dims, `repr(C, align(16))`, 32 B) + private `sext4`. Two's-complement signed-i4 nibble codec (byte-compatible with `QualiaI4_16D` + the `CausalEdge64` mantissa), sign-agnostic (caller pre-scales). The carrier is a deterministic **CAM address** + sparse-intensity "smell" — NO vector search, no float; the `{instance,reference}` dual is rejected ("64" = 64 poles). Contract lib **562 green** (+9), offline, zero new deps. The bipolar `−introspection..+exploration` pole semantics + asymmetric scaling ride the caller's pre-scale (A4). Plan `.claude/plans/a3-carrier-v1.md`; doctrine `.claude/knowledge/ephemeral-warm-cold-lifecycle.md`.

.claude/board/PR_ARC_INVENTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858

5959
**Confidence (2026-06-03):** working — both feature configs green, clippy/fmt clean; 2 CodeRabbit findings (public-API NaN guard in `lift`, f32 clamp-epsilon no-op in `batch_fisher_z`) fixed pre-merge with boundary tests.
6060

61+
**Correction (2026-06-03, follow-up PR after #460):** the `../../../ndarray` **path** dep + `ndarray-hpc` feature in the Added block above were wrong twice — (1) codex P2: an optional *path* dep still forces Cargo to read the local sibling manifest at resolution, so the "default build needs none of it" claim was false (a clean checkout failed before feature selection); (2) per the directive **"ndarray is mandatory for lance-graph,"** ndarray is not optional. Both fixed: ndarray is now a **mandatory, non-optional git dependency** (`git = AdaWorldAPI/ndarray @ master`, `ndarray-hpc` feature removed). `simd.rs` always uses `ndarray::simd` (no scalar-fallback variant). The fork is self-contained (internal subcrates only, no lance-graph back-dep) → no import cycle. See E-HELIX-NDARRAY-MANDATORY.
62+
6163
---
6264

6365
## #441 odoo-classes-bitmask-render (D-CLS arc) — classes as a SoA-view with presence bitmask

.claude/board/STATUS_BOARD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
## D-HELIX-1 — `crates/helix` golden-spiral Place/Residue codec (zero-dep + optional ndarray-hpc)
1414

15-
**Status:** Shipped (branch `claude/gallant-rubin-Y9pQd`; **61 unit + 6 doctests green** on the default zero-dep build AND under `--features ndarray-hpc`; clippy -D warnings + fmt clean). New standalone crate (empty `[workspace]`, root `exclude`) realising the user's `KNOWLEDGE.md`: `HemispherePoint` (√u equal-area placement) → `CurveRuler` (stride-4-over-17) → `Similarity` (Fisher-Z/arctanh) → `RollingFloor` (256-palette; occupancy-drift + version stamp) → `ResidueEdge` (3-byte endpoint pair) + `DistanceLut` (metric-safe 256×256 L1; `distance_adaptive` vs non-metric `distance_heuristic`) + `prove()` (2-D discrepancy companion to `jc::weyl`). Optional `ndarray-hpc` = batch Fisher-Z via `simd_ln_f32`. ~80% clean-room overlap with CERTIFIED primitives (E-HELIX-OVERLAP / TD-HELIX-OVERLAP-1); consolidation path in `KNOWLEDGE.md`. Process: autoattended — 5 research agents + 4 parallel Sonnet leaf workers + central consolidation. Next (owed): fidelity-vs-ground-truth probe (naive-u8 floor gate ≥0.9980 Pearson, CONJECTURE).
15+
**Status:** Shipped (branch `claude/gallant-rubin-Y9pQd`; **61 unit + 6 doctests green** on the default zero-dep build AND under `--features ndarray-hpc`; clippy -D warnings + fmt clean). New standalone crate (empty `[workspace]`, root `exclude`) realising the user's `KNOWLEDGE.md`: `HemispherePoint` (√u equal-area placement) → `CurveRuler` (stride-4-over-17) → `Similarity` (Fisher-Z/arctanh) → `RollingFloor` (256-palette; occupancy-drift + version stamp) → `ResidueEdge` (3-byte endpoint pair) + `DistanceLut` (metric-safe 256×256 L1; `distance_adaptive` vs non-metric `distance_heuristic`) + `prove()` (2-D discrepancy companion to `jc::weyl`). Optional `ndarray-hpc` = batch Fisher-Z via `simd_ln_f32`. ~80% clean-room overlap with CERTIFIED primitives (E-HELIX-OVERLAP / TD-HELIX-OVERLAP-1); consolidation path in `KNOWLEDGE.md`. Process: autoattended — 5 research agents + 4 parallel Sonnet leaf workers + central consolidation. Next (owed): fidelity-vs-ground-truth probe (naive-u8 floor gate ≥0.9980 Pearson, CONJECTURE). **Update (post-#460):** ndarray is now a MANDATORY non-optional **git** dep (codex P2 + directive "ndarray is mandatory for lance-graph"); `simd.rs` always uses `ndarray::simd`; `ndarray-hpc` feature removed. 63 unit + 6 doctests green; clippy/fmt clean. See E-HELIX-NDARRAY-MANDATORY.
1616

1717
## D-A3 — I4x32/I4x64 signed-i4 CAM codec (carrier `pack`/`unpack` + the 256-bit wide carrier)
1818

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ exclude = [
3939
"crates/learning",
4040
"crates/jc",
4141
"crates/sigker",
42-
# Place/Residue golden-spiral codec — standalone zero-dep (default), optional
43-
# ndarray-hpc accelerator. Verified via `cargo test --manifest-path crates/helix/Cargo.toml`.
42+
# Place/Residue golden-spiral codec — standalone, with a MANDATORY git dep on
43+
# the AdaWorldAPI ndarray fork (the SIMD foundation). Verified via
44+
# `cargo test --manifest-path crates/helix/Cargo.toml`.
4445
"crates/helix",
4546
# Aerial+ ARM-discovery transcode — standalone zero-dep proposer crate,
4647
# verified via `cargo test --manifest-path crates/lance-graph-arm-discovery/Cargo.toml`.

crates/helix/Cargo.toml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,19 @@ license = "Apache-2.0"
66
publish = false
77
description = "Place/Residue encoding: golden-spiral hemisphere placement, Fisher-Z aligned, into L1-metric-safe 256-palette endpoint pairs — the orthogonal RESIDUE companion to the HHTL PLACE"
88

9-
# Standalone codec constitution (matches bgz17 / jc / deepnsm): the default build
10-
# is ZERO production dependencies. The φ-spiral residue is the residue regardless
11-
# of SIMD path — the math is identical with or without hardware acceleration, so
12-
# ndarray is an OPTIONAL accelerator, never a correctness dependency.
9+
# Standalone crate (own [workspace] + root `exclude`) but NOT dependency-free:
10+
# ndarray (the AdaWorldAPI fork = "The Foundation") is a MANDATORY dependency.
11+
# helix's batch hot path (src/simd.rs) runs on `ndarray::simd`, and per the stack
12+
# rule "ndarray is mandatory for lance-graph" it is a hard dep, not an opt-in.
1313
[dependencies]
14-
# Optional ndarray hardware acceleration (AdaWorldAPI fork): batch Fisher-Z via
15-
# simd_ln_f32 and batch endpoint-L1 via U8x64. Feature-gated so the default build
16-
# stays zero-dep and standalone-verifiable via `cargo test --manifest-path`.
17-
# `std` enables `ndarray::simd` (simd_ln_f32 / F32x16 / U8x64); the module is
18-
# gated behind it. Kept minimal (no extra HPC features) to limit build surface.
19-
ndarray = { path = "../../../ndarray", optional = true, default-features = false, features = ["std"] }
20-
21-
[features]
22-
default = []
23-
# Activate the ndarray-accelerated hot path (simd_ln_f32 / U8x64 batch kernels).
24-
# The always-present scalar path is used when this is disabled.
25-
#
26-
# NOTE: this feature resolves `ndarray` to the AdaWorldAPI fork at the sibling
27-
# path `../../../ndarray` (NOT crates.io `ndarray`, which has no `::simd` module).
28-
# It therefore requires that sibling repo to be checked out — the same convention
29-
# `lance-graph` core uses. The default build is zero-dep and needs none of this.
30-
ndarray-hpc = ["dep:ndarray"]
14+
# MANDATORY ndarray (the AdaWorldAPI fork). Sourced by GIT, not a local path: a
15+
# local *path* dep forces Cargo to read the sibling manifest during resolution,
16+
# so a clean checkout without the sibling fails (codex P2 on #460); a git source
17+
# resolves the manifest remotely. `master` is the commit helix was tested against.
18+
# The fork is self-contained (internal subcrates only — no external path dep, no
19+
# back-dependency on lance-graph → no import cycle). `std` enables `ndarray::simd`
20+
# (simd_ln_f32 / F32x16 / U8x64).
21+
ndarray = { git = "https://github.com/AdaWorldAPI/ndarray.git", branch = "master", default-features = false, features = ["std"] }
3122

3223
[dev-dependencies]
3324

crates/helix/KNOWLEDGE.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ How the code realises the spec above. Modules → pipeline stages:
266266
| out | `residue.rs` | `ResidueEncoder::encode → ResidueEdge` | 3-byte endpoint pair `(start_idx, end_idx, floor_version)` |
267267
| distance | `distance.rs` | `DistanceLut::{linear, from_floor}` | 256×256 L1, metric-safe |
268268
| proof | `prove.rs` | `prove() → ProofResult` | the 2-D discrepancy companion (Open Item #1) |
269-
| accel | `simd.rs` | `batch_fisher_z`, `batch_l1_u8` | scalar always; ndarray `simd_ln_f32`/`U8x64` under `--features ndarray-hpc` |
269+
| accel | `simd.rs` | `batch_fisher_z`, `batch_l1_u8` | always ndarray `simd_ln_f32` / `U8x64` (mandatory dep; ndarray does its own AVX-512/AVX2/scalar dispatch) |
270270

271271
**Pipeline decisions (the latitude the spec grants — "code is downstream"):**
272272

@@ -289,7 +289,14 @@ How the code realises the spec above. Modules → pipeline stages:
289289
`const::simd::{GOLDEN_RATIO, EULER_GAMMA, E}`; that path does not exist. The
290290
canonical source is `std::f64::consts` (Rust ≥1.94); ndarray does not wrap
291291
them. `constants.rs` defines local consts (mirroring `std`, like `jc::weyl`'s
292-
`PHI_INV`) to stay zero-dep and toolchain-robust.
292+
`PHI_INV`) to stay toolchain-robust (independent of the mandatory `ndarray` link).
293+
- **ndarray is a MANDATORY git dependency (FINDING — codex P2 #460 + directive
294+
"ndarray is mandatory for lance-graph"):** the `simd.rs` batch path runs on
295+
`ndarray::simd`. ndarray is sourced by `git` (`AdaWorldAPI/ndarray @ master`),
296+
NOT a local path — an optional/local *path* dep forces Cargo to read the sibling
297+
manifest at resolution, failing a clean checkout; a non-optional git dep resolves
298+
remotely and is a hard dep (no feature gate). The fork is self-contained
299+
(internal subcrates only, no lance-graph back-dependency) → no import cycle.
293300

294301
**Metric-safety (enforced):** `ResidueEdge::distance_adaptive` = L1 over the
295302
256×256 LUT — a metric, safe for CAKES/CLAM bounds (regression-tested:
@@ -300,8 +307,9 @@ How the code realises the spec above. Modules → pipeline stages:
300307
# Overlap & Consolidation (placement check, 2026-06-03)
301308

302309
**FINDING (placement check).** ~80% of this pipeline already exists in the
303-
workspace; some of it is certified. helix is a deliberate **zero-dep clean-room
304-
re-derivation** (per the directive "scoped only to crate, self-resolving" and
310+
workspace; some of it is certified. helix is a deliberate **clean-room
311+
re-derivation** — it re-derives the math rather than reusing those primitives (per
312+
the directive "scoped only to crate, self-resolving" and
305313
the curve-ruler "regenerable from template" ethos). The genuinely novel pieces
306314
are the equal-area `√u` hemisphere placement and the PLACE/RESIDUE doctrine.
307315

@@ -315,8 +323,8 @@ are the equal-area `√u` hemisphere placement and the PLACE/RESIDUE doctrine.
315323

316324
**Consolidation path (when helix graduates from clean-room to integrated):**
317325
1. Replace `fisher_z.rs` with a thin re-export of `bgz-tensor::fisher_z::FamilyGamma`
318-
(the CERTIFIED i8 table) behind a feature; keep the scalar `Similarity` as the
319-
zero-dep fallback.
326+
(the CERTIFIED i8 table); keep the scalar `Similarity` as the per-element path
327+
(the batch SIMD path already requires the now-mandatory `ndarray` dep).
320328
2. Route the stride coupling through the established `(i·11)%17` golden-step or
321329
the stride-4 family-zipper rather than a second implementation.
322330
3. Feed `ResidueEdge` endpoints into the existing HIP/TWIG CAKES path

crates/helix/src/constants.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
//! `const::simd::GOLDEN_RATIO` etc. That path does **not** exist — the canonical
1919
//! source is `std::f64::consts::{GOLDEN_RATIO, EULER_GAMMA, E}` (Rust ≥ 1.94) and
2020
//! the `ndarray` fork does not wrap them. helix defines local consts (mirroring
21-
//! `std`, exactly as `jc::weyl` defines its own `PHI_INV`) to stay zero-dep and
22-
//! robust across toolchains that have not yet stabilised those float constants.
21+
//! `std`, exactly as `jc::weyl` defines its own `PHI_INV`) to stay robust across
22+
//! toolchains that have not yet stabilised those float constants — independent of
23+
//! whether `ndarray` is linked.
2324
2425
/// φ — the golden ratio `(1 + √5) / 2`. The PLACES constant.
2526
pub const GOLDEN_RATIO: f64 = 1.618_033_988_749_895;

crates/helix/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@
4747
//! Per the placement check recorded in `KNOWLEDGE.md` § "Overlap & Consolidation",
4848
//! the Fisher-Z/arctanh→int8 quantiser, the golden-spiral azimuth proof, the
4949
//! stride-4 coupling, and the EULER_GAMMA hand-off already exist elsewhere in the
50-
//! workspace (in places certified to ρ ≥ 0.999). helix is a deliberate, zero-dep
51-
//! **clean-room re-derivation** that keeps the whole substrate self-contained and
52-
//! regenerable-from-template; the genuinely new pieces are the equal-area `√u`
53-
//! hemisphere placement and the PLACE/RESIDUE doctrine. See `KNOWLEDGE.md` for the
50+
//! workspace (in places certified to ρ ≥ 0.999). helix is a deliberate
51+
//! **clean-room re-derivation** — it re-derives the math rather than reusing those
52+
//! primitives, keeping the cognitive substrate regenerable-from-template; the
53+
//! genuinely new pieces are the equal-area `√u` hemisphere placement and the
54+
//! PLACE/RESIDUE doctrine. Its one dependency is the **mandatory** `ndarray` fork
55+
//! (the SIMD foundation — see `src/simd.rs`). See `KNOWLEDGE.md` for the
5456
//! consolidation path back to the certified primitives.
5557
5658
#![forbid(unsafe_code)]

0 commit comments

Comments
 (0)