181 Commits

Author SHA1 Message Date
Andrey Antukh
15a099f118 Merge remote-tracking branch 'origin/staging' into develop 2026-11-20 09:54:54 +01:00
Filip Sajdak
c40287254c
✨ Explain why a library cannot be disconnected in its modal (#12921)
* ✨ 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>
2026-11-20 09:49:28 +01:00
Filip Sajdak
454e461c1e
✨ Copy stable deep link to selected boards from context menu (#10170)
* ✨ 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>
2026-11-20 09:47:11 +01:00
Pablo Alba
6d0be9f47f 🐛 Undo a main text edit and its follow-up sync in one step
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
2026-11-19 23:33:24 +01:00
Pablo Alba
8a9e87e33e 🐛 Skip WebGL auto-grow heals for texts with a failed font
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
2026-11-19 21:12:21 +01:00
Pablo Alba
ef0333eafe 🐛 Fix auto-grow text sizes after sync and page open
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
2026-11-19 21:12:21 +01:00
Pablo Alba
2964e88a8c ⚡ Re-measure auto-grow texts only on size changes
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
2026-11-19 21:12:21 +01:00
Pablo Alba
0e103fb215 🐛 Skip undo step for SVG auto-grow heal resizes
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
2026-11-19 21:12:21 +01:00
Pablo Alba
c34cd056e4 🐛 Skip undo step for auto-grow heal resizes
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
2026-11-19 21:12:21 +01:00
Pablo Alba
14cb15e844 🐛 Re-measure overridden auto-grow texts on page open
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
2026-11-19 21:12:21 +01:00
Pablo Alba
a37ad6161d 🐛 Keep auto-grow text boxes sizing on component copies 2026-11-19 21:12:21 +01:00
Alejandro Alonso
3e697c2794
✨ Forward frontend audit events to host callbacks (#13175)
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
2026-11-19 16:02:45 +01:00
Marina López
b100a5e26f
✨ Add viewers so org owners can change member role (#13163) 2026-11-19 12:27:17 +01:00
Andrey Antukh
ca1da39a35 🐛 Read the media and thumbnails of a package one at a time (#13024)
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
2026-11-19 12:05:06 +01:00
Andrey Antukh
a6d12c5c32 Merge branch 'staging' into develop 2026-11-19 11:38:22 +01:00
Elena Torró
981fa06961
🐛 Keep fill copies laid out after a component sync in the WebGL render (#13154)
* 🐛 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
2026-11-19 11:02:15 +01:00
Andrey Antukh
efd95dcf0c Merge remote-tracking branch 'origin/staging' into develop 2026-11-18 13:20:18 +01:00
Eva Marco
28a4794d73
🔧 Test the direction of the move shortcuts (#13115)
#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
2026-11-18 13:05:44 +01:00
Eva Marco
eb7860fcd7
🐛 Show the date of a restored autosaved version in the restore notice (#13120)
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
2026-11-18 13:04:55 +01:00
Andrey Antukh
3f6c69bb6a Merge remote-tracking branch 'origin/staging' into develop 2026-11-18 09:32:49 +01:00
Andrey Antukh
78cfe7fa58 Merge remote-tracking branch 'origin/staging' into develop 2026-11-17 10:53:02 +01:00
Marina López
e422de62d8
🐛 Fix create team inside organization (#13106) 2026-11-17 10:44:54 +01:00
Andrey Antukh
d97972c81d
🐛 Build the SSO redirect target on the server (#12952)
* 🐛 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=...&params)
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=…&params`) 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
2026-11-16 17:34:49 +01:00
Andrey Antukh
d2dfc09495
🐛 Carry the team id in every team scoped navigation (#12963)
* 🐛 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
2026-11-16 15:42:43 +01:00
Andrey Antukh
6e4e69c339
🐛 Read the media and thumbnails of a package one at a time (#13024)
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
2026-11-16 15:42:15 +01:00
María Valderrama
c0f746ee34
🐛 Apply the invite policy to pending invitations (#13080)
* 🐛 Apply the invite policy to pending invitations

* 📎 Code review
2026-11-16 15:38:07 +01:00
Luke Lau
1ccb9e9cb9
⚡ Move WASM component thumbnail rendering to the worker (#13046)
This PR moves component thumbnail rendering off the main thread
and onto the worker, which avoids the freezes.

The main thread will send the worker over a request containing the component's
shape data, and the worker will render it in batches. Once finished it will
both persist the thumbnails to the server if requested and send back the PNG
data to the main thread.

AI-assisted-by: claude-opus-5-5
2026-11-16 13:48:04 +01:00
Andrey Antukh
86eb0bf805 Merge remote-tracking branch 'origin/staging' into develop 2026-11-16 11:07:05 +01:00
Andrey Antukh
7ef8c1cf36 Merge remote-tracking branch 'origin/staging-2.19.x' into staging 2026-11-16 10:05:00 +01:00
Pablo Alba
77c87d16f1
🐛 Keep variant property order past eight properties (#13014) 2026-11-16 09:30:29 +01:00
Eva Marco
fa6af23d75
🐛 Disconnect a library that fails to load instead of breaking the file (#13048)
Opening a file connected to a broken shared library showed the
"Internal Error" page: every connected library was loaded in a single
stream, so one failing get-file broke the whole workspace.

Catch the error per library. When the backend fails to load it (a
server error, never a transport or transient error), a directly
connected library is disconnected and a toast tells the user; an
indirect one is only dropped from the state.

Closes #12429

AI-assisted-by: claude-opus-5-5
2026-11-16 09:02:31 +01:00
Andrés Moya
0e4be21320
🐛 Ensure component name always matches root instance name (#12794)
* 🐛 Remove svg extension when creating a component from a svg file

* 🐛 Normalize root names to always match the component name

* ✨ Remove any extension ignoring case, not only .svg

* 🔧 Add some fixes and checks

* 🔧 Improve rename detection
2026-11-13 13:53:28 +01:00
Andrey Antukh
69c33c4877
♻️ Wait on signals instead of event-loop turns on frontend tests (#12986)
* ♻️ Wait on signals instead of event-loop turns

`wait-for` counted its budget in event-loop turns (50 x `setTimeout 0`,
about 54 ms idle), so a delivery that travelled through the RxJS async
scheduler could arrive after the wait gave up. It now accepts a
`:signal`: the predicate is re-checked on every emission and the wait
resolves on the event that changes the state. The ceiling (5000 ms)
only bounds failure when a signal is given, and stays a poll budget for
the waits that have nothing to listen to.

`wait-for-store` wraps the store's input stream, which notifies its
subscribers after applying the update. The five explicit `:max-ticks`
sites move to `:timeout-ms` in the same change, so the old option never
lives in a state where destructuring silently ignores it.

New `frontend-tests.helpers.async-test` pins the contract: a late
delivery resolves, a store signal resolves on the event without a poll,
an already-true predicate does not yield, a never-true predicate records
one failure within the ceiling, and a resolved wait stops listening.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Wait for the persistence requests on their own stream

The persistence tests waited for `(= N (count @requests))` by polling the
atom at every event-loop turn. The mocked transport now pushes each
request into a `requests$` subject, and those 59 waits pass it as
`:signal`, so they resolve on the request that makes the count true. The
two predicates that mix the request count with the store state merge
both signals.

The wait that flaked (`the other file's edit is sent next`, in the
rollback test) is one of these: it no longer depends on a turn budget,
and it cannot lose the delivery.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Wait for the store event in the store backed tests

153 waits whose predicate reads the store now go through
`wait-for-store`, so they resolve on the store event that changes the
state instead of polling at every event-loop turn. The count is 153, not
the 162 the plan estimated: nine of them read the store through a
helper (`fill-color`, `shape-name`, `copy-children`) rather than
`@store`. The five sites that carried an explicit ceiling drop it, since
with an event the ceiling only bounds failure.

Resolving on the event exposes the places where the poll was really a
pause for a side effect to advance:

- `tokens-source-test` emitted `unlink-file-from-library`, a watch that
  chains a second `rp/cmd!` after an async hop. The store signal fires
  before the chain runs (the event itself dissocs the library), so the
  mock scope closed in flight and the second call reached the real HTTP
  layer. The test now waits for that second call, through the mock.
- `persistence-rollback-test` drives the persistence pipeline step by
  step; two of its waits are the pause before the next emit, not an
  effect, so they keep the poll.

AI-assisted-by: deepseek-v4.1-flash

* 📚 Document the wait contract and what still polls

`mem:frontend/testing` described `wait-for` as an immediate check plus a
bounded poll. It now waits on a signal, and the ceiling only bounds
failure; `wait-for-store` and the persistence `requests$` subject are
how a wait resolves on the event that changes the state. The waits with
nothing to listen to keep the poll, and the memory names them.

The two traps that cost a red suite are recorded too: a wait that means
"the side effect advanced" has no event and keeps the poll, and a
store-state wait can close the mock scope before the flow it observes
ends, so the chain's last RPC call has to be awaited through the mock.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Give the wait wrapper a single signal

`wait-for-store` built its options with `assoc`, so it replaced the
`:signal` a caller passed. The two waits whose predicate reads both the
store and the request counter relied on a merged signal that was being
discarded; they now pass it to `wait-for` themselves, and the wrapper
takes no options. That merge was the safety net for a request counted
after the store event, and it was inert.

The helper also reports why a wait failed (ceiling, ended signal, or an
error with its cause) instead of calling all three a timeout, counts
the predicate evaluations in the late-delivery case to prove the signal
path does not poll, reads the clock through `app.common.time` in the
helper and the test, and the test's turn probe cancels its timer. The
copyright header of `helpers/async.cljs` stays as the previous commit
left it, matching the majority spelling.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Give the cycle counter a signal too

Two waits in the retry tests read the store and the `cycles` atom, which
the `slow-cycle-timer` double fills inside the persistence watch. They
passed only the store signal, so a counter change could not wake them:
the same latent race the previous commit removed from the request count.
The double now also emits each new cycle into a `cycles$` subject, and
both waits pass the merged signal to `wait-for`.

The public `wait-for` docstring names the three failure reasons, and the
message for a failed signal bounds the cause text: the exception message
when there is one, otherwise the printed value inside a try, cut at 500
characters.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Stop the error handlers flooding the test log

Four tests in `main-errors-test` run a real error handler end to end.
Those handlers print the cause with `ex/print-throwable` before
notifying, which is what a developer wants in the app; in a test it only
writes console noise. One of them replays 10,000 offline errors, so a run
carried 10,006 dumps: 190,010 of its 192,682 lines, 13.8 MB, well past
the ~4 MB where GitHub truncates a step log and takes the summary and any
failing assertion with it.

The tests stub `ex/print-throwable` with a no-op for the duration of
their mock scope. The handlers still run, the assertions do not change,
and the 10,000-error loop still proves the governor emits once. A full
run now logs 2,583 lines and 384 KB. The single block that remains comes
from the re-entrancy guard, which prints its own notice on purpose.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Silence the deliberate WASM panic in its test

`get-svg-markup` logs a WASM panic with `console.error` before returning
empty, and `get-svg-markup-swallows-wasm-errors` sends two panics through
it on purpose. That was two 35-line dumps in which the exception printed
its own `data`, `arr` and protocol masks, and it reads like a failure that
the suite is hiding.

The test replaces `(.-error js/console)` for its body and restores it in a
`finally`. The assertions and the helper stay as they are: the same
panic answered with a different stack would still show up, because only
this test silences the console.

AI-assisted-by: deepseek-v4.1-flash

* 🐛 Use real timer for wait-poll ceiling

wait-poll read the app clock (ct/now), so tests freezing that clock
never reached the deadline and hung instead of failing. Track expiry
with a real setTimeout flag, pass timeout-ms through wait-signal and
wait-for, and cover the frozen-clock case with a regression test.

AI-assisted-by: muse-spark-1.3-contributor
2026-11-13 09:18:43 +01:00
Andrey Antukh
5c45c8ddaf Merge remote-tracking branch 'origin/staging' into develop 2026-11-13 08:18:50 +01:00
Andrey Antukh
dc38eaa843
🐛 Fix font upload crash and preserve font metadata (#11951)
* 🐛 Fix font upload crash and preserve variant metadata

opentype.js 2.0.0 returns no fontSubfamily name for fonts whose
Macintosh name table only holds custom records. That made
parse-font-weight/parse-font-style call re-seq on nil and crash the
upload.

A nil or blank variant is now treated as no match in
app.common.media, defaulting to weight 400 and style normal. The
variant parsing also accepts oblique as italic, and the new
parse-font-family helper derives the family from a filename by
stripping the known weight/style tokens, separating a style token
glued to a weight token ("Roboto-BoldItalic" -> "Roboto").
first-nonblank-string returns the first nonblank candidate, so a
blank preferredFamily/preferredSubfamily no longer shadows a valid
fontFamily/fontSubfamily.

app.main.data.fonts gains resolve-font-metadata and
prepare-font-entry. opentype.js values win per field; any missing
value falls back to the filename-derived family, weight and style.
The parsed and woff2 branches share the same helper, so metadata is
preserved instead of collapsing every face to weight 400, and
fonts with missing vertical-metric tables upload with no height
warning instead of failing.

process-upload reports per-file failures (unknown signature,
unparseable file, preparation error) with a single bad-font
notification instead of silently dropping them, and never errors
for per-file failures.

The upload now sends :variant-name to create-font-variant, which
accepts it as an optional param (ships in 2.20), so the foundry
name survives the upload.

Closes #10436

AI-assisted-by: deepseek-v4.1-flash
AI-assisted-by: muse-spark-1.3-contributor
Signed-off-by: CHOI JUNSOO <junsoo1172@gmail.com>

* 🐛 Parse glued font style tokens in the font parsers

EvaMarco's review on #11951: parse-font-family and
parse-font-weight handled glued tokens like "BoldItalic", but
parse-font-style did not. For names such as
"opensans-bolditalic-webfont.woff2" the three parsers disagreed:
the italic face resolved to style normal and collided with the
bold-only file on the (family, weight, style) join key. One
binary silently overwrote the other during upload, losing one
font face without any warning.

A new private normalize-font-name helper is applied by all three
parsers. It splits a style token glued to a weight token, now
with a lookahead boundary so "LightItalic_v2" splits too, and
strips a trailing technical suffix (-VF or _v<number>).
parse-font-family, parse-font-weight and parse-font-style now
interpret the name consistently.

Tests cover the three cases from the review, the bold-only
control case, and an end-to-end process-upload check that a bold
and a bold-italic WOFF2 survive as two variants.

Relates to #10436 and PR #11951.

AI-assisted-by: inkling-2-small-free

* Remove duplicate frontend test registration

---------

Signed-off-by: CHOI JUNSOO <junsoo1172@gmail.com>
2026-11-12 15:29:30 +01:00
makesomethingshit
dfc7919f7b
🐛 Preserve HSL values while editing lightness (#12629)
* 🐛 Preserve HSL values while editing lightness

Keep HSL editing components through black, white, and grayscale.
Use the same draft for numeric inputs, sliders, and gradient previews.
Strip the draft before emitting color data and reset it on other edits.

Closes #12615

Signed-off-by: makesomethingshit <junsoo1172@gmail.com>
AI-assisted-by: GPT-6

* 🐛 Keep HSL drafts consistent across gradient and ramp edits

Match RGB components to HEX so gradient echoes preserve HSL drafts.
Discard stale HSL values when editing Ramp hue, saturation or value,
while preserving them for opacity-only changes.
Cover grayscale gradient echoes and saturation restoration.

Signed-off-by: makesomethingshit <junsoo1172@gmail.com>
AI-assisted-by: GPT-6

---------

Signed-off-by: makesomethingshit <junsoo1172@gmail.com>
2026-11-12 10:11:56 +01:00
Marina López
df0092fc60
🐛 Enforce sso before creating organization teams (#12980) 2026-11-12 08:35:32 +01:00
Andrey Antukh
34c702bc80
✨ Add table partitioning for file-change (#12417)
* ✨ Partition file_change by file_id

Partition `file_change` by `HASH (file_id)` in 16 partitions, with the
same bounds as `file_data`, so a join between them is resolved partition
by partition. The primary key becomes `(file_id, id)`, which a
partitioned table needs, and every access filters by `file_id`.

The new table carries a `kind` column (1 snapshot, 2 revision) as a
reserve: the queries still tell them apart by the label, and `kind`
takes over when they are rewritten. The payload of a snapshot stays in
`file_data`; the `data` column is kept for reading old `legacy-db`
payloads.

The four snapshot commands require `file-id`, because it prunes the
partition. The objects GC locks and deletes by the pair, in batches. The
old table is kept as `file_change_legacy` as the way back.

The automatic migration refuses to run above 10 GiB or 2M rows and
points to the runbook; big instances partition online with that runbook,
which copies by id, follows the `updated_at` watermark in delta passes
and checks that no row of the source is missing from the target.

Closes #12416

AI-assisted-by: deepseek-v4.1-flash

* 🐛 Address the review of the file_change partition

The production runbook promised a rollback it did not have: the section
was a sketch, and its statements could write to the table about to be
dropped. The rollback is removed, and so is every comment that described
it. `file_change_legacy` stays as a frozen copy of the previous layout.

The cutover check now aborts the transaction when a row of the old table
is missing in the new one, instead of leaving the decision to the
operator.

The five secondary indexes of the new table are built after the last
delta pass: the bulk and the delta passes only need the primary key, so
the batches no longer maintain them.

The copy of 0158 is now replayed in a test against the pre-0158 shape
with a labelled and an unlabelled row, plus an empty instance that must
leave no legacy table behind. The updated_at assertion of the snapshot
mutations is bounded by the test clock, and the repair revision stops
writing the `features` of the file, like the normal save.

AI-assisted-by: deepseek-v4.1-flash

* 📎 Fix linter issues

* 🐛 Fix stale helper call in rpc_file_snapshot_test

The suite does not load: `th/run-pending-tasks!` does not exist in
backend-tests.helpers. The pending jobs runner is `run-pending-jobs`
(no arguments), the name every other call site of the suite uses.

AI-assisted-by: inkling-2-small-free

* 📚 Align the partition change with the 2.20.0 milestone

2.19.0 is already shipped; this work targets 2.20.0. The operations
file of the partition procedure carries the 2.20.0 prefix, the
references that point at it (the migration, the runbook table and the
memory) follow, and the RPC doc/changes tags of the snapshot commands
record 2.20 as the release that makes `file-id` required.

AI-assisted-by: inkling-2-small-free

* 🐛 Fix review findings on the partition rebase

The 0157 legacy test was missed by the rebase and inserted file_change
rows without the new mandatory `kind` column, so the backend suite fails
against the migrated schema. The inserts now carry `:kind`
(snapshot-kind for the labelled rows, revision-kind for the rest).

The post-cutover verification block of the runbook terminates the
first query with a semicolon so the block pastes into psql without a
syntax error.

The guard message of the migration names the step
(0158-partition-file-change) instead of "0158", ambiguous since two
migrations share that number.

Closes #12416

AI-assisted-by: inkling-2-small-free

* 🐛 Fix the stale label in the snapshot restore test

The rename block of snapshots-crud runs before the restore block,
so the restored version is already named "label1-updated" when the
restore publishes its message. The command names the version by the
label the row has at that moment, not by the one it had when it was
created, so the test was asserting a stale value.

Assert the current label, and say why in the comment.

AI-assisted-by: deepseek-v4.1-flash

* ♻️ Split the version event tests into one test per command

The workspace version events and the plugin proxy send the file-id
of the open file on every snapshot command, because the command
needs it to prune the partition of file_change. Both tests checked
that with a doseq and t/testing blocks, so a failure named the whole
group and not the command that broke.

Give each command its own test. The workspace ones share a helper
that runs the event and returns the command and params it sends; the
plugin ones keep their own mock of rp/cmd!.

AI-assisted-by: deepseek-v4.1-flash
2026-11-10 23:27:17 +01:00
Andrey Antukh
671ff4a05f Merge remote-tracking branch 'origin/staging' into develop 2026-11-10 20:06:46 +01:00
Andrey Antukh
e4fcc663c0 Merge remote-tracking branch 'origin/staging-2.19.x' into staging 2026-11-10 18:09:07 +01:00
Andrey Antukh
1db1487c7f
🐛 Require thread access when marking threads as read (#12894)
* 🐛 Require thread access when marking threads as read

mark-all-threads-as-read took any list of thread ids and wrote the read
status of the caller on each of them, without checking that the caller
can access the file that owns the thread. It was the only comment
mutation that did not check permissions, and it took the ids as an
unbounded array, so a single request could keep a database connection
and a transaction open for a long time.

The rpc now resolves the threads in one query and checks the comment
permissions of every distinct file, answering not-found when a thread
does not exist or is not accessible. Both cases answer the same error
on purpose, so the response cannot be used to tell existing threads
apart.

The status rows are now written with a single insert, keeping the
modified-at date one second in the future that makes the thread count
as read. Repeated ids are deduped, the command returns nil again like
the sibling commands with no result, and the schema limits the number
of threads per call to 500 while the dashboard sends the ids in batches
of that size.

Tests cover access rejection, unknown threads, mixed batches that write
nothing, repeated ids, empty lists, marking twice, and the frontend
batch split.

Relates to GHSA-j4vc-cmf6-jhr7

AI-assisted-by: minimax-m3.1-flash

* 🐛 Refresh the unread list when a batch fails

The dashboard sends the thread ids in batches of 500 and each batch
commits on the server. A failure in a later batch left the unread list
stale: the re-read only ran when every batch succeeded, so the threads
already marked as read stayed visible as unread.

The re-read now runs in both paths. On failure the event is emitted
before the error is propagated, so the error toast still shows and the
success toast stays limited to a full success.

The backend also answers an empty list without opening a transaction,
since there is nothing to check and nothing to write.

Relates to GHSA-j4vc-cmf6-jhr7

AI-assisted-by: deepseek-v4.1-flash
2026-11-10 15:54:11 +01:00
Andrey Antukh
8510daef52
🐛 Restrict the team invitation token and list to admins (#12892)
* 🐛 Restrict the team invitation token and list to admins

The token of a team invitation is a bearer credential: whoever holds it
accepts the invitation with the role of the invitation row. The RPC that
mints it only required edition permissions, while the rest of the
invitation commands require admin, so a team editor could get the token of
any pending invitation, including the ones that grant the owner role.

The token now requires admin, and the token of an owner invitation is
restricted to the team owner: an admin cannot create nor promote an owner
invitation, so it cannot keep its token either. It reuses the error code
already used for that rule.

Minting the token now leaves an audit event named as an action, carrying
the granted role and the id of the invitation, so the extraction does not
go unnoticed.

The list of pending invitations is admin only as well: it carries the
email of the invited person and the role offered, and the dashboard was
painting those emails to any member. The frontend catches the permission
error and shows the permission notice instead, and the copy action is not
offered for an owner invitation, which the backend rejects for an admin.

The five invitation commands now answer with the same permission error,
so they speak one language.

Relates to GHSA-4mmc-j8rh-74pf

AI-assisted-by: minimax-m3.1-flash

* 🐛 Clear the cached invitations and gate the list on team admin

The pending invitations are a team admin only list. The dashboard still
offered the entry to every member and keyed the section on the invite
policy of the organization, so a team admin blocked by that policy saw
the no-permission notice although the backend lets them list.

- `fetch-invitations` answers a denied refetch with an
  `invitations-fetched` event carrying an empty list, so a demoted admin
  does not keep the cached emails and the header no longer paints the
  invite button from a stale list.
- The header tabs and the team options dropdown hide the invitations
  entry without `:is-admin`, which already includes the team owner.
- `invitations-section-content` keys the section on `:is-admin`, and the
  invite policy only gates the invite actions: resending keeps the
  `can-invite?` check, deleting and row selection only need team admin.

AI-assisted-by: deepseek-v4.1-flash
2026-11-10 15:53:43 +01:00
Alonso Torres
4fb0ea9eee
🐛 Give unique values to same-name components combined as variants (#12881)
When components whose name matches the variant container are moved into
it, removing the container name leaves an empty value. Combining several
components named the same produced "Value 1" for the first variant and
empty values for the rest, so variants shared the same combination.

Assign the first unused "Value N" to the last property when all computed
values are blank, tracking values given within the same batch.

Combine moves the remaining mains into the container one at a time, in
the combine order, so the generated values follow that order instead of
the layer order.

Closes #12878
2026-11-10 09:16:08 +01:00
Luke Lau
cd1ece4beb
⚡ Keep the translation flag on undo and redo of a move (#12870)
* ⚡ Keep the translation flag on undo and redo of a move

Previously undos and redos always forced a component sync + thumbnail
rerender for every component touched even if the underlying commits were just
translations. This propagates the translation flag to undos and redos and
propagates it to commit-changes. An entry merged from several undos/redos is
a translation only if all of its undos/redos are translations.

This reduces a UI freeze when undoing a move of a board with 453 components
from 2.42s -> 0.22s.

AI-assisted-by: claude-sonnet-5-5

* :translation? -> :translation

---------

Co-authored-by: Andrey Antukh <niwi@niwi.nz>
2026-11-09 20:47:42 +01:00
Luke Lau
943e63a99e
⚡ Group color updates in selections (#12875) 2026-11-09 12:08:36 +01:00
Andrey Antukh
1df2941576 Merge remote-tracking branch 'origin/staging' into develop 2026-11-09 10:42:28 +01:00
Andrey Antukh
0ea6d166f0
✨ Add a session origin model to auth events (#12856)
* 🐛 Return the full profile from the LDAP invitation branch

The invitation branch responded with only {:invitation-token token},
so the session start received a map without id or auth-backend. With
the new auth-origin vocabulary that map fails validation and the login
breaks in development and tests; in production the event would be
emitted without a channel.

Return the profile plus the token, like the regular branch, and cover
both branches with RPC-level tests.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* 🐛 Mint an auth token in the OIDC callback with the invitation inside

The callback used the invitation JWE as the session token, so the
frontend landed directly on token verification and never ran the
regular session start: no signin event, no teams, no host hook.

Always mint an :auth token and carry the invitation in its claims.
Token verification returns the claims verbatim, so login-from-token
attaches the invitation to the profile and logged-in does the rest,
the same pattern the verify-email token already uses.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* ✨ Keep the session origin in the telemetry shadow rows

The anonymisation filter drops every string unless it is on a short
allowlist. Add source and activation next to lang and auth-backend so
the shadow copy keeps them; the email and the full name are still
dropped and the email domain is still derived from the email.

The filter keeps its two bindings: the transducer discards everything
that is not a UUID, a boolean or a number, so the allowlist is applied
on the filtered map, never on the raw props.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* ✨ Describe the signup outcome with activation, not with action

The three success branches of register-profile labelled a new account
as "login", "email-verification" or "accept-invitation", so the event
contradicted its own name and the value only lived in context, where
the analytics consumers never read it.

Add activation to the event props and drop action from those branches:
the name already says it is a signup, and a constant action would only
add noise. The retry branches keep their action in context because
there it distinguishes four different outcomes.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* ✨ Describe the session origin in the signin event

The event carried the profile but never said why the session started:
the only field that tried was frontend metadata that never leaves the
browser, and several flows filled it with the wrong value.

Add a small closed vocabulary (source, auth-backend, activation,
from-invitation) and compose it from the profile when signin is
emitted. The assertion fails in development and tests and is elided in
the release build, so a bad value cannot break a real login.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* ✨ Emit the session origin from every login entry point

The four emitters stamped a free-form string as metadata, so the
session event could not rely on it: two flows that were signups wrote
the same value as a login.

Route them through origin-meta: password and LDAP logins declare
source login, register declares source register with activation
immediate, and login-from-token derives both from the token issuer:
:auth for a login and :verify-email for a signup that needed the
email confirmation.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* 🐛 Send the invitation signups through the regular session start

Registering from a team invitation link navigated by hand to token
verification, so the session start never ran: no signin event, no
teams, no host hook. The same navigation was copied in four places.

Teach login-from-register to carry an optional invitation token,
extract the profile decoration into with-register-origin, and call it
from the four sites instead of the hand-written navigation.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* 🐛 Resolve the invitation without waiting for the teams

Registering from an invitation link now goes through the session
start, and that start only navigates after the teams request
completes. fetch-teams has no error handling, so a network failure
there would leave the invitation unaccepted and the user on the signup
screen with a session already minted.

Move the invitation navigation out of the teams path: it emits as soon
as the profile carries a token, and the teams path emits nothing for
an invited profile so it cannot move the user away from the token
verification screen.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* 📚 Document the session origin vocabulary and the invitation flow

Add a focused memory with the four fields, where each value comes from,
the table of flows, the LDAP exception and the invitation path through
logged-in, and link it from the frontend routing.

Update the audit-log memory: source and activation are now on the
telemetry allowlist, activation lives in props and action only exists
on the retry rows.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash

* 📎 Cover the invitation session start and fix the auth memories

The invitation flows and the token decoration in login-from-token were
only covered by helper tests, so removing the guard that keeps the
teams path from navigating, or the token attach, broke the behaviour
silently.

Run the events through ptk/watch with a teams-fetched event as input:
an invited profile navigates to the token verification screen and
never to the dashboard, and the signin keeps from-invitation. Add the
login-from-token cases with and without the token, and fix the memory
statements about action, the flow table and from-invitation.

Closes #12849

AI-assisted-by: deepseek-v4.1-flash
2026-11-09 10:11:54 +01:00
Álvaro Tejero-Cantero
87fc15b5aa
🐛 Open the first page in view mode when the URL has no page id (#12687)
A view URL without a page-id crashed builds with assertions enabled:
the viewer passes a nil page-id to `initialize`, whose schema accepted
a missing key but not a nil value. Release builds skip that check and
draw the first page, but every viewer event reads the page from the
route, so zoom to fit and fill, the next-board arrow, Navigate To
interactions, and comment pins did not work.

`initialize` now accepts a nil page-id, `fetch-bundle` makes it
optional, and `bundle-fetched` replaces a route without page-id by one
naming the file's first page. The viewer then initializes again on the
completed route, as it does when the user changes page. A file with no
pages keeps its route.

AI-assisted-by: claude-opus-5-5

Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro>
2026-11-06 13:05:39 +01:00
María Valderrama
2df4d10bd5
✨ Enforce attribute-based organization permissions (#12868)
* ✨ Enforce attribute-based organization permissions

* 📎 Code review
2026-11-06 11:40:50 +01:00
alonso.torres
7eacbec245 🐛 Keep comments, focus, thumbnails and text in step with a rollback
A rollback reverts the local data with a rebase, which is not a commit,
so the parts of the workspace that follow commits missed it:

- Comment pins moved in the reverted action stayed where they were, on
  screen and on the server, and pins on a board the rollback removed
  kept pointing to it. They go back to the reverted position, and pins
  on a removed board move to the page root.
- Focus mode stayed on with no shape left when the rollback removed the
  focused ones, and the next shape drawn turned it on again. It ends
  when its last shape goes, and the selection drops removed shapes.
- Component thumbnails kept the rejected look. The thumbnails of the
  reverted mains are rendered and uploaded again, and an upload whose
  shapes changed during the render is skipped.
- Under WASM, an open text editor reset to the reverted content but the
  canvas kept the old layout. It is laid out again.
- A library sync whose save failed showed no update notice again once
  the release undid it. The notice is checked again after that
  rollback.
2026-11-05 23:59:32 +01:00