Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .claude/board/ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ unchanged but now has two commits to order against, not one.
**Not blocking the `Mask` half**, which shipped in #53 without needing any
of this — it was never cost-gated.

**2026-09-03 — consequence 2 is now mechanised, consequence 1 is answered.** `bench/gate-run.sh` performs the two builds itself: the production tree as shipped, and the production tree with ONE file (`LaneProbe.java`, a package-private no-op seam `RowStore.lane()` calls) swapped for `bench/variants/probed/LaneProbe.java`. Same JDK, same `.so`, same machine, one script — the pinning this entry asked for is the script's own structure. The "implement, measure, then keep or discard" question is answered without a discardable implementation: the probe exists only as the bench variant until a PASS moves it into `java/src/main`, one file copy. `gate.py` refuses a run without the amendment sha, so the pre-registration ordering this entry names is enforced by the tool, not remembered. **Still open:** the amendment naming `N`. Nothing here runs the gate; nothing here decides.

## ISS-LGJ-EPOCH-UNCHECKED — RESOLVED for the `Mask` half (W1.1)

`Mask.words()` now re-authorises its cached word lane with the substrate
Expand Down
14 changes: 14 additions & 0 deletions .claude/board/PR_ARC_INVENTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@
> anti-pattern the imported board rules name. Backfilled below in one
> pass rather than left stale; PR #4 onward gets its entry at merge time.

## PR #64 — the §5 gate instrument: production accessor in two builds, verdict table as a tool (opened 2026-09-03, head `55b7648`)

**Added.** `D-LGJ-MMV-1a-bench`. A package-private no-op seam `LaneProbe` in `RowStore.lane()`; its probed twin under `bench/variants/probed/` (re-describe + epoch/length compare, the `Mask.words()` shape); `bench/gate-run.sh` compiling `java/` twice with that one file swapped and running `I_ProductionAccessorGate` (the PRODUCTION `classidAt`, Blackhole, `@Fork(5)`, 65,536 rows) against each; `bench/gate.py`, the §5 verdict table with a self-test pinning the plan's own struck cases, refusing `N ≤ 0`, sub-5×8-sample CSVs, and a missing amendment sha. `Harness` gains `-Dlgj.bench.result` and `LGJ_BENCH_QUICK`.

**Locked.** Both arms are the production accessor as the JIT sees it; no flag, no branch (§5.5). Quick runs are structurally not evidence. A verdict without a preceding amendment sha is not producible by the tool.

**Deferred.** The gate run itself and any `RowStore` behaviour change: blocked on the `N` amendment, an operator budget. The shipped seam is a no-op, so `ISS-LGJ-EPOCH-UNCHECKED` stays OPEN for `RowStore`.

**Docs.** `bench/README.md` § "The §5 gate"; `STATUS_BOARD` `-bench` → In PR, `-rowstore` blocker narrowed; `ISSUES.md` append on `BENCH-GATE-PRECEDES-ITS-SUBJECT`; #63 merge sha recorded.

**Confidence.** High that the instrument measures what §5 asks (the smoke delta ≈ +30 ns reproduces H's bare-crossing cost through the real accessor). None claimed for any verdict — none was produced.

## PR #63 — G11 built: the fence the doctrine named and nothing enforced (opened 2026-09-03, head `5a25b60`)

**Merged 2026-09-03 as `f1c8aef`** (recorded post-merge, per the rule; final head `5983e4b`, three commits).

- **Opened because a gate existed only as a sentence.** `CLAUDE.md` § Enforcement,
`Cargo.toml`, and `class_view_provider.rs:73` all cite "the G11 contract-import
fence" as structural enforcement. No test existed. Found while surveying the
Expand Down
4 changes: 2 additions & 2 deletions .claude/board/STATUS_BOARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ the membrane / Valhalla cheap addresses / everything else underneath).
| D-LGJ-MMV-0 | Mechanical fences: materialization-list gate, §E worker-topology fence (+ reflective arm 2b), SIMD-branch fence — each proven able to fire | Shipped (PR #48, merged `42fba54`) |
| D-LGJ-MMV-1a | Resolve `ISS-LGJ-EPOCH-UNCHECKED`. **5+3 council COMPLETE** — ratified at `.claude/plans/epoch-recheck-v3.md`: ship (a) as a native generation-checked liveness probe (NOT "epoch checking" — the compare is unreachable), arm (ii) scoped contract, six obligations W1-W6, C1's rewritten falsifier, no new ABI symbol on the production path (the one the wave admits is test-only) | **Mask half DONE 2026-08-28** (#53) — `Mask.words()` re-authorises its cached word lane on every use via `lgj_mask_describe` (`resolve_mask_with_parent`, O(1) per whole scan, never per word), disable-run red-then-green. **RowStore half OPEN** — see the row below. Per v3 W4 the issue closes as RESOLVED only when BOTH halves ship, so `ISS-LGJ-EPOCH-UNCHECKED` stays OPEN, scoped to `RowStore`; `ISS-LGJ-CACHED-DESCRIPTOR-CROSS-THREAD-WINDOW` is the W4-paired second entry (opened late, on #55) |
| D-LGJ-MMV-1a-mask | The `Mask` half — probe at `words()`, one downcall per whole scan, falsifiable at negligible cost. **Ships regardless of measurement** | Queued |
| D-LGJ-MMV-1a-rowstore | The `RowStore` half — probe per-access inside `lane()`; forced by falsifiability, not chosen on cost (a first-resolve probe is blind to the only scenario it could catch). Does not ship if per-access proves too costly | **Still Queued; the §5 gate was ATTEMPTED on #55 and the run is VOID.** Bench Component H measured a bare `lgj_lane_describe` crossing at **+35.5 ns** over a cached read (CI [34.54, 36.53], 5 forks x 8 iters, rows=65536) — indicative only, on two independent grounds: no `N` was pre-registered (v3 §5.2), and both arms call `Engine.describeLane` directly rather than `RowStore.classidAt`, so they bypass the cached `lanes[]` lookup, `requireOpen`, the `FacetId` null-check and bounds (v3 §5.4: the accessor is an inlining barrier and *that total* is what gates). A first attempt to read a won't-fix verdict off it was withdrawn. **A valid gate needs all three, in order:** an amendment naming `N > 0` committed first; before/after variants of the PRODUCTION accessor in two builds of `java/` (the two-build requirement stands, unamended); a results commit citing that amendment's sha |
| D-LGJ-MMV-1a-rowstore | The `RowStore` half — probe per-access inside `lane()`; forced by falsifiability, not chosen on cost (a first-resolve probe is blind to the only scenario it could catch). Does not ship if per-access proves too costly | **Still Queued; the §5 gate was ATTEMPTED on #55 and the run is VOID.** Bench Component H measured a bare `lgj_lane_describe` crossing at **+35.5 ns** over a cached read (CI [34.54, 36.53], 5 forks x 8 iters, rows=65536) — indicative only, on two independent grounds: no `N` was pre-registered (v3 §5.2), and both arms call `Engine.describeLane` directly rather than `RowStore.classidAt`, so they bypass the cached `lanes[]` lookup, `requireOpen`, the `FacetId` null-check and bounds (v3 §5.4: the accessor is an inlining barrier and *that total* is what gates). A first attempt to read a won't-fix verdict off it was withdrawn. **A valid gate needs all three, in order:** an amendment naming `N > 0` committed first; before/after variants of the PRODUCTION accessor in two builds of `java/` (the two-build requirement stands, unamended); a results commit citing that amendment's sha. **2026-09-03: the second and the tooling for the third exist** (`D-LGJ-MMV-1a-bench`); the sole remaining blocker is the first — the `N` amendment, an operator budget, not a measurement |
| D-LGJ-MMV-1a-hook | Test-only ABI export: invalidate a registry slot (bump generation) while deliberately leaking the `Arc`, so the allocation stays mapped — without it W5's disable arm performs a read-after-free and cannot report failure deterministically (Codex P1, PR #49). Full ABI citizen: minor bump, manifest + `abi.md`, lazy holder, `requireMinor`, `OldAbiCompatTest` leg. The ONLY new symbol this wave admits | Queued |
| D-LGJ-MMV-1a-bench | Isolated per-accessor JMH benchmark (build-time variant swap, Blackhole, ≥5 forks) — does not exist today; §5's gate is undecidable without it | Queued |
| D-LGJ-MMV-1a-bench | Isolated per-accessor JMH benchmark (build-time variant swap, Blackhole, ≥5 forks) — does not exist today; §5's gate is undecidable without it | **In PR (2026-09-03)** — `bench/gate-run.sh` (two builds of `java/`, one file swapped: the `LaneProbe` seam) + `I_ProductionAccessorGate` (the PRODUCTION `classidAt`, Blackhole, `@Fork(5)`, 65,536 rows) + `bench/gate.py` (the §5 verdict table, self-tested on the plan's own struck cases; refuses `N ≤ 0`, quick runs, and a missing amendment sha). Smoke-verified the swap takes (≈11 → ≈41 ns/call, quick mode, NOT evidence). The gate itself has NOT run: no amendment names `N` |
| D-LGJ-MMV-1b | Minors 2-4 lazy `Downcalls` holders; `OldAbiCompatTest` minor-1 leg; doctrine "fails cleanly at the call" wording restored by storno | Queued |
| D-LGJ-MMV-2a | Fused single-plane columnar pass — the lab arm's ~10× claim verified through the real ABI, equivalence before timing | Queued |
| D-LGJ-MMV-2b | Register-sweep family (§14-16) answers facet-major; −18 refusal re-pinned two-sided, kept reachable | Queued |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Cargo.lock.bak
/java/out/
/java/target/
/bench/out/
# gate-run.sh's two API builds (before/after) + its bench build. Its results/gate-*.csv are
# NOT ignored: a real gate run is banked deliberately, by the results commit §5 requires.
/bench/out-gate/
/bench/lib/*.jar
/valhalla-lab/out/
# run.sh's own compiled output (results/*-api, results/*-lab class trees) — the
Expand Down
38 changes: 38 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,44 @@ cd native/lgj-abi && CARGO_TARGET_DIR=$(cd ../.. && pwd)/target cargo build --re
Output: `results/jmh-run.txt` (full log, including every warm-up iteration) and
`results/jmh-results.csv` (machine-readable).

## The §5 gate — two builds, one verdict function

The `RowStore` half of W1.1 (`.claude/plans/epoch-recheck-v3.md` §5) is gated on a per-accessor
cost measurement that Component H could not supply: H times a bare `lgj_lane_describe` crossing,
not the production accessor (Codex P1 on #55). Component I is the instrument that does, and it is
deliberately split from `run.sh` because it cannot share one classpath between its arms:

```sh
cd bench && ./gate-run.sh # builds java/ TWICE, runs Component I against each
cd bench && ./gate.py --selftest # the §5 verdict table, pinned on the plan's own cases
cd bench && ./gate.py --n <N> --amendment <sha> results/gate-before.csv results/gate-after.csv
```

- **The seam.** `java/src/main/java/.../LaneProbe.java` is a package-private no-op that
`RowStore.lane()` calls on every cached read. `bench/variants/probed/LaneProbe.java` is the same
class with the per-access liveness probe (re-describe + epoch/length compare, the `Mask.words()`
shape from #53). `gate-run.sh` compiles the production tree once as shipped and once with that
single file swapped — §5.5's build-time variant swap, and the two-build consequence
`ISS-LGJ-BENCH-GATE-PRECEDES-ITS-SUBJECT` names, taken literally. There is no flag and no branch
in either arm; both are `RowStore.classidAt` as the JIT sees it.
- **The instrument.** `I_ProductionAccessorGate` has one `@Benchmark`, `store.classidAt(row, f)`,
Blackhole-consumed, `@Fork(5)`, §5's 65,536-row fixture, `CALLS_PER_OP = 1`. It emits one CSV
and decides nothing.
- **The verdict.** `gate.py` is the §5 table and only the §5 table: `delta_ns = after − before`,
`hw_delta = sqrt(hw_a² + hw_b²)`, ex-ante power `hw_delta < N/2`, then PASS / FAIL /
UNDERPOWERED from the delta interval against `N`; the "below resolution" label when the interval
contains 0; the 2× ratio recorded as a flag that blocks nothing. `--selftest` pins the plan's
own worked examples, including the three verdict rules §5 struck. It refuses `N ≤ 0`, refuses a
CSV with fewer than 5 × 8 samples (so `LGJ_BENCH_QUICK=1` smoke runs can never be mistaken for
evidence), and requires the sha of the amendment that recorded `N` — a run whose `N` was chosen
after the numbers is not pre-registered and this tool will not bless it.

**What has NOT happened:** the gate has not been run as evidence. No amendment names `N`, and §5.2
says that commit must precede both runs. A quick-mode smoke run on 2026-09-03 (1 fork, 2
iterations — refused by `gate.py` by design) showed the swap takes: before ≈ 11 ns/call, after ≈
41 ns/call, consistent with H's +35.5 ns bare crossing. That is a plumbing check, not a
measurement, and it is not banked.

## The components, and why each is isolated

| | class | question it answers alone |
Expand Down
54 changes: 54 additions & 0 deletions bench/gate-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# The §5 gate runner: build java/ TWICE (shipped LaneProbe vs the probed variant), run Component I
# against each, and leave two CSVs for gate.py. This script measures; it never decides.
#
# ./gate-run.sh # full: 5 forks x 8 iterations per arm (~2-3 min)
# LGJ_BENCH_QUICK=1 ./gate-run.sh # smoke: 1 fork — gate.py REFUSES the result, on purpose
#
# Outputs: results/gate-before.csv, results/gate-after.csv, results/gate-run.txt
set -euo pipefail

BENCH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$BENCH/.." && pwd)"
JDK="${JDK:-/opt/jdks/jdk-26.0.2}"
LIB_DIR="${LIB_DIR:-$ROOT/target/release}"
OUT="$BENCH/out-gate"
CP_LIBS="$(find "$BENCH/lib" -name '*.jar' | sort | tr '\n' ':')"
API="$ROOT/java/src/main/java"
PROBE="$API/com/adaworldapi/lancegraph/LaneProbe.java"
VARIANT="$BENCH/variants/probed/LaneProbe.java"

[ -f "$LIB_DIR/liblgj_abi.so" ] || { echo "FAIL: no $LIB_DIR/liblgj_abi.so" >&2; exit 1; }
[ -n "$CP_LIBS" ] || { echo "FAIL: no jars in $BENCH/lib" >&2; exit 1; }
[ -f "$PROBE" ] && [ -f "$VARIANT" ] || { echo "FAIL: LaneProbe seam files missing" >&2; exit 1; }
# The variant must differ from the shipped file, or the two builds are one build.
cmp -s "$PROBE" "$VARIANT" && { echo "FAIL: variant is identical to the shipped LaneProbe" >&2; exit 1; }

rm -rf "$OUT"; mkdir -p "$OUT/before" "$OUT/after" "$OUT/bench" "$BENCH/results"

echo "== build BEFORE: java/src/main as shipped"
"$JDK/bin/javac" -d "$OUT/before" $(find "$API" -name '*.java')

echo "== build AFTER: same tree, LaneProbe.java swapped for bench/variants/probed"
"$JDK/bin/javac" -d "$OUT/after" $(find "$API" -name '*.java' ! -path "$PROBE") "$VARIANT"

# One compiled bench, run against each API build (the bench class is identical by construction).
echo "== build the bench once"
"$JDK/bin/javac" -proc:full --add-modules jdk.incubator.vector \
-cp "$CP_LIBS$OUT/before" -d "$OUT/bench" $(find "$BENCH/src" -name '*.java')

run_arm() {
local arm="$1"
echo "== run $arm"
( cd "$BENCH" && JAVA_TOOL_OPTIONS= "$JDK/bin/java" \
--enable-native-access=ALL-UNNAMED --add-modules jdk.incubator.vector \
-Dstdout.encoding=UTF-8 -Dlgj.library="$LIB_DIR/liblgj_abi.so" \
-Dlgj.bench.result="results/gate-$arm.csv" \
-cp "$CP_LIBS$OUT/$arm:$OUT/bench" \
com.adaworldapi.lancegraph.bench.Harness I_ProductionAccessorGate )
}
{ run_arm before; run_arm after; } 2>&1 | tee "$BENCH/results/gate-run.txt"

echo
echo "arms written: results/gate-before.csv results/gate-after.csv"
echo "verdict: ./gate.py --n <N_ns> --amendment <sha> results/gate-before.csv results/gate-after.csv"
Loading