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
40 changes: 38 additions & 2 deletions .claude/board/ISSUES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
# Issues Log — Open + Resolved (double-entry, append-only)

## ISS-LGJ-BENCH-GATE-PRECEDES-ITS-SUBJECT — the RowStore gate cannot be run as specified

Found while starting the benchmark v3 names as the `RowStore` half's gate.
Two ordering problems, both in the plan rather than in the code:

**1. The gate requires the thing it gates to exist.** v3 says the
`RowStore` half is *"per-access or not at all, gated on a benchmark that
does not yet exist"*. But the benchmark's `after` arm **is** the per-access
probe — there is nothing to measure until it is written. So the honest
sequence is *implement, measure, then keep or discard*, and the plan reads
as though the measurement precedes the implementation. Whether to write an
implementation that may be discarded is an operator call, not a silent one.

**2. §5.5's build-time variant swap forces TWO BUILDS.** §5.5 rules out an
`if (guardEnabled)` branch inside the accessor — correctly, since it is
hoistable and is not the shape either arm ships. The consequence was never
stated: with one Java source tree there is no way to have both arms on one
classpath, so `before` and `after` are **separate builds of `java/`,
benchmarked in separate JMH runs**, and the comparison is across runs
rather than across `@Param` values. Every existing sweep in `bench/`
(A–G) compares arms *within* one run; this one structurally cannot.

Consequences for whoever writes it: the two runs must pin the same JDK,
the same `liblgj_abi.so`, and the same machine state, and the amendment
naming `N` must precede **both**. The pre-registration rule (§5.2) is
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.

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

`Mask.words()` now re-authorises its cached word lane with the substrate
on every use of that cache: one O(1) downcall per whole scan, never per
word. `Engine.epoch`'s javadoc claim ("Java re-checks this before
trusting a cached lane segment") is no longer false for masks.
word. ⊘ **Corrected on #54 (Codex P2):** an earlier version of this line claimed
`Engine.epoch`'s javadoc ("Java re-checks this before trusting a cached
lane segment") "is no longer false for masks". **It is still false.** The
fix routes through `Engine.describeMask`, so `Engine.epoch` retains
exactly zero callers — its only mention in `src/main` is the javadoc that
now explains why it is *not* used. That javadoc has been rewritten to say
so, which is what actually discharges the W3 obligation; the claim above
would have hidden it.

**A measured correction to the v3 plan, found by building it.** v3 §6 said
the probe would be `lgj_resource_info`, which "already reads live". It does
Expand Down
41 changes: 41 additions & 0 deletions .claude/board/PR_ARC_INVENTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,47 @@
> 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 #53 — W1.1: the §5 adversarial read, and the Mask half wired to the substrate (merged 2026-08-28, `3b4bc03` — 5 commits, head `8e2654d`)

- **Added:** the `Mask` half of W1.1 — `Mask.words()` re-authorises its
cached word lane with the substrate on every use of that cache (one
`lgj_mask_describe` per whole scan, never per word), with a two-sided
disable-verified falsifier. Plus the §5 read against its own premises.
- **Building it corrected the plan.** v3 §6 named `lgj_resource_info` as
the probe because it "already reads live". It does — but it resolves the
mask's OWN slot, and **that slot outlives its parent**. Measured: closing
the parent natively left the probe silent, `count()` correctly reported
`PARENT_CLOSED`, and `materializeRows()` **read freed bytes without
crashing**. Two keepers: *an absent segfault is not evidence of safety*
(Codex's #49 P1 hazard, reproduced deliberately), and *handle liveness is
not lane liveness*. `lgj_mask_describe` resolves WITH the parent, so the
fix needed **no new ABI symbol** — v3's ruling survives with its reason
corrected, not its conclusion.
- **§5, six defects** — two verified numerically: a standalone
`delta_ns ≤ 0` auto-pass that **contradicted** the delta table beside it,
and per-arm-only run acceptance that made PASS **unreachable for any
`N ≤ 14 ns`** even for a free probe. Now one verdict function and an
ex-ante `hw_delta < N/2` power precondition.
- **Then committed the defect it had just named** (row 24, found by
CodeRabbit and Codex independently): declared the table the whole verdict
function while leaving three `Ship if` / `both must pass` statements
standing. Struck in place. **Naming a failure mode does not confer
immunity to it** — the sharpest evidence the ledger has for its own
thesis.
- **Two reviewer nitpicks, one of whose remedies would not have worked:**
narrowing the `count()` assertion to "the concrete ABI exception type"
cannot discriminate, because BOTH paths raise `ClosedResourceException`.
The message discriminates, and now does. The other was right in substance
(a cached scan is no longer free) and wrong in arithmetic (it is one
describe per cached scan, not two); both foreclosed by naming the number.
- **Gates:** release `.so` rebuilt first; central runs at 335 then 337
checks, ALL PASSED; disable-run red-then-green at every stage. No new ABI
symbol, no public-signature change. Cursor Bugbot did not run — usage
limit, fifth consecutive PR.
- **Confidence:** high on the `Mask` half (implemented, falsified, measured);
the §5 rule is now internally consistent as far as three passes and two
reviewers can establish, and its numeric `N` remains UNMEASURED.

## PR #51 — plan: CI overlap labels a verdict, it never produces one (merged 2026-08-28, `6530e2f` — 3 commits, head `7acb7fd`)

- **Why it exists:** two findings landed on #49 **~2 minutes AFTER it
Expand Down
32 changes: 25 additions & 7 deletions .claude/plans/epoch-recheck-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,16 @@ could then yield opposite RowStore ship decisions. Ruled:

The straddle row is what the first rule got wrong in both directions
at once; the `0` row is a label and **never** a pass, which is what
the second repair got wrong. `delta_ns ≤ 0` is not a verdict at all
— it is the ordinary case that also earns the label.
the second repair got wrong. `delta_ns ≤ 0` is not a verdict at all,
and — ⊘ correcting this sentence's own first version, which said it
"is the ordinary case that also earns the label" — **it does not
automatically earn the label either.** The label is about
RESOLVABILITY, not about sign: it attaches when the INTERVAL contains
`0`, per the table's own row. At `delta_ns = −20, hw_delta = 5` the
interval is `[−25, −15]`, which passes and contains no `0` — a real,
resolvable speedup, and calling that "below the harness's resolution"
would be exactly backwards. Sign decides nothing here; the interval
decides everything.

**`N > 0` is still required, for a different reason than before.**
Its old justification (making the non-positive auto-pass consistent)
Expand All @@ -478,8 +486,11 @@ could then yield opposite RowStore ship decisions. Ruled:
not block; it is **recorded in the results commit as a flag to
investigate** (a large multiple on a fast accessor is worth knowing
even when the absolute cost is under budget). An UNDERPOWERED delta
is **not** rescued by any ratio: it yields no ship decision, and
"both must pass" is void in that case rather than half-satisfied.
is **not** rescued by any ratio: it yields no ship decision. (An
earlier phrasing here said *"both must pass" is void in that case* —
reworded, because "in that case" implies the struck rule still
applies in the others. It applies in none: there is no conjunction
left to satisfy, only the table.)
- **The delta's uncertainty estimator is FIXED BY THE AMENDMENT, and
the arms are INDEPENDENT.** ⊘ The rule offered *"paired per-iteration
samples where the harness exposes them, else
Expand Down Expand Up @@ -587,9 +598,14 @@ unverified*. No third option.
2.0 is a non-blocking diagnostic flag (⊘ this line read "both must
pass"; struck — the delta table is the sole verdict), each arm's own
99.9% CI
half-width must be under 10% of its own score or the run is void, a
non-positive delta passes and is recorded as *below the harness's
resolution* rather than as free, **the delta interval is the WHOLE verdict
half-width must be under 10% of its own score or the run is void, ⊘ (this
line read "a non-positive delta passes and is recorded as *below the
harness's resolution* rather than as free" — **struck**, the fifth
instance: it sat one clause before "the WHOLE verdict function" and
contradicted it in the same sentence; a non-positive delta is not a
verdict — and does not automatically earn the label either, which
attaches on the INTERVAL containing `0`, never on the sign),
**the delta interval is the WHOLE verdict
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
function** — PASS / FAIL / UNDERPOWERED, with "contains 0" a label and
never a pass, the ratio a non-blocking flag, and run acceptance an
ex-ante `hw_delta < N/2` power precondition (see §5's ⊘ triple
Expand Down Expand Up @@ -630,6 +646,8 @@ unverified*. No third option.
| 17 | Major, closure-term hole | `ISS-LGJ-EPOCH-UNCHECKED` could have closed RESOLVED on the Mask half alone while `RowStore`'s cached path stayed boolean-guarded. Closure is now per-half and conditional. |
| 18 | Minor ×2 | The `u32` generation-wrap qualification restored to both board summaries; the Mask "ships regardless" statement reconciled with Q2. |
| 19 | Major, form without arithmetic | §5 pre-registered the acceptance *form* but not the statistics, so identical data could still yield opposite decisions. Now defined: arms, score-to-ns/call conversion, signed delta and ratio directions, per-arm CI acceptance, and the non-positive case (passes, recorded as *below the harness's resolution*, never as "free"). |
| 26 | Low, on #54 — CodeRabbit | **Seventh instance, written while fixing the sixth.** Row 25's own prose said `delta_ns ≤ 0` "is the ordinary case that ALSO EARNS THE LABEL" — false for a delta whose interval lies entirely below zero. At `delta_ns = −20, hw_delta = 5` the interval `[−25, −15]` passes and contains no `0`, so the table attaches no label; the prose attached one anyway. The label is about **resolvability, not sign**, and calling a measurably-faster probe "below the harness's resolution" inverts its meaning. Corrected at both sites. |
| 25 | P1, on #54 — Codex | **Fifth instance, and the first inside a single sentence.** Row 24 struck the three §5 statements but left the Q3 SUMMARY's "a non-positive delta passes" standing — one clause before "the delta interval is the WHOLE verdict function", contradicting it in the same breath (`delta_ns = −1, hw_delta = 50, N = 10`: PASS from the clause, UNDERPOWERED from the table). Struck. Also on #54: the `ISS-LGJ-EPOCH-UNCHECKED` entry claimed `Engine.epoch`'s javadoc "is no longer false for masks" — **false**, since the fix routes through `Engine.describeMask` and leaves `Engine.epoch` with zero callers. Both corrected; the javadoc itself is now true rather than merely re-described. |
| 24 | Major/P1, on #53 — CodeRabbit and Codex, independently | **Row 23's own fix committed row 23's own defect.** It declared the delta table "the whole verdict function" while leaving three earlier verdict statements standing — "Ship if `delta_ns < N`", "Ship if `ratio < 2.0`", and Q3's "both must pass" — none marked struck. Codex's counterexample: at `delta_ns = 9, hw_delta = 2, N = 10` the earlier rule ships while the table returns UNDERPOWERED. So the fourth instance of the pattern row 23 *named*, produced by the commit that named it. All three are now struck in place (⊘, not deleted): the delta and ratio bullets define QUANTITIES, the table alone returns a verdict. |
| 23 | Adversarial read of §5 against its own premises (this pass, no reviewer) | Six defects, all internal-consistency, none of which a diff review would surface because each rule reads correctly *alone*: (1) the standalone `delta_ns ≤ 0` auto-pass **contradicted** the delta table it was shipped beside — at `delta=−1, hw=50, N=10` one says PASS, the other UNDERPOWERED; (2) per-arm-only run acceptance makes PASS **unreachable for any `N ≤ 14 ns`** at the ceiling it permits, even for a free probe — a gate that cannot return its own PASS; (3) the ratio was still compared on bare point estimates, the very error just fixed for the delta, and could veto a passing delta under "both must pass"; (4) "paired per-iteration samples" is **incoherent with §5.5's build-time variant swap** — separate builds have no pairing; (5) offering two estimators to be chosen at analysis time reopened exactly the freedom Q3 closed; (6) the retained "median of 5" contradicts the defined `avgt`-with-CI score every rule depends on. Fixed: one verdict function, ex-ante power precondition, ratio demoted to a flag, estimator fixed in the amendment, median clause regraded. **The pattern across rows 20/22/23: each repair fixed one verdict path and left a second standing beside it.** |
| 22 | P2, on #51 — subsumes row 20 | Row 20 kept arm-CI overlap as a *label* after removing it as a verdict. Still unsound: overlapping CIs for two means are not a CI for their difference, so the label asserts a noise-floor claim the data does not support AND lets a point-estimate failure read as definitively "too costly" on a run that cannot tell. §5 now computes `hw_delta` on the delta itself and compares the interval to `0` and `N`, with a straddling interval classified **UNDERPOWERED** — neither pass nor fail. Arm-vs-arm comparison no longer appears in the rule. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,21 @@ public static long rowCount(long handle) {
return (long) Layouts.INFO_N_ROWS.get(s.info, 0L);
}

/** Liveness stamp of a resource. Java re-checks this before trusting a cached lane segment. */
/**
* Liveness stamp of a resource, read from {@code LgjResourceInfo}.
*
* <p><strong>Currently unused, and the reason is worth keeping.</strong> This javadoc used to
* claim "Java re-checks this before trusting a cached lane segment"; that was false when
* written (zero callers) and is still false now, because the check that shipped in W1.1 does
* NOT go through here. {@code lgj_resource_info} resolves a resource's OWN registry slot, and
* a mask's slot outlives its parent — measured: closing the parent store natively left this
* probe silent while the mask's bytes were already freed. {@link Mask#words()} therefore
* re-authorises through {@code lgj_mask_describe}, which resolves WITH the parent.
*
* <p>Retained rather than deleted because the {@code RowStore} half of W1.1 is still open and
* a lane's owning resource is exactly what it will need to ask about; if that half ships
* without this, delete it then.
*/
public static long epoch(long handle) {
Scratch s = SCRATCH.get();
Downcalls.resourceInfo(handle, s.info);
Expand Down