Skip to content

refactor(test): add BootScenario and Refusal boot helpers - #85

Merged
mfw78 merged 3 commits into
mainfrom
refactor/t2-boot-scenario
Aug 5, 2026
Merged

refactor(test): add BootScenario and Refusal boot helpers#85
mfw78 merged 3 commits into
mainfrom
refactor/t2-boot-scenario

Conversation

@mfw78

@mfw78 mfw78 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What

Adds BootScenario, Entry, Booted and Refusal in crates/nexum-runtime/src/test_utils/scenario.rs, a new 636-line module that collapses the tempdir, write-manifests, engine-config and boot ritual into one builder over the real Supervisor::boot path.
BootScenario::new() roots a scenario on the CoreRuntime preset with a fresh redb store and an empty provider pool; over() takes caller-supplied Components<T> for other lattices.
module()/adapter() accept anything convertible into Entry, and each entry can name its own wasm component plus, for adapters, HTTP and messaging operator grants.
boot() builds the linker and calls Supervisor::boot directly; expect_refusal() panics if boot succeeds and otherwise wraps the error in Refusal, which centralises names/lacks context-chain assertions.
ManifestSource is promoted out of harness.rs into manifest.rs so both the harness and the new scenario share one enum, renamed from None/Path/Inline to Beside/Path/Toml to describe what each variant does rather than its shape, plus a resolve method and From impls for TestManifest, String and PathBuf.
test_utils/mod.rs re-exports the new scenario module and its public types.

Why

Part of #83.

T1 introduced the shared manifest builder; T2 gives the module tree work an equivalent for booting, so later slices in #83 can express a multi-component or granted-adapter boot, or a discovery/path/section refusal, without hand-rolling the tempdir and config wiring each time.
This PR retargets to main once the chain-backend PR ahead of it in the stack merges.

Testing

New tests in test_utils/scenario.rs and test_utils/manifest.rs cover a single-component scenario boot, dispatch and alive-count; two entries with distinct per-entry components booting side by side; a WASI clock override reaching the booted guest via a pinned wall-clock readback; an unknown module capability and an unregistered adapter kind each refusing before compile; a component with no manifest anywhere refusing on the discovery path; a nonexistent explicit manifest path refusing by name; a wired extension claiming a manifest section that an unwired one refuses; expect_refusal panicking when boot succeeds; the scenario store living under the scenario directory; entries carrying their component, manifest and operator grants through split(); and the ManifestSource resolve/From conversions round-tripping for Beside, an explicit path and inline TOML.

AI Assistance

Implement claude-fable-5, red-team claude-opus-5, PR claude-sonnet-5

@mfw78
mfw78 force-pushed the refactor/t1-test-manifest branch from 67ddd6b to 9d2b291 Compare August 5, 2026 04:27
@mfw78
mfw78 force-pushed the refactor/t2-boot-scenario branch from 4f28f18 to 8e52b74 Compare August 5, 2026 05:04
@mfw78
mfw78 force-pushed the refactor/t1-test-manifest branch from 9d2b291 to 0a3e96b Compare August 5, 2026 05:53
@mfw78
mfw78 force-pushed the refactor/t2-boot-scenario branch from 8e52b74 to a86fe8e Compare August 5, 2026 05:53
@mfw78
mfw78 force-pushed the refactor/t1-test-manifest branch from 0a3e96b to ae5496b Compare August 5, 2026 06:37
@mfw78
mfw78 force-pushed the refactor/t2-boot-scenario branch from a86fe8e to 3886080 Compare August 5, 2026 06:37
@mfw78
mfw78 changed the base branch from refactor/t1-test-manifest to main August 5, 2026 07:10
mfw78 added 3 commits August 5, 2026 07:11
Collapse the tempdir, write-manifests, engine-config and boot ritual
into one builder over the real Supervisor::boot path, with chains,
state_dir and clock knobs, a temp-redb plus empty-pool component
default, and a Refusal wrapper that centralises error-chain contains
assertions behind names and lacks.

AI Assistance: Claude (Fable 5) used for implementation and tests
Promote ManifestSource out of the harness so one enum covers a written
manifest, an explicit path that may not exist, and no path at all, which
is what the discovery refusals need; the harness now shares it instead of
keeping a private copy. Give each entry its own component and, for an
adapter, its operator http and messaging grants, so a multi-component or
granted-adapter boot is expressible. Add the limits and extensions knobs,
wiring extensions to both the linker and the boot gates. Drop the
duplicate RedbTypes lattice for the CoreRuntime preset, and drop the
chains default and knob: Supervisor::boot reads only modules, adapters
and limits, so the table was inert and its tests tautological. Pin the
clock override on the guest reading back the wall time it booted under,
replacing an assertion that held whether or not the override threaded.

AI Assistance: Claude Opus 5 used for red-team review, the rework, and mutation testing
AI Assistance: Claude Fable used for the comment sweep.
@mfw78
mfw78 force-pushed the refactor/t2-boot-scenario branch from 3886080 to 8319dda Compare August 5, 2026 07:12
@mfw78
mfw78 merged commit 3d723a1 into main Aug 5, 2026
4 checks passed
@mfw78
mfw78 deleted the refactor/t2-boot-scenario branch August 5, 2026 07:28
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