Skip to content

bprof: split the M28 organ arm off the substrate-core M29 khash KAT (stage-B PR-3)#87

Merged
bahadirarda merged 1 commit into
mainfrom
bprof-m28split
Jul 12, 2026
Merged

bprof: split the M28 organ arm off the substrate-core M29 khash KAT (stage-B PR-3)#87
bahadirarda merged 1 commit into
mainfrom
bprof-m28split

Conversation

@bahadirarda

Copy link
Copy Markdown
Contributor

What

Stage-B PR-3: the ONE gate site where PR-2's pattern (cfg the whole if/else) would be actively WRONG — naively gating M28/M29 together would delete the khash KAT from the compile-out image, contradicting boot-profiles §3.3's "khash is substrate-core" ruling. The split is asymmetric:

  • Gated (#[cfg(feature = "agent-organs")], PR-2 style): the whole M28 operator-inbound organ — opcmd selftest + fail gate + opcmd: witness + M28: operator-cmd OK marker + its skip form.
  • Substrate-core, hoisted standalone: the M29 khash KAT + khash: … kat=RFC7693-PASS witness + M29: khash-mac OK, running iff the agent arm didn't already emit it — via a dual-cfg let (khash_emitted_by_agent_arm): feature ON → the runtime profile decides (today's behavior); feature OFF → the binding is const-false, so the substrate-core khash can never fall through a runtime check into absence, even if a compile-out image were booted with yuva.profile=agent.

Byte-identity (the CI-gated invariant)

git diff contains ZERO removed/edited serial_write_str emission lines — the khash/M29 emits moved verbatim (git matched them as unchanged context). Serial order per scenario: default/agent khash, opcmd, M28, M29 (unchanged) · default/substrate M28-skip, khash, M29 (unchanged) · no-default/substrate khash, M29 with all M28 forms absent.

The lane

M28 moves from the pipeline cluster into the ORGANS table ("M28: operator-cmd OK|opcmd: challenge=|M28:" — the witness prefix confirmed unique to the gated arm); organs-not-built auto-recomputes 14→15; the khash/M29 core-PRESENT assertions were already in CORE_REQUIRE. Pipeline cluster is now M25/M30/M31/M38 — PR-4's scope.

Untouched

tb-hal, tb-encode, docs, the three default run scripts, kani, witness-census (unaffected by construction: the census generator greps source text, and both M28 literals remain in source — just cfg-gated).

Merge gate: 2× green + SP#4 byte-identity from boot logs.

…stage-B PR-3)

The one gate site where the PR-2 pattern (cfg the whole if/else) would be
WRONG: gating the M28 block whole would strip the M29 khash KAT from the
substrate image, contradicting boot-profiles.md §3.3 ("khash is
substrate-core"). Split asymmetrically instead:

- ONLY the M28 operator-cmd organ (opcmd selftest, its witness lines, the
  `M28: operator-cmd OK` marker AND its substrate-skip form) is gated behind
  `#[cfg(feature = "agent-organs")]`. With --no-default-features it vanishes
  absent-by-omission.
- The M29 khash KAT (a keyed BLAKE2s-256 integrity primitive) is hoisted OUT
  of the else arm into a standalone, ungated block. On the agent profile it
  still rides the opcmd path (byte-identical, skipped standalone); on the
  substrate profile (default build) and on EVERY --no-default-features boot it
  emits the same khash: + `M29: khash-mac OK` lines at the same stream
  position. Exactly one khash+M29 emission per boot on either profile / build.

Serial order preserved on the DEFAULT build (both profiles) byte-for-byte:
agent = khash/opcmd/M28/M29; substrate = M28-skip/khash/M29. On
--no-default-features: khash + M29 present, all M28 forms absent.

run-compileout-x86_64.sh: move M28 from the PIPELINE cluster into the ORGANS
table (`M28: operator-cmd OK | opcmd: challenge= | M28:`), organs-not-built
14->15; the khash/M29 core-PRESENT assertions already cover the substrate-core
half. ci.yml comments + step name updated to match. run-substrate,
witness-census, tb-hal, tb-encode, docs untouched.
@bahadirarda bahadirarda merged commit 6bc34fd into main Jul 12, 2026
45 of 46 checks passed
@bahadirarda bahadirarda deleted the bprof-m28split branch July 12, 2026 09:03
bahadirarda added a commit that referenced this pull request Jul 12, 2026
…ut of every main.rs organ block) (#89)

The status banner gains the 2026-07-10..12 paragraph: #85 M20 untangle,
#86 the 14 self-contained organs, #87 the M28/M29 asymmetric split
(dual-cfg let, khash substrate-core unconditional on feature-OFF), #88 the
pipeline cluster via the contiguous span audit. Frontmatter description
updated in lockstep. PR-5 (the image-split product decision, symbol/size
verification, wire-witness flip) stays the named §12 operator gate, with
the kernel-only-gate design recommendation recorded.
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