WI-4 (#831): verbatim-hashed normative fragments (B_payload/H_payload) #844

Merged
jason.woltje merged 2 commits from feat/831-verbatim-hashed-fragments into main 2026-07-19 20:34:21 +00:00
Owner

closes #831

WI-4 — Verbatim-hashed normative fragments (B_payload / H_payload)

Implements the fail-closed construction of verbatim-hashed normative fragments per BUILD-BRIEF §3.4 + SPEC-v5:

  • B_payload = version label + manifest_version + generator_version + per-fragment source identities + exact validated fragment bytes, length-framed (64-bit BE, injective).
  • H_payload = SHA256(HASH_DOMAIN_SEP ‖ length_frame([B_payload])) — derived one-way AFTER B_payload; no self-reference (h_payload is neither an argument nor a payload field).
  • Source-invalidation fail-closed: missing / oversize / hash-mismatch fragment → REFUSED, promotion=False, no payload/hash (cannot advance to promotion).
  • Single shared constructor for both Claude and Pi adapters → byte-identical vectors (T24).

Files: normative_fragments.py (+176), normative_fragments_unittest.py (+159), package.json (wires the new py unittest into test:framework-shell).

Review status — ⚠ NOT merge-ready

  • Reviews IN FLIGHT at exact head c63baec14aceb64a117c3e31bcac46e626197cf9: terra CODE + Opus SECREV (hash-construction surface, BUILD-BRIEF §7 mandatory).
  • No self-merge. Merge is Mos's (Gate 13/16) AFTER: both RoR GO + probe-5 admission classification (5 criteria) + full 6-check incl real-pipeline CI terminal-green.
  • Red-first genuine: test(#831) 083dde24 precedes feat(#831) c63baec1.
  • Note for CI: the local combined pnpm test shows 14 unrelated Vitest suites failing on UNBUILT workspace deps (@mosaicstack/brain/db/config) — a pre-existing monorepo build-ordering artifact (diff touches only .py + package.json, zero TS); the real pipeline builds deps first. test:framework-shell (incl the new unittest) is green.

PR opened to pre-run CI on the real pipeline in parallel with reviews. Head pinned at c63baec1.

closes #831 ## WI-4 — Verbatim-hashed normative fragments (B_payload / H_payload) Implements the fail-closed construction of verbatim-hashed normative fragments per BUILD-BRIEF §3.4 + SPEC-v5: - `B_payload` = version label + manifest_version + generator_version + per-fragment source identities + exact validated fragment bytes, length-framed (64-bit BE, injective). - `H_payload = SHA256(HASH_DOMAIN_SEP ‖ length_frame([B_payload]))` — derived one-way AFTER B_payload; **no self-reference** (h_payload is neither an argument nor a payload field). - Source-invalidation fail-closed: missing / oversize / hash-mismatch fragment → `REFUSED`, `promotion=False`, no payload/hash (cannot advance to promotion). - Single shared constructor for both Claude and Pi adapters → byte-identical vectors (T24). Files: `normative_fragments.py` (+176), `normative_fragments_unittest.py` (+159), `package.json` (wires the new py unittest into `test:framework-shell`). ## Review status — ⚠ NOT merge-ready - Reviews IN FLIGHT at exact head `c63baec14aceb64a117c3e31bcac46e626197cf9`: terra CODE + **Opus SECREV** (hash-construction surface, BUILD-BRIEF §7 mandatory). - **No self-merge.** Merge is Mos's (Gate 13/16) AFTER: both RoR GO + probe-5 admission classification (5 criteria) + full 6-check incl **real-pipeline CI terminal-green**. - Red-first genuine: `test(#831)` 083dde24 precedes `feat(#831)` c63baec1. - Note for CI: the local combined `pnpm test` shows 14 unrelated Vitest suites failing on UNBUILT workspace deps (@mosaicstack/brain/db/config) — a pre-existing monorepo build-ordering artifact (diff touches only .py + package.json, zero TS); the real pipeline builds deps first. `test:framework-shell` (incl the new unittest) is green. PR opened to pre-run CI on the real pipeline in parallel with reviews. Head pinned at c63baec1.
jason.woltje added 2 commits 2026-07-19 20:22:38 +00:00
jason.woltje merged commit e522b22fa4 into main 2026-07-19 20:34:21 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#844