#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
* ✨ Delay building schemas in check-fn
check-fn eagerly builds its schemas which contributes to the startup time. But
we can delay this to when the check function is actually called, which seems to
be when an edit is made. On the Travel A2B - Locofy Sample project file this
reduced the time to the first viewport render by ~15%.
* ✨ Make schema resolution lazy only on production builds
Add a lazy-delay macro that defers the expression only on builds that
set the app.common.data.macros/lazy-delay? closure define, and use it
in check-fn to resolve the schema.
The previous change made the schema resolution unconditionally lazy,
which hid wrong schema definitions until the first check call. With
this change development builds, tests and storybook resolve the schema
when the namespace loads, so a bad definition fails early, and
production builds keep the deferred resolution and the startup win.
The define is enabled in the release builds of frontend (main and
worker), exporter and library. On the JVM the expression is always
evaluated immediately.
AI-assisted-by: deepseek-v4.1-flash
---------
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
check_signed_off_by was never registered in the validator list, so it never
ran, and no test exercised it. The DCO sign-off applies to external
contributors through CONTRIBUTING.md, not to every commit, so the local
checker has nothing to enforce there.
Drop the function and the DCO mention in the script docstring.
AI-assisted-by: deepseek-v4.1-flash
Signed-off-by: Andrey Antukh <niwi@niwi.nz>
code-review-criteria and review-code carried weight that changed no
decision: a 16-row rationalizations table, red flags that repeated the axes,
and three sections written for the author of a change rather than for the
reviewer. 338 lines become 251.
Drop that layer, dedupe DRY/KISS/YAGNI between the core principles and the
axes, merge the two instruction lists of the flow, and compress the GitHub
comment format.
The reviewer no longer re-runs the suite or a build: the author's run and CI
already provide that evidence, and repeating it only made reviews longer. It
runs at most the single test file that settles a specific doubt, and states
which evidence it relied on.
AI-assisted-by: deepseek-v4.1-flash
Signed-off-by: Andrey Antukh <niwi@niwi.nz>
* ♻️ Give the Team management link in the team hero a real href
"Team management" in the "Team up!" notice of a team's Projects page was
an <a> without href. It now links to the team Members page; a plain click
still runs the in-app navigation (prevent default), and Ctrl/Cmd-click
opens the link in a new tab.
New visual test "Shows the Team management link": 0 px of difference at
rest and on hover.
AI-assisted-by: claude-opus-5-5
* ♻️ Give the Go to login link of the recovery page a real href
"Go to login" on the password recovery page was an <a> without href. It
now links to the login page; a plain click still runs the in-app
navigation (prevent default), and Ctrl/Cmd-click opens the link in a new
tab.
New visual test "Shows the Go to login link": 0 px of difference at rest
and on hover.
AI-assisted-by: claude-opus-5-5
Members, Invitations, Webhooks and Settings in the team page header
were <a> elements without href: the keyboard could not reach them and
they could not open in a new tab. Each one now links to its section; a
plain click still runs the in-app navigation (prevent default), and
Ctrl/Cmd-click opens the link in a new tab. The current section gets
aria-current="page".
They keep their look: the "Team header menu" visual test gives 0 px of
difference at rest and on hover.
AI-assisted-by: claude-opus-5-5
The checker rejected any Co-authored-by trailer, which also blocked a real
person. The trailer is meant to credit a human co-author, and git and
GitHub use it for that; only AI providers, agents and bots are unwanted.
Match the trailer value against a blocklist of providers and agents plus
bot identities, and point to the dedicated AI-assisted-by trailer for AI
participation. Co-authored-by joins the trailer exemption of the
80-character body rule.
Update the tests, CONTRIBUTING.md, the create-commit skill and the commit
memory to the new rule.
AI-assisted-by: deepseek-v4.1-flash
Signed-off-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>
After background blur support was added to render-wasm in 5ba53f7296,
we needed to start rendering shapes in the 256px margins of the tile,
since they contribute to the blur result.
This means that a tile may end up drawing shapes from the tiles around
it, and in the worst case we end up drawing 4x the number of shapes.
We can limit this to only the tiles that have background blur, which
significantly reduces the number of shapes drawn.
Masked groups do something similar so this generalizes and reuses the
`group_reach` stack, which stores how far past the current tile is
painted.
Before we start drawing the shapes in `render_shape_tree_partial`, we
walk the shapes in the tile to check how far the background blur
"reaches" and extend `group_reach` by just that amount, rather than
a 256px radius. As part of the generalization we also need to update
`masked_group_filter_reach` so it works on non-masked groups.
On the mem_benchmark file a full render calls render_shape 77.1% less
often. On the admin dahsboard there's 62% less. This gain shows up
particularly in interactive transforms, e.g. dragging another board
across the heroicons board goes from about 21 to 48 fps.
AI-assisted-by: claude-opus-5-5
* 🐛 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
worker_processes auto starts one worker per host CPU, ignoring the
container CPU limit, and since worker_connections went from 2048 to
65535 each worker reserves about 30 MB at startup. A frontend limited
to a few CPUs on a 64-core node needs close to 2 GB before serving a
request and gets OOM killed.
Default the worker count to the CPUs the container can use, its cpuset
and its cgroup CPU quota rounded up, when they are fewer than the CPUs
of the host, and keep auto otherwise. Make both settings configurable
through PENPOT_HTTP_SERVER_WORKER_PROCESSES and
PENPOT_HTTP_SERVER_WORKER_CONNECTIONS, and refuse to start on values
that are not valid.
Refs #13103
Signed-off-by: David Barragán Merino <david.barragan@kaleidos.net>
* 🐛 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
* 🐛 Check Host and Origin headers in the MCP server
The MCP endpoint, the REPL server and the plugin WebSocket accepted
requests with any Host and Origin header, so a web page open in the
user's browser could drive a local MCP server: connect as the plugin
and call its tools.
RequestGuard checks both headers against an allowlist and rejects other
requests with HTTP 403, or WebSocket close code 1008. The list comes
from PENPOT_MCP_ALLOWED_HOSTS, where "*" turns the check off. When it
is unset, local mode allows only loopback names and remote mode allows
any host, since remote mode relies on user tokens and has no file
access.
AI-assisted-by: claude-opus-5-5
* 🐛 Keep the Host and Origin check on in single-user remote mode
The default allowlist followed remote mode, so a single-user server with
PENPOT_MCP_REMOTE_MODE=true accepted any Host and Origin. It requires no
user token either, so a web page could still drive it and run code in the
user's Penpot session. The default now follows multi-user mode: single-user
servers allow only loopback names, and multi-user servers, which rely on
user tokens, allow any host. Startup warns when the check is off in
single-user mode.
PENPOT_MCP_ALLOWED_HOSTS entries with a scheme, port or path never matched,
so every request failed with 403. The server now refuses to start and names
the bad entry.
AI-assisted-by: claude-opus-5-5
* ✨ Add pgjdbc prepared statement cache settings
Expose pgjdbc's server-side prepared statement cache as three
optional backend variables: PENPOT_DATABASE_PREPARE_THRESHOLD,
PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_QUERIES and
PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_SIZE (bytes, converted
to whole MiB for the driver, rounding up). When unset, the
driver defaults apply (5 executions, 256 entries, 5 MiB), so the
behavior is unchanged. The values reach Hikari as
dataSourceProperties strings, because pgjdbc only reads String
values; flushCacheOnDdl stays at its default.
Closes#13092
AI-assisted-by: inkling-2-small-free
* ♻️ Sync the pool options schema with the code
The integrant pool options schema validated a ::connect-timeout
option that nothing reads, while the keys the code consumes
(::connection-timeout, ::idle-timeout, ::max-lifetime) were
missing from it. The schema now declares the three, matching the
code and the defaults map. The removed key was not referenced
anywhere else.
Follow-up to #13092.
AI-assisted-by: inkling-2-small-free
* ♻️ Rename the prepared statement cache threshold setting
Keep the three knobs under one name in the configuration:
PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_THRESHOLD
PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_QUERIES
PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_SIZE
The old PENPOT_DATABASE_PREPARE_THRESHOLD read as a verb and was the only
one of the three that did not name the prepared statement cache.
Fix the documentation of the values: 0 in either cache value disables the
cache, not only the size, and -1 prepares a statement from its first
execution and forces binary transfer, which is what pgjdbc does.
Cover the -1 threshold end to end: it already decoded and validated, but
nothing proved that it reaches the driver. The tests also pin 0, so a
falsy check cannot silently drop it.
Closes#13092
AI-assisted-by: deepseek-v4.1-flash
* ♻️ Fix the prepared statement cache contracts
The threshold schema accepted any integer, but the driver clamps every
negative to -1 and turns on binary transfer, so a typo like -10 changed
the wire protocol instead of failing at boot. Both schemas now declare
{:min -1}: -1 and the non-negatives stay valid.
The tests compared our own dataSourceProperties literals with our own
literals, which cannot catch the failure the feature fears (a property
the driver ignores). They now read the threshold back from a real
connection: 5 with no options, 1 and 0 when configured. The size ceiling
is covered one byte over a MiB, and queries=0 too.
The docs, the app.db comment and the memory described the threshold 0 as
disabling the cache. It does not: 0 stops the server-side prepared
statements while the driver's cache of parsed queries stays in use,
bounded by the other two values. The same texts lost the
pg_prepared_statements pointer (the view only lists the session that runs
the query) together with the flushCacheOnDdl and PgBouncer sentences, and
the section now carries its version marker.
Closes#13092
AI-assisted-by: deepseek-v4.1-flash
* 💄 Format the prepared statement cache pool test
The continuation arguments of the two with-connection calls were aligned
under the options map instead of two spaces past the form, which cljfmt
rejects.
Local verification missed it because `./scripts/ci backend --test` runs
the tests only: lint and format are separate tasks, so the pre-push check
is the whole `./scripts/ci backend` or an explicit --lint/--fmt.
AI-assisted-by: deepseek-v4.1-flash
* ♻️ Address the review of the prepared statement cache
The pool startup line shows the three values, so the configured cache is
visible without reading the environment back; a nil means the driver
default.
bytes->mib-ceil uses Math/ceilDiv: the same rounding in one expression,
and the size schema already rejects negatives.
The cache-limit tests count a closed statement in pg_prepared_statements
instead of comparing the property literals. A closed statement stays
prepared in the server only while the driver's cache holds it, which is
what tells an accepted property from an effective one; the positive case
keeps the cache enabled with a sub-MiB size. The config test drops the
groups that only exercised the decoder and keeps the ones that pin the
accepted range.
The manual and the memory note that a query parameter of the same name in
PENPOT_DATABASE_URI wins over the variable: pgjdbc ignores the Properties
value when the URL carries it.
AI-assisted-by: deepseek-v4.1-flash
AI-assisted-by: claude-opus-5-5
61cd9fe88683a4068817f538a2ae54d80aca095e stored a reference to the
last snapshot of the tile atlas, presumably to avoid the call to
image_snapshot when not needed.
But it turns out image_snapshot doesn't actually cost anything since
it just returns a reference to the surface texture. Storing the
reference actually causes a 4096x4096 texture copy because skia has
copy-on-write behaviour. Skia sees the reference stored in Surfaces,
so when the next render tries to draw on the surface it needs to
allocate + copy over the tile atlas texture.
By removing the reference skia can reuse the texture on the next
render which avoids a 64MiB copy on the GPU.
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>
* 🐛 Reap zombie Chromium processes in the exporter container
The exporter runs node as PID 1 with no init process. Chromium helper
processes orphaned when Playwright closes a browser are re-parented to
node, which never reaps them, so every browser-based export left
defunct chrome-headless processes behind.
Enable init for the exporter service so Docker's built-in init runs as
PID 1, reaps the orphans and forwards signals to node.
Closes#10339
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
* 🐛 Move zombie reaping fix into the exporter image
Install tini and run it as the image entrypoint with -s, so orphaned
Chromium helpers are reaped in every deployment, including Kubernetes.
-s keeps tini working without a warning when it runs under docker-init
(init: true). Drop the compose init: true change to keep one mechanism.
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
---------
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
* 🐛 Reap zombie Chromium processes in the exporter container
The exporter runs node as PID 1 with no init process. Chromium helper
processes orphaned when Playwright closes a browser are re-parented to
node, which never reaps them, so every browser-based export left
defunct chrome-headless processes behind.
Enable init for the exporter service so Docker's built-in init runs as
PID 1, reaps the orphans and forwards signals to node.
Closes#10339
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
* 🐛 Move zombie reaping fix into the exporter image
Install tini and run it as the image entrypoint with -s, so orphaned
Chromium helpers are reaped in every deployment, including Kubernetes.
-s keeps tini working without a warning when it runs under docker-init
(init: true). Drop the compose init: true change to keep one mechanism.
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
---------
Signed-off-by: Rayen Khammar <khammarrayen4@gmail.com>
The SQLite-based v2 binfile package was never released, and its only
caller was the developer REPL helper `app.srepl.binfile`, which exported
and imported a whole team. With the format gone, the helper, the
functions of `app.binfile.common` without a caller (`get-fonts`,
`get-file-thumbnail`, `get-team`, `get-teams`, `collect-summary`) and
the `sqlite-jdbc` dependency go with it.
The public surface does not change: the import RPC accepts only versions
1 and 3, and the test that pins the rejection of version 2 stays as it
is.
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Fix duplicate-file crash on nil keys in deleted component objects
* ♻️ Withdraw the legacy-36 migration in favor of 0036
legacy-36 and 0036-clear-nil-keys-in-objects perform the same
cleanup of nil keys in `:objects`. Migrations only clean up
invalid data here, so they carry no order dependency between
them and running both is wasteful.
Remove the legacy-36 defmethod and its id from
`available-migrations`, the same way 0021-fix-shape-svg-attrs
was withdrawn in favor of 0035. Files that recorded legacy-36
re-migrate through 0036; their persisted `:migrations` lists
keep the old id, and the playwright fixtures recording it stay
untouched.
Add a migrate-file test proving a file that recorded legacy-36
is re-armed for 0036 and passes schema validation after.
Document the withdrawal pattern in the migration subtleties
memory.
AI-assisted-by: inkling-2-small-free
---------
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
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>
* 🐛 Fix duplicate-file crash on nil keys in deleted component objects
* ♻️ Withdraw the legacy-36 migration in favor of 0036
legacy-36 and 0036-clear-nil-keys-in-objects perform the same
cleanup of nil keys in `:objects`. Migrations only clean up
invalid data here, so they carry no order dependency between
them and running both is wasteful.
Remove the legacy-36 defmethod and its id from
`available-migrations`, the same way 0021-fix-shape-svg-attrs
was withdrawn in favor of 0035. Files that recorded legacy-36
re-migrate through 0036; their persisted `:migrations` lists
keep the old id, and the playwright fixtures recording it stay
untouched.
Add a migrate-file test proving a file that recorded legacy-36
is re-armed for 0036 and passes schema validation after.
Document the withdrawal pattern in the migration subtleties
memory.
AI-assisted-by: inkling-2-small-free
---------
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
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>
legacy-db is no longer a write backend: fdata/upsert! rejects it
(:legacy-backend-read-only), handle-persistence stops writing
file.data and file_change.data, and the update-params schema of
fdata no longer accepts it. Reading old payloads keeps working, and
the file-data-backend default stays db.
The configuration guide, the backend config (a startup warning reads
PENPOT_FILE_DATA_BACKEND=legacy-db as db instead of failing every
save) and the storage memories say so, with the upgrade note for
deployments that still set the variable.
AI-assisted-by: deepseek-v4.1-flash
AI-assisted-by: inkling-2-small-free
* 🐛 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>
* 🐛 Show resolved color in alias token edit form swatch
The color token form opened every alias token with an empty swatch.
The resolved value only reached :color-result once the value field
was touched, so the swatch had nothing to show on open.
Keep the resolved color for the swatch when the field is untouched,
without showing the "resolved value" hint. Add an e2e test that loads
a fixture with a color token and an alias to it.
Closes#12672
AI-assisted-by: claude-opus-5-5
* 🐛 Show resolved value when opening an alias token edit form
The token edit form only showed "Resolved value" after typing in the
value field: the single-value inputs dropped the first resolution while
the field was untouched, and the typography/shadow reference field read
its first value from [:value :reference], which an alias token does not
have (its value is the reference string).
Show the hint on open when the resolved value differs from the written
one, so a plain `16` gets no `Resolved value: 16`. Start the reference
field stream with the alias string. Extend the e2e fixture with font
size and typography aliases and add a test for them.
Closes#12788
AI-assisted-by: claude-opus-5-5
* 🐛 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