Repository navigation
Implementation plan: morphir-host Phase A, part 3 (Registry, Pool, CLI off the daemon session) #992
Replies: 11 comments
Task 1: Keep the cause of a channel failureFiles:
Interfaces:
|
Task 2:
|
Task 3:
|
Task 4:
|
Task 5: CLI registry and one-shot calls on host sourcesAfter the morphir-rust PR merges. Umbrella branch from Files:
Interfaces:
|
Task 6: Workbench through
|
Task 7: Compatibility suites, CHANGELOG, PR
|
After part 3Part 4 (daemon cleanup) starts from: |
|
Tasks 1 to 4 shipped in finos/morphir-rust#271 (squash-merged as 8c10fe6): |
|
Part 3 is complete. Merged pull requests:
What changed for users: the Deferred to part 4:
|
|
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 3: Registry, Pool, and the CLI off the daemon session Implementation Plan
This discussion is the implementation plan for Phase A, part 3 of the host library work. Design: #949 (checkpoints 5, 10, 14, 18 and 19). Earlier plans: #976 (part 1) and #983 (part 2). Tracking: epic #958, Phase A #959.
The body holds the overview. Each task is a separate comment below, in order.
Goal: Resolve providers with a portable
morphir_host::Registry, reuse workbench guests with a portablemorphir_host::Pool, keep the daemon's error texts across channels, and move every remaining CLI extension path offmorphir-daemon's registry, typestate session, and actor.Architecture:
morphir-hostgainsRegistry, theGuestSourcetrait,Resolved, andPool<K>(checkpoints 5, 14, 19). It depends onmorphir-corefor IR version matching and stays wasm32-clean.morphir-host-nativegainsNativeSource(next toNativeChannel) andInstalledSource.ChannelErrorgains acause, so a transport failure that began as an I/O or JSON error keeps its text at the daemon boundary (part 2 ruling R8). The umbrella CLI builds amorphir_host::Registry, calls resolved sources, and serves the workbench throughPool. After this plan the CLI depends onmorphir-daemononly forDaemonErrortext mapping; part 4 removes the daemon's registry, typestate session, actor, and transport copies.Tech Stack: Rust 2024 (
rust-version = "1.98"),async-trait0.1,async-lock3 (portable async mutex),morphir-core(format versions),morphir-distribution,morphir-common,morphir-extension-sdk, tokio (tests and native only).Spec: discussion 949, checkpoints 5, 10, 14, 18, 19 (local
.dev/docs/superpowers/specs/2026-09-23-morphir-host-library-design.md). Part 1 plan #976, part 2 plan #983 and their closing checkpoints. Tracking: epic #958, Phase A #959, finos/morphir-rust#238 (Registry), finos/morphir-rust#239 (Pool), #963 (rest).Scope of this plan
In part 3:
ChannelErrorandHostError::Channelcarry acauseso I/O and JSON texts survive (part 2 R8).Registry,GuestSource,Resolved,ProviderMetadata,ProviderOrigin,InvocationPolicy,InvocationMode,CapabilityMetadataScopeinmorphir-host, ported from the daemon with the same rules and texts.NativeSourceandInstalledSourceinmorphir-host-native.NativeSourcestays native because in-process guests run on a blocking worker (spawn_blocking), asNativeChanneldoes.Pool<K>inmorphir-host, with the 8 behaviours of the workbench'sSessionReuseInvoker.extension list, playground catalog, workbench invoker, and the UI workspace provider move to the host crates.builtin_provider,open_*_session,open_loaded,installed_loaded,session_failure,failed_session_message, andui/provider/sessions.rsare deleted.Part 4 gets its own plan: delete the daemon's
ExtensionRegistry, typestateSession, kameo actor,ExtensionSession/SpawnedProcessSession/SpawnedProcessTransport,ExtismTransport,NativeMepTransport,activate_transport,ExtensionResponseExt, and moveConnectedDaemonSessionto an HTTPChannel. Those are now used only insidemorphir-daemonand its tests.Decisions this plan makes inside the spec
GuestSourceis a trait with oneconnectmethod that returns a boxedGuestConnection. The registry never activates anything itself.Poolis keyed by provider id and stores a fingerprint ("{id}@{version}:{origin:?}:{mode:?}", as today). ACallError::Failedplays the role of the daemon'sSessionLost: evict, reopen once, retry once.CallError::Rejectedkeeps the session.HostError::Invalid(text)with the daemon's texts. At the CLI boundary they pass throughDaemonError::from, so theExtension error:prefix stays (part 2 R6).ChannelCause::{Transport, Io, Json}.From<HostError> for DaemonErrormaps aChannelerror with causeIoorJsontoDaemonError::Other(anyhow!(message)), whose display is the message unchanged, so the CLI printsIO error: ...again instead ofExtension error: IO error: ....Global Constraints
morphir-hostmust passcargo check -p morphir-host --target wasm32-unknown-unknownand must not depend on tokio (except dev),morphir-daemon,morphir-host-native,morphir-distribution, or any language binding. It may depend onmorphir-core(checkpoint 19) and a portable async mutex (async-lock).morphir-host-nativemust not depend onmorphir-daemon.MaybeSendplus the pairedcfg_attr(async_trait)attributes.IO error: .../JSON error: ...texts part 2 R8 changed.abandonafter a timeout, replacement when the provider fingerprint changes, one-shot calls for direct (native typed) providers, the 120 s invocation timeout.Co-Authored-By. Plain English docs, no em dashes.--test-threads=1.Review Focus
provider_registrytests tomorphir-hostin task 2.IO error: ...throughDaemonError::from.InstalledSource::connectmust return the sameCheckedConnectionasactivate. Pinned by the task 3 parity test and the traversal test in the umbrella.Poolthat block unrelated providers. Pinned by the task 4 testa_slow_provider_does_not_block_another.File map
finos/morphir-rust (
ecosystem/morphir-rust/):crates/morphir-host/src/channel.rs,src/error.rsChannelCause,causeonChannelErrorandHostError::Channelcrates/morphir-host/src/registry.rs,src/registry/types.rsRegistry,GuestSource,Resolved, metadata and policy typescrates/morphir-host/src/pool.rsPool<K>crates/morphir-host/tests/registry.rs,tests/pool.rscrates/morphir-host-native/src/installed.rs,src/native.rsInstalledSource,NativeSourcecrates/morphir-daemon/src/error.rsFrom<HostError>keeps I/O and JSON textsfinos/morphir (umbrella):
crates/morphir/src/extensions.rs,src/extensions/guest.rsResolvedcrates/morphir/src/commands/{compile.rs, compile/prepare.rs, generate.rs, extension.rs}morphir_hostregistry typescrates/morphir/src/commands/ui/provider/playground.rscrates/morphir/src/commands/ui/provider/pool.rsPooledInvoker(replacessessions.rs)crates/morphir/src/commands/ui/provider/extension.rsInstalledSource, with a testBranches and pull requests
origin/main(feat/morphir-host-registry-pool). One PR after a whole-branch review. Refers to CLI Structure #238, CLI Structure #239.origin/mainafter that PR merges. Pin the submodule to the merge commit. Refers to feat(cli): run compile, generate and probe through morphir-host #963, Phase A: host library in the CLI #959.Tasks
RegistryandGuestSourceinmorphir-host,NativeSourceinmorphir-host-nativeInstalledSourceinmorphir-host-nativePool<K>inmorphir-hostPoolAll reactions