The app-mount seam: visor/frame/mount.ts, every caller moved onto it - #147
Merged
Conversation
One function stands a component up on a sandboxed surface and hands back what a visor needs to drive it — the frame element, the exports (every method a Promise, serialized through the runner the caller no longer sees), setRoute, suspend/resume, destroy. Implemented over today's internals, semantics unchanged: createFrameBackend, createSurface, instantiate and createRunner are now named in exactly one place. Why now: #142 validated moving the wasm instance INTO the frame (surface bound to the frame's real DOM; every other import a MessagePort proxy). That is a wholesale change of internals and no change to what a mount provides, so the internals go behind a seam first, and the swap that follows touches no caller. It is also the seam a visor-as-component embedder would call. Callers: demo.ts mountApp and mountPanel, solo.ts mountApp, and the todomvc spike's `frame` kind (the three same-realm harness kinds are untouched). Two options exist because callers already had the semantics and the plain seam could not express them, each recorded at its declaration: `signal` — mountPanel tears a mount down while it is still mounting and awaits the completion, so an in-flight mount must be abortable and settle (the rejection is the frame backend's own, which the generation counter already distinguishes from failure); `afterEvent` — the panel's live binding re-reads destination() after every pumped event (#22 rule 2). Every generation check in mountPanel keeps its comment. check-invariants.sh's frame-seam scans now cover mount.ts. The todomvc spike's import map gains @polyengine/runtime/embedder as a second name for the same sibling file, so shared code and the demo spell the embedder the same way. Gates: deno check (demo, spikes/todomvc); check-invariants 9/9; spikes/todomvc e2e 5/5; demo e2e 36/36 with zero scenario edits, run locally on arm64 with a linux-arm64 MinIO in engine/.deps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step A of #142's design: one function,
mountApp, stands a component up on a sandboxed surface and returns the frame, the exports (every method a Promise, serialized through a runner the caller no longer sees),setRoute,suspend/resume,destroy. Implemented over today's internals — a pure refactor. Step B swaps the internals (instance inside the frame, imports over ports) without touching callers.Callers moved:
demo.tsmountApp+mountPanel,solo.tsmountApp, the todomvc spike'sframekind.createFrameBackendhas one caller left (mount.ts).Two options beyond the minimal seam, each because a caller already had the semantic (reasoning at the declaration):
signal—mountPaneltears down in-flight mounts and awaits completion;afterEvent— the panel's live binding re-readsdestination()after each event (#22 rule 2).Gates:
deno checkboth consumers;check-invariants.sh9/9 (now scanningmount.ts); spikes/todomvc e2e 5/5; demo e2e 36/36, zero scenario edits (run locally with a linux-arm64 MinIO inengine/.deps— theminiorecipe fetches amd64 only, a papercut for another PR).Automerge armed.