diff --git a/.serena/memories/frontend/composable-component-tests.md b/.serena/memories/frontend/composable-component-tests.md index 3bd79181d3..12284a56ea 100644 --- a/.serena/memories/frontend/composable-component-tests.md +++ b/.serena/memories/frontend/composable-component-tests.md @@ -87,13 +87,15 @@ wrapper deftest in BOTH test namespaces (or only the frontend one if it needs fr Two pure runners (no store, JVM + CLJS): - `core/run-variant`/`run-all`: apply nodes only (no sync, `n/undo` throws). For engine tests. - `comp.runner/run-variant`/`run-all`: the case runner. Every comp node declares its kind via - `n/IComponentOperation` (`op-kind`: `:assembly`, `:user`, `:undo`, `:frontend-only`); the + `n/IComponentOperation` (`op-kind`: `:assembly`, `:user`, `:undo`, `:redo`, `:frontend-only`); the runner and the interpreter's `sync-op?` dispatch on it. A NEW node MUST implement it. User ops record their production changes (`n/record-changes`, nil when nothing changed); the runner throws if a `:user` op records nothing or another kind records changes. After a user op the runner syncs to a fixpoint (`ch/components-changed` + `generate-sync-file-changes`, one pass per cascade level, like the frontend watcher) and pushes op + syncs as one undo group. - `n/undo` reverts the latest group, no re-sync. The runner validates the file (against the + `n/undo` reverts the latest group and moves it to a redo stack; `n/redo` applies it again + (interpreter: `dwu/redo`); neither re-syncs. A user op that pushes a group empties the redo + stack; one that changed nothing keeps it. The runner validates the file (against the situation's files) once settled: after the sync fixpoint and after an undo group; never between cascade passes, where an outer copy still points at the component its main dropped (`:component-id-mismatch`), nor with `{:sync? false}`. Assembly ops (create/instantiate/nest/variant @@ -104,8 +106,35 @@ Two pure runners (no store, JVM + CLJS): frontend events call. Not modelled: the `:modified-at` bump, and the swap/switch event follow-ups (token propagation, WASM text resize, layout update). Tests: `common-tests.logic.composable-runner-test`. +- Undo/redo round trip (`comp/undo_check.cljc`, alias `uc`), on by default in the pure runner + (`:undo-check?`): after each `:user` step that pushed a group, undo must give back the + normalized file before it and redo the file after it (the variant continues from the redone + file); a user step that pushed nothing must change nothing (`:no-undo-entry`); at the end, + undo back to the last assembly step (the baseline; a case's own undo below it moves it) and + redo all. Files compare through `app.common.test-helpers.normalize` (`thn/normalize-file`: + drops file/component `:modified-at`, optionally `:position-data`; shapes as plain maps). + Failures are recorded in the situation with labelled diffs (labels die with the variant, so + they are resolved when recorded) and a `:signature`, the set of what differs + (`uc/signature`: `[:object