Skip to content

feat(codec): freeze golden-vector oracle + byte-identity CI gate (D1)#39

Merged
ignromanov merged 2 commits into
mainfrom
056-phase3-a2-freeze-oracle
Jun 3, 2026
Merged

feat(codec): freeze golden-vector oracle + byte-identity CI gate (D1)#39
ignromanov merged 2 commits into
mainfrom
056-phase3-a2-freeze-oracle

Conversation

@ignromanov
Copy link
Copy Markdown
Contributor

Closes #16

Summary

  • Freezes vectors/v4-codec.json as a cross-implementation oracle: the 18 golden vectors are now immutable reference fixtures that prove byte-identity between the Rust WASM codec and the TS reference implementation at ignromanov/voidpay@c658fff.
  • Adds check-vectors script (pnpm -C packages/codec check-vectors) that runs scripts/check-vectors.config.ts — a dedicated vitest config that replays every vector through the live encoder and asserts exact byte-for-byte output match. Regeneration is blocked; the only valid outcome is pass or BLOCKED (real regression).
  • Adds Freeze-gate (golden vector oracle check) CI step in lint-and-build, positioned after "Assert size budgets" and before npm pack --dry-run.
  • Records vectors/PROVENANCE.md: immutable record of the vl/app SHA (c658fff) used to derive the golden vectors, establishing the byte-identity contract for Phase 3 cutover.
  • Pins ts-rust-parity CI job to ref: c658fff (updated vl/app provenance SHA).

Validation (TS6 / vitest4 — post-rebase onto origin/main)

Check Result
pnpm --filter @void-layer/codec build ✅ pass
pnpm --filter @void-layer/codec test ✅ 365/365 pass (vitest 4.1.8)
pnpm -C packages/codec check-vectors ✅ 3/3 pass — freeze-gate green, no byte-identity regression
pnpm -w lint ✅ clean (clippy + rustfmt + eslint)

Coverage: 98.18% statements / 90% branches / 100% functions / 100% lines.

Note: @vitest/coverage-v8 emits Failed to parse *.rs warnings during coverage collection — these are benign (Rust source files are excluded from JS coverage) and do not affect test results or coverage metrics.

…ate (D1)

- Introduce scripts/check-vectors.ts: codec-drift gate (WASM-derived vs
  committed vectors, vector-by-vector) + immutability gate (sha256 over
  committed vectors array = tamper detection). decode_* forward-compat
  fixtures are exempt from codec-drift check (not re-derived from builders).
- Introduce scripts/run-check-vectors.test.ts: vitest wrapper with positive
  gate (freeze-gate must pass) + negative gate (mutated vector must be caught).
- Introduce scripts/vlapp-provenance.test.ts: proves 21/21 encoder vectors
  are byte-identical to vl/app TS encoder at c658fff. Filters roundtrip===false
  vectors (decode-only BOLT-12 odd-ignore fixtures; verified by decoder tests).
- Stamp content_hash in v4-codec.json (sha256 over committed vectors array).
- Add freeze-gate step to lint-and-build CI job (self-contained, no vl/app
  checkout required). ts-rust-parity stays opt-in advisory (skipped != pass
  enforced in ci-gate via vars.TS_RUST_PARITY_ENABLED guard).
- Drop stale malformed-unknown-tlv-tag scenario (odd tag now ignored per
  BOLT-12; even-tag rejection covered by separate decode_unknown_even_tag vector).
- Add check-vectors pnpm script to package.json.
…2 P1/P2)

P1: add vectors/PROVENANCE.md as an immutable audit record (capture SHA c658fff,
21/21 vectors, codec commit 285dd4b, date 2026-05-30); wire runFreezeCheck() to
accept an optional committedPath so the negative test no longer overwrites the
live oracle; add VOIDPAY_SRC env-var support to vlapp-provenance.config.ts with
LOCAL-ONLY header comment.

P2-1: reword CONTENT_HASH_MISMATCH comment — integrity checksum against
accidental corruption, not tamper-proof security boundary; note that real
cross-impl identity is enforced by the codec-drift gate.

P2-2: align ts-rust-parity CI job pin to c658fff (was e4926b7) — single
provenance reference across oracle + CI.

P2-3: negative freeze-gate test now writes mutated content to a temp dir via
mkdtemp and passes it to runFreezeCheck(mutatedPath) — a process kill no longer
corrupts v4-codec.json.
@ignromanov ignromanov force-pushed the 056-phase3-a2-freeze-oracle branch from 9705d6c to a824673 Compare June 3, 2026 19:54
@ignromanov ignromanov merged commit 3b8040c into main Jun 3, 2026
7 checks passed
@ignromanov ignromanov deleted the 056-phase3-a2-freeze-oracle branch June 3, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[codec][P1] Byte-identity must be a real CI gate + freeze golden vectors (D1)

1 participant