Skip to content

fix(runtime): epic train follow-ups#195

Open
mfw78 wants to merge 1 commit into
feat/m0-runtime-presetfrom
fix/m0-train-followups
Open

fix(runtime): epic train follow-ups#195
mfw78 wants to merge 1 commit into
feat/m0-runtime-presetfrom
fix/m0-train-followups

Conversation

@mfw78

@mfw78 mfw78 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This is a test-only follow-up to the epic train, adding coverage the prior PRs in the stack left as gaps: builder assembly, add-on install ordering, and runtime handle shutdown/wait semantics.
Closes #79.
This is part of the epic #79 train and merges in stack order, so it should land after its base, feat/m0-runtime-preset, and before any further train PRs.

Changes

  • crates/nexum-runtime/src/runtime/task.rs: TaskSet::shutdown now tallies each handle's join outcome (clean versus aborted) into a debug! summary while keeping the existing abort-then-join drain unchanged.
  • crates/nexum-runtime/src/builder.rs: a terse rustdoc note marking LaunchContext.data_dir as advisory and unused by the pre-built launcher.
  • crates/nexum-runtime/src/addons.rs, crates/nexum-runtime/src/builder.rs, crates/nexum-runtime/src/host/component/builder.rs, crates/nexum-runtime/src/runtime/task.rs: eight new tests covering ComponentsBuilder::build opening the core backends, add-on install running exactly once before boot, an invalid bind_addr rejection on the Prometheus add-on, the runtime handle's clean-completion and aborted-termination wait() outcomes, the handle's shutdown-trigger-to-wait path, a mixed clean-and-pending drain of TaskSet::shutdown, and a smoke test locking the preset launch path through RuntimeBuilder::new(...).runtime::<CoreRuntime>().launch().

Test plan

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features --no-fail-fast (all in-tree module wasms built first; the cow_boot and runtime supervisor end-to-end tests ran against the real wasms, not skipped)
  • The eight new tests individually confirmed present and passing

Notes for reviewer

Several items collected against this train remain deliberately deferred, each with no consumer in this diff, so they are follow-ups rather than gaps in this PR: abstracting TaskHandle/TaskExit off tokio and giving the event loop its own completion label instead of reusing TaskExit::ReceiverGone; threading the executor from the CLI or launch root; a typed BuildError enum for ComponentBuilder::build; renaming RuntimeAddOns to the singular RuntimeAddOn; migrating examples/embed.rs onto the type-state builder once RuntimeHandle can hand back the log read-handle; and a Runtime::extensions() linker-hook provider, which blocks on a ReferenceRuntime preset landing in shepherd-cow-host.

The add-on install-ordering test uses a stub add-on for the count and ordering assertion, and drives the invalid-bind_addr path directly against the real PrometheusAddOn, because that add-on installs a process-global metrics recorder that can be set only once per test binary; the invalid-address path errors at parse time before touching the recorder, so exercising it directly is safe.

The aborted-termination wait() test uses a deliberately aborted task rather than a panicking one as the fault proxy, since both yield the same JoinError outcome and panicking a spawned task risks tripping nextest's spawned-panic failure mode.

The bootstrap::run shim has no in-tree callers today (the CLI uses RuntimeBuilder directly and the embed example uses the preset); it is left in place as a public surface for the epic to reconcile rather than removed in this follow-up.

AI Assistance: Claude Code (Opus 4.8 implementation and adversarial review, Sonnet 5 PR authoring) used for the full change.

… semantics

Close the runtime-verification gaps left open across the M0 launch train:

- Drive ComponentsBuilder::build end-to-end so the backend assembly, data
  directory creation, and log pipeline sizing run at launch, not just typecheck.
- Exercise the preset shortcut and the AssembledRuntime launch path at runtime,
  asserting a bad config bails and add-ons install once before boot.
- Lock RuntimeHandle semantics: clean completion resolves Ok, the shutdown
  trigger drives wait to return, and an abnormal task stop surfaces the error.
- Assert an invalid metrics bind address surfaces the wrapped error at install.

Also summarise drained reconnect-task exit reasons at debug for soak diagnosis,
and note that LaunchContext.data_dir is advisory for the pre-built launcher.
@mfw78 mfw78 force-pushed the feat/m0-runtime-preset branch from fdd03a5 to f7c4c52 Compare July 5, 2026 16:25
@mfw78 mfw78 force-pushed the fix/m0-train-followups branch from bae8eab to 077f605 Compare July 5, 2026 16:25
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