Repository navigation
Implementation plan: morphir-host Phase A, part 2 (native channels, probe, CLI one-shot calls) #983
Replies: 12 comments
Task 1:
|
Task 2: Move the negotiation rules into
|
Task 3: Move the describe probe into
|
Task 4: Create
|
Task 5:
|
Task 6:
|
Task 7: Result validation,
|
Task 8: CLI probe and publish describe through
|
Task 9: CLI one-shot calls through
|
After part 2Start the part 3 plan from these facts:
|
Part 2 shipped
Changes to the plan during execution
Carried into part 3
|
|
This plan is complete. Further tracking of the host library work is in beads ( |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
morphir-host Phase A, part 2: native channels, probe, and CLI one-shot calls Implementation Plan
This discussion is the implementation plan for Phase A, part 2 of the host library work. Design: #949 (checkpoints 5, 6, 10, 14 and 18). Part 1 plan and its rulings: #976. Tracking: epic #958, Phase A #959.
The body holds the overview. Each task is a separate comment below, in order.
Goal: Put the process, Extism, and in-process native transports behind
morphir_host::Channelin a new cratemorphir-host-native, move the describe probe and the negotiation checks intomorphir-host, and run every CLI one-shot extension call (compile, generate, workspace discovery, install probe, publish describe, configured providers) throughmorphir_host::Session.Architecture:
morphir-hoststays portable. It gainsChannel::abort,ExpectedChecks(the daemon's full negotiation rules, moved), anddescribe(the install probe with session fallback, moved). The new cratemorphir-host-nativeowns everything that needs tokio processes, Extism, or non-portable validation crates:ProcessLaunch, framing, staging,ProcessChannel,ExtismChannel,NativeChannel, result validation, andactivate.morphir-daemonkeeps its public API and delegates to both crates. The umbrella CLI then drops its typestate one-shot paths. The workbench session pool and the provider registry stay on the daemon until part 3.Tech Stack: Rust 2024 (
rust-version = "1.98"), tokio (process,io-util,time,rt),extism1,tempfile3,semver1,async-trait0.1,morphir-extension-sdk,morphir-core,morphir-distribution,morphir-workspace.Spec: design record #949, checkpoints 5, 6, 10, 14 and 18 (local
.dev/docs/superpowers/specs/2026-09-23-morphir-host-library-design.md). Part 1 plan and its rulings: #976. Tracking: epic #958, Phase A #959, finos/morphir-rust#237 (rest), finos/morphir-rust#240 (transports part), #963 (rest).Status: All tasks done. See the closing checkpoint comment.
Scope of this plan
In part 2:
morphir-host:Channel::abort,impl Channel for Box<C>,ExpectedChecksand the expectation types, anddescribe.morphir-host-native(checkpoint 18): process launch, framing and staging,ProcessChannel,NativeChannel,ExtismChannelwith the Extism container, result validation,CheckedConnection, andactivate.morphir-daemondelegates to the moved code. Its public API does not change.ProcessMep,WasmMep), native MEP providers, and the workbench workspace provider run throughmorphir_host::Session.Part 3 gets its own plan:
RegistryandGuestSource, and provider resolution out ofExtensionRegistry(CLI Structure #238).Pool, and the workbench leavessessions.rsandSessionHandle(CLI Structure #239).morphir-daemondrops its typestate session and actor, and removesExtensionResponseExt(re-install npm #240 rest).Decisions this plan makes inside the spec
Channelgainsabortwith a default that callsclose. Part 1 usedclosefor both an orderly close afterexitand an abort after a protocol failure. A process channel must kill its child on abort, but wait for it on close. Waiting after a failure would hang for the full request timeout.describelives in portablemorphir-host, not inmorphir-host-native. It needs only the SDK andsemver, so a browser host can probe too.morphir-host-native, because it needsmorphir-coreandmorphir-distribution.CheckedConnectionwraps anyGuestConnectionand applies it. A validation failure closes the session in order, the same way a decode failure does (part 1 ruling R6). The daemon aborted instead. Both end the session and report the error.MorphirHostFunctions) are stubs today. They move unchanged. This plan does not implement them.NativeDirectcalls (typed Rust calls on built-in providers) as they are. They are not MEP sessions.Global Constraints
ecosystem/morphir-rust/crates/morphir-host(portable) andecosystem/morphir-rust/crates/morphir-host-native(new). Workspace members arecrates/*. Addmorphir-host-nativeto rootdefault-members, to the README crate table, and to every.github/ci-impact.tomlcrateslist that namesmorphir-daemon(part 1 lesson:classify.pyonly testsdefault-members).morphir-hostmust still passcargo check -p morphir-host --target wasm32-unknown-unknownand must not depend on tokio (except as a dev-dependency),morphir-daemon,morphir-host-native,morphir-distribution,morphir-core, or any language binding.morphir-host-nativemust not depend onmorphir-daemon.morphir-daemondepends onmorphir-host-native.MaybeSendplus pairedcfg_attr(async_trait)pattern.morphir.initialize(id 1), calls (ids 2, 3, ...),morphir.shutdown,morphir.exit.morphir.extension.describe(id 1). Fallback:morphir.initialize(id 2),morphir.initializednotification,morphir.extension.capabilities(id 3),morphir.shutdown(id 4), thenmorphir.exit.Content-Length: {len}\r\n\r\n{json}.Provider '{provider}' rejected '{method}': {error},Provider '{provider}' failed during {operation}: {error},Failed to start provider '{provider}': {error}.Co-Authored-By.--test-threads=1when judging a failure.Review Focus
a_protocol_failure_aborts_rather_than_closesand the task 5 testabort_kills_the_child_without_waiting.exit. The daemon's processterminatesentmorphir.exititself.JsonRpcConnection::closenow sends it throughsend, soProcessChannel::closemust not send another. Pinned by the task 5 testclose_after_exit_waits_without_a_second_exit.fallback_uses_the_released_ids_and_orderand by the host compatibility suite in task 9.generate_rejects_traversal_from_an_installed_provider_without_writing, already in the umbrella).verified_bytes_stage_under_the_explicit_managed_directoryand the umbrella teststaging_is_private_under_home_and_removed_after_success_or_failure.File map
finos/morphir-rust (
ecosystem/morphir-rust/):crates/morphir-host/src/channel.rsChannel::abort,impl Channel for Box<C>crates/morphir-host/src/jsonrpc.rsaborton failurecrates/morphir-host/src/testing.rsMemoryChannelcounts abortscrates/morphir-host/src/expected.rsExpectedExtension,PersistedExtensionCapabilities,CapabilityExpectation,ExpectedChecks,validate_negotiation(moved)crates/morphir-host/src/probe.rsdescribe,Description,DescriptionSource,permits_fallback,check_capability_kinds(moved)crates/morphir-host-native/Cargo.tomlcrates/morphir-host-native/src/lib.rscrates/morphir-host-native/src/process/{mod.rs,launch.rs,frame.rs,stage.rs,child.rs,channel.rs}ProcessChannelcrates/morphir-host-native/src/native.rsNativeChannelcrates/morphir-host-native/src/extism/{mod.rs,container.rs,host_functions.rs,channel.rs}ExtismChannelcrates/morphir-host-native/src/results.rsCheckedConnectioncrates/morphir-host-native/src/activate.rsactivate,ActivatedGuestcrates/morphir-daemon/src/extensions/**finos/morphir (umbrella):
crates/morphir/Cargo.tomlmorphir-host-nativecrates/morphir/src/extensions.rsmorphir_host::Sessioncrates/morphir/src/extensions/guest.rsCliErrorcrates/morphir/src/commands/extension/probe.rs,commands/extension.rsdescribethroughProcessChannelcrates/morphir/src/commands/ui/provider/extension.rscrates/morphir/tests/support/process_bundle.rsdescribethroughProcessChannelBranches and pull requests
origin/mainin the submodule checkout (git -C ecosystem/morphir-rust switch -c feat/morphir-host-native origin/main). One PR after a whole-branch review. It refers to Adding badge for LCR interactive #237 and re-install npm #240.origin/mainafter that PR merges and main CI passes on the merge commit. Pin the submodule to the merge commit. The PR refers to feat(cli): run compile, generate and probe through morphir-host #963 and Phase A: host library in the CLI #959.Tasks
Channel::abortand boxed channels (done)morphir-hostasExpectedChecks(done)morphir-host(done)morphir-host-nativewith process launch, framing and staging (done)ProcessChildandProcessChannel(done)NativeChannelandExtismChannel(done)CheckedConnection, andactivate(done)morphir_host::describe(done)morphir_host::Session(done)All reactions