Two operations set the touched groups of a shape: a :set of :touched,
which assigns the value as given, and :set-touched, which keeps them
only on a copy and drops an empty set. update-shapes and the undo of
add-component wrote the first while their own undo and sync wrote the
second. The contract prefers :set-touched; both builders now write it,
and an update with only its touched groups changed still records their
undo. A :set of :touched is still applied, for changes already stored.
Case AE leaves no empty touched set on the shape a detach turned plain;
both golden masters record the state again for it.
comp-touched-test: an update that sets the touched groups of a copy
shape writes one :set-touched operation, and its undo restores them.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 16.6 / 0.47
edit-through-a-chain-of-dependents 68.9 / 32.8 / 0.48
library-update-into-copies 83.1 / 42.8 / 0.51
main-edit-among-many-shapes 4.8 / 2.3 / 0.48
main-edit-into-10-copies 1.8 / 1.0 / 0.54
main-edit-into-100-copies 15.4 / 8.9 / 0.58
main-edit-into-1000-copies 153.1 / 82.0 / 0.54
variant-switch-into-copies 32.1 / 17.7 / 0.55
AI-assisted-by: claude-opus-5-5
Decision (c) of the component contract, after a fix that made the sync of a
library file reach that file at all (Phase 3c).
- Commit the sync of a library file to that file.
An update of the main of a library component, made from a copy in the
file, syncs the copies of the component in the file and in the library.
The changes of a sync carry no file id, so the commit took the current
file's: the library's copies, among them those its other mains nest, were
written to pages the current file does not have, and never changed (F19).
A sync now commits to the file it syncs.
workspace-remote-cascade-test: an update of the main of a library
component reaches the copy of it that another library main nests.
- Sync the components a sync changes in the same commit.
Decision (c) of the component contract: a sync reaches the copies of the
components it changes, until none is left, in one commit. A sync of a file
changed the mains of the components that nest the synced copies, and the
component watcher synced those in a commit of its own, one level per pass,
so the file stayed partly synced in between; the watcher only watches the
current file, so a sync of a library file stopped at its first level
(F19).
common: generate-sync-file-cascade syncs a file as
generate-sync-file-changes does, then the copies of each component of the
file that the sync changed, one per pass, applying each pass to the file
data, until none is left (generate-sync-components-cascade). The
composable runner, the benchmark and the golden master use it.
frontend: sync-file commits the whole cascade at once. When it syncs a
library file, it then syncs the copies in the current file of the library
components the cascade changed.
workspace-remote-cascade-test: an update of the main of a library
component, made from a copy in the file, reaches the file's copy of a
library component whose main nests it. The common golden master records
fewer changes undone in case W: a cascade is one change set.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 17.0 / 0.48
edit-through-a-chain-of-dependents 68.9 / 33.2 / 0.48
library-update-into-copies 83.1 / 43.6 / 0.52
main-edit-among-many-shapes 4.8 / 3.5 / 0.73
main-edit-into-10-copies 1.8 / 0.9 / 0.49
main-edit-into-100-copies 15.4 / 8.1 / 0.52
main-edit-into-1000-copies 153.1 / 83.9 / 0.55
variant-switch-into-copies 32.1 / 19.6 / 0.61
AI-assisted-by: claude-opus-5-5
Decision (f) of the component contract, with a fix it needed and a check of
decision (g) (Phase 3c).
- Return empty modifiers for a scale constraint axis.
The constraint of each axis of a child gives the modifiers that the
parent's resize adds to the child; :scale has no method of its own and
took the default, which returned an empty vector. Adding a vector to
modifiers reads its :last-order as nil: JavaScript adds nil as 0, the JVM
throws, so a child scaled on one axis and constrained on the other (scale
and top, say) could not be resized on the JVM. The default now returns
empty modifiers.
geom-shapes-constraints-test checks the default is empty and adds to
modifiers.
- Keep the children of a transformed copy shape derived.
Decision (f) of the component contract: transforming a copy shape touches
that shape only; its children change as a consequence and stay untouched,
and sync gives them their expected geometry, their main's placed against
their parent and resized through their constraints.
Touch. The placement step decided per shape whether a transform touched it
by comparing it with its copy root, so the children of a resized root that
stretched (scale, left and right) were touched (F10), a derived width or
height always touched (F22), and a resize that scales the content touched
the strokes, radii and the like of every child (F39). The editor now tells
the placement step which shapes the user transformed (the keys of the
modifiers given, or those the stored modifiers were set for); any other
shape of the transform changes only as a consequence of theirs (a child
through its constraints, a board that hugs them) and touches nothing.
Sync. Sync placed every main shape by the offset between the roots only,
so the children of a resized copy root that a resize leaves untouched
(center) went back to their main's place at the next sync of the main
(F10). Now, before it walks the children of a copy shape that keeps its
own geometry, sync resizes, turns and moves the main shape's subtree to
match it, its children following through their constraints and layouts,
and walks those: each child gets that geometry unless it has its own.
comp-expected-geometry-test: a copy root resized as the editor does places
a child constrained left, right, center, scale and left-right, leaves it
untouched and keeps it there through a sync; a resize that scales the
content scales the child's stroke and touches only the root. The frontend
golden master records, in cases AI and the touched child under a main
rotation, the children the resize or rotation of a root no longer touches.
- Check a copy child resize leaves its hug board untouched.
Decision (g) of the component contract: the size of a board that hugs its
content is the layout's, never an override. The layout reflow writes it as
derived, and a transform touches only the shapes the user transformed
(decision (f)), so a resize of a copy child that grows the board it sits
in touches the child only.
workspace-layout-owned-sizes-test pins it.
Benchmark (lower quantile, ms; baseline / now / ratio); the machine
was loaded, and the code before this change, run in between, gave the
same spread (0.44 to 0.59):
deepest-edit-through-three-levels 35.2 / 16.7 / 0.47
edit-through-a-chain-of-dependents 68.9 / 33.4 / 0.48
library-update-into-copies 83.1 / 40.3 / 0.49
main-edit-among-many-shapes 4.8 / 2.4 / 0.49
main-edit-into-10-copies 1.8 / 1.0 / 0.54
main-edit-into-100-copies 15.4 / 8.8 / 0.57
main-edit-into-1000-copies 153.1 / 92.7 / 0.61
variant-switch-into-copies 32.1 / 19.6 / 0.61
AI-assisted-by: claude-opus-5-5
The name a text takes from its content and the size it is measured to are
derived: they never touch a copy (decisions (d) and (g), Phase 3c).
- Let a copy text's automatic name follow its own letters.
The editors name a text after its letters on every edit. In a copy that
rename went through the same write as the content, so it touched
:name-group (F27), against decision (d) of the component contract: only an
explicit rename is an override.
- update-shapes takes :ignore-touched as a set of attributes too, and the
editors' commits (v1 and v3, finalize and keystrokes) and the replace of
text pass #{:name}: the name follows the content, so its write is
derived. Token unapply still runs for such an update.
- Sync gives an untouched copy text the name generated from the letters it
shows after the sync when its main's name is the one generated from the
main's letters (decision (d), refined), and the main's name otherwise.
So a copy that retyped its text keeps that name, and one that did not
follows the main's.
The pure runner's text edit makes the same commit. Case Y no longer pins
F27 and checks the copy's name follows its letters; both golden masters
record the copy without :name-group.
text-sync-test: an untouched copy takes the main's letters and name, a
copy that typed its letters keeps the name they give, and a main named by
hand passes its name on.
- Name a text with several paragraphs without line breaks.
The editors name a text after its letters, with the line breaks of its
paragraphs included, so a text "Hello world" + Enter + "Ends Sunday" was
named "Hello world\nEnds Sunday"; the layers panel showed a space there
(F82). generate-shape-name now turns each line break, with the spaces
around it, into one space.
text-test: the name of a two-paragraph text joins them with a space.
- Keep the size a WASM text grows to from touching the copy.
A text that grows with its content (auto width, auto height) gets its size
from the WASM renderer after a font loads, a style changes, a paste or an
edit ends. That size is derived from the content, yet the resize applied
it as a user change, so a copy's text took :geometry-group each time and
kept that size against its main (F1). The resize and the debounced resize,
the size an edit ends with and its geometry undo now pass ignore-touched.
These paths measure the text in WASM, so no headless test reaches them.
Checked in the browser with the WASM renderer: an edit of a copy's text
touches :content-group only, and a resize after a font size change of 24
grows the text with no :geometry-group.
- Keep the finalize resize of a text out of the undo stack.
When an edit of an existing text ends, the WASM renderer gives the size it
grows to, and the finalize commit stores that size along with its undo.
The resize that shows it on the canvas recorded an undo of its own with no
undo group: a release build kept a second undo entry for one edit, and a
dev build failed the undo entry check (F36). It now records none; a new
text still joins the undo group of its creation.
Checked in the browser with the WASM renderer: an edit of an existing text
adds one undo entry.
- Keep the size a text edit ends with from touching the copy.
When an edit of a text ends, the editor stores its content together with
the size measured for it (the SVG renderer's text modifier, or the WASM
measure in the v1 editor). Only the name was written as derived, so an
edit of a copy's text touched :geometry-group besides :content-group, and
the text kept its size against its main (F1, in the SVG renderer). These
writes now take the size, the position data and the name as derived; the
content still touches.
workspace-text-modifier-test: an edit that ends with a measured width
touches the copy text's content only. Checked in the browser with the SVG
renderer: an edit of a copy's text touches :content-group and
:text-content-text only.
- Measure again on WASM the texts a sync writes.
The size of a text that grows with its content is derived (decision (g) of
the component contract): sync writes the main's, and the renderer measures
the text again. The SVG renderer does so when it draws the text; the WASM
renderer did not, so a copy text with content of its own kept its main's
width and height after a sync (F35). Now, with the WASM renderer, a sync
of the current file measures again the auto-grow texts of the current page
it writes, without a component sync of its own, in the undo group of the
sync; a sync with no undo group gets one for both.
Texts on other pages keep the size sync wrote until they are measured
again.
workspace-sync-wasm-text-test: a sync that writes a copy text with content
of its own measures it again, in the undo group of the sync. Checked in
the browser with the WASM renderer: after the main text grows or shrinks,
two copy texts with content of their own get their own widths and no
:geometry-group.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 18.1 / 0.51
edit-through-a-chain-of-dependents 68.9 / 34.0 / 0.49
library-update-into-copies 83.1 / 40.2 / 0.48
main-edit-among-many-shapes 4.8 / 2.5 / 0.51
main-edit-into-10-copies 1.8 / 0.8 / 0.44
main-edit-into-100-copies 15.4 / 8.5 / 0.55
main-edit-into-1000-copies 153.1 / 83.5 / 0.55
variant-switch-into-copies 32.1 / 18.1 / 0.56
AI-assisted-by: claude-opus-5-5
Fixes in when the workspace syncs copies and propagates tokens, and in what
a layout wait covers (Phase 3c).
- Sync the copies when a shape is dragged inside a main.
The component watcher dropped every commit flagged :translation? (the WASM
drag commits only moves) so dragging whole mains around the canvas stays
fast. A drag of a shape inside a main is flagged the same, so its copies
never followed until some other edit of that main made them jump (F70).
The watcher now drops a translation commit only when it moves shapes
outside mains or whole mains: every shape it moves inside a main moves
with the main's root (decision (q)). Otherwise the commit goes through
component sync like any edit.
workspace-sync-barrier-test: a translation of a whole main is dropped; one
of a main's child syncs the copy. fill-commit in the interpreter takes
several labels.
- Propagate the file's tokens after any library update.
Updating a library from the notification synced the file and then
propagated its tokens, so the copies take the token values of the file's
token status, not the library's. The update button of the libraries
dialog's Updates tab only synced the file (F83).
dwl/update-libraries syncs the file from the given libraries and then
propagates its tokens; the notification and the Updates tab both use it.
workspace-library-updates-test: updating a library syncs it and then
propagates the tokens.
- Sync copies whether or not component thumbnails are on.
The component watcher's whole pipeline, the sync of the copies included,
ran only when the :component-thumbnails flag was on or the WASM renderer
was active. The flag is on by default, but an install that turned it off
never synced copies on the SVG renderer: editing a main left its copies as
they were (F8). The flag now gates only the thumbnail streams.
workspace-sync-barrier-test: with the flag off, a main edit reaches the
copy.
- Hold a token's shapes pending until the token is applied.
A plugin's waitForLayoutUpdate waits until no shape has layout work
pending. Applying a token resolves the tokens first, asynchronously, and
opened no pending work meanwhile, so the wait found nothing pending and
returned before the token reached the shapes or their copies (F54). The
shapes are now pending, as a :token task, from the start of the resolution
until the update is emitted, and the layout, text and sync work it starts
takes over from there.
The composable interpreter no longer waits on the token itself: case AY
applies a token and checks its copies after the same wait a plugin uses,
and fails without this change.
AI-assisted-by: claude-opus-5-5
Two derived commits that left the copies' sync in an undo entry of its own
(Phase 3c).
- Move frame guides in the undo group of their transform.
A transform of a board sends the move of its guides before the shapes'
update. The guide move committed every guide of the board, moved or not,
each in a commit with an undo group of its own, so when the board was a
main with a guide, its transform and the copies' sync landed in different
undo entries: one undo reverted only the copies (F6).
Both transform paths now give the shapes' update an undo group up front
and pass it to the guide move, which commits only the guides that move,
all in one commit in that group.
workspace-frame-guides-undo-test: one undo reverts a rotation of a main
with a guide, its copy included, and a move of a main together with its
guide.
- Reflow layouts in the undo group of the step that asked for it.
A layout reflow runs a moment after the commit that needs it: the
:layout/update events are buffered for 100 ms and reflowed per page. The
reflow lost the undo group of the step (F43):
- the buffer passed no undo group to the reflow;
- update-shapes asked for a reflow without the group of its commit;
- the reflow's transform opened an undo transaction, so it made an entry
of its own instead of stacking on the latest one, and the sync that a
reflow of a main starts took that entry's fresh group.
So one undo after a sync that reflows (a flex main's margin edit, a nested
sync with minimal frames, a swap) reverted only the reflow, or only part
of the step.
update-shapes now gives a commit that needs a reflow an undo group up
front and passes it on; the buffer reflows each page in the group an
update of that buffer names (those that name none come from the same step,
like update-layout-child's); the reflow stacks on the latest entry with no
transaction of its own.
Cases AJ and AN no longer pin F43: one undo after a nested sync reverts
the remote change and the float noise of the reflow, and one undo after a
flex main's margin edit reverts the margin, the sync and the reflow. The
frontend golden master records that.
AI-assisted-by: claude-opus-5-5
Fixes in the variant events of the workspace and in the component calls of
the plugin API (Phase 3c).
- Rename a variant in one commit.
Renaming a variant renamed its board, then each of its components and
mains, as separate commits inside an undo transaction. The transaction
kept the undo group of its first commit, the board's, while the sync that
the renamed mains started took the group of their commits and made an
entry of its own: one undo reverted only the copies' names (F6, case AV).
clv/generate-rename-variant builds the board, component and main renames
in common, and the event commits them once, so the rename and its sync are
one undo entry, like transform into a variant.
Case AV no longer marks its round trip as a known failure; the frontend
golden master records it without failures.
- Keep overrides in a plugin swap only within a variant set.
The plugin's swapComponent swapped with keep-touched for any component,
while the UI keeps a copy's overrides only on a variant switch: the same
swap kept different overrides by route (F33). It now keeps them only when
the copy's component and the target are variants of one set (decision
(p)), as swap-keeps-touched? says.
shape-bugfixes-test: two variants of one set keep the overrides; of
different sets, or plain components, do not.
- Look up a plugin variant head's component in its own file.
The plugin's isVariantHead looked the shape's component up in the file of
the shape, so it was false for copies of a library's variants; and it
looked it up before checking the shape is a head, so on a shape with no
component it failed the lookup's assert (F91). It now checks the head
first and looks in the shape's :component-file.
shape-bugfixes-test: a copy of a library variant is a variant head, and a
plain rect is not.
- Add a variant with the shortcut when a variant set is selected.
The context menu of a variant container offers "Add variant" and shows the
create-component shortcut for it, but the shortcut's event did not know
containers: with one selected it fell through to creating a component,
which the container's own rules refuse (F95). With a single variant
container selected, the shortcut now adds a variant to it, as the menu
entry does.
workspace-variants-test: the shortcut on a variant container gives the set
a third member.
- Refuse plugin variant edits whose variant is on another page.
The variant events the plugin API calls (add a variant, add, remove or
rename a property, set a property value) build their changes on the
objects of the page the workspace shows. For a variant whose mains sit on
another page, they updated the components but not their mains, so the
mains kept their old :variant-name and the file failed validation (F94).
The plugin now refuses these edits, as it refuses edits of shapes on
another page, unless the variant is in the current file and on the current
page.
library-test: each edit goes through with the variant on the current page
and is refused, with nothing emitted, with it elsewhere.
- Check every component of an assets group before combining it.
The assets panel offers to combine a group of components as variants when
they can be: more than one, none a variant, all with their main on one
page. It counted every component of the group, subgroups included, but
checked the other two rules only on the components directly in it, while
the combine takes them all; with none directly in it, those rules always
held (F98). can-combine-group? now checks every component of the group.
assets-components-test: a group whose only components are in a subgroup
can be combined; a variant or a main on another page in a subgroup blocks
it; one component cannot.
AI-assisted-by: claude-opus-5-5
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
- 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
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
remove-empty-properties, run after a rename in the layers panel, found
the position of each property by grouping all the properties of the
variant's components by name and numbering the groups. A map of more
than eight keys does not keep their order, so with nine or more
properties the numbers did not match the positions and the wrong
property was removed: with ten properties and the sixth empty in every
component, it removed the first (F86).
The positions now come from the properties themselves: a property is
removed when its value is empty in every component. The work moves to
common as clvp/generate-remove-empty-properties, and the event only
commits what it builds.
workspace-variants-test checks the case with ten properties.
AI-assisted-by: claude-opus-5-5
The clear-thumbnail-batch tests mock the RPC and count every call
recorded while the mock is installed. A thumbnail deletion batch left
over by an earlier test of the suite (a component sync clears the
thumbnails of the frames it changes) can call it in that window, so
the tests failed in the full frontend run from time to time and passed
alone.
- The batch tests count the calls about their own object ids.
- The test that clears an empty queue expected no call at all; a call
made by the event under test could only carry no object ids, so it
checks that none of the recorded calls is such a call.
AI-assisted-by: claude-opus-5-5
- 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
Which shapes of a copy a transform leaves untouched (the ignore tree)
was frontend code, written twice: calculate-ignore-tree for the
modifiers of the SVG renderer and calculate-ignore-tree-wasm for the
matrices of the WASM renderer. The second is the single-pass version
of the first: each shape still compares itself with the copy root of
the latest transformed shape above it, as the repeated walks did when
the last one won.
app.common.logic.placement now holds it once: calculate-ignore-tree
takes the transformed ids in order and a function that transforms a
shape, built with modifiers-transform (SVG) or matrices-transform
(WASM), both cached per shape. check-delta and transform-attrs moved
with it. The frontend calls the common version, and its tests moved
to common-tests.logic.placement-test, which runs on the JVM and in JS,
with a rotation through modifiers added.
No behavior change: the golden masters and the suites are unchanged.
The benchmark does not run this code.
AI-assisted-by: claude-opus-5-5
The namespace held 3,300 lines: component sync, instance creation and
detach, swap and the variant switch's attribute carry, duplication,
and the sync of library colors and typographies. Each now has its own
namespace:
- app.common.logic.libraries (cll): component sync, reset, update
main, attribute and placement sync, and the sync of a file with its
libraries;
- app.common.logic.instances (cli): create, instantiate and restore a
component, detach a copy;
- app.common.logic.swap (clsw): swap a copy head, carry overrides
across a variant switch;
- app.common.logic.duplicate (cld): duplicate components and shapes;
- app.common.logic.library-assets (clla): sync of library colors and
typographies, which the asset multimethods delegate to.
Each new namespace may require libraries, never the reverse; the
helpers they share became public there (attr-operations,
reposition-shape, orient-like, swap-content-root-id, ...). Callers use
the new aliases. The functions move as they were.
No behavior change: the golden masters and the suites are unchanged.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 37.3 / 1.06
edit-through-a-chain-of-dependents 68.9 / 69.7 / 1.01
library-update-into-copies 83.1 / 79.8 / 0.96
main-edit-into-10-copies 1.8 / 1.6 / 0.92
main-edit-into-100-copies 15.4 / 15.4 / 1.00
main-edit-into-1000-copies 153.1 / 156.0 / 1.02
variant-switch-into-copies 32.1 / 27.0 / 0.84
AI-assisted-by: claude-opus-5-5
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
Sync and the variant switch can take a copy text's family from one side
and its weight from the other. The variant id goes with the weight, so
it can name a variant of the other family: the WASM renderer then picks
the closest variant, but the SVG renderer falls back to the regular one.
The frontend now gives each text content that a sync or a component swap
commits variants of its own families: a run whose variant is not one of
its family's takes the family's closest to its weight and style
(cttx/update-font-variants, fonts/find-closest-variant). The pure runner
has no fonts, so case BA leaves variant ids out of its comparison.
The merge also leaves alone a run that already shows the placed style,
so a main edit no longer rewrites the variant ids of a copy whose
family is its own; with a new family, the run still takes the placed
variant id.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 35.7 / 1.01
edit-through-a-chain-of-dependents 68.9 / 65.2 / 0.95
library-update-into-copies 83.1 / 75.1 / 0.90
main-edit-into-10-copies 1.8 / 1.5 / 0.86
main-edit-into-100-copies 15.4 / 15.1 / 0.98
main-edit-into-1000-copies 153.1 / 151.4 / 0.99
variant-switch-into-copies 32.1 / 30.4 / 0.95
AI-assisted-by: claude-opus-5-5
The migration 0033 stores every swap of a file as an override group.
A swap made in a copy is paired with the child of the near main that
holds the same position, as sync paired it; any other slot is dropped.
All pairings are found on the data as it was, so swaps nested in swaps
pair against the content of the outer one, and libraries pair the same
whether they are migrated or not. A head that refers to its own slot
only inherited it, and drops it even when its near main cannot be
reached. Any other slot that matches no child, or whose near main is in
a library that is not loaded, keeps the slot as its ref, so validation
reports it. An import, which migrates its files before it links their
libraries, leaves those slots and converts them once the libraries are
linked. A migrated head that sits elsewhere than the child it replaces
would place it gets its geometry marked as touched, so the first sync
does not move it. Migrated and new files carry the feature
components/swap-group, so a client that still writes slots cannot open
them.
Validation checks the new form: :misplaced-slot reports any slot,
:misplaced-swap-group the group anywhere but on a nested copy head in a
copy, :ref-not-in-near-main a nested copy head whose ref is not a child
of the near main of its parent, and :duplicate-ref two children of a
copy that refer to the same main shape. Each has a repair.
Nothing but the migrations reads slots any more: the slot branches go
from sync, swap, switch, reset, detach, paste, duplicate and move. The
helpers that read and write a slot on a shape move to files/swap-slots,
and the ones that follow refs to files/comp-processors. The graph
projection drops the FillsSwapSlot edge, the components debugger shows
the component a swapped head takes its content from, and the plugin API
documents componentRefShape for a swapped copy. The swap tests are
named after what they check.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 34.6 / 0.98
edit-through-a-chain-of-dependents 68.9 / 63.5 / 0.92
library-update-into-copies 83.1 / 76.4 / 0.92
main-edit-into-10-copies 1.8 / 1.6 / 0.87
main-edit-into-100-copies 15.4 / 15.1 / 0.98
main-edit-into-1000-copies 153.1 / 148.8 / 0.97
variant-switch-into-copies 32.1 / 26.4 / 0.82
AI-assisted-by: claude-opus-5-5
A swapped copy sub-head now keeps the shape-ref of the main child it
replaces (its position), takes its content from its own component, and
carries the touched group :swap-group. It used to point at the root of
the new component and store a swap slot naming the replaced child.
Every path reads and writes that form:
- sync pairs a swapped head with the child it replaces and syncs it
from its own component; it takes from the replaced child only its
placement: position, constraints and layout item attributes;
- reset undoes a swap in place, keeping the head's id and the other
overrides of the copy;
- detach, paste and duplicate make a head that leaves every copy level
a plain copy of its own component, and advance a deeper one by
position; the children of a swapped head never advance;
- a variant switch keeps a swap stored this way, and counts only the
copy's own swap, not one made in a main of the chain;
- update main replaces the main child with a clone of the swapped one,
and from a swapped head updates its own component;
- a swap inside a copy keeps the old shape-ref and adds :swap-group;
swapping back to the component of that position gives a plain nested
copy whose children refer to the position's children; a swap inside
a main is a plain nested copy.
Files that hold swap slots keep working until a migration converts
them. The component memories describe the model.
This fixes what came from the slot: reset of a swapped child cleared
the other overrides of the copy (F12) and gave copies of a main new
ids (F66); update main left a swap mark (F16); a second variant switch
lost the overrides (F29); grid cells did not pair a swapped child
(F44); a swapped child did not follow its position (F65). F49 keeps
failing, in another form.
The tests that asserted slots now assert the override group; the tests
of the slot code build the old form with :as-slot?.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 35.4 / 1.01
edit-through-a-chain-of-dependents 68.9 / 68.7 / 1.00
library-update-into-copies 83.1 / 77.5 / 0.93
main-edit-into-10-copies 1.8 / 1.6 / 0.92
main-edit-into-100-copies 15.4 / 15.4 / 1.00
main-edit-into-1000-copies 153.1 / 151.1 / 0.99
variant-switch-into-copies 32.1 / 32.4 / 1.01
AI-assisted-by: claude-opus-5-5
No components v1 file reaches the code any more: opening one fails the
feature check, and imports reject it or give it the feature. What only
served v1 goes:
- validate-file and validate-file-affected no longer skip a file
without components/v2;
- the root of a deleted component is found by its main instance id
only, in the type helper and the component sprite;
- generate-sync-library, which synced shapes inside live components,
and the live components in containers-seq, so asset usages walk the
pages only (deleted components keep their objects and still sync);
- the unused :components-v2 file option, from the schema, the file
data and the test fixtures; stored files that carry it still
validate;
- the team migration-in-progress check and its frontend alert, which
leaves ephimeral features out of the team comparison;
- the components v2 introduction dialog, its styles and icons, and the
:v2-info-shown profile prop;
- the graphic asset events and builders and the reads of graphics in
the selection (the :add-media, :mod-media and :del-media changes stay,
so stored changes still apply), and the uncalled render-page and
render-components helpers.
AI-assisted-by: claude-opus-5-5
Both binfile importers stored a file without the components/v2 feature
as a v2 file, though its component data was never migrated. Such a file
is now rejected with :file-in-components-v1, the code that opening a v1
file already raises, when it has components or shapes linked to them
(:component-id, :shape-ref or :main-instance). A file without component
data takes the feature and imports as before.
Since every imported file now has the feature before the pending
migrations are registered, the no-op components/v2 migration goes.
The import dialog explains the rejection: the entry says that the file
uses an old type of components that Penpot no longer supports, with its
own text, as errors.deprecated talks about opening a file.
AI-assisted-by: claude-opus-5-5
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.
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.
The component helpers of types/file and types/container and the
library events of the workspace had the lowest coverage left.
- common-tests.types.file-test: the export detach, the reuse of the
library page, the original ref of a swap, deleted components and
used-in?. Pinned: F52 (a library copy nested in a local component
loses its ref in every copy), F56 (the original ref of a swap is nil
when the mains are on different pages) and F57 (library color refs
inside :fills survive the export detach).
- common-tests.types.container-test: the placement rules for moves
and pastes (copies, mains, variant containers, deleted components,
component loops) and small helper branches. A plain shape moved
into its own child passes the rules (F58); relocate-shapes drops it
first.
- frontend-tests.data.workspace-libraries-test: the events on several
shapes at once, each one undo entry; update of a library main; a
blank rename; placing with an id ref.
- workspace-library-updates-test: how a file learns that a library
changed, and the sync dialog with its update and dismiss, with the
RPC mocked.
- workspace-library-links-test: linking, unlinking and sharing.
The variant events had almost no frontend tests, and several switch,
paste, token and restore paths never ran.
- Variant property edits (AR) and adding a variant (AS), in both
runners, through the common generators and the dwv events.
- A frontend-only node for the variant management events: transform
(AT), combine (AU), rename (AV), rename in layers, removal of empty
properties and member errors (AW), and the shortcuts (AX). Each
case has copies of the members; direct tests cover the remaining
branches. AV and AT confirm F6: the copies' name sync lands in an
undo entry of its own (pinned).
- Tests for valid-components-for-variants? and valid-variant-switch?.
- The WASM variant switch test is registered in the runner; it never
ran.
- Token apply and remove nodes and case AY. Its undo confirms F55, an
empty :applied-tokens map after undo (pinned). The interpreter waits
for the token, since apply-token opens no pending work (F54).
- A paste-to-root node and case AZ: F17 does not show through paste.
The frontend copy helper merges touched groups as the clipboard
does.
- Switches that carry real geometry, path and text-structure
overrides, resized through a transform.
- Restoring a component whose page was deleted.
A coverage run found sync paths that no test ran. New cases, in both
runners:
- AK: update main into a grid main. With a swapped child the main's
cells keep the copy child's id (F49, pinned).
- AL: update main after renaming the copy root and its child.
- AM: update main of a swap inside a group. The copy child keeps a
swap slot that names a removed main child (F16, pinned).
- AN: a copy flex child's margin override through a main edit, a
reset and update main. The frontend round trip of the main edit
shows F43 with real sizes (pinned).
- AO: a copy dropped into a grid cell of a main. Its undo shows F41
(pinned).
- AP: a library main deletes a middle child.
- AQ: a main change reaches a copy nested in a sub-board.
Also: the frontend interpreter sends the real reset event instead of
installing a file; a test undoes and redoes an undo entry without a
group, which only release builds store; a test confirms F50, a copy
text touched only in :content-group losing its override (pinned).
A review of the suite after the new operations:
- Dead helpers and duplicate nodes go; the lineage reset and swap
nodes are constructors of reset and swap-shape.
- Repeated helpers are shared: grid boards (tho/add-grid-frame,
tho/place-in-grid-columns), n/nested-head-under, n/child-shape,
r/sync-cascade (the benchmark uses it too), the frontend fixture and
fill helpers, and the plugin getMainComponent.
- Runner tests that repeated cases B, C and D go.
- Comments say what the code does, and the wrong ones are fixed.
- Case K's remote edit painted red on red and its unedited variants
asserted nothing; it starts grey and every variant asserts.
- F43 is pinned in one case, AJ, by the value one undo leaves. L, M, Q
and K get real frame sizes, since their pins depended on when the
100 ms layout buffer flushed.
- make-nested-component takes a level count and depth-sweep gives each
depth once, so K, Q, R, T and W stop running depth 1 twice.
- The completion-contract tests no longer depend on fixed pauses or
on how the watcher batches its events.
Benchmark against the baseline (lower quantile): ratios 0.92 to 1.03,
no world flagged.
Fill the unit test gaps in common and frontend component code:
- One test per component error code: break a file in one way, check
the codes validation reports, repair it as the backend does (until
valid, at most ten passes) and check what the repair changed.
Pinned: F46 (a dangling ref in a copy child is never reported), F47
and F48 (two repairs that never converge). :component-not-main,
:should-be-component-root and :not-component-not-allowed have no
test, as no file can produce them.
- Library color and typography sync must not touch copies. Both do
(F3): the color sync touches :fill-group, the typography sync
:content-group and :text-content-attribute, and a later main edit of
that attribute then no longer reaches the copy. Pinned.
- Twenty live thf/dump-file calls in common tests go; they printed
whole file trees on every run and asserted nothing.
- The disabled copy-nested-3 frontend test runs again: a stray
backquote quoted its run-store call, so it never called done.
The composable runners could edit, add, remove and move children, swap
and switch, but not run the other component operations. New nodes run
each one through the production generator in the pure runner and the
real event in the frontend interpreter:
- Detach, UpdateMain, DeleteComponent and RestoreComponent;
- Duplicate, and NestCopy (a copy moved into a main);
- EditText, with the automatic rename the text editor applies;
- MoveShape (frontend only, through the sidebar) and MoveToCell;
- swap-shape and reset on any copy head;
- Undo with a step count, and an edit undone before its sync (frontend
only).
New cases, all with the undo/redo round trip:
- Q, R, S, T, U: detach, update main, delete and restore, duplicate
and nest, at nesting depths 0 to 2;
- V, W, X: a new edit after undo, three undos over nested cascades, an
undo before the edit's sync;
- Y: text overrides against main text edits;
- Z: a main child move;
- AA to AF: swap outcomes on values and structure, and the grid cell
of a swapped child;
- AG, AH, AI: the plugin suite's slot alignment cases.
The plugin suite gets OpDetach, OpSwap and OpReset, names that keep
the roles of two nestable components apart, Assert.knownFailure, and
ports of cases Q, AA, AB and K's reset.
Supporting changes: nodes can record what they created
(IAppliedResult); create-component takes a size, since with 0.01
frames the frontend reflows split undo entries at points that depend
on timing (F43); the interpreter ends the text measurement headless,
so text steps settle; tm/known-failure pins the wrong value a known
bug gives in a case assertion; the interpreter no longer moves its
undo baseline after a skipped optional, which cut the end-of-variant
round trip short.
Confirmed and pinned: F12 (resetting a nested swap clears the top
copy's overrides), F27 (the automatic text rename touches
:name-group), F29 (a second switch loses an override) and F44 (a
swapped grid child misses the main's cell changes). F43 also shows
through a plain sync at depth 2 (case Q).
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.
Both runners now run an undo/redo round trip on every variant, unless
the case turns it off with a reason. After each user step that adds an
undo group, undo must give back the file before the step and redo the
file after it; a user step that adds no group must change nothing. At
the end of the variant, undoing back to the last assembly step and
redoing everything must give back both states. Files compare through
a shared normalizer that drops :modified-at and, on request,
:position-data, and keeps :touched and :remote-synced.
- The pure runner gets a redo stack and a Redo node; a user operation
that pushes a group empties it. Case P undoes and redoes a main edit
in both suites.
- The frontend interpreter runs the round trip through the real undo
and redo events, and checks that each step moves the workspace undo
index by one entry. Each variant starts with an empty undo stack.
A case can mark a failure that a known bug causes. The mark pins, per
phase, the signature of the failure (the shape, page and component
attributes or the undo index that differ). It covers no other failure,
and it fails the case once the bug stops happening.
The check found two bugs, both pinned:
- F41: when sync moves a copy child to an earlier position, its undo
change puts the child back at the same index, so undoing a reorder
in a main leaves the copies reordered (case F).
- F43: the reflow after a swap or variant switch loses the step's undo
group, so its commits land in undo entries of their own and one undo
leaves the step half reverted (cases L and M).
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.
Rebuild the indices only for the page ids the changes carry.
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.
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.
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.
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.
When render-wasm is active, generate SVG for the Code inspector and
Copy as SVG from the WASM export path instead of classic SVG codegen.
Add multi-root render_shapes_svg so multi-select stays one document.
Closes#12567
Setting a library as tokens source did not update shapes that use tokens,
because set-tokens-source never ran the token propagation that every other
token operation runs. Run it after the commit.
Going back to the local tokens, or unlinking the library that was the
source, left no local set active: the file has a single tokens status, and
switching to a library replaced it with the library's one. Keep the status
of the file's own tokens lib aside in a new optional :own-tokens-status
attribute while an external library is the source, and restore it when the
file is its own source again. Exporting without libraries and absorbing a
deleted source library restore it as well.
Closes#12430
AI-assisted-by: claude-opus-5-5
Text copied in Penpot carries its content in a data attribute of the
clipboard HTML, which plugins and other apps can rewrite. The v3 editor
and canvas paste used it as is, so bad data could reach WASM and the
file and break the shape.
The payload is now dropped, and the paste falls back to plain text in
the caret style, unless its content passes the text shape schema, its
span geometry holds only safe numbers and its file and team ids are
uuids. Payloads in HTML over the paste size limit are not decoded.
Copied text shapes pasted into the editor get the same checks, plus a
numeric position; when they fail, nothing is pasted.
Closes#12167
AI-assisted-by: claude-opus-5-5
LibraryComponent.restore() did not check that the component belongs to
the current file's library. Called on a deleted component of a connected
shared library, it restored that component and saved the change to the
library file, while remove(), annotation and duplicate() reject such
handles with a validation error.
restore() now rejects them the same way: "Can only restore components
from the current file's library".
Closes#12607
Fixes the problems found after #12326 and listed in #12327.
Mousetrap now tries several names for each key press, in order, and
fires the first one with a binding: letters and digits by keyCode when
a modifier is held, punctuation by position (layout map, or a US table
when the browser has none), the typed glyph, and the typed glyph
without the Shift it needed. With AltGr the typed glyph comes before
the position. The shortcut recorder asks Mousetrap for the key it
stores, so a recorded shortcut always fires.
This makes "?" and "+" work on every layout, Shift and Ctrl+Shift with
punctuation work in Firefox and Safari, Option+letter work on macOS,
and AltGr+º hide the UI on Linux with a Spanish layout.
Chrome on Linux returns the map of the first configured layout, not
the active one. Mousetrap now drops the map when an unmodified
punctuation key types something else.
The layout twins are no longer needed and are removed: "shift+'" made
"?" zoom to the selection on Spanish layouts. The Add node shortcut is
removed too: on US layouts its key is the "+" zoom key, and on Firefox
with a Spanish layout it cannot fire. The Firefox and Safari warning
in the shortcuts settings is gone, since those shortcuts now work
there. The user guide and translations follow these changes.
AI-assisted-by: claude-opus-5-5
* 🐛 Fix restrict per-side stroke width tokens to rectangles in plugins API
* ♻️ Reuse per-side stroke restriction check across plugin API
Move the per-side stroke width restriction into the public
`per-side-stroke-attrs-restricted?` helper, now taking `page-id`, and reuse
it from both `shape.applyToken` and the token application path. Keep the
error message in a single `per-side-stroke-widths-message` def used by all
three rejection sites.
Wait for token resolution in the uniform stroke width regression test
instead of relying on a bare `settle`, which could assert before the
applied token lands.
AI-assisted-by: deepseek-v4.1-flash
---------
Co-authored-by: Luis de Dios <luis.dedios@kaieldos.net>
A text image fill was always laid over the whole text box, so a pasted
image span showed another part of the picture in a box of another size.
Text image fills now honour the image transform, as shape fills do: the
image covers the transform rect instead of the whole box. Paste gives
each pasted image span a transform that keeps the image at the same
pixel offset from the span, like the gradients.
The SVG export emits one linked image per span transform, rather than
one per image id, and the style panel keeps the transform it reads back.
AI-assisted-by: claude-opus-5-5