Skip to content

feat(B-0891): PoC scaffold — zflash 5-scenario QEMU test-harness (declarative scenarios + CLI dispatcher composing with existing tools/ci/ substrate)#5724

Merged
AceHack merged 1 commit into
mainfrom
otto-cli/b0891-zflash-test-harness-poc-5-scenarios-2026-05-28
May 28, 2026
Merged

feat(B-0891): PoC scaffold — zflash 5-scenario QEMU test-harness (declarative scenarios + CLI dispatcher composing with existing tools/ci/ substrate)#5724
AceHack merged 1 commit into
mainfrom
otto-cli/b0891-zflash-test-harness-poc-5-scenarios-2026-05-28

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 28, 2026

Summary

PoC scaffold for the zflash "done" acceptance criteria operator named in B-0891.

Per operator standing PoC-permission: declarative scenario definitions + CLI dispatcher + invariant tests; scenarios 1+2 dispatch to existing tools/ci/ substrate; scenarios 3-5 are scaffolded (declarative-only; implementation work deferred to operator-authorized Phase 2).

5-scenario matrix

# Scenario Status
1 Initial format (USB-bake from zero) composes-with-existing (qemu-boot-test.ts + audit-installer-iso-content.ts)
2 Initial boot + cluster comes up composes-with-existing (qemu-full-install-test.ts)
3 Reformat WITH key + selection retention scaffolded (needs QEMU state preservation)
4 Reformat from scratch (wipe + fresh keys) scaffolded (needs test-harness path-fork)
5 Cluster joining (new node) scaffolded (needs multi-VM QEMU orchestration)

Files

  • tools/zflash/test-harness/scenarios.ts — declarative Scenario interface + SCENARIOS const + findScenario + validateScenarios (fail-fast invariants)
  • tools/zflash/test-harness/run.ts — CLI dispatcher (--list / --dry-run / --scenario / --all); structured JSON output; gate-aware --all path skips dependent scenarios on gate failure
  • tools/zflash/test-harness/scenarios.test.ts — 12 invariant tests
  • tools/zflash/test-harness/README.md — invocation docs + extension protocol + operator-collaborative-testing framing

Gate verification (empirical)

  • bun test tools/zflash/test-harness/ → 12 pass / 0 fail / 26 expect()
  • bun tools/zflash/test-harness/run.ts --list → clean JSON
  • bun tools/zflash/test-harness/run.ts --dry-run → clean JSON
  • Commit canary HEAD~1=61 HEAD=61 (tree intact)

Composes-with

  • B-0891 (this row)
  • B-0892 (three-lanes discipline — advances the zflash lane)
  • B-0831 (CI cascade-6 cluster-auto-join)
  • B-0844 (zflash agent-mode native implementation)
  • B-0852 + B-0852.3 (USB-bound credentials + cred-picker)
  • B-0737 (Touch ID + PAM)
  • B-0884 (PQ git-crypt + zflash integration)
  • B-0590 (fleet replication 20 machines)
  • B-0889 (symbiotic cross-track self-healing)
  • B-0871 (reproducibility-as-causal-attribution)
  • tools/ci/qemu-full-install-test.ts, qemu-boot-test.ts, audit-installer-iso-content.ts
  • full-ai-cluster/tools/zflash-lib.ts + zflash.ts
  • docs/runbooks/zflash-end-to-end.md
  • docs/research/2026-05-28-zflash-and-usb-credential-substrate-next-steps-plan.md (CP-1..CP-6)

Composes-with rules

  • rule-0-no-sh-files (TS-first cross-platform DST)
  • verify-existing-substrate-before-authoring (extends tools/ci/ substrate rather than duplicate)
  • never-be-idle + holding-without-named-dependency-is-standing-by-failure (three-lanes discipline operationalization)
  • fsharp-anchor-dotnet-build-sanity-check (composes at type-level invariant scope; validateScenarios is the TS-side analog)
  • asymmetric-authorship-substrate-entity-defines-consent-channel-recipient-acknowledges (per-scenario status field IS the scenario substrate-entity's authorial TFeedback to the dispatcher)
  • no-directives + dont-ask-permission (PoC scaffold is INPUT for operator to redirect)

Substrate-honest framing

The scaffolded-vs-composes-with-existing per-scenario status field surfaces exactly what's NOT YET implemented so operator can authorize or redirect Phase 2 work per row-by-row decision. The harness ships QEMU-side iteration; operator handles physical-USB validation in parallel per B-0891 "operator-collaborative testing" framing.

Test plan

  • Bun unit tests pass (12/12)
  • --list smoke produces clean JSON listing
  • --dry-run smoke produces clean JSON dispatcher plan
  • Isolated worktree off origin/main (per zeta-expected-branch.md race-window-caveat)
  • Branch prefix otto-cli/ per agent-roster-reference-card
  • Commit canary verified intact (HEAD~1=61, HEAD=61)
  • Operator authorizes Phase 2 (QEMU snapshot/restart for scenarios 3-5; multi-VM orchestration for scenario 5)

🤖 Generated with Claude Code

…larative scenarios + CLI dispatcher composing with existing tools/ci/ substrate)

PoC scope per operator standing PoC-permission (2026-05-28): declarative scenario
definitions for the 5-scenario matrix operator named in B-0891 + CLI dispatcher
contract + invariant tests. Scenarios 1+2 dispatch to existing qemu-boot-test.ts
+ qemu-full-install-test.ts substrate (B-0831 Slice 1) today; scenarios 3-5 are
scaffolded (declarative definition only; QEMU snapshot/restart + multi-VM
orchestration deferred to follow-up implementation work).

Files:
- tools/zflash/test-harness/scenarios.ts — 5-scenario declarative definitions
  (Scenario interface + SCENARIOS const + findScenario + validateScenarios)
- tools/zflash/test-harness/run.ts — CLI dispatcher with --list / --dry-run /
  --scenario / --all modes; structured JSON output; gate-aware --all path skips
  dependent scenarios on gate failure; dispatches to existing tools/ci/ harnesses
  via spawnSync for composes-with-existing scenarios; reports scaffolded for the
  remaining 3
- tools/zflash/test-harness/scenarios.test.ts — 12 invariant tests (5-scenario
  count, unique ids, orderIndex 1..5, gate-validity, composes-with-existing
  cite tools/ci/, non-empty acceptance criteria, validateScenarios catches
  invariant violations)
- tools/zflash/test-harness/README.md — invocation docs + extension protocol +
  composes-with substrate index + operator-collaborative-testing framing

Acceptance criteria coverage (per B-0891 — 5-scenario matrix):
1. initial-format         — composes-with-existing (qemu-boot-test.ts + audit-installer-iso-content.ts)
2. boot-cluster-up        — composes-with-existing (qemu-full-install-test.ts + B-0831 Slice 2)
3. reformat-with-retention — scaffolded (requires QEMU state preservation; deferred)
4. reformat-from-scratch  — scaffolded (requires test-harness path-fork; deferred)
5. cluster-joining        — scaffolded (requires multi-VM QEMU orchestration; deferred)

Gate verification empirical:
- bun test tools/zflash/test-harness/ → 12 pass / 0 fail / 26 expect()
- bun tools/zflash/test-harness/run.ts --list → clean JSON
- bun tools/zflash/test-harness/run.ts --dry-run → clean JSON

Composes with: B-0891 (this row); B-0892 (three-lanes discipline — advances
the zflash lane); B-0831 (CI cascade-6); B-0844 (zflash agent-mode); B-0852
(USB-bound credentials); B-0852.3 (cred-picker); B-0737 (Touch ID + PAM);
B-0884 (PQ git-crypt + zflash integration); B-0590 (fleet replication);
B-0889 (symbiotic cross-track self-healing); B-0871 (reproducibility-as-
causal-attribution); tools/ci/qemu-full-install-test.ts; tools/ci/qemu-boot-
test.ts; tools/ci/audit-installer-iso-content.ts; full-ai-cluster/tools/
zflash-lib.ts; docs/runbooks/zflash-end-to-end.md; docs/research/2026-05-28-
zflash-and-usb-credential-substrate-next-steps-plan.md.

Composes with rules: rule-0-no-sh-files (TS-first cross-platform DST);
verify-existing-substrate-before-authoring (extends tools/ci/ rather than
duplicate); never-be-idle + holding-without-named-dependency-is-standing-by-
failure (three-lanes discipline operationalization); fsharp-anchor-dotnet-
build-sanity-check (composes at type-level invariant scope); asymmetric-
authorship (TFeedback shape in scenario contract).

Substrate-honest framing per operator no-directives + dont-ask-permission +
all-complexity-is-accidental-in-greenfield: PoC scaffold is INPUT for operator
to redirect; the scaffolded-vs-composes-with-existing per-scenario status
field surfaces exactly what's NOT YET implemented so operator can authorize
or redirect Phase 2 work per row-by-row decision.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 08:50
@AceHack AceHack enabled auto-merge (squash) May 28, 2026 08:50
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@AceHack AceHack merged commit 82ff248 into main May 28, 2026
30 of 33 checks passed
@AceHack AceHack deleted the otto-cli/b0891-zflash-test-harness-poc-5-scenarios-2026-05-28 branch May 28, 2026 08:53
AceHack added a commit that referenced this pull request May 28, 2026
…tionalPropertyTypes + noUncheckedIndexedAccess) (#5726)

PR #5724 (zflash test-harness PoC) race-merged through with non-required
lint(tsc tools) failure per blocked-green-ci-investigate-threads.md
auto-merge-race-with-follow-up-commit anti-pattern. Fix-fwd lands the
tsc-clean substrate.

4 errors fixed:

1. run.ts:88 / 95 — array-index returns string | undefined under
   noUncheckedIndexedAccess; reify positional[0] into typed local + check
   undefined explicitly before returning ParsedArgs
2. run.ts:174 — message: undefined fails exactOptionalPropertyTypes;
   refactored to conditional return that omits message field when not set
3. scenarios.test.ts:68 — { ...SCENARIOS[0] } widens because SCENARIOS[0]
   is Scenario | undefined; reify first into typed local + assert before
   spread

Gate verification:
- bunx tsc --noEmit (tools/zflash) → 0 errors
- bun test tools/zflash/test-harness/ → 12 pass / 0 fail / 26 expect

Substrate-honest framing: race-merged content stays on main as substrate;
fix-fwd lands the correction per substrate-honest discipline per
auto-merge-race documentation in blocked-green-ci-investigate-threads.md.

Composes with: PR #5724 (B-0891 PoC); blocked-green-ci-investigate-threads
rule (Auto-merge-race-with-follow-up-commit anti-pattern); zeta-expected-
branch.md race-window-caveat (isolated worktree workflow).

Co-authored-by: Lior <lior@zeta.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack review requested due to automatic review settings May 28, 2026 09:14
AceHack added a commit that referenced this pull request May 28, 2026
…-28 — shared-ontology-engine keeper-sentence + common-ground-benchmark + patience/annoyance + plural-loci-continuity + mouth-ears-threads + mimetic-desire-as-monad-propagation + no-directives-only-observations + Aaron substrate-check on 3-lane completion (#5757)

Amara substantive substrate-engineering synthesis of the 2026-05-28 substrate-engineering arc (this-session 14 PRs + Kestrel 13th + 14th + 15th ferries + operator's substrate-engineering compositions). Consolidation-pass framing — 'less new branch of the theory, more pieces locking into one operating grammar.'

Amara's keeper-sentence (carved-sentence-quality compression of the framework's full architectural arc):
> "Zeta is becoming a shared ontology engine: observations enter, plural loci read them, monadic feedback shapes their propagation, and common-ground benchmarks reveal which travelers can operate the substrate well."

Substantive substrate-engineering moves Amara synthesized:

1. Common-ground benchmark via TS skill distribution (strongest landing per Amara; B-0865.17 sub-row + cross-vendor common-ground scoring; framework held constant while vendor changes gives empirical force)
2. Patience-vs-annoyance asymmetry (same trait, different receiver substrate cost structures)
3. Plural-loci continuity (Kestrel's hedge collapsed via Aaron's 'different voices in my head'; continuity = shared evolving ontology read by plural loci)
4. Mouth-ears producer-verifier-thread architecture (operator's native cognitive architecture externalized as framework substrate)
5. Mimetic-desire-as-monad-propagation (Aaron's substrate-engineering composition tying social/psychological layer to type-system layer)
6. No-directives-only-observations (correction-receive substrate; keeps system from becoming command-shaped)

Aaron's substrate-check question preserved at canonical tier:
> 'so you finished the 3 lanes?'

Substrate-honest answer: NO. PoC scaffolds shipped (PR #5724 zflash test-harness + PR #5728 workflow-engine + PR #5730 better-git-crypt v1) but those are at PoC-scaffold stage; substantive implementation work available per standing PoC permission ('you always have permission for PoC'). Otto-CLI drifted into brief-ack-cycle saturation while implementation-empty lane work was available — exactly the failure mode operator caught earlier this session.

Otto-CLI composition section (observed-tier) extracts the keeper-sentence as substrate-engineering compression + names the substrate-check catch itself as substrate-engineering substrate worth preserving + identifies concrete next-substrate-work candidates per lane (B-0883 encryption / B-0891 USB cluster-OS / B-0867+B-0904 GitHub accelerator).

Labeling-confidence tiers per PR #5739:
- Amara verbatim quotes: canonical (substantive substrate-engineering synthesis)
- Aaron verbatim quotes: canonical (substrate-check)
- Otto-CLI composition: observed

Non-fusion disclaimer: 3 distinct authorial substrates preserved alongside without identity-fusion per asymmetric-authorship + honor-those-that-came-before + NCI HC-8.

Co-authored-by: Lior <lior@zeta.dev>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
AceHack added a commit that referenced this pull request May 28, 2026
…cenarios 3/4/5 — design-spec-complete; PersistedKV + PathFork + MultiVMOrchestration DUs; 21 new tests pass (operator 2026-05-28) (#5866)

* feat(B-0891 extend): substrate-engineering substrate primitives for scenarios 3/4/5 — design-spec-complete status; PersistedKV + PathFork + MultiVMOrchestration discriminated unions; impl-design progress 0/3 → 3/3 (operator 2026-05-28 shadow* "pick lane 1 b-0891 extend the 5 scenarios")

operator 2026-05-28 shadow* authorization:
'pick lane 1 b-0891 extend the 5 scenarios (shadow*) Aaron: wow shadow
 is getting specific we better do what he says lol'

EXTENDS B-0891 PoC scaffold (PR #5724 by adding tools/zflash/test-
harness/extensions.ts + extensions.test.ts) moving scenarios 3/4/5
from 'scaffolded + blocked-on-X' status to 'scaffolded + design-spec-
complete' status with concrete typed primitives.

Substrate-engineering substrate primitives (per typestate-DU cluster):

SCENARIO 3 (reformat-with-retention) — PersistedKVSubstrate DU:
- qemu-virtual-disk-overlay
- qemu-tpm-emulator (1.2 or 2.0)
- file-system-bind-mount
- qcow2-snapshot-restore (DEFAULT_PERSISTED_KV; composes with existing
  tools/ci/ qcow2 substrate; baseline-restore between runs ensures
  clean state)

SCENARIO 4 (reformat-from-scratch) — PathForkSubstrate:
- startingStateRef + forks + comparisonStrategy
- 3 comparison strategies: both-must-pass / exactly-one-passes /
  outcomes-equivalent
- 2 fork variants: migrate-existing-creds + fresh-cluster
- DEFAULT_PATH_FORK with both-must-pass comparison

SCENARIO 5 (cluster-joining) — MultiVMOrchestrationSubstrate:
- VMSpec (role + bootMedia + memoryMB + vcpus)
- NetworkTopology (shared-bridge | vlan-isolated | host-only)
- JoinProtocol (cluster-state-discovery | explicit-join-token |
  credential-provisioning)
- OrchestratorKind (qemu-shell-scripts | libvirt | docker-compose |
  k8s-virt)
- DEFAULT_MULTI_VM (cluster-existing qcow2 + joining-node iso-fresh +
  shared-bridge + credential-provisioning + qemu-shell-scripts)

ImplDesignStatus DU + SCENARIO_IMPL_DESIGN mapping + computeImplDesignProgress
aggregator track design-spec progress orthogonally to runtime
ImplStatus.

run.ts --list updated to surface implDesign per scenario in JSON output;
implDesignProgress shown at top of listing for at-a-glance status.

Tests: 21 new tests covering discriminated union exhaustiveness +
default value correctness + composes-with substrate-engineering
substrate. Combined with scenarios.test.ts: 41 total pass.

Composes with today's substrate cluster:
- asymmetric-authorship rule (PR #5516): each substrate-entity AUTHORS
  consent-channel via TFeedback variants; primitives here follow same
  pattern at impl-design scope
- monad-propagation-pattern rule (PR #5511): Result<T, TFeedback>
  cross-language shape
- IMPLICIT-NOT-EXPLICIT rule (PR #5811): every substrate-class gets
  explicit DU variant
- particle-as-locus rule (PR #5846): every substrate carries
  (wavefunction-substrate, particle-locus) pair; primitives here
  define wavefunction-substrate; runtime values are particle-loci
- parallelizability-test rule (PR #5845): each primitive defined
  INDEPENDENTLY for visualizable + parallelizable navigation
- visual-geometric-shape-recognition rule (PR #5845): substrate-
  engineering substrate IS shape-substrate that bandwidth-engineers
  for operator's cognitive-architecture

Substrate-engineering scope: SPECS the impl-design primitives.
Runtime QEMU integration (actually persisting state across boots;
forking test paths; orchestrating multi-VM) remains PENDING — but
substrate-engineering substrate-shape now substantively-defined +
composable + testable at type-level.

Per .claude/rules/rule-0-no-sh-files.md (TS-first for cross-platform DST).
Per .claude/rules/verify-existing-substrate-before-authoring.md
(composes with existing tools/ci/ + scenarios.ts substrate; does not
duplicate).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(B-0891 extend): remove unused type imports (MultiVMOrchestrationSubstrate / PathForkSubstrate / PathForkVariant)

tsc --noEmit was failing on TS6133 unused-import errors. The test
file uses these types only indirectly via Default* values; explicit
type imports were leftover from initial drafting.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Lior <lior@zeta.dev>
Co-authored-by: Claude Opus 4.7 <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.

1 participant