Skip to content

docs+feat(rvf): ADR-009 — RVF v1 wire contract, exact magic bytes, golden vectors, CI gate - #769

Merged
ruvnet merged 2 commits into
mainfrom
feat/adr-009-rvf-wire-contract
Aug 2, 2026
Merged

docs+feat(rvf): ADR-009 — RVF v1 wire contract, exact magic bytes, golden vectors, CI gate#769
ruvnet merged 2 commits into
mainfrom
feat/adr-009-rvf-wire-contract

Conversation

@ruvnet

@ruvnet ruvnet commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Codifies the shipped RVF v1 wire format as the single normative contract (ADR-009), resolving the spec inconsistency where ADR-004/005 described a fixed offset-zero header while the shipped crates implement a tail-discovered manifest — flagged as the top blocker for optical/delta RVF delivery work.

Contents

  • ADR-009 (docs/architecture/decisions/): tail-manifest layout normative for v1; exact little-endian wire bytes pinned (segment 53 46 56 52, root 30 4D 56 52); version-stability rules for any future byte change; ADR-004/005 wire sections marked superseded.
  • rvf-types: exported SEGMENT_MAGIC_BYTES / ROOT_MANIFEST_MAGIC_BYTES; docs distinguish mnemonic (RVFS/RVM0) from wire bytes.
  • Golden vectors (rvf-wire/tests/wire_contract_golden.rs), derived from shipped writer output, all claims verified empirically:
    • full 64-byte canonical empty segment header — SHAKE-256 field matches the NIST empty-input vector 46b9dd2b...
    • root manifest: prefix 30 4D 56 52 01 00 00 00, trailing CRC32C FF DD 18 14, zero-fill in between
    • tempfile round-trip proving tail discovery needs no offset-zero header
  • Bug-adjacent fixes: tail_scan.rs comment documented the wrong anchor byte (code was right); doc pseudocode compared wire bytes to literal ASCII — a reader built from it would reject every real RVF file.
  • CI: rvf-wire-contract.yml — fmt + clippy -D warnings + tests over rvf-types/rvf-wire on wire-related paths, pinned action SHAs, contents: read.
  • Separate commit: 4 mechanical pre-existing clippy fixes in rvf-types so the new gate is green from run one.

Verification

cargo fmt --check, clippy -D warnings: clean. Tests: rvf-types 230, rvf-wire 57 + 3 golden — all passing. Workflow YAML parses.

No wire bytes changed — existing artifacts, hashes, and signatures remain valid.

🤖 Generated with claude-flow

ruvnet added 2 commits August 2, 2026 16:47
…t CI gate

Derive Default where clippy requires it (quality.rs, security.rs, sha256.rs)
and const-block a constant assertion — mechanical, behavior-preserving; the
new rvf-wire-contract workflow runs clippy -D warnings over rvf-types and
would fail its first run without these.

Co-Authored-By: claude-flow <ruv@ruv.net>
…c bytes and golden vectors

Two incompatible layouts were both described as RVF: ADR-004/005's fixed
64-byte header at offset zero, and the shipped append-only segment stream
with a tail-discovered 4096-byte Level-0 root manifest. The magic
mnemonics (RVFS/RVM0) also read as ASCII byte sequences when the v1 wire
bytes are actually their little-endian serializations (53 46 56 52 /
30 4D 56 52).

- ADR-009 makes the shipped tail-manifest layout normative for v1 and
  pins the exact wire bytes; ADR-004/005 wire sections marked superseded
- rvf-types exports SEGMENT_MAGIC_BYTES / ROOT_MANIFEST_MAGIC_BYTES;
  docs state the mnemonic-vs-wire distinction explicitly
- Golden byte-vector tests derived from shipped writer output: full
  64-byte canonical empty segment header (SHAKE-256 empty-input value
  matches the NIST vector), root manifest prefix 30 4D 56 52 01 00 00 00
  + trailing CRC32C FF DD 18 14 + zero-fill, and a tail-discovery
  round-trip proving no offset-zero header is required
- Fixed tail_scan.rs comment documenting the wrong anchor byte ('R'/0x52
  where the code correctly scans 0x53) and doc pseudocode comparing wire
  bytes to literal ASCII (a reader built from it would reject every real
  RVF file)
- New rvf-wire-contract CI workflow (pinned actions, fmt+clippy+tests
  over rvf-types/rvf-wire on wire-related paths)

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet
ruvnet marked this pull request as ready for review August 2, 2026 21:12
@ruvnet
ruvnet merged commit 105b804 into main Aug 2, 2026
45 of 46 checks passed
@ruvnet
ruvnet deleted the feat/adr-009-rvf-wire-contract branch August 2, 2026 21:24
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.

1 participant