Skip to content

feat: pin the golden vector distribution with a relay-vectors/1 manifest, spec §15.8, Requirement 16 - #181

Merged
SoundMatt merged 2 commits into
mainfrom
feat/relay-140-vector-manifest
Aug 21, 2026
Merged

feat: pin the golden vector distribution with a relay-vectors/1 manifest, spec §15.8, Requirement 16#181
SoundMatt merged 2 commits into
mainfrom
feat/relay-140-vector-manifest

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Implements issue #140 (NEW-SPEC-2): pins the canonical spec/vectors/ golden vector distribution with a machine-checkable, hash-verified manifest — same pattern as #180's conformance manifest, applied to vector distribution instead of §17 requirement status.

Scope decision (important)

The originating issue's proposal had two parts:

  1. Pin/hash/version the vector distribution — implemented here.
  2. Extend the vector set itself with byte-for-byte wire-format vectors (MQTT varint boundary, LIN diagnostic-checksum selection, etc.) — explicitly declined. This would contradict RELAY's own pre-existing scope boundary at §1.1/§17.1 (established by REL-SPEC-2, already merged): "RELAY does not define wire formats... so RELAY cannot ship byte-for-byte wire vectors itself without exceeding that boundary." §15.8's new text states this explicitly rather than silently narrowing scope. Only part 1 ships in this PR.

What's added

  • New §17 Requirement 16 — Vector manifest. A conformant implementation that embeds a local copy of the canonical vectors MUST embed the exact pinned set and MUST have a CI step that fails on any SHA-256 divergence from the published manifest for the vectors_version it targets.
  • New §15.8 defines the relay-vectors/1 manifest shape: kind, manifest_version, vectors_version (bound to spec/version.json), vectors[] ({name, sha256} pairs, one per file under spec/vectors/ including spec/vectors/errors/).
  • New embedded schema spec/schemas/vectors-manifest.json.
  • New §20.1 CI gate for manifest regeneration/diffing, mirroring gate 4 (conformance manifest).
  • Reference implementation: spec/vectors/vectors_manifest.json (16 entries — all hashes independently computed via shasum -a 256 and cross-checked against VerifyVectorManifest()'s own computation), plus VectorsManifest(), ParsedVectorsManifest(), and VerifyVectorManifest() in vectors.go.
  • VectorNames() now excludes the manifest file itself from the vector set it enumerates — it's metadata about the distribution, not a vector. This required matching fixes in two pre-existing tests (spec_vectors_test.go, cmd/relay/jsonschema_test.go) that globbed spec/vectors/*.json directly and would otherwise have tried to parse the manifest as a relay.Message fixture and failed.
  • New REQ-RELAY-096 in .fusa-reqs.json.

Version

SpecVersion bumped 2.32.4 (MINOR), same precedent as Requirements 13/14/15.

Verification

  • 6 new tests: manifest exclusion from VectorNames(), manifest JSON validity + shape, a clean VerifyVectorManifest() run against the real committed manifest, and a hash-mismatch-detection unit test.
  • Real mutation test performed: temporarily corrupted one hash in spec/vectors/vectors_manifest.json, confirmed TestVerifyVectorManifestClean fails with the exact expected finding, then reverted and confirmed clean again.
  • go build ./... && go vet ./... && go test ./... — all packages green.
  • gofmt -l . — clean.
  • gofusa check (pinned v0.48.0, matching CI): 0 errors.
  • gofusa trace -req-coverage 100: 100% (96/96 requirements traced).

Closes #140.

SoundMatt and others added 2 commits August 20, 2026 20:25
…est, spec §15.8, Requirement 16

- New §17 Requirement 16: implementations that embed a local copy of the
  canonical spec/vectors/ golden vectors MUST embed the exact pinned set
  and MUST have a CI step that fails on any SHA-256 divergence from the
  published manifest for their targeted vectors_version.
- New §15.8 defines the relay-vectors/1 manifest shape (kind,
  manifest_version, vectors_version, vectors[] of {name, sha256}).
- New embedded schema spec/schemas/vectors-manifest.json.
- New §20.1 CI gate for manifest regeneration/diffing.
- Explicitly declined the originating issue's proposal to extend the
  vector set itself with byte-for-byte wire-format vectors: that would
  contradict RELAY's own pre-existing scope boundary (§1.1/§17.1,
  established in REL-SPEC-2) that wire formats are out of scope for
  RELAY's own embedded vectors. Only the manifest/pinning/hashing
  mechanism ships here; documented explicitly in §15.8 and the
  CHANGELOG rather than silently narrowing scope.
- Reference implementation: spec/vectors/vectors_manifest.json (16
  vectors, hashes independently verified via sha256sum),
  VectorsManifest()/ParsedVectorsManifest()/VerifyVectorManifest() in
  vectors.go. VectorNames() now excludes the manifest file itself from
  the vector set it enumerates (it is metadata about the distribution,
  not a vector) — required matching fixes in two pre-existing test
  files (spec_vectors_test.go, cmd/relay/jsonschema_test.go) that
  globbed spec/vectors/*.json directly and would otherwise have tried
  to parse the manifest as a golden vector.
- New REQ-RELAY-096. 6 new tests, including a real mutation test
  (temporarily corrupted the manifest, confirmed TestVerifyVectorManifestClean
  fails, reverted) and a hash-mismatch-detection unit test.
- SpecVersion bumped 2.3 -> 2.4 (MINOR, same precedent as Requirements
  13/14/15).

Closes #140.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
@SoundMatt
SoundMatt merged commit 05a5300 into main Aug 21, 2026
8 checks passed
@SoundMatt
SoundMatt deleted the feat/relay-140-vector-manifest branch August 21, 2026 03:30
SoundMatt added a commit that referenced this pull request Aug 21, 2026
…tation/1), spec §20.6 (#183)

- New §20.6 defines the shape an implementation MAY publish to make §20.1's
  CI gates externally verifiable rather than self-asserted: an in-toto
  Statement whose subject digest is the SHA-256 of the attested binary
  file, and whose predicate bundles the full §17.2 conformance manifest,
  the attestation-generating tool's own embedded vectors_version (§15.8 -
  explicitly NOT observed from the attested binary, which a black-box
  invocation cannot introspect), and an optional implementation-defined
  safety_evidence_summary.
- Scope decision, documented in the CHANGELOG rather than silently
  narrowed: this PR ships spec-only. The originating issue also proposed
  cryptographic signing, publishing alongside a release's container
  image, surfacing the digest in version --format json, and having
  relay probe/relay report treat an unverifiable release as
  non-conformant. None of that ships here - RELAY's own CI does not
  currently push container images to any registry, and fabricating an
  unreal 'signature' without real key management would be worse than not
  signing at all. predicate.signed MUST be false on an unsigned
  attestation; this section defines shape only.
- New embedded schema spec/schemas/relay-conform-attestation.json.
- Reference implementation: relay conform --attestation <binary> in
  cmd/relay/conform.go.  New REQ-RELAY-098.
- Real bug found and fixed while implementing this: buildManifest's
  Requirements slice was missing entry 16 (Vector manifest) - PR #181
  added the §17 Requirement 16 spec text and verifier-table row but never
  added the corresponding code entry, so every relay-conform/1 manifest
  generated since v2.4 silently omitted it despite the spec's own text
  mandating 'exactly one entry per §17 requirement (1-16, ...)'. Fixed;
  the two manifest-shape tests that should have caught this
  (TestBuildManifestSelf, TestRunConformManifestFlag) were also stale at
  a hardcoded 15 and are corrected alongside it. Mutation-tested: reverted
  the fix, confirmed both tests failed, restored.
- 6 new tests for the attestation feature, including independent
  cross-checks: subject digest matches a separately-computed sha256 of
  the binary file, vectors_version matches the tool's own parsed
  vectors_manifest.json, and schema validation against the new embedded
  schema.
- SpecVersion bumped 2.5 -> 2.6 (MINOR, new optional format + CLI flag).

Closes #142.

Signed-off-by: Matt <47545907+SoundMatt@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

[NEW-SPEC-2] Normative golden-vector distribution, pinning, and hashing for wire-format conformance vectors

1 participant