Skip to content

runtime: fold the preset launch-surface into the seam generalization #273

Description

@mfw78

Problem. The Runtime preset trait is too narrow for two composition paths, so neither can use the runtime::<R>() shortcut and both wire assembly the long way:

  • Linker extensions. The trait bundles only components and add-ons, so a preset that also needs a linker Extension (the cow-api capability namespace) is inexpressible. nexum-cli wires the long way purely to attach with_extensions([extension::<ReferenceTypes>()]).
  • Pre-built instances. components()/add_ons() are static factories that build from config, so a preset cannot hand back an already-built, programmable instance. A testing MockRuntime preset that returns pre-wired mock chain/store handles is therefore impossible; the mock path uses a Prebuilt<T> component-builder through ComponentsBuilder::new instead, bypassing the preset trait.

Current. trait Runtime { type Types; type ChainBuilder; type StoreBuilder; type ExtBuilder; fn components() -> ComponentsBuilder<..>; fn add_ons() -> AddOns; }. The Ext/ExtBuilder slot is a component backend payload (RuntimeTypes::Ext), not the linker Extension; extensions are supplied separately by the caller, and every component is built from config rather than accepted pre-built.

Change. Decide how far the preset trait should stretch: an fn extensions() provider so a domain preset carries its full launch surface, and/or a pre-built-instance path so a preset can hand back owned, already-wired components. Weigh against #94's position that the preset marker is deliberately not the vehicle for every assembly, and note the mock ergonomics are already met by the harness plus Prebuilt<T> (a MockRuntime preset would be a shortcut, not a functional gap).

Consumers.

Files. crates/nexum-runtime/src/preset.rs, crates/nexum-runtime/src/builder.rs (the PresetBuilder stage).

Risk / size. M; a trait-surface addition plus a design decision.

Depends on. #93. Relates to #80, #274.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/engine-runtimewasmtime runtime: instantiation, fuel, epoch, ResourceLimitercomponent/lifecyclemodule FSM: restart policy, poison-pill, resource enforcementdxDeveloper experience is suffering.needs-designRequires thinking. No one has bandwidth.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions