parity probes: materializer + extract_json (caught + fixed real bug)
Two new cross-runtime parity probes joining the validator probe from
the gauntlet wave. Pattern: feed identical input through Rust and Go;
diff outputs. Each probe surfaced a different signal.
## Materializer parity probe
scripts/cutover/parity/materializer_parity.sh runs Bun + Go
materializer against an identical synthetic data/_kb/ root, diffs the
resulting evidence/ JSONL byte-equivalent (modulo provenance.recorded_at).
**First run: 0/2 match.** Real finding: Go's Provenance.LineOffset
had `json:"line_offset,omitempty"` which strips the field when value
is 0. Line offset 0 is the FIRST ROW of every source file — a real
semantic value, not absent. Bun side always emits it.
Fix: drop `omitempty` on Provenance.LineOffset. Updated comment
explaining why.
**Re-run: 2/2 match.** On-wire JSON parity holds.
## extract_json parity probe
scripts/cutover/parity/extract_json_parity.sh feeds 12 fixture
strings through both runtimes' extract_json:
- fenced ```json``` blocks
- unfenced ``` blocks
- bare braces with prose around
- first-balanced-of-many
- nested objects
- unicode in string values
- escaped quotes
- empty object
- top-level array (both return first inner object)
- no JSON
- depth-balanced but invalid syntax
- trailing garbage
Substrate gate: cargo test -p gateway extract_json PASS before probe.
**Result: 12/12 match.** Algorithms genuinely equivalent.
## scripts/cutover/parity/extract_json_helper/main.go
Tiny Go binary that reads stdin, calls validator.ExtractJSON, prints
{matched, value} JSON. Counterpart to the Rust parity_extract_json
binary in golangLAKEHOUSE's sibling lakehouse repo (separate commit).
## Pattern crystallized
Every cross-runtime port should land with a parity probe. Three
probes now exist:
- validator (5/6 wire-format gap captured 2026-05-02)
- materializer (caught + fixed real bug 2026-05-02)
- extract_json (12/12 match 2026-05-02)
The instrument is reusable — each new shared HTTP/CLI surface gets
a probe row added.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# extract_json parity probe — Rust vs Go
|
||||
|
||||
**Date:** 2026-05-02T09:42:37Z
|
||||
**Rust helper:** `/home/profit/lakehouse/target/release/parity_extract_json` (links live `gateway::v1::iterate::extract_json`)
|
||||
**Go helper:** `./bin/parity_extract_json_go` (links live `internal/validator.ExtractJSON`)
|
||||
|
||||
Identical model-output strings → both runtimes' `extract_json`.
|
||||
Match = identical `{matched, value}` JSON output.
|
||||
|
||||
**Substrate gate:** `cargo test -p gateway extract_json` PASS before probe.
|
||||
|
||||
**Tally:** 12 match · 0 diff (out of 12 fixtures)
|
||||
|
||||
_No divergences — extract_json parity holds across all fixtures._
|
||||
@@ -0,0 +1,13 @@
|
||||
# Materializer parity probe — Bun vs Go
|
||||
|
||||
**Date:** 2026-05-02T09:38:32Z
|
||||
**Bun:** `/home/profit/lakehouse/scripts/distillation/build_evidence_index.ts`
|
||||
**Go:** `./bin/materializer`
|
||||
|
||||
Identical `data/_kb/` source → both runtimes' materializer.
|
||||
Match = JSONL byte-equal after normalizing `provenance.recorded_at`
|
||||
(per-run wall clock) + sorted line order (dedup ordering).
|
||||
|
||||
**Tally:** 2 match · 0 diff (out of 2 stems)
|
||||
|
||||
_No divergences — on-wire JSON parity holds._
|
||||
Reference in New Issue
Block a user