master now builds the factory's Canvas leaf directly and inserts it into the
detached split, instead of calling workspace.createLeafInParent(). The check
script's stand-in WorkspaceSplit gains insertChild, and the fake workspace
drops the createLeafInParent it no longer needs. All 21 mount plan checks and
the call site checks pass on the merged tree.
Events that used to be sequenced with timers now land on a named poll of the
wait, through the injected delay, so each block asserts the poll it ended on
rather than an elapsed time. The one block whose subject is elapsed time, the
slow real factory, still runs against the clock.
The wiring checks pinned where the dispatch sits and how it cancels, but
not what else the effect does beside it. A readiness read in the effect's
own body (an early return onto the workspace leaf, or a ternary choosing
it) restores the whole-file leaf on a slow start while every existing
check stays green, and so does a direct createNode() or
mountWorkspaceLeaf() call next to the dispatch, which mounts a second
host. Reject both: the effect may not name canvasNodeFactory outside the
closures it hands the helper, and may not call either mount path itself.
Counting reads made the cap blocks stop discriminating: the cap is a
wall-clock quantity, so readiness has to land after real elapsed time for
its expiry to be the thing under test. Both are green at base again without
them.
The mount-plan checks had grown a case per scenario with narrated assertion
labels, so the three scripts read as a patch history rather than as a
description of the behaviour. Table the cases that share a shape, name each
block for what it pins, and run them through the same per-block runner the
lifecycle checks already use, so an arm that reintroduces one defect reports
every block it breaks instead of stopping at the first.
Sequencing by wall clock goes with it: the hosts now ready, give up or
cancel on a counted read, which is what the poll loop actually observes.
Only the two blocks whose subject is elapsed time still use timers. Drop the
helper JSDoc, the issue numbers the squashed commit will carry anyway, and
the comments arguing the implementation is correct rather than recording the
contract.
The declaration check counted `let effectCancelled = false;` in the whole
file, so moving the sole declaration to module or component scope still
satisfied it while leaving a flag shared by every invocation: one
embeddable's cleanup then cancels the mount that replaced it, which is the
regression the flag exists to prevent. Parse the effect instead and require
the declaration's enclosing function to be the effect itself.
Reading the syntax tree also replaces the text heuristics for the other
wiring rows: the dispatch must be a statement of the effect's body and the
whole of its expression, which rejects an `if` gate and an `&&` operand
directly rather than by inspecting the preceding line.
The mount wait's consumer was covered through the injected host interface, but the three sites that settle whenInitialized -- initialize() succeeding, its catch, destroy() -- were only read. Aliasing the two modules the factory imports but does not exercise lets it run under node, so the producer side and the real factory through the real dispatch are executed too.
Seven discriminating checks and three controls for the lifecycle wait and
the superseded-mount latch, plus call-site assertions requiring the
dispatch to consult this invocation's own cancellation flag and the
cleanup to raise it before its early returns.
A subpath embed fell back to a whole-file workspace leaf whenever the
factory took longer than the two second cap to initialize. Startup can
legitimately outlast it: layout ready polls up to 50 x 50 ms before
initialize() is called, and initialize() then awaits the core canvas
plugin's load, so the cap cannot tell a slow start from one that will
never finish. CanvasNodeFactory now exposes whenInitialized, settled on
every terminal path, and the wait uses it; the cap remains only for a
host that reports no lifecycle.
Cancellation also latches per dispatch, so a mount superseded by a link
change cannot mount over its replacement once the shared refs are
repopulated.
The call-site check accepted a dispatch re-gated on
view.canvasNodeFactory.isInitialized(), which skips the wait inside
mountEmbeddableHost and restores the whole-file workspace leaf while both
check scripts stayed green. Require the dispatch to be reached
unconditionally.
Also pin the boundaries the existing rows only reached by argument: a zero
timeout, an undefined subpath, a null extension, a factory that never
appears or is torn down mid-wait, the synchrony of both fast paths, a
teardown landing as the factory readies, and concurrent embeddables.
The mount-plan checks exercise the helper only, so removing the dispatch
from the mount effect and keeping the helper leaves them green while the
back-of-the-note embeddable regresses to a whole-file workspace leaf.
Check the wiring against the source of the effect, which cannot be
imported here because it pulls in the types-only obsidian package.
The first version of the regression test used node:test inside src/, which
the repository's own lint rejects there: src/ is runtime code that must work
on mobile and in popout windows, so node built-ins and bare timers are
banned. Follow scripts/check-*.mjs instead - jiti-imported TypeScript with
node:assert, outside the linted source tree - and inject the wait primitive
so the module can still default to Obsidian's sleep global.