mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
743 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ea61730f61
|
✨ Add review mode, review comments and tasks to design reviews (#12939)
* ✨ Add review mode, review comments and tasks to design reviews A design review now opens a read-only review mode. The left panel shows the pages and layers with the View only badge, the toolbar offers the review tools (move, comment, comment an area, create a task, show the changes) and the right panel holds the inspect of the selection, the comments of the review and its tasks. A bar at the bottom names the review, shows the progress of its tasks and opens its details. Comments can point at a spot, a layer or an area, and a comment written in a review says so with its own mark, wherever the file is open. The layers panel counts the open comments of each layer. Tasks are new: work on a file, assigned to someone and tied to a layer or to a spot of the canvas. A comment can become a task and stays attached to it. A task moves through open, done, verified, reopened and won't do; anybody may move it, and each move is an event that records who made it. Deleting a layer with open tasks moves them to its board and offers to undo the deletion or to mark them done; a task can then be linked to another layer or get its layer back. Assignees are told by email. Merging a branch moves its tasks and their threads into main: the open ones keep going, the closed ones stay as its history, and the merge dialog lists them and can tell their assignees. The details of a review show its overview, its tasks and its activity: what the saves of the branch did to each layer since the review opened, by person and day, with the values before and after. The changes can be shown on the canvas one after another. The backend adds the review fields of a comment thread, the task and task event tables, the activity of a review (recorded by each save of a branch under review) and the commands of the tasks. * ♻️ Bring the design review styles and components up to the DS Move what the review UI repeated into the design system: layer-chip*, progress-bar*, comment-card*, link-button* and textarea*, each with its story and docs. The screens keep the look they had: the same review states compare equal, pixel by pixel, before and after. The stylesheets follow the rules of the UI guide: local variables for the colors that change by state, the right tokens, no unused imports and fewer element and nested selectors. What has no DS token or typography says so in a TODO. The aliases left in comments.scss resolve to their tokens. The components get complete schemas and a single owner for the copyright. Translations take literal keys and templates instead of dynamic keys and glued strings, and comments.cljs no longer depends on the review tasks: the workspace passes it what a thread shows about its task. Fix three bugs of the review: - The inspect took the width of a narrower panel and its height from the window, so it looked squeezed and cut its last rows. It now fills the panel that holds it. - Enter on the menu of a task opened the task. The row now reacts only to keys on itself, and the menu keeps Enter from the workspace shortcuts. - The resolved and lost marks ignored the pointer: hover now wins over the state of a mark. * ✨ Turn each review message into a task and restore the filter dropdown Each message of a thread can now become a task, so one thread can hold several. The new file_task.comment_id column records the message, the migration fills it with the first message of the thread for existing tasks, and the backend rejects a message from another thread or one that already has a task. Comments and tasks of a review behave like normal ones. The canvas marks show a short preview on hover and there is one mark per task. A blue label marks what belongs to a review, in the thread and in the sidebar, and a selected card takes a blue border there and the primary color elsewhere. The new review-label* component holds the label. The sidebar and the review panel go back to a filter dropdown in place of the chips. Comments offer the views all, yours and mentions, with an option to hide the resolved ones. Tasks offer all, yours, open and to verify, with an option to hide the closed ones. Resolved comments now show by default. "New task" outside a review now arms the task tool: it shows the task cursor and the next click opens the task form, not a comment. Then the comment tool returns, and Esc leaves the tool. The details modal shows changed properties in the format of the compare dialogs, and showing a task on the canvas syncs the WASM viewport. The sidebar cards put the layer chip on the line of the replies, and task states lose the dot and take a color each. Fix these bugs: - The hover card of the activity tab crashed on a change with no token. - The assignee and reviewer dropdowns came out cut. The select now portals into the closest dialog, because the modal makes the rest of the page inert. - The review label cut the header of the thread. It now sits below it. * ✨ Group overlapping review marks and let tasks change assignee Comments and tasks of a review that fall on the same spot now show as one mark with a counter in a white bubble. A click fans them out, as the comment bubbles do, and the user picks one. They group on the same layer and, by proximity, at a low zoom. The card of the mark lists up to five items. Hovering a mark outlines its layer, or its board when the layer is gone. The WASM viewport draws no outlines under the comments tool, so it now draws the highlighted ones there. Opening a comment from a mark closes the open task. A task can change assignee from the selector in its state and from "Assign to" in its menu, which holds the team in the same popover. The change shows right away and goes to the history of the task. A closed task keeps its assignee. Deleting a task or a comment now asks first, with the usual confirmation. A task deleted from the details of a review brings the dialog back on its tab. The state of a task takes two rows, in its panel and in a thread: state and layer, then assignee and the review it comes from, which a review omits. The text of tasks and comments sits in a box. The history no longer says that the task was created. * ✨ Keep the branch bar and the palettes at one level on a branch The open branch bar covered the horizontal scroll of the canvas. It now sits as far from the bottom as the review bar. Folded, it stays flush. On a branch the palettes no longer lift over the branch bar: both sit at the same level and work as a toggle. Opening one folds the other, also through the palette shortcuts, and both can stay folded. The new `:bottom-bar` state says which one is open. It exists only while the branch bar does, so a file that is not a branch keeps the palettes on their layout flags and at their usual place, and what happens on a branch does not reach them. The branch bar comes open on a branch and centers on the canvas, not on the window, so that it clears the folded palettes at usual widths. The room it published for the palettes goes away with the lifting. * ✨ Give every task a thread and tidy the design review screens Every task now lives in a message of a comment thread, so anyone can go on commenting on it. A task made from scratch gets a thread whose first message is its title, on its layer and in its review, created in the same transaction. A comment turned into a task keeps its thread, as before. The panel of a task with no thread is gone: a task always opens as its thread. Migration 0814 gives a thread to the tasks that had none. Deleting a thread deletes its tasks, after a confirmation that says so. The anchor of a task was a plain map, not a point, so a thread on a layer refused replies. It is now a point. The details of a review filter the tasks by state with the chips of the activity, in the colour of each state, and show how many are closed on the right. The "New task" button leaves the dialog. Descriptions look the same everywhere: the box of the branch info dialog, an "Edit" button and a dashed box when empty. Read, they grow up to 400px and scroll inside; edited, the textarea starts at 400px. The text of a review in the sidebar does the same once unfolded. In the review bar, the author gets a "Publish latest changes" button when the branch moved past the review, with a hint that approvals must be renewed. The others keep a badge, now "Unpublished changes", with a hint. The bar refreshes once the publish lands. Smaller changes: the resolve checkbox lines up with the task button and has a tooltip, messages sit in a filled box, task events take an outline, and the change navigator sits right above the review bar. * 💄 Sort the test runner requires that cljfmt rejects The Frontend Tests lint step fails on runner.cljs: the requires for workspace-tasks-test, review-details-test and review-markers-test sat out of alphabetical order. This is the output of cljfmt fix. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> * 🐛 Test the design review mode in the pull request spec The review bar replaced the branch banner, so four tests still drove the branch bar: a visible Compare button, the rectangle tool and the Review button. They now drive the design review instead. * Opening a file with a pr-id enters the review: the bar names the review, the header trades the file name for the review title, and comparing, merging and cancelling sit in the bar's options menu. * The compare dialog opens from that menu. * The review is read-only rather than an editable file: the review toolbar offers its five tools, the drawing tools are gone, the sidebar says View only, and the right panel is the review's own Inspect, Comments and Tasks tabs. * The verdict comes from the bar's Submit review button and the dialog it opens, scoped by role so the bar action and the dialog action do not collide. The tests also reach the review bar by its region label instead of walking up three parents from the Reviewing the design review text, which broke as soon as the bar's markup changed. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> * 🐛 Count only the test thread's acquisitions in the climit test acquires-the-command-own-limits-before-the-root-limits failed on CI with an extra "root/global" ahead of the expected order. The test records metrics through with-redefs, which is global, so a call of another thread of the test JVM, such as an RPC an earlier test left running, can take a root limiter inside the window and land in the same atom. Record the thread with each metrics call and keep, in acquired-in-order, only the acquisitions of the calling thread. Both tests that read it acquire their limiters on the test thread. The same class of flake was fixed on develop for the waiting-count test (12d73d0f63); this one is still open there. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> * 📚 Describe the task moves the server allows in the table comment The comment on file_task said a task is reopened only from done and that editors move tasks. files_task.clj::transitions also reopens a verified or won't-do task, and set-task-status lets anybody who can read the file move one. Say the same in the schema. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> --------- Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> Co-authored-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
4cb0e452ff
|
Merge branch 'develop' into iop-vc-preview
Bring iop-vc-preview up to develop b438676d6c. Conflicts: - migrations.clj: develop's 0157-migrate-legacy-file-data and 0158-del-forbidden-file-library-rels keep develop's order, and the branch's 0800-0808 follow them. No file names collide, so nothing is renumbered. - files_update.clj: develop's save-path rewrite wins (commit-by-commit rejection, page-scoped validation, the file carrying ::changes and ::rejected). The branch's op-log save is ported onto it instead of the earlier [file op-changes media-index] triple: process-changes-and-validate attaches the media fix-up remap as ::media-index, and update-file* builds the op-log vector from the accepted changes (remapped) behind the repair changes. A branch save persists only when develop's saved? holds, and its audit and log outcome is "rejected" when the first commit is refused. The tpoint threading, persist-branch-file!, the public invalidate-caches!, and the branch audit props are kept. - Repair and validation timing tests: take develop's calls, since process-changes-and-validate returns a file again. - binfile_test.clj: keep the branch import-overwrite test and develop's library relation tests. - dashboard.cljs, dashboard_test.cljs: union of requires and tests. - viewer.cljs: develop's optional page-id plus the branch's pr-id. - left_header.cljs: develop's raw-svg logo, recent-files href and project link, inside the branch's wrapper with the review badge, branch title and branch bar. The unused deprecated-icon require and nav-to-project go. - en.po, es.po: three-way merge by msgid. Every entry of both sides is kept, develop's removals of a duplicate errors.save-retrying and of integrations.mcp-server.title.beta stand, and labels.retry carries develop's references plus the branch's. Adaptations to develop: - email.clj, files_pull_request.clj: the review request email joins develop's template registry and goes through send-template, as the comment emails it mirrors now do. The registry coverage test lists it, and the rollback test of the pull request commands injects its failure into send-template, the function the create path now calls. - rpc_file_pull_request_test.clj: pr-flags is read at test time instead of at namespace load. The loaded value held the production defaults, which now enable the admin console (#12475), and it replaced th/state-init's test flags, so creating a profile called nitrate and failed with :nitrate-not-configured. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
671ff4a05f | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
e4fcc663c0 | Merge remote-tracking branch 'origin/staging-2.19.x' into staging | ||
|
|
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 |
||
|
|
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 |
||
|
|
0420db1ca9
|
🐛 Apply the share-link page scope to the comment queries and writes (#12888)
* 🐛 Apply the share-link page scope to the comment queries and writes A share link can be restricted to a subset of the pages of a file, and the comment queries enforced that scope. But the RPC that resolves the profiles of the commenters authorized the request with check-comment-permissions! and dropped the returned perms, so its query filtered only by file id. The holder of a page scoped link got the id, email, fullname and photo of every profile that commented on any page of the file, including the pages the owner left out of the link. The query now takes the pages of the share link and only selects the authors of the threads on them. The profile of the caller is still added, so the viewer keeps its own avatar. The scope was missing as well on the comment writes that take a page id or a thread id: create-comment-thread accepted a page outside the link, create-comment accepted a thread of an unshared page, and update-comment-thread, update-comment-thread-position and update-comment-thread-frame accepted a thread of an unshared page. They now raise not-found, the same way the comment queries already did. Replying to a thread of an unshared page also sent the emails to the thread participants. The page scope rule now lives in one place: share-link-pages returns the pages granted by a share link and check-page-scope raises not-found when a page is outside of it, so get-comment-threads reuses the helper instead of checking the pages inline. The docstring of get-profiles-for-file-comments said that it returns the participants of all the comment threads of the file, which is not true anymore for a share link. The docs are public, so the text and the changes list are updated. The tests of the share link page scope are hardened: the setup asserts that the comment threads are created, the membership case has a second commenter so it can no longer pass for the wrong reason, and the link without pages, the allowed paths of the thread updates and the who-comment=team denial are covered. Relates to GHSA-89cq-3wv7-987r AI-assisted-by: minimax-m3.1-flash * 🐛 Enforce the share-link page scope on the remaining comment writes Check the page scope of the share link before mutating in the four comment writes that still skipped it: update-comment-thread-status, update-comment, delete-comment-thread and delete-comment. The check runs before the ownership checks, so an out-of-scope write fails with not-found and the response does not reveal that the comment or thread exists. Load the file in create-comment only after the permissions and page scope checks, matching create-comment-thread, so a rejected reply does not load the file data. Cover the denial and the in-scope paths of the four commands, and the fail-closed case of a link without pages on the comment reads. Move the outsider thread creation after the profiles assertion so the caller-union assertion fails when the union is removed. Document the page scope invariant in the backend permissions memory. AI-assisted-by: deepseek-v4.1-flash |
||
|
|
4874da450f
|
🐛 Escape SVG values and sanitize every SVG upload (#12887)
* 🐛 Escape SVG values and sanitize every SVG upload The SVG sanitizer removed dangerous elements and attributes by name and then wrote the tree back with clojure.xml/emit, which escapes nothing. A payload hidden in an attribute value or in a text node became live markup again: an id of "x' onload='alert(1)'" was stored as a real onload handler, and an entity encoded script tag was stored as a real script element. Write the filtered tree with a serializer that escapes text and attribute values, and route every path that stores an uploaded SVG through it. The thumbnail writers (create-file-object-thumbnail and create-file-thumbnail) and the organization logo stored the upload untouched, so they could plant live markup in a public bucket. The filter only knows about SVG elements, so it also accepted documents that are not SVG at all: a page with an iframe or a meta refresh was stored as an image. The sanitizer now rejects any document whose root is not an svg element in the SVG namespace, and it compares the scheme of an url the way the browser does, so a scheme split with a tab or a line break no longer slips through the javascript: filter. The attributes are written sorted by name, because the parser hands them over in the reverse order of the document and the output changed on every sanitization. The profile picture of an identity provider is not stored either when it is an SVG: the avatar is always rendered as an image, so an SVG would only add the risk of keeping live markup in the storage. The dimensions of an SVG are now read from its local name, so an SVG with a namespace prefix can be uploaded like any other. The logo had no size limit and the sanitizer reads the whole file, so it now honors the media max file size. The output shape changes with it: no line breaks, double quotes, and the single quote of an attribute value escaped as an entity. The hash of every stored SVG object changes with it. The media tests use cuerdas.core instead of clojure.string, as the rest of the codebase does. Relates to GHSA-qwhj-rchj-58mg AI-assisted-by: minimax-m3.1-flash * 🐛 Drop non-SVG namespace subtrees in the SVG sanitizer The sanitizer only checked the namespace of the root, so a child could rebind xmlns to XHTML and smuggle live HTML (iframe/srcdoc/meta) past the blocklist. The serializer escapes attribute values, but the browser decodes them again, so srcdoc stays live. Track the namespace bindings through the recursion and drop any element that is not in the SVG namespace, with its subtree. The root is validated up front with the same model, so a document that is not an svg document is rejected with an honest hint instead of a misleading one. The default namespace is stored under a namespaced key, because a prefix literally named `default` collided with the internal key and re-opened the same hole through a prefixed binding. The attribute filter now keeps `xmlns`/`xmlns:*` declarations, which are not event handlers, so a prefix named like one does not end up undeclared in the output. The blocklist also drops HTML-only elements written in the svg namespace (iframe, meta, embed, link, base). Add regression tests for the child rebinding, for the prefixed variants, for the `default` prefix, for the root local name, for the create-file-media-object-from-url path (mocked download), and for the HTML-only tags. Assert double-quoted attributes in the clean content test. Relates to GHSA-qwhj-rchj-58mg AI-assisted-by: longcat-2.5-free |
||
|
|
c39e3e8301
|
✨ Strictly validate uploads against file bytes on disk (#12801)
* ✨ Strictly validate uploads against file bytes on disk Sniff the real content type of every upload with simplemagic magic bytes instead of trusting the client-supplied mtype header. Declared types outside the allowlist keep the not-allowed code; allowed declarations whose bytes differ are rejected as mismatch. Covers SVG by probing its root tag over leading bytes (magic never matches XML text), TTF/OTF by magic name and WOFF/WOFF2 by four-cc. Read the real file size from disk instead of trusting the declared :size. Files over the limit are rejected even when the declared size lies downwards, and small files pass even when it lies upwards. Run the path check first everywhere so forged server paths keep the params-validation code. Recheck from-url downloads after the write, with a declared-only fast fail at header time. Thread the assembled path through font validation. Refresh the affected tests around real and sparse fixture files, including a PNG-as-font chunked-upload rejection case. Closes #12796 AI-assisted-by: muse-spark-1.3-contributor * 🐛 Accept BOM-prefixed SVG uploads and cover WOFF/WOFF2/OTF/WEBP Address review comments on #12801: - SVG files saved with a UTF-8 BOM were rejected as :media-type-mismatch: read-head kept U+FEFF and the <svg probe never ran. A leading BOM is now stripped before the probe, and a generic XML sniff (application/xml, text/xml) is treated as "no magic evidence" for declared image/svg+xml, so the root-tag probe decides whether the file opens with an <svg root. - sniff-match?/svg-file? docstrings claimed the magic database never matches SVG; simplemagic 1.17 does match an SVG with an XML prolog as image/svg+xml. Reworded to match reality. - Added matching-pass tests for WOFF, WOFF2, OTF and WEBP (they hit the read-four-cc, magic-name and direct magic branches) and three BOM SVG regression cases. AI-assisted-by: inkling-2-small-free |
||
|
|
e1f924cf00 |
🐛 Send organization invitations to unregistered emails (#12937)
send-template drops nil values before enqueuing the mail job, but the invite-to-organization schema required the :user-name key. Inviting an email with no Penpot account left :user-name nil, the key was dropped and the job failed its schema check, so the invitation email was never sent. :user-name is now optional in invite-to-organization and in renewal-notice, which has the same shape. New test renders both templates through the queue with a nil :user-name. AI-assisted-by: claude-opus-5-5 |
||
|
|
4e8f05171e
|
🐛 Forward attribute deletion events to admin console (#12932) | ||
|
|
ae24118caf
|
🐛 Send organization invitations to unregistered emails (#12937)
send-template drops nil values before enqueuing the mail job, but the invite-to-organization schema required the :user-name key. Inviting an email with no Penpot account left :user-name nil, the key was dropped and the job failed its schema check, so the invitation email was never sent. :user-name is now optional in invite-to-organization and in renewal-notice, which has the same shape. New test renders both templates through the queue with a nil :user-name. AI-assisted-by: claude-opus-5-5 |
||
|
|
3de7e62aa9
|
⚡ Don't send file data contents back from duplicate-file (#12911)
The client calls the duplicate-file command in two places, the dashboard and in the plugin API. In both places the :data is dropped via `(dissoc file :data)`, so the client never uses that field. However the file data takes a while to send over the wire and decode. When duplicating penpot-app there's a roughly 1s freeze whenever the response is returned from the server with the file data. We can avoid it by dropping the data from the response. I also did a quick check and neither the MCP server nor any public client of the API on GitHub seem to use the :data field. Co-authored-by: Andrey Antukh <niwi@niwi.nz> |
||
|
|
1df2941576 | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
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 |
||
|
|
988cde3c9d
|
✨ Make WebGL the default renderer for new accounts (#12880)
New profiles now store renderer `wasm` in their props at creation, so every signup path (email, OIDC, LDAP, Nitrate, demo, CLI) starts on WebGL. A renderer passed by the caller still wins. Existing profiles without a stored renderer keep the frontend fallback to SVG, so no backfill or version check is needed to leave them as they are. The `register-profile` audit event gains `renderer-default` when the profile is created in that call, so signups before and after this change can be told apart. Closes #11855 AI-assisted-by: claude-opus-5-5 |
||
|
|
a77cb2608e
|
🐛 Normalize stored SVG attribute keys to kebab-case (#12006)
* 🐛 Normalize stored SVG attribute keys to kebab-case The v3 reader already emits kebab-case keys, but birth stored the camelCase React prop names, so import and export never converged: fill rules painted wrongly and filter defs lost their blur. Birth now normalizes every stored attribute key to kebab-case through the `svg-props` whitelist (`attrs->kebab-props`), applied on all element paths of the svg importer, on the file builder and on defs. svg-raw `:content` is kebab-ized in spelling only and keeps unknown keys, because the sidebar reads them. Non-spec attrs Penpot must keep live in `penpot-extra-attrs`, seeded with `:stroke-style`. Render boundaries translate back to camelCase for React and for the wasm props, and the shape schema declares the closed kebab contract derived from that same whitelist, so birth and validation cannot drift. Migration `0035-fix-shape-svg-attrs-and-defs` converts old files once with the birth transforms, and carries back the svg-viewbox rect normalization the withdrawn `0021` had. That old id leaves `available-migrations`, so files recording it migrate again through this one, and the binfile cleaner drops its own svg repair. Review fixes included here: `setup-opacity` and the blend mode read the stored keys, gradient stops accept `:style` as a CSS string or a map, `inherit-attributes` reads `:style` so a child's inline style beats the inherited group attr per CSS, and the svg-attrs menu shows spec spelling (`viewBox`, `class`) through `stored-attr-display-name`. Tests cover the migration, the closed svg-attr schemas and the import/export round trip; the svg-content schema test pins its sample seed, which dealt no svg-raw shape on unlucky runs. Closes #11947 AI-assisted-by: muse-spark-1.3-contributor * 🐛 Keep legacy svg node tags and transforms valid in migration 0035 The closed svg node schemas require keyword tags and map attrs, but stored files hold def and svg-raw content tags as strings, and some node `:attrs` as nil. Migration 0035 left them as they were, so the file data check that runs after migrating rejected those files and they could not be opened. `normalize-node-tree` now turns string tags into keywords and nil attrs into an empty map, at birth and in 0035. With keyword tags, the svg defs renderer applies the shape transform to user-space defs. Legacy `:svg-transform` values are plain maps, which multiply into NaN matrices. `gmt/coerce` turns them into matrices, in 0035 and in the binfile cleaner, because every v3 import decodes the transform as a plain map again. Legacy masks and gradients now render as designed in the svg renderer. The binfile test helper calls `export-files!` with the current config keys. AI-assisted-by: claude-opus-5-5 --------- |
||
|
|
2df4d10bd5
|
✨ Enforce attribute-based organization permissions (#12868)
* ✨ Enforce attribute-based organization permissions * 📎 Code review |
||
|
|
6a1b58c310 | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
0b8a428d6b
|
🐛 Validate binfile library relations against the package (#12862)
Ignore imported library relations that point outside the package or self-link a file on the v3 import path. Delete leftover cross-team and self relations from file_library_rel and their matching file_library_sync rows with migration 0158, sync rows first. Move the get-files-rels SQL to a var, without behaviour change. Cover the write-side invariants with state-based tests: tampered manifests, package containment, self links and the migration cleanup. AI-assisted-by: deepseek-v4.1-flash AI-assisted-by: muse-spark-1.3-contributor |
||
|
|
eadd1cce70 |
🐛 Keep a copy linked when the repair finds its component's main
A component whose :main-instance-id points to a missing shape fails validation on its copies with :ref-shape-not-found. A repair scoped to the copy's page never sees the main's own error, so it detached the copy, even when the main was still on the component's page. The repair of :ref-shape-not-found now looks for the component's main on its page first and points :main-instance-id back to it, which keeps the copy linked. A copy is still detached when no main is found. |
||
|
|
61bf66342b |
✨ Tell repairs, damaged data and other files apart in save notices
The notice of a rejected save always said the same thing. It did not name the file when the user had moved to another one, gave no hint when the page held data that was already invalid, and replaced the notice of a backend repair still on screen, since the store holds one toast. The backend flags a rejection whose first commit touches pages or components that failed validation before it (:preexisting-damage). The rejection notice names a file other than the open one, says when the data was damaged before, and folds into a repair notice still on screen; a later repair notice folds a rejection notice in the same way. The notice says that the latest changes were undone, no longer that the rest of the work is saved. |
||
|
|
6426b17c9c |
🐛 Fix small save bugs found by the rollback test plan
- Ending a drag inside the frame the shapes already belong to sent an empty reparent save and bumped the revision. The move commits only when some shape changes parent. - When a user restored a version, other sessions reloaded the file with no notice. They now see a dialog naming who restored which version (by its name, else its date), saying that later changes are no longer in the file and, when they had changes not saved yet, that those were lost. - Exports drawn in the browser (PDF, SVG, and PNG when the WASM renderer draws it) and duplicating a file from the dashboard started at once, so an export could show changes a pending save then rejected, and a copy could miss queued edits. Both wait for the file's pending saves. A client export warns that it includes unsaved changes; a copy warns that it misses them. |
||
|
|
cb26e8a39b |
✨ Keep autosave and the workspace alive when saves fail
- A save that failed on a short platform failure (a lost or refused database connection, lack of resources, a server shutting down, a serialization failure or deadlock, a socket or HTTP timeout, a host that did not resolve, an interruption) answered 500, which stops autosave. It now answers 503, which the frontend retries. Other I/O and database errors keep answering 500, timeouts 504. - A save answered not-found no longer replaces the workspace with the access page. It is a terminal save error: the workspace stays open with the failed save notice, report and reload link. When edit rights are lost, the notice says how many changes could not be saved. - A library sync marked the library synced three seconds later, whatever happened to its save. A rejected sync was undone but stayed marked: copies stayed out of date and the "updates available" notice never came back. The mark now waits for the save, a rollback of the sync brings the notice back, and a failed mark (e.g. the user just became a viewer) is logged instead of leaving the workspace. - While saves fail the workspace is read-only. The view-mode banner says editing is disabled because changes can't be saved, with the Inspect banner's size and bold lead and no Done button. Users can still switch pages, pan, zoom and inspect. The lock lifts when a save lands and brings back the mode the user had or picked meanwhile; the WebGL context lock keeps the workspace read-only if it lasts longer. The lock lives in app.main.data.persistence.lock. - A viewer is never locked. A role change that leaves the user a viewer keeps the edits that lost permission, queued and on screen, and shows the count notice again. The role change that brings edit rights back releases them and rolls them back on screen, as a rejected save would. Any other terminal failure is released by the next role change or file opened. The debug faults `io` (socket timeout, 503) and `eof` (500) cover both sides of the I/O rule. |
||
|
|
989f68abfd |
♻️ Share the change helpers of the update-file tests
The update-file tests each built the same rect change and the same change that fails while applied. The rect change moves to the test helpers as th/add-rect-change and the failing one gets a named helper. The test of a database failure during the retry no longer counts calls to process-changes: it fails every attempt that leaves the failing commit out. |
||
|
|
2f3b928a60 |
⚡ Check the schema of only the pages a save touches
update-file checked the schema of the whole file on every save, which loads and decodes every page even when the changes touch one. On files with several pages that was most of the time of a save. validate-file-schema-affected! checks the file data with the pages index reduced to the pages the changes modify; the data outside pages is still checked whole, and a change type it does not know makes it check the whole file. update-file uses it for the strict and the soft schema check. A save of 10 commits on a file of 10 pages of 2k shapes goes from ~1.1 s to ~240 ms; a single page file costs the same. |
||
|
|
4f42ab1d2d |
✨ Keep the valid commits of a save that fails validation
A save whose changes failed validation was rejected as a whole: autosave stopped, the edits made after it piled up unsent, and a reload lost them all, the valid ones included. The frontend now sends each commit of a save as its own group with its commit id (:changes-with-metadata). When applying and validating all of them at once fails, the backend searches by bisection for the first commit that fails, keeps the commits before it and answers with :rejected (that commit and every later one). Only the kept changes are stored, snapshotted and broadcast, so other users never see the rejected ones. Flat :changes and groups without ids stay all-or-nothing; database and network errors still fail the whole request. A rejection without an error type is reported as an internal error. The frontend rolls the file back to what the server holds: it undoes every pending commit of that file, applies again the remote changes that arrived meanwhile, and redoes the kept commits. Undoing only the rejected commits would write stale values over a peer's later change to the same attribute. The rejected and later commits leave the queue, the buffer and the undo history, and a warning that hides after ten seconds tells the user. The pure bookkeeping lives in app.main.data.persistence.commits. The pending notice of a commit the rollback dropped no longer leaves the save status at pending, which made "Pin this version" hang and fail. Debug tools drive these cases by hand: debug.commitInvalidChange() makes a save fail validation, holdSaves() delays the answers, failNextSave() and failNextRollback() fail them on purpose (backend flag debug-save-faults), and persistenceState() shows the queue. |
||
|
|
97fe51e08b | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
9234e829d9
|
✨ Render email templates inside the mail job (#12448)
* ✨ Render email templates inside the mail job The web process rendered each email to full subject and HTML body before submitting it, so every queued job carried a huge params payload. The queue now stores only the template id plus the raw template data, and the new :send-templated-mail job renders and sends the email inside the worker. The old :sendmail job stays in place to drain jobs submitted in the previous format; the quota notice and the REPL test mail keep using it. All templated callers (auth, profile, feedback, invitations, comments, Nitrate) submit recipes through eml/send-template. Closes #12445 AI-assisted-by: muse-spark-1.3-contributor * ♻️ Unify templated mail on template id strings The ::eml/template value was a namespaced keyword whose name had to match the registry key, with one live mismatch (user-feedback vs feedback). Callers now pass the registry id string itself, so keys stay ::eml/-namespaced and values stay plain data, and the single templates set rejects unsendable mail both at submit and in the worker. Closes #12445 AI-assisted-by: muse-spark-1.3-contributor * 🐛 Encode templated mail data with the template schema The job params column is plain JSON, so the URIs of an organization (:logo, :avatar-bg-url) were stored as record maps and the template check rejected them in the worker. Invites for organization teams, organization invites and renewal notices failed without a retry. Each registry entry now carries the JSON encoder and decoder of its template schema: send-template encodes the data before submit and the worker decodes it before rendering. The job schema keeps only the mail envelope, as the template schemas own the typed data. Closes #12445 AI-assisted-by: claude-opus-5-5 --------- |
||
|
|
eef6868e9f
|
✨ Forward attribute update events (#12861) | ||
|
|
e42bae34cf
|
✨ Preserve subscription audit properties (#12850) | ||
|
|
9d898b8b31
|
🔧 Normalize the tenant to lowercase (#12843)
An operator writing `PENPOT_TENANT=ACME` and one writing `acme` name the same tenant: the value is compared as an exact string in the keys and rows it lands in, and one uppercase letter would otherwise split one tenant into two. The value is normalized when the configuration is read, so nothing downstream has to care about case, and the validated form accepts only lowercase labels from then on. AI-assisted-by: deepseek-v4.1-flash |
||
|
|
f532b8c12e
|
✨ Add get-profiles-by-ids management method (#12832) | ||
|
|
35baa06606
|
✨ Migrate legacy file payloads to file_data and delete orphans (#12785)
* ✨ Migrate legacy file payloads to file_data and delete orphans Copy file.data and labelled file_change.data to file_data on boot (type main/snapshot, backend db, deleted_at preserved), then delete file_change rows with data but no label, which no read path reaches. Large instances pre-migrate with batched statements and fake this step. Closes #12784. AI-assisted-by: muse-spark-1.3-contributor * 📚 Add 2.19.0 operations runbook for legacy file_data migration Manual pre-migration procedure for big instances, same statements as migration 0157 in batched transactions, following the convention of the file-change partition runbook. Closes #12784. AI-assisted-by: muse-spark-1.3-contributor * 🐛 Address review feedback on the legacy file data migration Fix the issues raised in the review of the migration that moves the legacy file payloads to file_data. The migration deletes the unlabelled file_change rows that carry data, but restore-files still cleared their date, and the retention test asserted they came back. A row without a date never reaches objects-gc, which is the leak fixed in #12419. Restore now unmarks only snapshots, the rows that carry a label, and the retention test checks that the legacy payload keeps its date instead of coming back. Cover the conflict path that had no test: a pre-existing snapshot that collides with a labelled change row, and a second run that must leave the legacy columns null and the orphan row absent. The runbook analyses file_data after the inserts, so the planner does not wait for autovacuum. Drop app.srepl.procs.fdata-storage: the copy it performed is what the migration replaces and nothing requires it. Closes #12784 AI-assisted-by: deepseek-v4.1-flash |
||
|
|
0e9a9a8950
|
💥 Enable admin console by default (#12475)
Signed-off-by: David Barragán Merino <david.barragan@kaleidos.net> |
||
|
|
be37341f36 | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
610813281b | Merge remote-tracking branch 'origin/main-2.18.x' into staging | ||
|
|
41654aa1b7
|
✨ Restrict management RPC methods to their declared shared keys (#12736)
* ✨ Restrict management RPC methods to their shared keys Management methods now declare the shared-key ids allowed to call them with ::rpc/shared-keys. A wrapper in wrap-management checks the key id from the request before opening a transaction, so a valid key outside the declared set answers 403 shared-key-not-allowed. Methods without the metadata keep accepting any configured key. Scope upload-tempfile to exporter and media-processor, file analysis to nexus, durable jobs to exporter, and the Nitrate methods to admin-console. The test helper injects a declared key for the allowed path, and a coverage test fails when a management method is missing or declares the wrong set. Closes #12730 AI-assisted-by: deepseek-v4.1-flash * ♻️ Harden shared-key authorization scope and tests Rename the per-method metadata to ::rpc/allowed-shared-keys so it reads as the allowed key ids, not the secrets. Fix the management test helper to resolve the key from the supplied request and to keep an explicit nil, which prevents a rejection test from silently using an allowed key. Strengthen coverage: assert every management namespace is scanned, check all four job methods reject a key they do not declare, verify a rejected complete-job leaves the row and its events untouched, and exercise both keys allowed on upload-tempfile. Log denied keys with the method name and key id, without the secret, and update the audit-log memory for push-audit-events. Closes #12730 AI-assisted-by: deepseek-v4.1-flash |
||
|
|
eb344d4e78
|
📎 Cover the auto-repair of a branch save
A branch derives its data from its merge base and op log, so a save that repairs pre-existing damage (penpot#12524) must record the repair changes in the op log, ahead of the client's changes. The new test inherits frame damage from main through the merge base, saves on the branch, and checks five things. The op log row equals the repair changes followed by the client's changes. A reload of the branch shows the repaired state, and a second save needs no repair. The repair snapshot of the branch, which has no data row of its own, is readable and keeps the damage. The branch diff lists the repaired shape, and the merge into main succeeds. Dropping the repair changes from the op log fails four of these assertions. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
0cc2e97338
|
Merge develop into iop-vc-preview
Bring iop-vc-preview up to develop 43f3bda8b5, which carries the final squash of penpot#12420 (93d36d04d8). iop-vc-preview carried an earlier copy of penpot#12420 (42a2e33ffe and a6c20b3e95). Every file the early or the final copy touches was merged three-way with a6c20b3e95 as the base, so develop's side wins for every penpot#12420 hunk and iop-vc-preview keeps only its own deltas. Changes from other develop PRs (#12524, #12192, #12731, #12686, #12442) are kept. Adaptations to develop: - files_update.clj: apply-changes returns the triple [file op-changes media-index] on the #12524 auto-repair path too, and a repaired branch save logs the repair changes ahead of the client's ones. - files.clj: absorb-library-by-file takes develop's update-file! map. - migrations.cljc: migrate keeps its target arity and develop's ordered :migrations set. - climit.edn: the branch global limits declare a queue, as #12686's example-config-bounds-every-wait requires. - Tests: the repair tests destructure the triple, the branch import test uses the #12192 export cfg keys, and the ref-paths test classifies :set-own-tokens-status. - Dashboard comments and placeholder take develop's design-system icons around iop-vc-preview's review list; en.po and es.po keep the union of both sides. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
afe6c1b99c
|
🐛 Confine upload paths to temp dirs (#12772)
* 🐛 Confine upload paths to temp dirs Reject upload maps whose path leaves the server temp dirs. Transit bodies can forge a Path such as /etc/passwd and the handlers open it directly. Centralize the realpath prefix check in media validation and apply it to all nine upload fields. Legit multipart files under /tmp/undertow/ or /tmp/penpot/ still pass. AI-assisted-by: muse-spark-1.3-contributor * ♻️ Rename upload validators to check-* Drop the validate prefix and the bang from the media validation helpers for a consistent check naming. Move the temp dir confinement into validation and cover all nine upload fields. Add unit tests for each helper. AI-assisted-by: muse-spark-1.3-contributor * 🐛 Fix svg upload tests to use penpot tmp dir SVG upload tests wrote tempfiles to the system tmp dir, outside the allowed upload prefixes, so check-upload-path rejected them. Point write-temp-svg at /tmp/penpot like the other upload tests. AI-assisted-by: muse-spark-1.3-contributor |
||
|
|
93d36d04d8
|
✨ Stabilize fragmented file data across snapshots and GC (#12420)
* ✨ Stabilize fragmented file data across snapshots and GC Snapshots, automatic and user, now store pointer-based rows that share fragments with the live file instead of duplicating page content. `get-file-snapshot` resolves those pointers on the server so version previews keep rendering plain data, and `restore!` reuses the shared rows. Export still materializes (the package carries no fragments) and import regenerates them. `file-gc` treats the main file and every unpurged snapshot as liveness roots, reads the file unrealized, and reattaches the original pointer wherever the cleaned value is unchanged, so a pass over an untouched file writes no fragments and a pass over an edited file keeps the ids of the pages it did not touch. Snapshot creation and the restore backup take the file row `FOR SHARE`, which serializes them with the pass and closes the race that let a new snapshot reference fragments the pass was about to mark. All backend pointer bindings go through the `fdata/with-pointers`, `with-tracked`, `with-tracked-pointers` and `with-untracked` macros. The loader reads fragments a previous pass marked until `objects-gc` purges them, and the frontend fails loudly with retry instead of dropping an unresolved fragment. Review fixes in this branch: the automatic snapshot attaches before pending migrations, `realize-pointers` is the single verb, `reattach-unchanged` takes the identity fast path, the restore guard takes its revn from the backup read, and `PointerMap.withMeta` generates a fresh id when metadata changes. Tests cover both snapshot writers (red without the lock), snapshot sharing and pin release through the real delete and purge paths, reattach against orphan marking, preview after offload, the pointer binding contracts and the with-meta id change. Closes #12410 AI-assisted-by: muse-spark-1.3-contributor AI-assisted-by: deepseek-v4.1-flash ♻️ Pin no-churn behavior for untouched pages Pin the behavior the churn verification measured: a save keeps the fragment id of every page it does not touch, with a page of eleven keys (PersistentHashMap), a 46-shape objects map and a nine-page index (hash map). Also pin the mixed case: a data-level objects-map flip rewrites the old pointer pages once and the next save keeps the new ids. The memory records the identity rule behind it: re-assoc with the same value returns the same map in array and hash maps alike. Closes #12410 AI-assisted-by: deepseek-v4.1-flash ⚡ Stop loading untouched pages when enabling objects-map `enable-objects-map` wrapped every page on every save, and reading a page's objects forced its PointerMap to load the fragment. A save of one page in a seven-page file therefore made seven fragment reads. Skip unloaded pointers: their fragment was already wrapped by the encode-file that wrote it, so loading it only to wrap it again is a no-op. The save now loads only the pages it edits. A page with a plain fragment (a data-level feature flip) keeps its plain fragment until it is first loaded or edited; a migration that enables the feature must rewrite the data itself. Cover the change with load-count tests for save and restore, update the flip test to the new contract, and drop the stale restore comment. Closes #12410 AI-assisted-by: deepseek-v4.1-flash ⚡ Keep page fragment ids through pending migrations Applying a pending migration on read realized the file, ran the migration and persisted it again; the persist wrapped every plain page in a new PointerMap, so every page got a new fragment id even when the migration did not change it. That leaves the fragment cache cold and rewrites every fragment on the first read after a deploy. Capture the original pointers before realizing, reattach the unchanged positions after migrating (same value comparison file-gc already uses), persist the reattached file and return the realized one: the read contract is plain data. Read-only connections skip the persist and the reattach. A migration that adds objects-map skips the reattach so the pages get wrapped. Move the three helpers to fdata so file-gc and the migration path share them, and cover the path with a real 0031 migration test: the unchanged page keeps its id, the changed page gets a new one, the caller gets realized data and a second read does not migrate again. Closes #12410 AI-assisted-by: deepseek-v4.1-flash * 🐛 Realize library pointers with each library's own loader Fragment rows are keyed by file id, and every caller binds the fragment loader of the file it works on. get-resolved-file-libraries returned libraries with their pages still as pointers, so the first read of a library page under fdata/pointer-map asked the consuming file for the fragment and failed with :fragment-not-found. That broke migrations and file validation for every file using a pointer-mapped library. The weak-map loader now realizes each library's pointers with the library's own id. The test fails without the change. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> * 🐛 Restore the pointer-map require the repair path still needs The branch dropped `app.util.pointer-map` from the namespace while the auto-repair path (added to develop before this branch) still rebinds `pmap/*tracked*` around validation and repair in `repair-preexisting-damage` and `process-changes-and-validate`. The namespace did not compile, so the whole backend failed to load. Those toggles do not fit the fdata macros: `with-untracked` binds nil and `with-tracked` creates a fresh atom, while the repair path has to turn tracking off and restore the existing atom (and read it before the repair starts). Restore the require and keep the bindings explicit. Also pin the feature-off path with a test: with `fdata/pointer-map` off (the default), a save creates no fragments, file-gc writes nothing and the snapshot preview still returns plain data. Drop a stray `\n` char literal left at the end of one deftest. Update the memories with the exception to the macro rule, the snapshot FOR SHARE locking and the pre-migration automatic snapshot. Closes #12410 AI-assisted-by: deepseek-v4.1-flash * 🐛 Validate debug files with their own pointer loader The `/dbg/actions` file validation passed the file id where `get-resolved-file-libraries` expects the file map, so the library map was seeded with a nil key. It also validated a file read without realizing it, so the first page lookup of a pointer-mapped file raised "load is not supported when *load-fn* is not bind" and the endpoint could not validate exactly the files the feature touches. Read the file realized (validation walks every page and component anyway) and build the library map from the file. The library loader already resolves each library's pointers with its own id, so the realized file and its libraries validate as plain data. Covered by a handler-level test that fails before the change. AI-assisted-by: deepseek-v4.1-flash * ♻️ Bind the snapshot loader through the fdata helper `reduce-snapshots` hand-rolled the same `binding` that `fdata/with-pointers` builds (it also loaded the function's own pointer loader before entering the reduction). Use the macro so the rule holds there too and the namespace no longer needs `app.util.pointer-map`; the loader is identical (same cfg and file-id) and snapshot walking behaves the same. AI-assisted-by: deepseek-v4.1-flash * 📚 Note the pointer-binding exceptions and snapshot ordering Record what the feature review settled: - Two direct `binding`s stay on purpose: the fine-grained `*tracked*` toggles of `app.rpc.commands.files-update` (validation/repair turn tracking off and restore the existing atom) and `binfile.common/encode-file` (fresh tracked set inheriting the current one). Atom-scoped macros would only be worth it if the set grows. - The automatic snapshot is taken before the pending migration, and the pre-migration window is narrow: the `get-file` RPC migrates on read and its ETag hashes the available migrations, so a post-deploy read cannot be a 304 from the pre-deploy state. The old-format snapshot only appears when the save is the first request to touch the file after the deploy, and `get-file-snapshot` previews it as stored. AI-assisted-by: deepseek-v4.1-flash * 🐛 Apply pending migrations when previewing a version Automatic snapshots are attached before the save applies pending file migrations, so a version can store the old format. The preview RPC handed that data to the UI as stored, and the viewport renders it with the current code. Realize the snapshot with the live file id (fragments are keyed by file, not by snapshot), normalize its migrations to a set (the decoder keeps the pgarray as a vector, and `set/difference` would compare indexes) and apply the pending migrations with the pure `fmg/migrate-file` and the live libraries. Nothing is persisted: the stored version keeps its data and restoring it re-migrates on the next read. The response now carries the snapshot's migrations. Use `:features` the way `get-file` does for `fdata/objects-map`: a client that does not declare it gets plain objects. The historical feature set is not checked against the enabled one on purpose: a version may predate a feature change. Cover the preview of a snapshot with a pending migration and the objects realization; both pin that the stored row is untouched. Update the file-data memory with the preview contract and the vector/set trap. AI-assisted-by: deepseek-v4.1-flash * 🐛 Decode snapshot migrations as an ordered set `file-snapshots/decode-snapshot` handed the `file_change.migrations` pgarray as a vector. `set/difference` falls back to index lookups when the first collection is shorter than the second, so the pending set was right only by accident: a stored subset happens to work, while a stored set larger than `available-migrations` (a snapshot taken by a newer build) marks every available migration as pending and re-applies it to already migrated data. Decode it as a `d/ordered-set`, the type the rest of the code and `schema:file` expect. This also covers `restore!` and the snapshot list, and it lets `get-file-snapshot` drop the `(into #{} ...)` normalization it was carrying. Re-wrap the union in `fmg/migrate` so the invariant holds even when a caller hands a plain set. A snapshot with NULL `migrations` predates SQL migration 0140 and keeps the format version of its time. Pin that legacy path: the preview regenerates the applied set from that version, migrates in memory and leaves the stored row untouched. Update the file-data memory with the invariant and the legacy path. AI-assisted-by: deepseek-v4.1-flash * 🐛 Fix flaky waiting-gauge assertion in climit test The throwable-while-waiting test asserted the exact list of waiting-gauge publications, but the component sampler republishes the same count when its first tick lands inside the recorded window under load. Assert only the last value, which is the contract the helper documents. AI-assisted-by: muse-spark-1.3 --------- Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> Co-authored-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
29373fff9f
|
✨ Rework the progress of the import and export dialogs (#12192)
* ✨ Rework the import dialog The import wizard paints a Check/Upload/Import stepper derived from the dialog status, plus a phase title, a description and a progress bar per phase, and its rows follow the new design: folder icon, file name and a size subtitle. While checking, the dialog shows no rows and no spinner, because the phase header already carries the message. The wizard writes the job milestone once, in the header (`jp/current-milestone-text`), since every file of a container reports the same one. A row keeps its name and its size, says "Ready" once its container finished uploading, and shows the error text when it fails; the button that drops a file only appears while the wizard still offers its import step. The `jobs.queued` label now reads "Waiting job slot". The bar measures the whole import: determinate while the containers are uploaded, weighted by their size (`imp/upload-pct`), and animated otherwise, because the stages of a job are not comparable. The phase title counts the files, and `imp/imported-count` counts them done with the job's own counter, so the number moves while a container rebuilds its files one by one. The analysis reads the entries of a version 3 package in one pass: a file shows what it occupies inside its container, its own entries plus the storage objects its media and thumbnails reference, while what the container weighs stays in `:container-size`, the size the upload bar is weighed on. The ready step waits for the end of the analysis (`imp/ready-to-import?`), not for every known file, so Continue never leaves out the files that arrive later. Tests cover the file sizes, the upload percentage, the done counter, the wizard step and the milestone in course. The change also adds `-XX:NativeMemoryTracking=summary` to the backend devenv so `jcmd` shows native memory, and documents the wizard, the promise call styles (`mem:clojure/promesa`) and two CSS pitfalls: a logical `inline-size` wins over an inline physical `width`, and Rumext leaves a plain `:style` map raw, so inline styles leave CLJS as `#js` objects. AI-assisted-by: glm-5.3-flash AI-assisted-by: deepseek-v4.1-flash * ✨ Rework the export dialog Every exported file is its own job, so each row reports its own state: folder icon, name and a size-plus-`.penpot` subtitle; waiting for a worker; running with the milestone of the job and an animated bar; or exported with a tick. A failed row paints red, takes the close icon and shows the hint of the job, or a generic label, through `files-export-modal.export-error`. Success, failure and cancellation replace each other, so a row never reports two outcomes at once. The ids of the messages are canonicalized to string before they match a row, because they cross serialization boundaries. The export result now carries `:size`, so the subtitle says the format until the job produces the artifact and the size once it exists; a transport failure builds a synthetic error, so a nil `ex-data` no longer leaves the row hanging. The header counts the files and says whether the export runs or ended; since every file has its own job, it paints no global bar. Closing changes too: the Close button is gone. While files are in flight the footer offers Cancel export and the X cancels as well, which marks the loading rows cancelled and leaves them in place, so their outcome can be read; once every row reached a terminal state the footer offers Done, which dismisses the dialog. The retry button of the finished design is left out, because the client has no retry mechanism yet. Styles come along: the rows scroll while the header and the footer stay put, and the new phase header, row and bar follow the tokens of the import wizard. The title key becomes `files-export-modal.title`, and the new keys cover the header, the row states and the buttons. AI-assisted-by: muse-spark-1.3 * ♻️ Inline the binfile job adapters into their task handlers The wrappers in app.binfile.jobs only forwarded to the core, so each task handler now composes its own run: frozen cfg, active check, progress bridge and format dispatch. export-cfg freezes the whole export (file-ids, export-type, output) and v3/export-files! takes it as its single argument; ::bfc/ids becomes ::bfc/file-ids. The bridge keeps one job: bfj/run forwards the cfg to its callback, and check-active answers with it to thread the run. AI-assisted-by: muse-spark-1.3 * 🐛 Migrate binfile tests to the single-arg export-files! The refactor made v3/export-files! take a single cfg carrying ::bfc/file-ids and ::bfc/output, but six calls in binfile_test (added by the tokens handling change) still used the old two-arg form with ::bfc/ids. Move them to the new form, as the rest of the file already does. AI-assisted-by: muse-spark-1.3 * 🐛 Fix export artifact expectations to include file size The export flow now reports the artifact size, but the stale expectations dropped it and failed the frontend suite. Include the size in both assertions so they match the emitted message. AI-assisted-by: muse-spark-1.3-contributor * 🐛 Migrate remaining export-files! test callers to the single-arg form rpc_binfile_test and offload_file_data_test still passed the output apart and used ::bfc/ids; move both into the cfg as ::bfc/file-ids/::bfc/output. * 🐛 Hide the downloads hint when no file was exported After Cancel or when every job failed, the export header said "0 files exported · Check your downloads folder."; drop the hint then. * ♻️ Read the object of a container entry once The index of a container asked twice for the object of the same zip entry: once to test it and once as the key of the update. Resolve it once, in the branch that owns it, so the entries of a file never pay for a question that does not apply to them. Addresses a review note on #12192. AI-assisted-by: deepseek-v4.1-flash * ♻️ Never size an import row with its container's weight A row of a version 3 package took the size of the container whenever the container held no entry for its file, while the comment beside it promised the opposite. An unknown size now stays nil, which the row already understands: it paints no subtitle instead of a number that belongs to the whole package. The test carries a file the manifest lists and the container does not hold, and the memory records what the row does then. Addresses a review note on #12192. AI-assisted-by: deepseek-v4.1-flash * 🐛 Retry pool stats read until snapshot is consistent Hikari exposes each pool counter through a separate MXBean call, so a borrow or return between the reads can leave one snapshot off by one. The test read once and failed in CI with total 2 vs active + idle 3. Read up to 20 times with a 10ms pause until total equals active + idle, then assert on the stable snapshot. The invariant stays strict; only the transient race is tolerated. AI-assisted-by: muse-spark-1.3-contributor --------- Co-authored-by: Elena Torro <elenatorro@gmail.com> |
||
|
|
65a76a21cd | Merge remote-tracking branch 'origin/staging' into develop | ||
|
|
87c1b640fa
|
♻️ Pin which fragment a one-page save loads and keeps
save-loads-only-edited-page counted fragment loads only. Assert as well that the one load is the edited page's fragment, that the untouched pages keep their fragment ids, that the rewritten page is stored as an objects map, and that the file reloads equal to the edit applied to the file before the save. Under the old enable-objects-map, which wrapped every page, the test fails with three loads instead of one. Replaying 1,000 recorded saves of a 49-page file on a pointer-map copy found no other load the save path adds beyond the edited page and the components map. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro> |
||
|
|
c0f0b14540
|
🎉 Add direct MCP feedback channel via dedicated tool (#12551)
* ♻️ Move devenv-only tools to a separate folder * 🎉 Add an MCP feedback channel Add a user-approved feedback tool and an MCP-token-authenticated backend endpoint that queues plain-text email. Enable the tool through the configured backend URI in both local and multi-user mode. Validate subject and feedback limits, enforce per-profile rate limits, and document configuration. Cover authentication, queueing, tool availability, and failure handling with backend and MCP tests. Closes #12490 AI-assisted-by: gpt-6 * ♻️ Move MCP feedback submission into RPC Use the standard RPC wrappers for feedback and remove the dedicated HTTP endpoint, route wiring, and custom rate limiter. Restrict MCP tokens to opted-in routes and commands. Add a shared RPC call helper to the MCP backend client and adapt the existing tests. AI-assisted-by: gpt-6 * 🐛 Harden MCP feedback auth, validation and messages Accept MCP tokens when either the mcp or the access-tokens flag is on, so instances that enable MCP without personal access tokens can send feedback. Personal tokens still need access-tokens. Keep the issuer in one constant, decode tokens without raising to reject unknown issuers, and name the issuer and type checks. Reject control characters in the subject, and in the feedback all but tabs and line breaks, in both the command and the tool, so a NUL answers 400 instead of failing when the mail job is stored. Answer 403 with profile-blocked or profile-not-active for unusable profiles, record only who sent feedback in the audit event, and add doc metadata. Replace on OAuth approval an MCP token issued before MCP tokens had their own issuer, or one this instance cannot decrypt, since the backend rejects both. In the MCP server, mention disabled access tokens on 401, drop the unused 503 case, and say that delivery happens in the background. Document the flags in the README. AI-assisted-by: claude-opus-5-5 * 📚 Document the MCP feedback tool and MCP token rules List submit_feedback among the MCP tools and add an MCP feedback section to the configuration guide covering PENPOT_MCP_BACKEND_URI, PENPOT_MCP_FEEDBACK_EMAIL, the flags and the email settings. Add commented examples of both variables to the compose file. In the agent memories, record when OAuth approval replaces an MCP token, how the MCP server reaches the backend, and which flags, routes and commands accept MCP tokens. AI-assisted-by: claude-opus-5-5 |
||
|
|
3cc91e8ba2
|
♻️ Take the command limits before the root ones in the RPC limiter (#12686)
* ♻️ Take the command limits before the root ones in the RPC limiter The RPC concurrency limiter took the root limiters (the ones every request passes through) before the ones a command declares, so a request waiting for the limits of its own command held the root permits of its profile while it waited: a profile with a pile-up of heavy requests saw its other requests queue behind them and be rejected with 429. That order was forced by two commands that entered the limiter from inside their handler: a command that declares no limits of its own can only take them deeper than the root ones, so two paths of one profile could take the same limiters in opposite order and park for good. The commands declare their limits in their metadata now and their handlers call the work directly, so no command enters the limiter from inside its handler and every path takes the limiters in the same order. The root limiters are appended to the sequence first, so the limits a command declares end up outermost and are taken first: a request waiting for them does not hold the root permits of its profile. The photo of a team keeps its limits, because it declares them now that the helper does not. A call from inside a handler can only reenter the limits that thread already holds, and it is refused when it asks for a new one, because that would take it after the root ones and invert the order against the other paths. The key of a limit is resolved the same way in every path, so both paths point at the same limiter and the reentrancy check sees it. Every entry of the shipped climit.edn declares a queue, so the number of requests waiting for the same limit is bounded instead of piling up until the timeout. The production file lives outside the repository and has to be mirrored to pick them up. The tests cover the acquisition order of a command with and without limits of its own, the order of the limits as a whole (a ring of any size fails, not only a pair in opposite order), the nested call that asks for a limit the thread does not hold, and the queues and timeouts of the shipped configuration. The import of a binfile declares its request as multipart in its test, the way the commands that take an upload map do. AI-assisted-by: minimax-m3.1-flash AI-assisted-by: deepseek-v4.1-flash * 🔧 Keep the commands' limits and the shipped config in sync `profile-plugin-ops` guarded only an UPDATE on the caller's own profile row, which the row lock already serializes, so its global cap could only reject a burst of different profiles toggling plugins. Both commands declare the by-profile limit alone now, and the example config drops the entry. A declared id without an entry does not limit anything: `wrap` logs a warning and runs the handler with no limiter at all, which is how a command ends up unbounded in production. A test fails now when a command declares an id the config does not list, and the header of the example says the production file mirrors the shape and lists every declared id, not the values. AI-assisted-by: deepseek-v4.1-flash * 📚 Record that background work is not waited for with a sleep A long command moved to the background reports its own completion, so polling it with a sleep inside a foreground command only blocks the session and the notification arrives anyway. The rule says to keep working on something else, or to end the response and wait for it. AI-assisted-by: minimax-m3.1-flash |
||
|
|
e20a0d748e
|
✨ Add OAuth support for MCP server (#12480)
* 🎉 Add OAuth support for remote MCP connections Add MCP-specific discovery, client registration, and approval endpoints. Exchange single-use authorization codes with PKCE for the fixed MCP user token, enabling MCP and creating the token on approval when needed. Use self-contained client IDs without new database tables or stored client records. Keep temporary authorization state in Redis/Valkey. Accept bearer credentials while preserving query-parameter connections. Enable OAuth through PENPOT_MCP_AUTH_URI in multi-user mode. Document the environment variable in the README and implementation details in Serena. Explain protocol and concurrency decisions in the Clojure code. Cover token provisioning, OAuth state, client registration, HTTP flows, and the approval page with tests. AI-assisted-by: gpt-6 * 🐛 Wait for devenv initialization before starting builds Docker reports a container as Running as soon as its main process starts, while the entrypoint may still be preparing the development environment. manage.sh used that status to launch tmux jobs, allowing frontend builds to race with ownership changes to /opt/rustup and Cargo setup. On a fresh container, rustup could fail with Permission denied before the frontend watcher started. Nginx would later serve the existing JavaScript, leaving source changes absent from the running app despite restarting devenv. Wait for nginx's local health endpoint before launching the jobs. Nginx starts after entrypoint setup, so its response confirms that setup has finished. Allow up to 120 seconds and report a timeout without starting the jobs if initialization does not complete. Validation: shell syntax and whitespace checks pass. AI-assisted-by: gpt-6 * ♻️ Share the login modal with MCP authorization Extract the viewer login modal and its styles into a shared auth component, retaining the viewer wrapper and its close behavior. Use the modal on the MCP approval page and preserve the pending request through login. Closing it clears the saved return URL and shows a cancellation message without further actions. Cover return URL handling and cancellation with frontend tests. AI-assisted-by: gpt-6 * ✨ Show client icons in MCP authorization Preserve HTTPS logo URLs from client registration and published metadata and show the icon beside the application name on the approval page. Ignore unusable URLs and hide failed images without blocking approval. Update the access description to refer to MCP connections established from Penpot. Cover logo metadata and approval responses in backend tests. AI-assisted-by: gpt-6 * 🐛 Follow the system theme when no preference is configured Default to the system theme in the shared resolver used by the app and plugins. Preserve explicit light and dark choices, including the legacy default value that means dark. Reuse the reactive theme hook in progress widgets and show the system preference in settings for accounts without a configured theme. Verify preference resolution with regression tests and browser checks. All 1,474 frontend tests pass. AI-assisted-by: gpt-6 * 🐛 Replace expired MCP tokens during OAuth approval Settings can give an MCP token an expiry date. OAuth approval reused the newest MCP token without checking it, so an expired token reached the client and never matched a plugin connection. Approval now treats an expired token as missing and creates a new one. Token exchange rejects a code whose token expired after approval with invalid_grant. AI-assisted-by: claude-opus-5-5 * 🐛 Log unexpected errors on MCP OAuth endpoints The OAuth routes sit outside the shared HTTP middleware, so the shared error handler never saw them, and their own handler turned unexpected failures into a 503 without logging anything. Failures in the session middleware of the approval endpoints had no handler at all. Unexpected failures now also go through the shared error handler for its logging, while clients still get an OAuth error body. The OAuth error handler also wraps the session middleware of the approval endpoints. AI-assisted-by: claude-opus-5-5 * 🔧 Add devenv script to run the MCP server with OAuth start-mcp-devenv-oauth starts the MCP server in multi-user mode with PENPOT_MCP_AUTH_URI derived from PENPOT_PUBLIC_URI, to test OAuth in the devenv. Agentic tooling still uses the single-user start-mcp-devenv. AI-assisted-by: claude-opus-5-5 * 🐛 Fix failing test case --------- Co-authored-by: alonso.torres <alonso.torres@kaleidos.net> |
||
|
|
10c603dbee
|
✨ List copies that follow through a nested component
The copies summary now follows the same cascade the post-merge sync does: when a copy that follows a changed component sits inside another component's main, that outer component's copies are listed too, marked with the component they follow through. The summary is computed only when a caller asks for it (the compare view and the conflict responses), so the ahead and behind counts skip it. AI-assisted-by: claude-opus-5-5 |
||
|
|
95ad841ed5
|
✨ Report what a merge does to component copies
The merge summary now says, for each component whose main the incoming side changed, which copies will follow it after the integration and which keep an override, per sync group and token slot. Each copy entry lists what the copy rule settled, with the side and the reason, and what the user still decides. A copy the rule settles entirely stays in the summary as an informational entry instead of disappearing, and applies nothing. A conflict on a component's main counts the copies its resolution also decides. AI-assisted-by: claude-opus-5-5 |