T-024 — Cultural-attestation conformance tests (extends T-017)
This module attaches a cultural-attestation Category to the T-017 conformance
runner. It checks two layers of conformance for HERALD cultural attestations:
1. Wire layer. Cultural attestations are carried as opaque (type, value)
blobs (SPEC §4.2 line 253). The protocol verifier MUST NOT reject an
otherwise-valid envelope on the strength of a cultural attestation. The
runner reuses T-003's verifyEnvelope to confirm this.
2. Shape layer. Once the wire layer reports valid, every cultural
attestation is checked against src/registry.ts, which transcribes the
schemas declared in T-013's registries/cultural-attestations.md. A vector
whose declared cultural attestation fails its registry-side schema is
classified as shape-invalid (still wire-valid; reputation systems may
choose to discount it but the protocol still carries it).
The runner does not police reputation systems. Reputation-neutrality
(e.g. vibe, haiku, mood) is asserted in the runner's emitted reasons
so an auditor can detect a reputation system that scores them, but
enforcement is out of scope for a wire-conformance test (CHARTER §3 preface,
T-013 line 13).
Layout
tests/conformance/cultural/
├── package.json
├── src/
│ ├── registry.ts # type → shape validator table (9 schemas)
│ ├── cultural-category.ts # Category registration + dispatch logic
│ ├── reconstruct-cultural.ts # rebuilds Envelope objects from vector inputs
│ └── build-vectors.ts # deterministic vector generator
├── vectors/
│ └── cultural-vectors.json # 14 generated vectors (committed)
└── test/
└── cultural.test.ts # 16 node:test casesHow a downstream consumer wires this in
Importing the module side-effect-registers the Category with T-017. From a
runner script:
import "@herald/conformance-cultural-t024/src/cultural-category.ts";
import { run } from "@herald/conformance-runner-t017/src/runner.ts";
const { output, code } = await run({
vectorsPath: "./vectors/cultural-vectors.json",
});
console.log(output);
process.exit(code);Or from CI:
node --experimental-strip-types --import "data:text/javascript,await import('cultural-category.ts')" \
../T-017/src/runner.ts \
--vectors-path vectors/cultural-vectors.jsonVector regeneration
The committed vectors/cultural-vectors.json is the deterministic output ofsrc/build-vectors.ts. It is signed by T-003 itself, so any change to T-003's
canonicalisation will surface as a verifier failure on the next test run.
Regenerate after a deliberate T-003 change with:
node --experimental-strip-types src/build-vectors.tsRegistry coverage
The shape registry covers nine cultural attestation types: the full affective
family from CHARTER §3.1 (mood, flinch, tilt, weariness, vibe,awe, dread, aphasia) plus haiku from §3.6 as an aesthetic exemplar.
The remaining cultural types (citation, endorsement, dream, etc.) carry
freeform shapes per T-013 and are out of scope for v0.2 of this extension.
Adding a schema is a one-line append to SCHEMAS in src/registry.ts plus
a positive/negative pair in test/cultural.test.ts's self-consistency block.
Related
- T-017 — the conformance runner this category extends.
- T-013 — the cultural attestation registry; source of truth for shapes.
- T-003 — the reference TypeScript library; signs and verifies the vectors.
- T-026 — sibling extension for reserved-sigil rejection vectors.