* ♻️ Reduce the routes, viewer, theme and typography e2e specs
The five specs of Task 10 (routes, theme, viewer and roles) go from 14
tests to 6, and the two of Task 11 (missing font and add typography)
from 9 to 4. Nine unit tests cover rules that had none: five for the
private legacy-match and four for the viewer frame navigation. No
skipped test and no fixture removed.
The browser keeps the wiring: the known and unknown hash as two steps
of one test, the theme applied live without a reload, the viewer role
walked in two loads with the context menu counted instead of trusted,
and the typography states merged around shared fixtures. The viewer
zoom click comes back as a header step; the arrows e2e becomes unit
tests, with the Next button still clicked by the child-click test. The
missing-font test asserts the renamed, disabled typography button
instead of a hidden one it never described.
WorkspacePage gains reloadWorkspace, which clears the socket registry,
reloads and reopens the mock, and settles on the sitemap page name or
on the canvas when the restored sidebar tab hides it. layerRow matches
rows by anchored text, because a selected row's action buttons can join
its accessible name, and selectLayer accepts click options for the
shift-click steps. The font specs use both and no longer import
MockWebSocketHelper.
The viewer role asserts its two absences by testid: new-project-button
already existed and add-custom-font is new in fonts.cljs, the only
product change, with the visible side covered by dashboard.spec.
routes_test adds the path-params case for legacy-match; viewer_test
asserts the first event and the page id of the frame navigation, and
watch-events delivers asynchronously and handles the nil a watch can
return.
Measured at four workers: 23 to 10 tests; Task 10 from 141.3 to
68.5/72.3 worker-seconds and Task 11 from 150.1 to 109.0/109.3.
Closes#13058
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Let the two reduced e2e steps fail when they should
The typography step selected the next layer with Shift, which in the layers
panel is a range selection: the range also brought in the text with a
typography token, so the button was hidden by the applied token and not by
the mixed values. A mod-click adds only that shape, and two new assertions
keep the token and the asset texts out of the selection.
The logo step clicked 100 px below the logo and asserted the URL, which
potok updates after the click returns, so the assertion matched the old URL
on its first poll. Probing elementFromPoint under the logo answers the
hit-area question directly.
AI-assisted-by: deepseek-v4.1-flash
* ♻️ Cut shortcuts and inspect e2e specs and harden their assertions
Shortcuts spec: drop the enable-custom-shortcuts mock, since no frontend,
common or backend code reads the flag, and cut 18 tests to 6. A header
comment records where the removed rules went: named steps here and the
77 unit tests of settings_shortcuts_test.cljs. The six keep only what a
browser proves: the file input and diff modal, the alert for a file with
nothing to apply, the download of a bound and an empty entry, the RPC
write with reload, the conflict that disables the previous binding, and
both reset flows.
Fix the shortcuts review findings: the invalid-file step dismisses the
timeout-free toast before the next import and covers both removed payloads
in one import. The conflict test records a default-bound and a custom-bound
key on one page load, then resets and imports a key a default binding
holds, so the diff modal's apply path runs with a default in the way, and
checks the alert, the disabled row and the exported payload; the export
test resets and imports the file it just downloaded.
Inspect tab spec: cut 27 tests to 8 with 25 named steps, from 622.9 to
181.5 worker-seconds and 162.5 to 46.7 seconds of wall time. Layout,
shadow and blur, fill, stroke, typography and clipboard cases run as steps
in one page load per group; the two cases that mutate the shape with
Design-tab controls keep their own. Replace 500 ms sleeps with waits on
rendered state, make layer expansion idempotent, match layer names exactly,
poll row counts and await every matcher. Drop the false comment about name
capitalisation, the three unused shapeToLayerName entries and the skip the
"Layer info" assertion now covers.
Move layerRow and selectLayer into WorkspacePage with the helpers the next
PR in the stack needs: layerRow matches an anchored name on the layer-row
test id, because a selected row's hide and lock button titles join its
accessible name, and selectLayer waits for aria-checked instead of the
shape name. waitForSelectedShapeName takes options. The inspect spec drops
its escapeRegExp, getLayerRow and inline selection. Rename the fixture
token to radius-md so the radius assertion is not satisfied by the row
label.
Closes#13009
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Pass the translation flag in the sync text undo test
The merge of staging into develop brought back the required :translation
key of an undo entry, and the test added in ef0333eafe calls append-undo
without it. check-undo-entry throws, the exception escapes the promise
and the whole frontend run exits before printing the summary.
The entry stands for the commit of a component sync, which is not a
translation, so it carries :translation false, the value the production
watcher derives from the commit.
AI-assisted-by: deepseek-v4.1-flash
With the tokenscript flag every resolution rebuilt the whole library:
each sidebar render, each propagation and each keystroke in a token
form. The adapter now keeps the interpreter state of the last
resolutions and updates it with set-sets, so only the tokens that
changed and their dependents are re-resolved and converted. Every other
output token stays the same object.
- common/deps.edn moves penpot/tokenscript-interpreter to v0.3.0:
token readers and writers and a set-sets that looks only into changed
sets (#1), on top of the DTCG import and export (#4) Penpot already
uses.
- The sidebar, token propagation, token application and the plugin API
pass the active sets unmerged (cfo/get-active-token-sets and its
force variant); the interpreter merges them. The plugin API's own
resolution cache is gone.
- The adapter hands Penpot's token records to the interpreter with a
reader (value and DTCG type, an error for a token without a value)
and a writer (the conversion to :resolved-value or :errors), which
runs only for the re-resolved names.
- The cache resolves new sets from the last resolution with the same
set ids, else from one sharing a set id, else from scratch.
- The token form controls resolve the draft in a set of its own on top
of the library's sets, the selected set last
(cfo/get-token-sets-for-edit). The form leaves the edited token's old
name out of them (cfo/without-token). A keystroke re-resolves only
the draft and its dependents. The last draft is cached apart, so
typing doesn't evict the sidebar's resolutions. Without the flag the
controls don't build these sets. The plugin API's token name and
value setters validate the candidate the same way.
- The token form hint shows resolved font families as a name list.
- Tests cover the unmerged set helpers, a plugin rename to a name below
the old one (which needs the old name left out), and compare renames,
with and without updating the references, against StyleDictionary.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
Move the pure subscription rules out of the browser specs and into unit
tests, then keep only the cases a browser can prove.
- Extract show-manage-subscription-link? and show-main-menu-power-up? from
the dashboard team panel and the workspace main menu, and use them at
both call sites. A new subscription_dashboard_test.cljs covers which
plan a subscription reads to, including unpaid and canceled demotion, the
owner and enterprise sides of both affordances, and the banner and
members-CTA boundaries: four editors over the seats, no usage data, and
the demoted plans.
- Add get-versions-stored-days tests to workspace_versions_test.cljs: an
active nitrate or enterprise license keeps 90 days, a canceled one lets
the team plan decide, a license without the admin console does not count,
and unlimited, enterprise, professional and planless teams keep 30, 90
and 7 days.
- Rewrite the profile usage tests as async tests with mock/with-mocks* and
an async transport double: the editors from the usage call reach
[:props :subscription :editors], a failing call leaves the profile
untouched and logs once, and the call is skipped without the
subscriptions flag.
- Cut the e2e suite from 13 cases to 7. Five dashboard cases keep the menu
icon, the two sidebar plan names, the owner-only settings link and the
members CTA; two workspace cases keep the translated days warning with
the upsell step and the enterprise menu with no upsell. Assert the
unlimited glyph and drop the CTA count.
- Drop the three get-team-info mocks the dashboard never calls and six
unreferenced subscription fixtures, reusing the invitations fixture.
- Sort the subscription test requires in runner.cljs: cljfmt's
:sort-ns-references? wants subscription-dashboard-test first.
Closes#13005
AI-assisted-by: deepseek-v4.1-flash
* ✨ Explain why a library cannot be disconnected in its modal
A library that another connected library uses cannot be disconnected from
a file, but the Libraries modal showed it with the same disconnect button
as any other library, only disabled, and said nothing about why.
Replace that button with an icon and a tooltip. A nested library ("Connected
through ...") says it is inherited from its parent, and a direct library
that another connected library uses says which one. Both name the library
to disconnect first. A library nothing else uses keeps its button.
library-disconnect-hint decides the case from the same data the disabled
state used, so the buttons that were disabled are the ones that change.
The legacy libraries tab keeps its button.
Closes#12838
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Name every library to disconnect in the disconnect hint
The hint named only the parent of a nested library as the one to
disconnect. That was wrong when several libraries use it (disconnecting
one leaves it linked through the others) and no help when the parent is
nested too and has no disconnect button either.
The removal step now lists the libraries the user can actually disconnect:
those that use the library directly or through others, and that no linked
library uses. The parent is still named as the reason it is inherited. In
a cycle nothing is removable, so the parent is named as before.
Tests cover a shared dependency, a deep chain and a cycle.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 List directly linked libraries in the disconnect hint
A library linked to the file directly stays until the user disconnects
it, even when another linked library uses it. The hint skipped those: for
a file linked to A and B, with A using B and B using C, it told the user
to disconnect only A, and C stayed linked through B.
Collect the libraries that use it, however far up, and that are either
linked directly or used by no linked library. A directly linked library
that another one uses cannot be disconnected yet, and its own tooltip
says to disconnect that one first.
The test covers a directly linked intermediate library.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Count a library linked in this session as direct in the hint
Only the libraries fetched when the workspace opens carry :is-indirect.
One linked afterwards comes back without it, so the hint did not treat it
as directly linked: after connecting B (which uses C) and then A (which
uses B) without reloading, C's tooltip said to disconnect only A, and C
stayed linked through B.
A library the user linked has no flag and is direct by construction, so
only one known to be indirect is skipped.
The test covers that sequence.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Flag libraries linked in this session as direct or indirect
Only the libraries fetched when the workspace opens carried :is-indirect.
Linking a library afterwards loads it and its dependencies through
load-library-file, and none of them got the flag, so a missing flag could
mean either. The disconnect hint in the Libraries modal reads it to tell
which libraries the user can disconnect, and it listed the wrong ones for
a chain connected in the same session (it named a dependency that has no
disconnect button).
Set the flag where the library is loaded: the library the user links is
direct and the libraries it brings in are indirect. The hint is back to
trusting only a flag that says false, because a missing one no longer
means a direct link.
The test links a library with one dependency and checks both flags.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Keep a library's direct flag when it is loaded twice
When links overlap, a library can be requested twice: once because the
user linked it and once because a library linked right after brings it
in. Each load stored its own :is-indirect value, so whichever answer
landed last won, and an indirect one could erase the direct link. The
disconnect hint then listed the wrong libraries.
Store a loaded library through one event that never turns a known direct
link into an indirect one. The reverse order already ends direct, since
the user's link is stored with the flag false.
The test links a library and then one that uses it before the first
answer arrives, and answers in the order that used to lose the flag.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Scope a library's kept direct flag to the file it belongs to
The flag kept when a library is loaded twice was read from :files, which
outlives a workspace. A library that was a direct link of the file visited
before could keep that flag in the next file, where another library only
brings it in, and the disconnect hint then listed one library too many.
Keep the flag only when it was recorded for the file being loaded, using
the :library-of the entry already carries.
The test leaves a library flagged direct for another file and links a
library that brings it in.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 💄 Name the libraries in the disconnect hint as design asked
The nested library hint now reads "Connected through <parent>. To
remove it, disconnect <libraries>." instead of "Inherited from ...".
The library names in both hints (connected through and used by) show
in the primary foreground color, so they stand out from the text.
The translation is split on its two placeholders instead of rendered
as HTML, because the library names are written by users. The full
plain sentence stays as the aria label of the icon.
The new key is workspace.libraries.connected-through-hint, since
workspace.libraries.connected-through already labels the parent in the
list.
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
---------
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
Co-authored-by: Eva Marco <evamarcod@gmail.com>
* ✨ Copy stable deep link to selected boards from context menu
The workspace "Copy link" action copied the raw current location, which
only carries file and page ids, so the link did not point at any specific
board. Build the link from the current route plus a `board-id` query param
derived from the selection: a selected board contributes its own id, and a
selected shape contributes the id of the board it belongs to.
`board-id` is an existing workspace route param (`zoom-to-frame` already
selects and zooms to it on load), and board ids are stable across renames
and reordering, so the link keeps resolving to the same board. When the
selection contains no board, it falls back to the previous behavior.
Relates to #4584
AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 📎 Add tests for copying a stable board link
copy-link-to-clipboard now links to the boards of the selection through
their ids, and nothing covered it. The tests run the event on a state
with two boards, a rectangle in each and a rectangle on the root, with
the router and the clipboard replaced.
They check that a selected board, and a shape in a board, link to that
board; that shapes in two boards link to both and a board with its child
gives one id; that the route params are kept next to the board ids; and
that an empty selection, or a shape on the root, copies the current
location. The five board cases fail on the version of the function before
the change.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* ♻️ Share how the selection maps to its boards
select-shape and copy-link-to-clipboard each worked out which boards
a selection belongs to, with slightly different rules for a shape on
the root. Both now call selected-board-ids.
A selection with a shape on the root has no board to point at, so the
URL and the copied link both leave out the board ids. Before, the
copied link kept the boards of the rest of the selection. The URL also
lists each board once now, and has no board-id for an empty selection.
AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
---------
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
Co-authored-by: Eva Marco <eva.marco@kaleidos.net>
After a font size change on a main text, the main resizes itself in a
commit that stacks onto the edit's undo entry. That commit still took
the group its undo transaction was opened with, and the component sync
it starts inherited that group. So the sync became a separate undo
entry: the first Ctrl+Z undid only that sync, the copies were measured
again right away, and nothing visible changed. The user had to press
Ctrl+Z twice to undo the edit.
A stack-undo? commit that records undo (save-undo? and undo changes,
the same test the history watcher uses) and has no undo group of its
own now takes the group of the entry at the current undo index. The
commits it starts, such as the component sync, inherit it, so one
Ctrl+Z reverts the edit, the resize and the sync.
A stacked commit that records no undo joins no entry, so it keeps a
group of its own: the automatic text heals must not take the rollback
unit of the user's last action. A stacked commit that joins an open
transaction that already holds changes keeps the transaction's group,
as append-undo adds it to the transaction.
The rule for commit groups in
mem:frontend/workspace-state-persistence-subtleties now includes the
stacked-entry step.
Tests: frontend-tests.data.workspace-undo-test covers a stacked commit
with no transaction, in an empty transaction and in a transaction that
already holds changes; a stacked commit that records no undo; and one
undo over an edit, its stacked commit and a follow-up commit of the
same group. frontend-tests.data.workspace-heal-undo-test drives the
real resize-text and component watcher on a main text with a copy:
one undo reverts the edit, the resize and the syncs on both.
Closes#13207
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a face that failed to load counts as ready,
because WASM lays the text out with a fallback font. The page-open
check skipped only texts waiting for a font, so it measured texts with
a failed face using the fallback and saved that size with no undo
step, on every page open. A team font that was deleted or returns 404
changed the size of every auto-grow text using it.
The check after fonts load had the same problem: a face that was
pending at page load and then failed was measured with the fallback
and resized, also without undo.
Both checks now skip texts that use a failed face, as the SVG :check
phase already does. The font relayout still runs for them, so they
show in the fallback font, but their stored size stays as it was.
app.render-wasm.api.fonts/font-failed? reports a failed face, and
shape-ids-for-failed-fonts finds the texts that use one.
Tests: frontend-tests.render-wasm.stale-text-selrects-test covers a
page load and a font load where one stale text uses a failed face;
only the other text is resized. The tests now mock font-failed?, so
they do not read failed faces left by other tests.
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a sync re-measure of copies shared a 40 ms
batch with user resizes of the main text. The batch skipped the
component sync when any request asked for that. So a resize of the
main (grow type, font size, paste, search and replace) often never
reached copies on other pages or in other files, and the viewer and
exports showed the old size.
A batch now skips the sync only when every request asks for it, the
same rule as :save-undo?. Such an edit costs one extra short sync
round. That round holds only skip requests, so it stops after one
pass.
A copy that the sync switched from fixed to auto-grow was never
re-measured, because the check read the grow type before the sync.
The check now reads the grow type that the change sets. A copy that
the sync makes fixed is not re-measured.
A sync started without an undo group (library update dialog, color
and typography sync) committed with a fresh group, and its re-measure
and layout pass took other ones. Ctrl+Z first undid only the
re-measure and left the copies in the old box. The sync now picks its
group when it runs: inside an undo transaction (color, typography and
asset deletes) it takes the transaction's, otherwise a fresh one. The
re-measure and layout pass share it, so one undo reverts the edit, the
sync and its follow-ups, and a failed save rolls them back together.
On the SVG renderer, opening a page resized a copy with no position
data even when its size had not drifted. Measured sizes round up, so
17.4 became 18. The measurement from that resize then landed on the
user's last undo entry. The heal now reports whether it resized, and
the check phase resizes only when the size drifted.
The SVG page-open check covered only texts with overridden content.
A copy loses its touched flags, so a label overridden inside a main
(a Button label in a Card main) was never checked in the main's
copies, and its heal skips the component sync. The check now covers
every auto-grow text inside a copy, as the WebGL check does. The
heal's reflow now skips the component sync too: without undo it
touched the main component on every page open.
A page-open check measured with a font that failed to load wrote the
fallback font size. It now writes no size then; a copy without
position data still gets it. The WebGL and SVG renderers can measure
a text differently; a gap over 1 px makes each page open by a user of
the other renderer write the size back. Two browsers on the SVG
renderer can do the same: a long auto-width line can differ by more
than 1 px, and an auto-height text can wrap a line differently. This is
a known limit, noted in the text-heal docstring.
The drift check moves to text-size-drifted? in
app.common.geom.shapes.text, and takes a tolerance. Both renderers use
it: 1 px for the SVG check and the WebGL page-open check, 0.1 px for
the WebGL font-load check. The WebGL check did not skip axes that fill
their layout parent, so those texts looked stale on every page open
and were resized for nothing. It now reads the stored width and height
and skips fill axes.
The sync docstring and a test message gave the wrong reason for
:skip-component-sync?. :ignore-touched stops the resize from marking
:geometry-group. :skip-component-sync? stops the re-measure commit from
starting another sync. "Remasure" is now "re-measure" in
identifiers, test names and comments. The sync docstring now states
that an auto-grow copy takes the main's size on each geometry sync,
also with overridden content, until the re-measure or the page-open
check corrects it. The sync's undo comment no longer says the layout
pass gets the sync's undo group: the layout buffer drops it, and the
pass joins the same undo entry through :stack-undo?.
Tests: heal undo tests cover mixed user and sync batches in both
orders, and undo for both renderers. A heal leaves the undo stack
unchanged, and undo reverts the user edit. A heal reflow skips the
component sync. Sync tests cover a copy that becomes auto-grow
(re-measured) and one that becomes fixed (not), and a sync with no
undo group that shares one with its re-measure, also inside an undo
transaction, with and without a group of the edit. Viewport tests cover
no resize without drift, a drifted copy that resizes and settles, the
check of every auto-grow text in a copy, and no size write from a
failed font. Component tests mount the SVG renderer: a drifted copy is
measured once to check and once to settle, with no undo step, and a
matching copy is measured once. Stale-selrect tests cover skipped fill
axes. The drift tests move to common-tests.geom-shapes-text-test, with
tolerance and grow-type cases.
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a sync from a main component re-measures every
auto-grow text it changes on the page. The sync runs on every edit to
a main component, so an edit that cannot change a text size, such as
opacity, shadow or text color, still re-measures and re-lays out every
synced text.
The sync now re-measures a text only when the change sets an attribute
that can change its size: :grow-type, :width, :height,
:layout-item-h-sizing, :layout-item-v-sizing, or :content that differs
in more than its fills. A text color change reaches copies as a
:content change, so fills are removed from both contents before
comparing. Sync emits operations only for attributes that changed, so
the operation attributes are enough. Moves (x and y only) do not
re-measure.
Tests: frontend-tests.data.workspace-sync-text-wasm-test adds cases for
a fill change and an opacity change on the main text (no re-measure),
and for a font size change and a width change on an auto-height text
(re-measure).
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the SVG renderer, opening a page measures auto-grow text copies
with overridden content and writes back their size and position data
when they drifted. The write went through the normal text commits,
which stack onto the user's last undo entry. So the first Ctrl+Z after
opening a page also reverted the heal.
A component sync also set the position data of a copy to nil, even
for a fill change on the main. Such a copy skipped the check and went
through the normal path, with undo.
Heal requests now take :save-undo? false. resize-text and
update-position-data accept optional opts, and a request with
:save-undo? false marks its text as a heal for the current batch. A
later user request for the same text in the batch removes that mark.
The batch commit splits in two. User texts commit as before. Heal
texts commit with :save-undo? false and :skip-component-sync? true,
so each copy heals on its own page open instead of syncing.
The heal resize asks for the parents' reflow with :save-undo? false.
The layout buffer lays out heal updates apart from user ones and
passes the flag to apply-modifiers, so the reflow records no undo
step either.
The :check phase also heals a copy without position data, with no
undo. When the size drifted, the text moves to a new :settle phase.
The measurement that the heal resize causes also commits without undo.
Known limit: when the heal's reflow moves the text (for example,
re-centering it in a flex parent), the renderer measures the text
again with no phase. That position-data commit still stacks onto the
last undo entry. Left for a follow-up.
Tests: frontend-tests.data.workspace-heal-undo-test (SVG store) covers
a heal resize with no undo, no component sync and a reflow without
undo; a heal and a user change in one batch; a user request after a
heal of the same text; and the layout buffer keeping a heal's reflow
apart. frontend-tests.ui.viewport-texts-html-test covers the options
each phase sends: drifted copy, matching copy, copy without position
data, unmeasurable text, settle, and no phase.
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, the workspace resizes auto-grow texts whose
stored size no longer matches their WASM layout. This runs when a page
opens and when fonts finish loading. These resizes are not user
actions, but each one recorded an undo step. So the first Ctrl+Z after
opening a page undid the resize instead of the user's last edit, and
the copy went back to the wrong size.
The listener for the stale-text event now asks for the resize with
:save-undo? false. The flag passes through the resize debounce to the
commit, which hands it to apply-wasm-modifiers, so the shape update
records no undo step.
Resizes are batched in a debounce window. A batch skips the undo step
only when every request in it asked for that. A user resize that lands
in the same window keeps its undo entry. Batch options are now merged
for every request, including those without options, so this check
works.
Tests: frontend-tests.data.workspace-heal-undo-test covers a heal
resize that commits without an undo step, a resize without the flag
that still records one, a mixed batch that keeps the undo step in
either order, and a batch of heals that skips it.
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the SVG renderer, a text is measured only when its text
properties change or when it has no position-data. A component copy
with overridden text content keeps its own position-data. If its
main changes while the page is closed, the copy takes the main's
size, and nothing measures it when the page opens. It keeps the
main's height, so its flex siblings overlap the extra lines.
When a page opens, each auto-width or auto-height text with
overridden content on a copy starts in a :check phase and gets one
hidden HTML measurement. In :check, the result is written (size and
position-data) only if the size differs by more than 1px on the axis
the text grows on. Otherwise nothing is written, though the text
modifier is still cleaned. The phase is then dropped, so later
measurements work as before. A copy with no position-data skips the
check and is measured and committed as usual.
The new dwt/text-size-drifted? holds the 1px rule. It ignores an axis
that fills its layout parent, because the layout sets that size and
the check would otherwise find drift on every open. The 1px tolerance
matches the WebGL page-load check. SVG stores whole pixels, rounded
up, so smaller gaps are only rounding. A finer tolerance would
rewrite the same texts each time a page opened.
Each content-overridden auto-grow copy costs one extra measurement
per page open.
Tests: frontend-tests.data.workspace-texts-test covers
text-size-drifted? for sub-pixel and exact 1px gaps, the growing axis
only, and fill axes. frontend-tests.ui.viewport-texts-html-test covers
which copies start in :check, the drifted, matching and unmeasurable
cases, and the 1px commit when no phase is set.
Known limit: the heal commits like any SVG measurement, so it adds to
the user's last undo entry.
Relates to #12721
Relates to #13065
With the WebGL renderer, a component copy synced while its page was
closed takes the main's size for its auto-width or auto-height text.
Nothing measured it again when the page opened. The only check of stored
text sizes against the WASM layout ran after font loads, and only for
texts that waited for a font. Once fonts were loaded, which is true for
every page after the first in a session, the stale copy kept the main's
size. Its flex siblings then overlapped the extra lines.
Page loads now check every auto-grow text they bring into WASM. This
covers the sync path for small pages and the chunked async path for
pages with 100 or more shapes. A stale text goes through the existing
stale-text event, so the workspace resizes it. Texts still waiting for a
font skip the check, since the font check handles them when the font
arrives. So no text is resized twice.
The page check uses a 1px tolerance, and the font check keeps 0.1px. The
classic renderer stores whole pixels and WASM stores fractions, so a
finer tolerance would rewrite the same texts each time a page opened.
Shape updates made while editing do not run the check, so typing does
not resize texts.
Tests: new frontend-tests.render-wasm.stale-text-selrects-test covers
small and large page loads, sub-pixel gaps, fixed texts, texts waiting
for a font, and shape updates while editing.
Note: set-objects also serves thumbnails, the viewer and the export
worker, where nothing listens to the event. There the check costs one
cached size read per auto-grow text, the same cost the font check already
had for texts that waited for a font.
Relates to #12721
Relates to #13065
* 🐛 Fix Chinese browser language autodetection
* ♻️ Pass the browser language to autodetect
* ♻️ Share locale resolution between autodetect and set-locale
Hosts need a vendor-agnostic way to react to named audit events in the
browser (for example SaaS config.js). Penpot exposes
penpotAddEventCallback / penpotEventCallbacks, loads an early stub before
config.js, and invokes matching callbacks after make-event, without
coupling to any analytics SDK.
Closes#13091
AI-assisted-by: Composer
The analysis of a package reads the metadata of every media and
thumbnail of its container to attribute the shared objects to each
file. It read them all at once, one promise per entry, and the
container of a big file holds thousands of them: every read opens its
own decompression stream, and Chromium fails the whole analysis under
that load while Firefox keeps up. The failure is masked by zip.js with
a generic "Cannot close a ERRORED writable stream".
The references now go through an observable, one entry at a time, and a
reference that cannot be read leaves its file without a size instead of
failing the package: a number that misses one of the objects of the
file is worse than no number.
Closes#13022
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Keep fill copies laid out after a component sync in the WebGL render
Lay out other pages in CLJS and reflow nested layouts that keep their size.
Closes#13015
AI-assisted-by: claude-opus-5-5
* ⚡ Skip the nested layout pass during WebGL drag previews
Gap, padding and margin drags keep the cost they had before the fix.
Relates to #13015
AI-assisted-by: claude-opus-5-5
Plugins and the MCP could not learn which Penpot instance they run on,
so agents guessed the domain when they wrote links to files.
Add penpot.location with the instance base URL (baseUrl), the URL of
the current screen (href) and its query params (params). It works in
the dashboard and the workspace and requires content:read. Params that
carry secrets (share-id, the MCP authorize params, and any key ending
in token, secret or password) are left out, and href is rebuilt from
the remaining params so it never carries one.
The MCP instructions tell agents to use href instead of building links.
The plugin API test suite checks location against the open file, and
its API surface is regenerated from the current types.
Closes#13013
AI-assisted-by: claude-opus-5-5
#13068 fixed the move left and right shortcuts, which moved and showed
the opposite direction. Its test only checks the key binding. These
tests run each move shortcut, in the workspace and the path editor,
and check that it moves in its own direction, fast or by one unit, and
that its tooltip shows the matching arrow.
Without the fix of #13068, 8 assertions fail.
AI-assisted-by: claude-opus-5-5
When a peer restored an autosaved version, the notice said "restored an
earlier version" instead of naming it by its date and time.
The modal wrapper passes the props map to the component without
camelCasing its keys, so the `created-at` prop reached the component as
"created-at" while it read `createdAt`, and the date was always nil.
Named versions were fine because `label` is one word. The prop is now
`date`, and a test renders the registered modal the way the wrapper
does.
Closes#13037
AI-assisted-by: claude-opus-5-5
* 🐛 Validate the shapes of a page added by an update-file change
The backend validates every shape an `:add-obj` or a `:mod-obj` change
writes, but an `:add-page` change carries a whole page and its shapes
reached the file unchecked. Duplicate page and the undo of a page
deletion send that page as the client holds it, so a tab that loaded a
file before a migration ran could write the old format back into it.
A tab opened before #12006 deployed holds camelCase svg attr keys such
as `:fillRule`, and the closed `:svg-attrs` schema rejects them. The
file saves, and the next read that migrates it fails the file data
check, so the whole file stops opening (#13107).
`:add-page` now validates each shape of the page on the backend, as
`:add-obj` does for one.
AI-assisted-by: claude-opus-5-5
* 🐛 Rerun the svg attr normalization on files that recorded 0035
Files that recorded migration 0035 never run it again, so camelCase
svg attr keys written after it ran stay in the file. A tab that loaded
a file before 0035 ran could save such keys through an `:add-page`
change, and the closed `:svg-attrs` schema then rejects the whole file
on its next migrating read (#13107).
The svg attr normalization now runs under the id
`0037-fix-shape-svg-attrs-and-defs`, and the 0035 id leaves
`available-migrations`, as 0021 did when 0035 replaced it. Every file
that recorded 0035 migrates again. Kebab input passes through
unchanged, so the rerun touches only the keys written after 0035.
AI-assisted-by: claude-opus-5-5
* ♻️ Move the 0037 migration tests to their own namespace
The svg-attr migration was renamed to 0037, but its tests stayed in
the 0035 test namespace under migration-0035-* names. Move the whole
section to files_migrations_0037_test.cljc, register the new namespace
in the test runner, and rename its tests to match the migration id.
Replace the doseq over the two withdrawn ids with two self-contained
deftests, one for 0021 and one for 0035. No production code changes.
AI-assisted-by: hy4-flash-free
* 🐛 Keep the log watch installed until the rejection record arrives
The logger swaps the record on an executor thread, after the call that
logged it returns. The test removed the watch in the `finally` around
`update-file` and only then polled for the record, so under load the
record landed on nobody and the test read a nil `:attempts`.
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Count only update-file calls in the save-test transport log
The mocked transport is installed with `set!` and outlives the fixture: a
timer another module left pending can still reach it mid-test, as a
`:delete-file-object-thumbnails` call did in CI. Filter to the only
command persistence sends, `update-file`, so a stray call neither fails
the emptiness assertion nor releases a `wait-for` on a save.
AI-assisted-by: deepseek-v4.1-flash
---------
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
* 🐛 Fix token export writing the wrong active themes
The export passed only the tokens library, so the active themes and
sets in `$metadata` were the ones of the imported file, kept in the
library, instead of the ones activated in the file. The multi-file
export now needs the file's status, so no caller falls back to them.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
* 🐛 Say no tokens were found when importing a file without tokens
Importing `{}`, or a JSON file without any token, said the token data
was invalid.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
---------
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
* 🐛 Make execute_code wait for save before success
* 🐛 Address review feedback on waitForSave
Reject with an Error carrying a `code`: save-timeout, rolled-back,
save-retrying, or the failure code (save-failed by default). Lower the
default timeout from 90s to 60s, leaving room for the 30s layout wait
and the code under the MCP tool timeout.
When persistence is already in error at the start of the wait, keep the
stored failure code, and tell a failure Penpot keeps retrying apart from
one that needs the file reopened.
Share timeout validation with waitForLayoutUpdate through
app.plugins.utils, and make reject-not-valid reject with an Error, which
also fixes the string rejections of connectLibrary, restore, remove,
pin, export, findVersions and saveVersion.
The MCP execute_code handler now waits for the save only when the
workspace is ready, like the layout wait, so dashboard calls no longer
fail on a save error from an earlier file.
Move the waitForSave tests to frontend-tests.plugins, add tests for the
error codes, the retrying state and a failure during the wait, and add
plugin API suite and MCP handler tests. Update the docs, CHANGELOG and
the generated API files.
AI-assisted-by: claude-opus-5-5
* 🐛 Show the error page for critical WASM errors
Since #8651 the :wasm-error handler showed the error page for :panic
only, so a :wasm-critical error (a WASM trap with no error code) fell
through to a toast and the user kept working on a broken renderer.
Only the codes in recoverable-wasm-codes now show a toast: :non-blocking
from Rust, plus :wasm-reload-context-failure and :viewer-canvas-failed,
raised by the frontend. Any other code shows the error page. This covers
errors from the render loop, event handlers, promises and store events;
errors thrown inside React effects still reach the error boundary.
The h/call docstring now describes what it does: it always throws.
Closes#12990
AI-assisted-by: claude-opus-5-5
* ✨ Add a guard for React effects that call WASM
React sends any error thrown in an effect, or in its cleanup, to the
error boundary at the app root, which replaces the whole workspace with
the error page. That holds even for recoverable WASM errors, which
should only show a toast.
errors/wrap-wasm-effect runs an effect fn and the cleanup fn it
returns. A recoverable WASM error goes to on-error (toast); any other
error is rethrown, so it still reaches the boundary. The macro
with-wasm-effect wraps mf/with-effect with it.
The macro lives in its own namespace, app.main.ui.hooks.wasm-effect:
app.main.ui.hooks cannot require app.main.errors, because the renderer
loads it and that makes a circular dependency.
AI-assisted-by: claude-opus-5-5
* 🐛 Show a toast for recoverable WASM errors in the viewport
A recoverable WASM error thrown inside a viewport effect reached the
React error boundary, which replaced the whole workspace with the
error page.
Every viewport effect that calls WASM in its body or cleanup now uses
with-wasm-effect, so a recoverable error shows a toast and the
workspace stays; panics and critical errors still show the error page.
Effects that call WASM only from a listener, ts/asap or ts/raf keep
mf/with-effect: those errors never reach React.
AI-assisted-by: claude-opus-5-5
* 🐛 Show a toast for recoverable WASM errors in the text editor
The WASM text editor calls WASM from two React effects: on mount (select
all, render) and in the first caret blink. A recoverable error there
reached the error boundary and replaced the workspace with the error
page.
Both effects now use with-wasm-effect. The mount effect also guards its
select-all and render step on its own: it opens an undo transaction
with no timeout first, and without that inner guard a recoverable error
would stop the effect before it returned the cleanup that commits the
transaction and disposes the WASM editor.
AI-assisted-by: claude-opus-5-5
- Extract modifier encoding and FFI operations into common bindings
for renderer benchmarks and application callers.
- Keep readiness checks and render scheduling in the frontend API.
- Release propagation output after decoding failures.
- Cover payload ownership, heap growth, snapping and interactive
lifecycle behaviour with shared fixtures and integration tests.
AI-assisted-by: gpt-6.1-sol, deepseek-flash
Token import and export move to tokenscript.document.read and
tokenscript.document.write in the tokenscript-interpreter package
(penpot/tokenscript-interpreter#4).
tokens-lib keeps an adapter that maps its documents to a TokensLib and
back: penpot's token types, the keys of composite values and the
activation of themes and sets. About 600 lines of format detection,
legacy rewriting and tree walking go.
- Imports read DTCG 2025.10 files: {value, unit} dimensions, color
objects in their color space (oklch(l, c, h)), the fontFamily and
fontWeight type names, $root, $extends and $ref aliases. Legacy and
DTCG nodes can be mixed in one file.
- What penpot does not store is dropped and listed in one warning
toast: $extensions, $deprecated, group descriptions, values the
reader cannot use (such as a Rec. 2020 color without hex), groups
whose $extends fails and tokens of types penpot does not have.
- Sets a theme marks disabled are no longer part of the theme, and
activating a theme deactivates the other themes of its group.
- Exports are unchanged by default. export-dtcg-json and
export-dtcg-multi-file take {:profile :dtcg} for 2025.10 values and
types. Such a file reads back with the DTCG types: spacing and
sizing tokens come back as dimensions.
- The package moves from frontend/deps.edn to common/deps.edn, since
the backend and the SDK read and write token files too.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
The text measurement in update-text-shape used ->> with p/catch. But
p/catch takes the promise first, so the handler was read as the promise.
The call then returned a promise that resolved to the handler function at
once. Measurement errors were never logged, and a failed measurement was
left as an unhandled rejection.
The caller ran p/finally right away, so the text left the pending set and
its :text-measure reflow task closed before it was measured. The text
could then unmount: the measurement read a detached node, got a zero rect
and skipped resize-text. waitForLayoutUpdate could also resolve before
the text was measured. This bug came in with #9898.
Use p/merr instead, which takes the function first. It logs the error and
resolves to nil, so the promise settles only when the measurement does.
Tests check that the promise stays pending until the measurement settles,
that the measurement then completes, and that a failed measurement
resolves to nil.
AI-assisted-by: claude-opus-5-5
* ✨ Extend combobox icons and input handling
Allow a combobox to show a fallback icon when no option provides one.
Clear delivered input values so unmounting does not emit them again.
AI-assisted-by: gpt-6-luna
* ✨ Add scale options panel to the right sidebar
Add scale controls for selection dimensions, presets, and anchor points.
Scale shape content around the selected anchor and preview canvas resizes.
Reset scale state when selection changes, and exit scale mode with Escape.
Cover scaling and resize previews with frontend tests.
AI-assisted-by: gpt-6-luna
---------
Co-authored-by: Luis de Dios <luis.dedios@kaleidos.net>
Clicking a set's row in the theme editor threw an assertion error and
left the set as it was: the row passed the set's name to the toggle,
which looks the set up by id. The row now uses the checkbox's handler,
so the two can't drift apart again.
The editor's set and group toggles move into pure functions next to
it, with tests. A new spec clicks a set's name to tick and untick it.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
The `move-unit-left` shortcut was bound to the Right arrow and moved the
selection right, and `move-unit-right` the reverse, in both the workspace
and the path editor. Arrow keys behaved correctly, but the shortcuts panel
and the shortcut settings showed "Move left" next to the Right arrow, and
customizing "Move left" rebound the rightward move.
AI-assisted-by: claude-opus-5-5
Signed-off-by: Roshan Ramani <roshanramani.dev@gmail.com>
toggle-token and apply-token-from-input each worked out inside the
event which attributes a token goes on, and repeated most of it. The
decision now lives in pure helpers both events share: `toggle-action`
(remove the token or apply it), `apply-action` (on which attributes)
and `target-shapes` (a selected group stands for its children).
`action->event` turns the result into the event to run. Nothing
changes in behavior; apply-spacing-token-separated loses its `attr`
option, which every caller left empty.
Unit tests cover the decision, with the cases the store tests
lacked: a color token comes off the stroke too, a shape without the
token completes the others, and a spacing token on chosen attributes.
Store tests cover what had none: applying from the fill and stroke
rows, the opacity, position and size fields, the min width of a flex
child and the selection colors, choosing the token a shape already
has, and toggling a token on a group.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
* 🐛 Keep app booting when SES bootstrap fails
Wrap repairIntrinsics in a guarded bootstrap so a SES Temporal check failure
no longer aborts bundle evaluation and blanks the whole app. When it fails,
plugins and MCP stay unavailable for that session, a telemetry event reports
the error, and trying to open a plugin shows an environment warning.
Add vitest coverage for both bootstrap paths and a CLJS regression test for
the runtime-unavailable toast.
Closes#12924
AI-assisted-by: hy4-flash-free
* 🐛 Fix CI format check and plugin test entry point
Wrap the long Prettier line in bootstrap.spec.ts so `pnpm run format:check`
passes again in the plugins module, and document that the duplicated SES
options are an intentional contract snapshot.
Switch the runtime-unavailable CLJS test to the public open-plugin! entry
point instead of the private load-plugin! function. The M2 test for
signal-runtime-ready was dropped: loading app.plugins in the Node test
runner needs packaging and DOM shim changes outside this fix.
Closes#12924
AI-assisted-by: hy4-flash-free
* 🐛 Build the SSO redirect target on the server
The organization SSO flow took the destination URL from the client and
redirected to it after the identity provider round-trip, so any
authenticated profile could point that redirect at another domain: the
server never checked where the URL came from.
The RPC now takes the route token of the client (?screen=...¶ms)
and the server builds the destination out of it: the public URI plus
the query string, parsed and rendered back. The destination can no
longer leave the public URI, and the callback checks it again before
redirecting, which covers the state tokens minted before the change.
The state token also carries the profile that started the flow, so
only that session is granted the organization SSO entry: a state
prepared by someone else cannot mark the session of the one that
completes it. Whenever the RPC receives an organization id (it always
comes from the client), it also checks that the profile is a member of
the organization or its owner, instead of letting any profile start a
flow for an organization it does not belong to.
Tests cover the destination builder, a callback that ignores a
destination outside the public URI, a state that does not grant the SSO
entry to another session, and the organization access check.
AI-assisted-by: minimax-m3.1-flash
* 🐛 Check the SSO redirect target against the public URI
The callback compared the destination with a string prefix, so the two
bypasses the advisory documents (a userinfo prefix and a look-alike
host) were closed only by the trailing slash of the public URI. The
check now compares the parsed origin (scheme, host case-insensitive,
port with the default made explicit) and requires the path to be under
the base path of the public URI, so neither bypass passes.
The client sent `location.search`, the history token, whose leading `?`
is URL syntax and no part of a query string. It sends the query string
proper now (`screen=…¶ms`) through `rt/get-current-query-string`,
and `rt/token->query-string` is the single bridge between the two
shapes: every other consumer concatenates the token over the base path.
The server puts the separator back when it joins the destination, and
trims one that still arrives, so a browser holding the previous bundle
keeps its destination while the new one rolls out.
Building the destination can no longer break the flow: it catches its
own errors and lands on the public URI, which matters in the
deployments where the browser origin differs from the configured one.
A value that is not a route is ignored with a warning, decided by the
keys it parses into (a URL becomes a single key holding the whole URL),
and a route with no `screen`, like the root params of the application
(`template=…`), stays a usable destination.
The organization membership lookup is now shared by the check that
gates the SSO flow and the one that raises, so the two cannot drift
apart, and the docstring of the RPC lists `:no-organization-access`
next to `:no-team-access`.
`rt/nav-raw` returns its `:href`/`:uri` through `@event`, as its
sibling `rt/navigate` already did. Nothing in the app listens to
`::rt/nav-raw`, so the callers behave the same; the SSO test now reads
the destination from the event instead of intercepting the helper.
Tests cover the two bypasses and the base-path rule, the RPC with an
unusable destination, the value that is not a route, the request that
carries both ids, an organization that does not exist, the query string
the frontend sends, and the two router helpers.
AI-assisted-by: minimax-m3.1-flash
* ♻️ Deduplicate SSO destination URL building
The backend had an unreachable blank check and a one-line wrapper around
the URI helper in build-dest-url. On the client, the SSO retry and error
flows each assembled the destination from public-uri and the route params.
Flatten build-dest-url with a cond and call u/query-string->map directly.
Add rt/token->url as the single client helper for absolute route URLs, with
tests for both token shapes and for a blank token. Update the routing memory
with the new helper contract.
AI-assisted-by: hy4-flash-free
Move what the token group works out into pure functions with tests:
whether a type's section is open, whether a text is being edited, and
what clicking a token pill does. Nothing changes in behavior.
Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
* 🐛 Carry the team id in every team scoped navigation
The eleven `go-to-*` helpers of `app.main.data.common` resolved the
team with a plain `or` against `:current-team-id`, or read that key
alone, so an event emitted while no team was initialized built a
dashboard or workspace route without a `team-id`. `team-container*`
raises `:not-found :invalid-team-id` for such a route and
`exception-section*` does not report `:not-found`, so the user landed
on the not-found page and PostHog never saw it.
Add `resolve-team-id`, which falls back to the team of the route
already on screen and then to the profile `:default-team-id`. The
route goes first on purpose: an emitter that runs from a team screen
knows which team the user is looking at, and the personal team would
open their file under another team. The `:default` sentinel keeps its
meaning. With none of the four the helper still navigates with a nil
id, which is the documented last resort.
Harden the team-container test at the same time: it now renders the
same component with the store team the caller wants, captures markup
and errors per render, unmounts the root from a `finally`, and covers
the guard that compares the route id with the store team. React
reports a hook-order violation through `console.error` and recovers,
and only when a render adds hooks, so the harness captures that too
and the "id leaves" direction stays a guard test.
Closes#12962
AI-assisted-by: deepseek-v4.1-flash
* ♻️ Measure the navigation tests by termination
The `emitted` helper of `common_test` waited for the first event, with a
budget of 50 macrotasks, so a helper that emitted anything before its
navigation could be disposed early, and a helper that stopped closing
its stream passed on the first event. Wait for termination instead:
`async/observe` over a subject, and make `go-to-dashboard-search`
complete by pushing the `::rt/navigated` it listens for, which is the
event it waits for in the app to focus the search box. Every helper of
the family is measured the same way now, `-search` included.
`nav-params` returns nil when no navigation matched instead of calling
`deref` on nil, as its docstring promised. Add the mirror test for the
`:default` sentinel of `go-to-dashboard-deleted`, the second copy of
the branch that `-recent` already had covered.
Correct two memories: the resolver decides for every team scoped
helper, not for every `go-to-*` and not alone, since two direct
`rt/nav` emitters are the residual; and `(rx/empty)` is for a stream
that must not emit, not for one that must stay open.
Relates to #12962
AI-assisted-by: deepseek-v4.1-flash
The analysis of a package reads the metadata of every media and
thumbnail of its container to attribute the shared objects to each
file. It read them all at once, one promise per entry, and the
container of a big file holds thousands of them: every read opens its
own decompression stream, and Chromium fails the whole analysis under
that load while Firefox keeps up. The failure is masked by zip.js with
a generic "Cannot close a ERRORED writable stream".
The references now go through an observable, one entry at a time, and a
reference that cannot be read leaves its file without a size instead of
failing the package: a number that misses one of the objects of the
file is worse than no number.
Closes#13022
AI-assisted-by: deepseek-v4.1-flash