# Depth instrument v2 — same-frame depth, cross-frame refused

**Lesson embodied.** A grade is measured on **one frame**, or it is not
measured at all. The v1 instrument's famous "0.937 → 0.934" compared a
v5 frame against a v6 frame; the same-frame truth was 0.9791 → 0.9341
— the grade was ~15× stronger than its own receipt claimed. So v2
makes the discipline *behaviour*, not prose: a session is created from
one base frame, every row registers against that frame's pixel
sha256, and registering a row graded from any other frame **throws**
`CROSS-FRAME BASELINE REFUSED`. Second half of the lesson:
predict-then-measure. The instrument integrates the grade's own
formula per-pixel over the frame's actual distance distribution
(float) *before* it measures the real grade, and prints the residual —
its own error term — per metric. A claim that arrives without a
prediction row is a build without a receipt.

## Provenance

- Instrument, spec, tolerances, synthetic control:
  `~/workspace/dimentra-review/renderer-gallery/board-newbark/depth-instrument-v2.cjs`
- Correction of record: `board-newbark/RECEIPT-depth-v2.md`;
  full record `board-newbark/measurements-depth-v2.json`.
- Grade shapes carried from `board-newbark/depth-law-grade.cjs`
  (multiplier + blend forms); the `hsv` readout from
  `board-newbark/finish.cjs`. The canonical renderer was not used and
  not touched.

## What was carried in

The statistics (`computeStats`: distance bands near/mid/far, primary
channels value-range ratio / value separation / interior
texture-contrast ratio, corroborating saturation ratio, legacy
screen-third ratio, hue projection toward the hour's airlight), the
float predictor + measured grade (`gradeFloatPixels` /
`gradeMeasuredPixels`, arms linear / exp / exp2 / exp2-blend incl. the
v8 dose + texture-sparing blend path), `createSession` / `sessionRow`
/ `runArm` / `predictOnly`, and the synthetic control — all ported to
a single self-contained file (Node builtins only). Not carried:
the `law` / `founder` arms (they read the fields module's
`distanceLaw`, outside this distillation's sources; no filed v2 number
uses them) and the board re-baseline runner (board-bound, below).

## How to run

```text
node example.cjs   # control run + one same-frame arm + the refusal, live
node check.cjs     # PASS <n> FAIL <m>; also exports runCheck()
```

## Worked example

`example.cjs` runs the control (25/25 per graded arm, 77/77 total),
then one same-frame `exp` arm read in full — predicted saturation
ratio 0.9099 vs measured 0.909, residual −0.0009, beside the v1
band-mean approximation of the same quantity (0.84, residual 0.069:
the coupling v2 removes) — then registers a row from a one-byte-
mutated copy and prints the refusal.

## Fixture

`example/control-filed.json` — minimized extraction (2026-11-07) from
`measurements-depth-v2.json`: the filed control's pass flag, per-arm
check counts (25/25/25 + 1 + 1), its tolerances, and its base-frame
hash. The board tables are deliberately not carried (see below).

## Filed numbers — reproduced vs cited, exactly

**Reproduced by `check.cjs` (run here, from the rebuilt instrument):**

- Synthetic control **77/77**: linear 25/25, exp 25/25, exp2-blend
  25/25 against the independent analytic ground truth, + identity arm
  (no grade ⇒ ratios exactly 1, separation 0, hue projection 0) +
  discipline row — the filed result in RECEIPT-depth-v2.md §2 and
  `measurements-depth-v2.json`.
- The rebuilt step-field frame's base hash equals the filed control
  baseHash (`941b09193c55…`) — the control here runs on the identical
  frame the source instrument ran on, not a lookalike.
- The refusal itself: same-hash registration accepted, mutated-hash
  registration throws, asserted directly outside the control.

**Cited, NOT reproduced (board-bound):**

- The corrected board table (RECEIPT-depth-v2.md §3): same-frame
  legacy saturation 0.9791 → 0.9341 (linear, day) etc., the primary-
  channel table on the v6 / merged-v7 bases, and the v8 exp2-blend
  pre-registration (§4). Reproducing those needs the board builders,
  the renderer harness and the finish LUT — a different program's
  territory (the board / rendition lanes), and re-deriving them here
  from copied code would be exactly the forked-instrument failure the
  house tooling law exists to prevent. They are cited from the receipt;
  this program's claim stops at the control that gates them.

## Consumers

Board depth claims, emblem-sheet grading, GameM8c frame grading —
any lane that wants to say a grade *did* something: open a session on
one frame, predict, measure, file the residual.

## Honest limits

- The control's frame is synthetic by design (flat bands, five known
  colours): it proves the instrument measures what its formulas say,
  on ground truth known analytically. It says nothing about any real
  scene — that is what the (cited) board re-baseline is for.
- Tolerances are the source's, including the re-derived interior-ratio
  0.035 — its derivation (checker arithmetic + the failed first run at
  0.02, residual −0.0237) is in the source header and receipt §5 F1;
  the tolerance was not loosened here.
- On board frames the source runs the `linear` arm through
  `depth-grade.cjs` verbatim; this distillation carries no board
  frames and uses the arm-library path throughout (the v7 lane proved
  that path delta-0 against `depth-grade.cjs`; noted in the code).
