mirror of
https://github.com/penpot/penpot.git
synced 2026-11-20 00:50:34 +00:00
16 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3643d6fb7b |
🐛 Fix component sync, reset and update main
Fixes in the sync of copies from their mains, in reset and in update main
(Phase 3c).
- Undo a token sync to the tokens a copy shape had.
The token sync of a copy shape wrote, as its undo, the shape's tokens read
with an empty map as default, so undoing the sync of a main's token gave a
copy shape that had none an empty :applied-tokens map instead of no map
(F55). The undo now writes the value the shape had.
Case AY no longer marks its round trip as a known failure; both golden
masters record the round trip without failures in the two variants that
hit it.
- Reorder a copy's children with the fewest moves and exact undo.
When a main reordered its children, sync wrote a move for every copy child
the walk found out of place, from its position in the copy's original list
to its main's index:
- once one child was out of place, every following pair was too, so a main
with 1,000 children that moved its first one to the end wrote 999 moves
per copy, quadratic in the children (F85);
- :mov-objects inserts before the index of the list that still holds the
shape, so a move to a later place landed one short, and the undo, which
used the original position, did not put the child back: undoing a
reorder in a main left its copies reordered (F41).
The walk now syncs the pairs, removals and additions first, and then moves
the copy's children, as those changes left them, into their main shapes'
order: the longest run already in order stays, and each other child moves
right after the one before it in the main's order. Each move is computed
on the order the moves before it left, so its index is exact, and its undo
puts the child back after its old neighbour.
The update main walk keeps its moves: the copy's order differs from the
main's only after F41's undo, as the UI never reorders a copy.
comp-sync-test: a reorder in a six-child main moves each displaced copy
child once, gives the main's order, and undoes exactly. Cases F, AG and AO
no longer mark their round trip as a known failure; both golden masters
record it without failures.
- Remap a main's grid cells after the update main pairs children.
An update main from a copy of a grid main pushes the copy's cells into the
main, with each copy child mapped to its main shape. The cells were
remapped before the children walk, when a swapped copy child still
referred to the main child it replaces; the walk then removed that child
and added a new main child for the swapped one. The main's cell kept the
removed child's id and the new child was in no cell (F49); the next sync
of the copy took that broken cell back.
The cells are now remapped after the walk: each copy child goes with the
main shape the walk added for it, or else with the one it refers to.
Case AK no longer pins F49: with a swap, the main's third cell holds the
new main child, the main takes the copy's cells as they are (the swap had
made the first one manual), and the copy keeps its child in the third
cell. Both golden masters record that.
- Add update main's new main shapes and their undo in the main.
When update main pushes a copy child the main lacks (a swapped child), it
adds a copy of it to the main (F102):
- the refit of the groups around it was a :reg-objects that named the
component, which reaches only a deleted component's stored shapes, so a
group in the main kept its old bounds;
- the undo deleted the new shapes from the copy's page, so when the main
sat on another page the undo left them in the main.
The new shapes, the refit of their parents and the undo of both now go to
the main's container; undoing deletes the new shapes and refits the
parents again.
The case AM setup and the new test fit their groups to their children, as
the editor does; an unfitted group's size is one the refit cannot give
back on undo. Both golden masters record case AM with the fitted groups.
comp-sync-test: an update main from a copy on one page into a main on
another fits the group around the pushed copy, and undo gives the main
back.
- Sync flips with the rest of the geometry.
A flip changes a shape's transform, points and selrect, which sync and
touch as geometry, and toggles :flip-x or :flip-y, which were not in
sync-attrs: when a main flipped a child, its copies took the flipped
transform but kept their old flip flags, which the renderers and the
placement of swapped shapes read (F38). A flip on a copy touched geometry
through the transform all the same.
:flip-x and :flip-y now sync and touch as :geometry-group.
comp-sync-test: a copy follows its main's flip, flags and transform,
untouched.
- Reset a nested copy of a flex board keeping its children.
Sync gives each child of a copy of a flex board the flex child attributes
(margins, sizing, z-index, ...) of the main child it refers to. It looked
that child up in the copy head's own component; for a nested copy that is
not where its children's mains are (they are the children of the nested
copy in the outer main), so the lookup gave nil, and a reset, which copies
every attribute, wrote nil into all of them (F103). A child with no main
was written nil the same way.
The lookup now uses the container the walk reads the main shapes from,
where every child's :shape-ref points, and a child with no main shape is
left as it is.
comp-reset-test: resetting a nested copy of a flex board keeps its child's
margin (with a grid board too, whose children F15 leaves).
- Sync layout child attributes of the children of grid mains.
Sync and update main copy the layout child attributes of a board's
children (margins, sizing limits, z-index, absolute position, align-self)
from the shapes they pair with, but only when the main was a flex board:
the children of a grid main never got them, so a margin set on a grid
main's child never reached its copies (F15). Grid boards now go through
the same step, renamed update-layout-children.
comp-sync-test: a copy follows the margin its grid main gives a child.
comp-reset-test checks the reset of a nested grid copy keeps it too.
- Clear remote-synced when a nested copy is reset.
A reset makes a copy equal to its near main, but the reset of a nested
head marked every shape below the copy root :remote-synced, the mark of a
shape last synced from a remote main. Update main reads that mark: it
gives the main the copy's overrides only for shapes without it, and
otherwise clears the main's touched groups. So after resetting a nested
copy, an update main from the top copy cleared the overrides of the nested
copy in the main, which the next sync from its own component then
overwrote (F13).
A reset now clears the mark, as the shapes follow their near main.
comp-reset-test: after a reset of a nested copy, an update main from the
top copy keeps the fill override of the nested copy in the main. Both
golden masters record case AB without the marks.
- Check that a nested copy keeps its constraints.
A copy of one component dropped into another's main, whose constraints the
outer main then sets, keeps them, in that main and in its copies, when the
inner component's main is edited: the setting is an override of the nested
copy. The test guards it; the reset of the constraints a drop writes,
which looked like a loss (F45), changes nothing a user sees, as nil means
the same left/top.
- Undo a library typography sync to the text's measured layout.
The library color and typography syncs rewrite a text's content and clear
its :position-data, so the text is measured again. Their undo put back the
old content but cleared the position data too, so an undone sync left the
text unmeasured (F90). The undo now writes back the position data the text
had.
library-asset-sync-test: undoing a typography sync gives back the font
size and the position data.
- File the copy's relinks of an update main with the copy's file.
Update main from a copy of a library component writes some changes in the
library (the main) and some in the copy's file; the frontend commits each
part to its file, telling them apart by the changes of the copy shapes the
walk visited (F9). A swapped copy child is not visited: update main adds a
main shape for it and relinks the copy shapes to it, and those relinks,
changes of the copy, went with the library's changes. The shapes it
relinks now count as the copy's.
comp-sync-test: pushing a swap from a copy of a library component keeps
every change of the copy's shapes in the local part.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 16.9 / 0.48
edit-through-a-chain-of-dependents 68.9 / 33.0 / 0.48
library-update-into-copies 83.1 / 40.9 / 0.49
main-edit-among-many-shapes 4.8 / 2.3 / 0.48
main-edit-into-10-copies 1.8 / 0.8 / 0.45
main-edit-into-100-copies 15.4 / 7.8 / 0.51
main-edit-into-1000-copies 153.1 / 82.2 / 0.54
variant-switch-into-copies 32.1 / 18.2 / 0.57
AI-assisted-by: claude-opus-5-5
|
||
|
|
b5aa49801f |
🐛 Check and commit plugin component calls as the UI does
- The UI offers swap and reset only on copy heads, and detach only on copies that are not inside another copy. The plugin's swapComponent and resetOverrides accepted any shape inside a copy (F92), and its detach any shape at all (F93), and sent the same events, whose changes expect a head. swapComponent and resetOverrides report "The shape is not a component copy head" for anything else; detach reports a shape that is not a copy, or a copy inside another copy, by ctn/detachable?, which the detach event checks too. swapComponent looked up the target file before checking its argument, so a value that is not a component failed an assert instead of reporting "Component not valid". - The plugin's switchVariant did not check whether the switch would nest a component in itself. The switch event checks that and calls the :on-error of its params' metadata; the plugin passed none, so the default, rx/throw, built an error observable that nothing used, and the call did nothing and reported nothing (F53). The plugin passes an :on-error that reports "The switch would create a component nesting loop", and the event's default does nothing. - Choosing a property value in the design tab with several members selected sent, for each member, an event that set the value and another that cleared its error, each its own commit and undo entry. The plugin's setVariantProperty set the value and left the error as it was (F94). dwv/update-property-value takes the components, and sets the value and clears the error of each in one commit; the design tab passes the selected members, the plugin its component, and the composable interpreter the one member of its edit. shape-bugfixes-test checks each plugin case on the proxy, and workspace-variants-test sets a value on two members with errors. AI-assisted-by: claude-opus-5-5 |
||
|
|
9296c00209 |
✨ Build variant actions and update main changes in common
Several actions built their changes in frontend events, step by step, each step its own commit, so the pure runner could not run them and one undo could revert half an action. - Renaming a variant member in the layers panel sent three events, each in its own undo transaction: update the properties from the typed formula, remove the properties no member gives a value, and set or clear the member's error. One undo reverted only the last. clvp/generate-rename-member builds the three steps in one changes (with generate-update-properties and generate-remove-empty-properties), and dwv/rename-member commits it once with the same analytics events. update-properties-names-and-values goes; remove-empty-properties and update-error stay for the design tab. - Transforming a component into a variant sent about fourteen events, and combining components as variants that transform and eight more. clv/generate-transform-in-variant and clv/generate-combine-as-variants build those steps as one changes, from the generators common already had, and the events commit them once. The flex layout initializer moves to common as cls/layout-initializer. Combine still sizes the board with two frontend dimension updates inside its undo transaction: the frontend applies them through modifiers, which common has no step for. - update-component split the changes of an update main (the copy's, marked :local-change?, from the main's, which may belong to a library) with two transducers; cll/split-local-changes does it. Its undo-group argument, never passed, goes, and the main's library is the copy head's :component-file, which it looked up through the file data only to read its id back. - dwv/valid-variant-switch? read the libraries from the state and repeated the lookup of clv/find-switch-target. clv/valid-switch? takes the libraries and asks find-switch-target; the plugin's switchVariant and the frontend test call it. Behavior changes: - One undo after a rename of a member, a transform or a combine reverts all of it. After a transform, it reverted only the sync of the copies' names (F6 in case AT); its pins go. - The transform no longer sends the "create-board" analytics event of the board it creates around the main. In the composable suites, renaming a member in the layers panel, removing the empty properties and setting a member's error are variant property edits both runners run, and case AW joins the JVM set. Its rename node drives the real layers-panel rename, which removes the empty properties too, so the step that removed them goes. The golden masters are recorded again for AW (the JVM one gains the case, the frontend one loses that step) and for AT (its final states no longer list the F6 undo failures). AI-assisted-by: claude-opus-5-5 |
||
|
|
1fa27f0299 |
♻️ Build the changes of the variant property events once
- Removing, reordering and setting the value of a variant property each wrote the component's new properties and then the variant name of its main, built from them. set-variant-properties does both. - ctv had two functions that find the position of a property by name; the private find-index-by-name goes. - generate-reorder-variant-poperties and the frontend event reorder-variant-poperties are spelled reorder-variant-properties. - Nine events of workspace/variants (set the value, the name, the error, the variant id, add, remove, remove the empty ones, reorder, and update after a rename in the layers) each looked up the page, its objects and the file data, built the same empty changes, and committed them inside an undo transaction. variant-changes builds those changes, and the transactions go: each one held a single commit, which already makes one undo entry on its own, or joins the transaction a caller has open. No behavior change: the golden masters and the suites are unchanged. AI-assisted-by: claude-opus-5-5 |
||
|
|
9dd1b356ca |
✨ Record a golden master of the component code
Before refactoring the component sync code, record the exact files the component tests produce, so a refactor that changes any of them fails. The JVM test common-tests.logic.golden-master-test runs every variant of the composable cases the pure runner runs and every benchmark world. It records the file after each user, undo and redo step (the runner's new :observe option), the final files with the signatures of the undo/redo round trip failures, and each world's file after its timed work. The frontend interpreter records the store's files of every variant of its cases and of the completion contract the same way. app.common.test-helpers.golden-master writes a state as the normalized files in sorted "path value" lines: ids become test labels, or numbers in tree order when unlabelled; grid cells are named after their shape and position; timestamps are left out. So a state is the same in every run whatever ids it draws. Only a digest per state is committed; the full lines go to tmp/golden-master/ and tmp/golden-master-frontend/ (recorded/, and actual/ for a state that differs), so diff -r shows a change. PENPOT_GOLDEN_MASTER=record records them again. Both sides repeat exactly across runs. Dropping :opacity from the attributes sync copies fails the case C variants that edit it. The interpreter's fixture also turns cts/wasm-enabled? off for each composable test and restores it after, as it already restores the store. A test that starts the WASM renderer left the flag on, so in a full frontend run the cases ran on WASM shape proxies, which leave out the attributes that are nil or false, and the frontend golden master differed from a run of the cases alone (:flip-x and :flip-y). AI-assisted-by: claude-opus-5-5 |
||
|
|
256d6001a0 |
✨ Test what copy texts keep through sync and switches
Add a battery of tests for text overrides in copies. - A short notation for text content in tests (thtx): paragraphs of runs with short style names, read back with equal runs joined, edits in the notation, set-text and set-content through the change path, and the override rule for texts (override-units), which says which overrides a copy must hold against its main. - Sync matrix: every whole-text copy edit against every main edit, plus the cards of the worked examples, the "Hello world" table, a token on a copy, typographies and a library color sync. Where the code differs from decisions (k) to (o), the result is pinned against F72 to F80. - Switch matrix: copy edits against variants that differ in letters, size, color, a new line or a bolded word; F76, F77, F79 and F81 pinned. - Composable case BA: EditText also edits fills, font family and a whole text; the copy and the main change different styles, then reset or update main, in both runners; F72 pinned. - Editor output: the content the WASM and v1 editors commit when a copy text is typed into, retyped, split with Enter and has a word bolded, recorded in the workspace and replayed on a copy. Typing sets only the text groups and a style change no text override; F79 pinned on both editors' content. |
||
|
|
62f99e0493 |
✨ Make the component test suites fail when their claims break
A review found tests that would pass with what they test broken. - Runners: both judge one variant at a time, fail a variant with no assertion and a known-failure mark that applies nowhere, and give the asserter the state the operations produced. The pure runner validates the final file and rejects operations of unknown kind. The frontend interpreter fails a step when the store reports an event error (Potok only logs it), reports asserter errors against their case, and stops the watchers that install! starts. - Nodes drive the real code: a main root rename goes through end-rename-shape, and the clipboard's advance of nested copies is one common function, cll/advance-copied-objects, that copy-selected and both test paths call. - Cases N, AH, AI, AK, AD, AE, K, C, H, S, AY, I, Y, AX and F check what they claim; O, R and T get real sizes. - Stricter common unit tests found F60 (a repair detaches healthy copies), F61 (a switch drops a fixed-sizing size), F62 (the ref chain never stops at its target) and F63 (latent); all pinned. - Frontend library tests: the RPC double records on subscribe, the dropped commits check that nothing syncs, and the link and share tests check the events sent. - Plugin suite: OpSwap and OpDetach throw when the API call did nothing, and case AB checks that the reset head is an instance of the original component. - The composable suite memory records the new rules. |
||
|
|
680b08dcaf |
✨ Make composable interpreter steps wait for pending work
The composable interpreter treated a step as done after a 60 ms gap
with no commits, and treated its 2 s timeout as done too. Slow sync or
reflow work could finish after the step, so a case could assert on a
half-synced file.
Each event step now waits, as the plugin waitForLayoutUpdate does,
until every pending work tracked by the reflow registry has drained:
the watcher's sync wait, the sync it starts, and layout and text
reflow. A step that does not drain within 2 s fails the test and names
the work still pending, and the next variant starts with nothing
pending.
The tests cover an edit with a deliberately slow sync, undo and redo
steps that must wait for the watcher's touch-component, translation
and derived commits, a sync that never finishes, and a restart of the
edit watchers, which must keep the undo entries of an edit the same.
Also in this commit:
- Keep page-less changes from adding a nil page. Applying a commit locally
rebuilds the object indices of every page its changes name. Changes that touch
no page, such as :mod-component, name none, and their nil page id was rebuilt
too: the file data in the store gained a page under a nil key holding
{:objects nil}. Every component touch after an edit to a main added it, and
undo never removed it.
- Check undo and redo of every step in the composable cases. The composable
cases tested undo only where a case asked for it, so a change generator with a
wrong inverse, or a step that splits into several undo entries, went
unnoticed.
- Add operations and cases to the composable component suites. The composable
runners could edit, add, remove and move children, swap and switch, but not
run the other component operations.
- Test component validation, repair and library asset sync.
- Add a component sync benchmark with a recorded baseline. The coming refactors
and fixes change sync code, and a slowdown must be seen and explained in the
commit that causes it.
- Tidy the composable suite and make its cases stricter.
- Test the component sync paths no test reached. A coverage run found sync paths
that no test ran.
- Test variant events, token sync and switch overrides. The variant events had
almost no frontend tests, and several switch, paste, token and restore paths
never ran.
- Test the file and container helpers and the library events. The component
helpers of types/file and types/container and the library events of the
workspace had the lowest coverage left.
|
||
|
|
61ec544881 |
🐛 Hold the sync wait for every local commit
The component watcher opened its :sync-file wait only for commits saved to the undo stack. Undo and redo commit without it, so a wait such as the plugin waitForLayoutUpdate returned before the watcher had handled them. Translation and derived commits were filtered out before the wait opened. Open the wait for every local commit of a file and close it once the watcher has decided what to do: sync, only touch the component, or drop the commit. Dropped commits close it right away. Add wrf/pending, a snapshot of the pending work, for tests and diagnostics. |
||
|
|
7d0b9e0b59 |
♻️ Share the workspace edit watchers with the test harness
The composable test interpreter wired its own copy of the undo stack subscription and started only the component watcher, so it reacted to edits differently from the app, and a missing subscription failed silently. Gather the subscriptions that react to edits while a file is open (undo stack, layout updates, text reflow, WASM text measurement) in initialize-edit-watchers, stopped by finalize-edit-watchers, and the per-page component and token watchers in watch-library-changes. The workspace and the interpreter both start them. Starting the edit watchers again replaces the running ones. A file reload starts the workspace again without finalizing it, which left two undo stack watchers running, so an edit added an extra undo entry. |
||
|
|
106572a2d6 |
✨ Run the composable component cases on the JVM
The composable test engine, nodes, setups and cases lived in the frontend test tree, so only the frontend interpreter could run them. Move them to CLJC test helpers under app.common.test-helpers.composable and add a pure runner (comp.runner) that does what the workspace does around each operation, without the frontend store: - after a user operation it syncs the changed components until none is left, as the frontend watcher does with one pass per sync commit; - the operation and its syncs form one undo group, and the undo node reverts the latest one; - it validates the file once the sync or the undo has settled. Each node declares its kind: assembly, user, undo or frontend-only. User nodes record the production changes they apply, and the runner throws when a node breaks that. The swap and switch nodes build their changes with the production clv/generate-component-swap-in-place. Rotate and ChangeHeight need the frontend placement step, so the pure runner rejects them. The cases are zero-arg functions in comp.cases, shared by the frontend interpreter and common-tests.logic.composable-sync-test. The latter runs cases B to M and the new case O, a switch of an overridden copy, on the JVM and in JS. Case N and the rotation case stay frontend-only. |
||
|
|
cd1ece4beb
|
⚡ Keep the translation flag on undo and redo of a move (#12870)
* ⚡ Keep the translation flag on undo and redo of a move
Previously undos and redos always forced a component sync + thumbnail
rerender for every component touched even if the underlying commits were just
translations. This propagates the translation flag to undos and redos and
propagates it to commit-changes. An entry merged from several undos/redos is
a translation only if all of its undos/redos are translations.
This reduces a UI freeze when undoing a move of a board with 453 components
from 2.42s -> 0.22s.
AI-assisted-by: claude-sonnet-5-5
* :translation? -> :translation
---------
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
|
||
|
|
81c3b3cd56
|
📎 Update copyright name on file header (#11346) | ||
|
|
83a3d099f6 |
🐛 Mock RPC and timer in composable test interpreter to fix network errors
The `SyncFromLibrary` op dispatches a real `sync-file` event that schedules `rx/timer 3000` + an RPC call to `update-file-library-sync-status`. In the headless test runner (no backend), this produces a network error that leaks into test output. Wrap the `check` function in `mock/with-mocks` to mock `rp/cmd!` (returning success) and `rx/timer` (firing instantly). This eliminates the 3200ms grace period in `op-grace-ms` and prevents the network error from appearing in test output. AI-assisted-by: mimo-v2.5 |
||
|
|
4ea56e0b89
|
🐛 Fix propagation of geometric changes to rotated component copies (#10574)
* 🐛 Fix geometry sync between mains and rotated component copies Rotating a copy instance as a whole marked every shape inside it as touched for geometry, so later geometric changes in the main (e.g. a resize) were no longer propagated to that copy, while non-geometric ones (e.g. fills) still were. And on paths where geometry did get written to a rotated copy (e.g. resetting overrides), the sync engine compensated only the roots' position delta, so the written values wiped the copy's rotation back to 0. Model the instance root's transformation as inherited, overridable content, asymmetric to position (which remains free per-instance placement): - An untouched copy follows the main's transformation verbatim, including rotation and flips (preserving the BUG #13267 semantics that rotating a main propagates to its copies). - Transforming a copy as a whole overrides only its ROOT: check-delta compares the root's rotation/flips absolutely, but the descendants relative to their root, so they merely follow and stay untouched. - When a copy root's geometry is overridden, update-attrs expresses the main's geometry in the copy's own frame: reposition-shape applies the roots' relative transformation (rotation/flips) around the dest root center in addition to the position delta. Geometric changes from the main then keep propagating to the rotated copy, landing correctly in its rotated frame instead of destroying its placement. Covered by the new composable test case case-n-geometry-sync-with-rotated-instances: an 8-variant sweep over optional copy rotation, optional main rotation, and one of a fills or height edit on the main child, asserting the whole model through the real workspace events (the new rotate operation dispatches dwt/increase-rotation, whose apply-modifiers step runs the check-delta classification under test; change-height dispatches dwt/update-dimensions and implements IPropertyCheck so one-of sweeps can mix property and geometry edits). Verified by temporarily reverting the fix: the case then fails with 6 assertion failures and passes again with the fix restored. Fixes #10109 AI-assisted-by: claude-fable-5 * 🐛 Fix synchronization problems --------- Co-authored-by: alonso.torres <alonso.torres@kaleidos.net> |
||
|
|
2c15dcdb84
|
✨ Add systematic component tests via a composable test model (#10529)
* ✨ Add systematic component tests via a composable test model Introduce a framework for systematically testing Penpot component behaviour (synchronisation/propagation, swaps, variant switches, nesting), plus a first suite of cases built on it. A test is expressed as a COMPOSITION OF OPERATIONS over a "situation" (an in-memory file value plus named role bindings). Operations are reified as data and composed by two combinators — `in-sequence` (threads the situation) and `one-of`/`optional` (alternatives, enumerated into concrete variants). So one written case stands for a whole matrix of variants, and coverage grows by composition rather than by copying tests. Operations drive the REAL production change pipeline, and event-operations dispatch the REAL workspace events and await settlement, so the production watcher's automatic propagation is what is exercised — the tests reflect genuine app behaviour, not a reimplementation. Structure (frontend/test/frontend_tests/composable_tests/): - core — the domain-agnostic engine: situation, the operation and enumeration protocols, the combinators, and the runners. - comp/nodes — the component operations (create/instantiate/reset, nesting, swap, the variant ops, child add/remove/move, change, undo, library sync). - comp/setups — component-shaped starting configurations. - interpreter — runs a case against the real frontend store: sync-ops apply directly, event-ops dispatch real events and await settlement (absorbing sync-file's delayed status RPC, which would otherwise leak an error into subsequent tests). - comp/sync-test — the cases (B-F, H, I, K, L, M). This is test-only code with a single consumer — the frontend test suite (the layer that runs the real app) — so it lives entirely under the frontend test tree as .cljs, not under app/common. The framework and its cases are documented in the project memory frontend/composable-component-tests, added alongside. Co-authored-by: Claude <noreply@anthropic.com> * 🐛 Guard WASM mock teardown against an empty snapshot `teardown-wasm-mocks!` unconditionally restored from the `originals` atom. When run without a matching setup (double teardown, or `with-wasm-mocks*` misused around an async test body), the snapshot is empty and every WASM API function was `set!` to nil — permanently, for the remainder of the test run. Any later code calling one of them (e.g. a leaked debounced resize-wasm-text event firing during a subsequent test namespace) then crashed with "initialized? is not a function". Make the restore a no-op when there is nothing to restore. Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> |