From 3b3669b63b8f95cca4c1e45fa9d6446ac1600f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero-Cantero?= <807608+alvorithm@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:31:39 +0100 Subject: [PATCH 1/5] :bug: Drop map-valued svg attrs when migrating legacy files (#13130) Files written by old Penpot versions hold maps where an svg attribute value should be, such as a `:filter` that once read `url(#filter_2)`. Since #12006 the `:svg-attrs` schema is closed and admits scalars only, and migration 0035 kept those maps, so the file data check at the end of every migration rejected the file. Such a file can be neither imported nor opened. Two built-in templates, Avataaars and Tutorial for beginners, are among them. `attrs->kebab-props` now drops a value that is not a string, a number, or a boolean, at the top level and inside `:style`. Migration 0035 and every birth path go through it, so stored attrs match the schema. Of the 143 files in penpot/penpot-files, 4 fail to import at `:svg-attrs :filter` before this change, and all 4 import after it. AI-assisted-by: claude-opus-5-5 --- common/src/app/common/svg.cljc | 27 +++++++++++++++---- .../files_migrations_0035_test.cljc | 25 +++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/common/src/app/common/svg.cljc b/common/src/app/common/svg.cljc index 15a3bff12d..7349e7e1d8 100644 --- a/common/src/app/common/svg.cljc +++ b/common/src/app/common/svg.cljc @@ -673,15 +673,32 @@ {} attrs))) +(defn- drop-non-scalar-values + "Removes the entries whose value is not a string, a number or a + boolean: the stored schema admits nothing else." + [attrs] + (reduce-kv (fn [res k v] + (if (or (string? v) (number? v) (boolean? v)) + res + (dissoc res k))) + attrs + attrs)) + (defn attrs->kebab-props "Like `attrs->props` (same whitelist, trim and `:style` parsing) but with kebab-case keys, the stored convention for `:svg-attrs` and - `:svg-defs` node attrs. Kebab is a fixed point: running it twice - returns the same map." + `:svg-defs` node attrs. Values that are not scalars, at the top level + or inside `:style`, are dropped: files written by old versions hold + maps there, which no renderer can use and the closed schema rejects. + Kebab is a fixed point: running it twice returns the same map." [attrs] - (-> attrs - (attrs->props) - (d/kebab-keys))) + (let [props (attrs->props attrs) + style (some-> (:style props) (drop-non-scalar-values) (not-empty))] + (-> props + (dissoc :style) + (drop-non-scalar-values) + (cond-> (some? style) (assoc :style style)) + (d/kebab-keys)))) (defn- normalize-node-tree "Walks a svg node tree applying `attrs-fn` to every `:attrs` map. Tags diff --git a/common/test/common_tests/files_migrations_0035_test.cljc b/common/test/common_tests/files_migrations_0035_test.cljc index 350b669fed..078bc895e4 100644 --- a/common/test/common_tests/files_migrations_0035_test.cljc +++ b/common/test/common_tests/files_migrations_0035_test.cljc @@ -367,6 +367,31 @@ (t/is (= :mask (get-in file' [:data :pages-index page-id :objects rect-id :svg-defs :a :tag]))) (t/is (= :g (get-in file' [:data :pages-index page-id :objects raw-id :content :tag]))))) +(t/deftest migration-0035-drops-map-valued-svg-attrs + ;; Files exported by old Penpot versions hold maps where an svg attr + ;; value should be, such as a `:filter` that once read + ;; `url(#filter_2)`. The closed `:svg-attrs` schema admits scalars + ;; only, so `migrate-file` must drop them or the file cannot be + ;; imported or opened. The values below are copied from the + ;; "Avataaars" and "Tutorial for beginners" templates. + (let [shape-id (uuid/next) + file (ctf/make-file {:name "Map-valued svg attrs"}) + page-id (first (get-in file [:data :pages])) + shape (-> (cts/setup-shape {:id shape-id :type :rect :name "rect"}) + (assoc :svg-attrs {:fillRule "evenodd" + :filter {(keyword "{") "{ \"url(#filter_2) nil}\""} + :mask {(keyword "url(-filter0-d-16837-160)") nil} + :style {:fill "red" + :filter {:a "b"}}})) + file (-> file + (assoc :migrations (disj cfm/available-migrations migration-id)) + (update-in [:data :pages-index page-id :objects] assoc shape-id shape) + (update-in [:data :pages-index page-id :objects uuid/zero :shapes] conj shape-id)) + file' (cfm/migrate-file file {}) + attrs (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs])] + (t/is (= {:fill-rule "evenodd" :style {:fill "red"}} attrs) + "map values are dropped, scalars are kept"))) + (t/deftest migration-0035-turns-plain-map-svg-transform-into-matrix ;; The svg defs renderer multiplies `:svg-transform` as a matrix; a ;; plain map there renders as `matrix(NaN, ...)`. From 240e7575869088ead04b257f55f031c45952ce0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Tue, 17 Nov 2026 12:24:49 +0100 Subject: [PATCH 2/5] :bug: Size frontend nginx workers from the container CPU limit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit worker_processes auto starts one worker per host CPU, ignoring the container CPU limit, and since worker_connections went from 2048 to 65535 each worker reserves about 30 MB at startup. A frontend limited to a few CPUs on a 64-core node needs close to 2 GB before serving a request and gets OOM killed. Default the worker count to the CPUs the container can use, its cpuset and its cgroup CPU quota rounded up, when they are fewer than the CPUs of the host, and keep auto otherwise. Make both settings configurable through PENPOT_HTTP_SERVER_WORKER_PROCESSES and PENPOT_HTTP_SERVER_WORKER_CONNECTIONS, and refuse to start on values that are not valid. Refs #13103 Signed-off-by: David Barragán Merino --- docker/images/files/nginx-entrypoint.sh | 39 ++++++++++++++++++++++++- docker/images/files/nginx.conf.template | 4 +-- docs/technical-guide/configuration.md | 21 +++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/docker/images/files/nginx-entrypoint.sh b/docker/images/files/nginx-entrypoint.sh index e76e581f1c..4132871f07 100644 --- a/docker/images/files/nginx-entrypoint.sh +++ b/docker/images/files/nginx-entrypoint.sh @@ -51,6 +51,42 @@ update_oidc_name /var/www/app/js/config.js ## Nginx Config ######################################### +# nginx's `auto` starts one worker per CPU of the host, not of the container, +# and each worker reserves the memory for all its connections at startup. A +# container limited to a few CPUs on a large node can run out of memory before +# serving a request, so size the workers from the CPUs the container can use +# (its cpuset, and its CPU quota rounded up) when they are fewer than the host's. +container_cpu_limit() { + local quota="" period="" cpus + cpus="$(nproc 2>/dev/null)" || return 1 + if [ -r /sys/fs/cgroup/cpu.max ]; then + read -r quota period < /sys/fs/cgroup/cpu.max + elif [ -r /sys/fs/cgroup/cpu/cpu.cfs_quota_us ]; then + quota="$(< /sys/fs/cgroup/cpu/cpu.cfs_quota_us)" + period="$(< /sys/fs/cgroup/cpu/cpu.cfs_period_us)" + fi + # "max" (cgroup v2) and -1 (cgroup v1) mean no quota, and 0 is not one. + if [[ "$quota" =~ ^[1-9][0-9]*$ && "$period" =~ ^[1-9][0-9]*$ ]]; then + quota=$(( (quota + period - 1) / period )) + (( quota < cpus )) && cpus=$quota + fi + (( cpus < $(nproc --all) )) || return 1 + echo "$cpus" +} + +export PENPOT_HTTP_SERVER_WORKER_PROCESSES=${PENPOT_HTTP_SERVER_WORKER_PROCESSES:-$(container_cpu_limit || echo auto)} +export PENPOT_HTTP_SERVER_WORKER_CONNECTIONS=${PENPOT_HTTP_SERVER_WORKER_CONNECTIONS:-65535} + +if [[ ! "$PENPOT_HTTP_SERVER_WORKER_PROCESSES" =~ ^(auto|[1-9][0-9]*)$ ]]; then + echo "penpot: invalid PENPOT_HTTP_SERVER_WORKER_PROCESSES '${PENPOT_HTTP_SERVER_WORKER_PROCESSES}'; expected auto or a positive integer" >&2 + exit 1 +fi + +if [[ ! "$PENPOT_HTTP_SERVER_WORKER_CONNECTIONS" =~ ^[1-9][0-9]*$ ]]; then + echo "penpot: invalid PENPOT_HTTP_SERVER_WORKER_CONNECTIONS '${PENPOT_HTTP_SERVER_WORKER_CONNECTIONS}'; expected a positive integer" >&2 + exit 1 +fi + export PENPOT_BACKEND_URI=${PENPOT_BACKEND_URI:-http://penpot-backend:6060} export PENPOT_EXPORTER_URI=${PENPOT_EXPORTER_URI:-http://penpot-exporter:6061} export PENPOT_HTTP_SERVER_MAX_BODY_SIZE=${PENPOT_HTTP_SERVER_MAX_BODY_SIZE:-367001600} # Default to 350MiB @@ -58,7 +94,8 @@ export PENPOT_IPV6_LISTEN_DIRECTIVE=${PENPOT_IPV6_LISTEN_DIRECTIVE:-"listen [::] if is_truthy "${PENPOT_DISABLE_IPV6_LISTEN:-}"; then export PENPOT_IPV6_LISTEN_DIRECTIVE="" fi -envsubst "\$PENPOT_BACKEND_URI,\$PENPOT_EXPORTER_URI,\$PENPOT_HTTP_SERVER_MAX_BODY_SIZE,\$PENPOT_IPV6_LISTEN_DIRECTIVE" \ + +envsubst "\$PENPOT_HTTP_SERVER_WORKER_PROCESSES,\$PENPOT_HTTP_SERVER_WORKER_CONNECTIONS,\$PENPOT_BACKEND_URI,\$PENPOT_EXPORTER_URI,\$PENPOT_HTTP_SERVER_MAX_BODY_SIZE,\$PENPOT_IPV6_LISTEN_DIRECTIVE" \ < /tmp/nginx.conf.template > /etc/nginx/nginx.conf if [[ " $PENPOT_FLAGS " != *" disable-admin-console "* ]]; then diff --git a/docker/images/files/nginx.conf.template b/docker/images/files/nginx.conf.template index 0451e7a24a..bae5030007 100644 --- a/docker/images/files/nginx.conf.template +++ b/docker/images/files/nginx.conf.template @@ -1,9 +1,9 @@ -worker_processes auto; +worker_processes ${PENPOT_HTTP_SERVER_WORKER_PROCESSES}; pid /tmp/nginx.pid; include /etc/nginx/overrides/main.d/*.conf; events { - worker_connections 65535; + worker_connections ${PENPOT_HTTP_SERVER_WORKER_CONNECTIONS}; multi_accept on; } diff --git a/docs/technical-guide/configuration.md b/docs/technical-guide/configuration.md index 37ea377bec..33dffaa0eb 100644 --- a/docs/technical-guide/configuration.md +++ b/docs/technical-guide/configuration.md @@ -957,6 +957,27 @@ PENPOT_INTERNAL_RESOLVER: 127.0.0.11 names. Defaults to the nameservers found in `/etc/resolv.conf`. `127.0.0.11` is the embedded Docker DNS server; use the address of your own resolver on other setups. +### Nginx workers + +The frontend container sizes its nginx workers from the CPUs it can use, its CPU quota or +its cpuset, when they are fewer than the CPUs of the host. Otherwise it starts one worker +per CPU of the host. Each worker reserves the memory for all its connections when it +starts, so tune these if the frontend uses more memory than you expect: + +```bash +# Frontend +PENPOT_HTTP_SERVER_WORKER_PROCESSES: 2 +PENPOT_HTTP_SERVER_WORKER_CONNECTIONS: 2048 +``` + +- `PENPOT_HTTP_SERVER_WORKER_PROCESSES`: Number of nginx worker processes, a positive + integer or `auto` for one per host CPU. Defaults to the CPUs the container can use, with + the quota rounded up, or `auto` when it has no limit. +- `PENPOT_HTTP_SERVER_WORKER_CONNECTIONS`: Maximum simultaneous connections per worker, + a positive integer. Defaults to `65535`, which takes about 30 MB of memory per worker. + +The container refuses to start if either value is not valid. + ## Other flags There are other flags that are useful for a more customized Penpot experience. This section has the list of the flags meant From a84d76d3971ef3ebc26f427a0fc2d92e97d49091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero-Cantero?= <807608+alvorithm@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:39:32 +0100 Subject: [PATCH 3/5] :bug: Stop camelCase svg attributes from breaking files (#13132) * :bug: Validate the shapes of a page added by an update-file change The backend validates every shape an `:add-obj` or a `:mod-obj` change writes, but an `:add-page` change carries a whole page and its shapes reached the file unchecked. Duplicate page and the undo of a page deletion send that page as the client holds it, so a tab that loaded a file before a migration ran could write the old format back into it. A tab opened before #12006 deployed holds camelCase svg attr keys such as `:fillRule`, and the closed `:svg-attrs` schema rejects them. The file saves, and the next read that migrates it fails the file data check, so the whole file stops opening (#13107). `:add-page` now validates each shape of the page on the backend, as `:add-obj` does for one. AI-assisted-by: claude-opus-5-5 * :bug: Rerun the svg attr normalization on files that recorded 0035 Files that recorded migration 0035 never run it again, so camelCase svg attr keys written after it ran stay in the file. A tab that loaded a file before 0035 ran could save such keys through an `:add-page` change, and the closed `:svg-attrs` schema then rejects the whole file on its next migrating read (#13107). The svg attr normalization now runs under the id `0037-fix-shape-svg-attrs-and-defs`, and the 0035 id leaves `available-migrations`, as 0021 did when 0035 replaced it. Every file that recorded 0035 migrates again. Kebab input passes through unchanged, so the rerun touches only the keys written after 0035. AI-assisted-by: claude-opus-5-5 * :recycle: Move the 0037 migration tests to their own namespace The svg-attr migration was renamed to 0037, but its tests stayed in the 0035 test namespace under migration-0035-* names. Move the whole section to files_migrations_0037_test.cljc, register the new namespace in the test runner, and rename its tests to match the migration id. Replace the doseq over the two withdrawn ids with two self-contained deftests, one for 0021 and one for 0035. No production code changes. AI-assisted-by: hy4-flash-free * :bug: Keep the log watch installed until the rejection record arrives The logger swaps the record on an executor thread, after the call that logged it returns. The test removed the watch in the `finally` around `update-file` and only then polled for the record, so under load the record landed on nobody and the test read a nil `:attempts`. AI-assisted-by: deepseek-v4.1-flash * :bug: Count only update-file calls in the save-test transport log The mocked transport is installed with `set!` and outlives the fixture: a timer another module left pending can still reach it mid-test, as a `:delete-file-object-thumbnails` call did in CI. Filter to the only command persistence sends, `update-file`, so a stray call neither fails the emptiness assertion nor releases a `wait-for` on a save. AI-assisted-by: deepseek-v4.1-flash --------- Co-authored-by: Andrey Antukh --- .serena/memories/backend/testing.md | 2 +- .serena/memories/frontend/testing.md | 1 + backend/test/backend_tests/rpc_file_test.clj | 33 ++ .../backend_tests/rpc_file_update_test.clj | 24 +- common/src/app/common/files/changes.cljc | 7 + common/src/app/common/files/migrations.cljc | 17 +- .../files_migrations_0035_test.cljc | 332 ---------------- .../files_migrations_0037_test.cljc | 371 ++++++++++++++++++ common/test/common_tests/runner.cljc | 2 + .../plugins/wait_for_save_test.cljs | 22 +- 10 files changed, 454 insertions(+), 357 deletions(-) create mode 100644 common/test/common_tests/files_migrations_0037_test.cljc diff --git a/.serena/memories/backend/testing.md b/.serena/memories/backend/testing.md index 62bd36173d..671ebc1b50 100644 --- a/.serena/memories/backend/testing.md +++ b/.serena/memories/backend/testing.md @@ -32,4 +32,4 @@ JVM `clojure.test` (kaocha runner) under `backend/test/backend_tests/`. `worker-config` can talk to a different Redis key prefix than a cfg the test builds itself. The symptom is a component that silently does nothing locally and races in CI (which sets no `PENPOT_TENANT`). -- `backend-tests.helpers` has `metrics-stub` (a metrics instance with no collectors, where every `run!` is a no-op), `init-climit` (a concurrency limiter built from an inline config map, with an optional second argument for the metrics instance to publish to) and `with-climit`, the macro that builds one, runs the body and halts it. `init-climit` starts the republisher daemon thread, so a test that builds a limiter without halting it leaks that thread for the rest of the JVM run: use `with-climit`. Log lines are capturable with `add-watch` on `app.common.logging/log-record` (it holds the last record; the watcher sees every one, but only of the levels the logger has enabled: a line the app writes at TRACE never gets there). +- `backend-tests.helpers` has `metrics-stub` (a metrics instance with no collectors, where every `run!` is a no-op), `init-climit` (a concurrency limiter built from an inline config map, with an optional second argument for the metrics instance to publish to) and `with-climit`, the macro that builds one, runs the body and halts it. `init-climit` starts the republisher daemon thread, so a test that builds a limiter without halting it leaks that thread for the rest of the JVM run: use `with-climit`. Log lines are capturable with `add-watch` on `app.common.logging/log-record` (it holds the last record; the watcher sees every one, but only of the levels the logger has enabled: a line the app writes at TRACE never gets there). The logger swaps the record on an executor thread, after the call that logged it returns: keep the watch installed until the record arrives (poll for it) and only then remove it, or the record lands on nobody under load. diff --git a/.serena/memories/frontend/testing.md b/.serena/memories/frontend/testing.md index 37f5304395..3bfbe08542 100644 --- a/.serena/memories/frontend/testing.md +++ b/.serena/memories/frontend/testing.md @@ -40,6 +40,7 @@ To assert over emitted event sequences, observe termination: subscribe through ` - Teardown belongs to the terminal continuation, never to `finally`-around-triggers (it would dispose in-flight flows). - A body that awaits must be `(^:async fn …)` even if the rest is sync; sync sequences are atomic vs the event loop. - The `:esm` test build cannot load the CommonJS `sax` module behind `tubax`, so SVG parsing fails in tests (`dwm/valid-svg-string?` answers false, `dwm/svg->clj` errors): mock both with the parsed data. +- `set!` mocks are global and outlive the fixture, so a flow another module left running (a store's pending timer) can still reach the mocked transport mid-test; `with-persistence` records every command for that reason. Filter to the commands your layer issues — persistence only sends `update-file` — before counting or asserting emptiness, and never let a stray call release a `wait-for` on one. From `frontend/`: - Full unit test run (always builds, suppressed output): `pnpm run test:quiet`. diff --git a/backend/test/backend_tests/rpc_file_test.clj b/backend/test/backend_tests/rpc_file_test.clj index e45794a739..6019839a59 100644 --- a/backend/test/backend_tests/rpc_file_test.clj +++ b/backend/test/backend_tests/rpc_file_test.clj @@ -13,6 +13,7 @@ [app.common.pprint :as pp] [app.common.thumbnails :as thc] [app.common.time :as ct] + [app.common.types.page :as ctp] [app.common.types.shape :as cts] [app.common.types.tokens-lib :as ctob] [app.common.types.tokens-status :as ctos] @@ -3433,3 +3434,35 @@ (t/is (= (into #{} (map :id) (:result miss)) (into #{} (map :id) (:result hit)))) (t/is (every? #(not (contains? % :migrations)) (:result hit)))))))) + +(t/deftest add-page-rejects-an-invalid-shape + ;; Duplicate page and the undo of a page deletion send the whole page as + ;; the client holds it. A tab that loaded the file before a migration + ;; ran holds the old format, here camelCase svg attrs (#13107), and the + ;; page must not reach the file: the next migrating read would reject + ;; the whole file. + (let [profile (th/create-profile* 1 {:is-active true}) + file (th/create-file* 1 {:profile-id (:id profile) + :project-id (:default-project-id profile) + :is-shared false}) + page-id (uuid/next) + shape-id (uuid/next) + shape (cts/setup-shape {:id shape-id :type :rect :name "rect" + :x 0 :y 0 :width 10 :height 10 + :parent-id uuid/zero :frame-id uuid/zero + :svg-attrs {:fillRule "nonzero"}}) + page (-> (ctp/make-empty-page {:id page-id :name "Copy"}) + (assoc-in [:objects shape-id] shape) + (update-in [:objects uuid/zero :shapes] (fnil conj []) shape-id)) + out (th/command! {::th/type :update-file + ::rpc/profile-id (:id profile) + :id (:id file) + :session-id (uuid/random) + :revn 0 + :vern 0 + :features cfeat/supported-features + :changes [{:type :add-page :id page-id :page page}]}) + stored (bfc/get-file th/*system* (:id file) :migrate? false :realize? true)] + (t/is (th/ex-of-type? (:error out) :assertion)) + (t/is (th/ex-of-code? (:error out) :data-validation)) + (t/is (not (contains? (get-in stored [:data :pages-index]) page-id))))) diff --git a/backend/test/backend_tests/rpc_file_update_test.clj b/backend/test/backend_tests/rpc_file_update_test.clj index c5a8ba9b6d..34e4fe8b00 100644 --- a/backend/test/backend_tests/rpc_file_update_test.clj +++ b/backend/test/backend_tests/rpc_file_update_test.clj @@ -282,18 +282,20 @@ (defn- update-file-logged "Updates the file and returns the response in `:out` and, in `:rejected`, - the props of the log record of the rejection, if any." + the props of the log record of the rejection, if any. Keeps the watch + until the record arrives: the logger writes it on another thread, so it + can land after the update returns." [ctx params] - (let [records (atom []) - out (try - (add-watch l/log-record ::capture - (fn [_ _ _ record] (swap! records conj record))) - (update-file ctx params) - (finally - (remove-watch l/log-record ::capture)))] - {:out out - :rejected (some-> (wait-for-record records "update-file commit rejected") - ::l/props)})) + (let [records (atom [])] + (try + (add-watch l/log-record ::capture + (fn [_ _ _ record] (swap! records conj record))) + (let [out (update-file ctx params)] + {:out out + :rejected (some-> (wait-for-record records "update-file commit rejected") + ::l/props)}) + (finally + (remove-watch l/log-record ::capture))))) (t/deftest bisects-the-commits-to-find-the-invalid-one (let [{:keys [page-id] :as ctx} (create-file) diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index b2b0e6de60..b81764e580 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -930,6 +930,13 @@ (when (and id name page) (ex/raise :type :conflict :hint "id+name or page should be provided, never both")) + + ;; NOTE: we only perform hard validation on backend. The page arrives + ;; whole (duplicate page, undo of a page deletion), as the client holds + ;; it, so each of its shapes is validated as `:add-obj` validates one. + #?(:clj (doseq [shape (vals (:objects page))] + (validate-shape shape (:id page)))) + (let [page (if (and (string? name) (uuid? id)) (ctp/make-empty-page {:id id :name name}) page)] diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 70e78627af..b930a88385 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -2345,19 +2345,22 @@ (update :pages-index d/update-vals update-container) (d/update-when :components d/update-vals update-container)))) -(defmethod migrate-data "0035-fix-shape-svg-attrs-and-defs" +(defmethod migrate-data "0037-fix-shape-svg-attrs-and-defs" ;; Stored svg attribute keys are kebab-case (issue #11947): the v3 reader ;; already outputs kebab and birth normalizes any outside spelling, so ;; export/import converges to the same state. Old birth and the cleaner ;; era stored camelCase React prop names instead, which the reader - ;; kebab-ized on import beyond repair. Convert once, with the same - ;; birth transforms: `:svg-attrs` and `:svg-defs` node attrs go through + ;; kebab-ized on import beyond repair. Convert with the same birth + ;; transforms: `:svg-attrs` and `:svg-defs` node attrs go through ;; the whitelist+kebab transform (unknown attrs drop, same as birth), ;; while svg-raw `:content` attrs are kebab-ized spelling-only (unknown ;; keys kept: the sidebar reads keys outside the whitelist). Kebab ;; input passes through unchanged, so re-running is safe. This replaces - ;; "0021-fix-shape-svg-attrs" (id withdrawn from `available-migrations` - ;; below): files that recorded it migrate again through this one. + ;; "0021-fix-shape-svg-attrs" and "0035-fix-shape-svg-attrs-and-defs" + ;; (ids withdrawn from `available-migrations` below): files that + ;; recorded either migrate again through this one. 0035 was withdrawn + ;; because a client that loaded a file before 0035 ran could still save + ;; camelCase keys into it afterwards (#13107). ;; Node tags in defs and svg-raw content are stored as keywords; files ;; that hold them as strings get them converted here, since the closed ;; node schemas reject strings. `:svg-transform` held as a plain map @@ -2502,5 +2505,5 @@ "0033-normalize-main-instance-names" "0034-fix-path-content-offset" "0035-fix-dangling-children" - "0035-fix-shape-svg-attrs-and-defs" - "0036-clear-nil-keys-in-objects"])) + "0036-clear-nil-keys-in-objects" + "0037-fix-shape-svg-attrs-and-defs"])) diff --git a/common/test/common_tests/files_migrations_0035_test.cljc b/common/test/common_tests/files_migrations_0035_test.cljc index 078bc895e4..c64ce69527 100644 --- a/common/test/common_tests/files_migrations_0035_test.cljc +++ b/common/test/common_tests/files_migrations_0035_test.cljc @@ -7,8 +7,6 @@ (ns common-tests.files-migrations-0035-test (:require [app.common.files.migrations :as cfm] - [app.common.geom.matrix :as gmt] - [app.common.geom.rect :as grc] [app.common.types.file :as ctf] [app.common.types.objects-map :as omap] [app.common.types.shape :as cts] @@ -189,333 +187,3 @@ (t/is (some? (get objects' frame-id)) "the frame that exists is kept")))) -;; ====================================================================== -;; 0035-fix-shape-svg-attrs-and-defs -;; Stored svg attribute keys are kebab-case (issue #11947). Old birth and -;; the cleaner era stored camelCase React prop names, which the v3 reader -;; kebab-ized on import beyond repair. This migration converts once, with -;; the same birth transforms: `:svg-attrs` and `:svg-defs` node attrs go -;; through the whitelist+kebab transform, svg-raw `:content` attrs are -;; kebab-ized spelling-only. It replaces "0021-fix-shape-svg-attrs" (id -;; withdrawn): files that recorded it migrate again through this one. -;; ====================================================================== - -(def ^:private migration-id - "0035-fix-shape-svg-attrs-and-defs") - -(defn- make-shape - [shape-id shape] - (assoc shape :id shape-id)) - -(defn- camel-shape - [shape-id] - (make-shape shape-id - {:type :rect - :svg-attrs {:fillRule "evenodd" - :stroke-width "2" - :stroke-style "dotted" - :data-foo "drop-me"}})) - -(defn- camel-defs - [] - {"g1" {:tag :linearGradient - :attrs {:id "g1" - :gradientUnits "userSpaceOnUse" - :xlink:href "#base" - :data-x "drop-me"} - :content [{:tag :stop - :attrs {:offset "0" - :stopColor "#ffffff"} - :content []}]}}) - -(t/deftest migration-0035-converts-camel-svg-attrs-to-kebab-in-pages - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (camel-shape shape-id)}}}} - data' (cfm/migrate-data data migration-id) - attrs (get-in data' [:pages-index page-id :objects shape-id :svg-attrs])] - (t/is (= "evenodd" (:fill-rule attrs))) - (t/is (= "2" (:stroke-width attrs))) - (t/is (= "dotted" (:stroke-style attrs)) "penpot-extra-attrs survive") - (t/is (not (contains? attrs :data-foo)) "unknown attrs are dropped") - (t/is (not (contains? attrs :fillRule)) "no camel keys survive"))) - -(t/deftest migration-0035-converts-camel-svg-attrs-to-kebab-in-components - (let [shape-id (uuid/next) - component-id (uuid/next) - data {:components - {component-id - {:objects - {shape-id (camel-shape shape-id)}}}} - data' (cfm/migrate-data data migration-id) - attrs (get-in data' [:components component-id :objects shape-id :svg-attrs])] - (t/is (= "evenodd" (:fill-rule attrs))) - (t/is (not (contains? attrs :fillRule)) "no camel keys survive"))) - -(t/deftest migration-0035-normalizes-def-node-attrs - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-defs (camel-defs)})}}}} - data' (cfm/migrate-data data migration-id) - grad (get-in data' [:pages-index page-id :objects shape-id :svg-defs "g1"])] - (t/is (= :linearGradient (:tag grad)) "tags are untouched") - (t/is (= "g1" (get-in grad [:attrs :id])) ":id survives") - (t/is (= "userSpaceOnUse" (get-in grad [:attrs :gradient-units]))) - (t/is (= "#base" (get-in grad [:attrs :xlink-href]))) - (t/is (not (contains? (:attrs grad) :data-x)) "unknown def attrs are dropped") - (t/is (= "#ffffff" (get-in grad [:content 0 :attrs :stop-color])) - "nested stops are normalized"))) - -(t/deftest migration-0035-kebabizes-content-spelling-only - (let [shape-id (uuid/next) - page-id (uuid/next) - raw-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :path - :content [{:marker "untouched"}]}) - raw-id (make-shape raw-id - {:type :svg-raw - :content {:tag :g - :attrs {:strokeWidth "2" - :data-foo "keep-me"} - :content [{:tag :path - :attrs {:strokeLinecap "round"} - :content []}]}})}}}} - data' (cfm/migrate-data data migration-id) - path (get-in data' [:pages-index page-id :objects shape-id]) - raw (get-in data' [:pages-index page-id :objects raw-id]) - content (:content raw)] - (t/is (= [{:marker "untouched"}] (:content path)) - "non-svg-raw content is untouched") - (t/is (= "2" (get-in content [:attrs :stroke-width]))) - (t/is (= "keep-me" (get-in content [:attrs :data-foo])) - "unknown content keys survive") - (t/is (= "round" (get-in content [:content 0 :attrs :stroke-linecap]))))) - -(defn- string-tag-defs - [] - {:a {:tag "mask" - :attrs {:id "a" :maskUnits "userSpaceOnUse"} - :content [{:tag "rect" - :attrs {:width "10" :height "10" :fill "#FFF"} - :content []}]}}) - -(defn- string-tag-content - [] - {:tag "g" - :attrs {} - :content [{:tag "text" - :attrs {:fontSize "12"} - :content ["Hi"]} - {:tag "style" - :attrs nil - :content [".a{fill:red}"]}]}) - -(t/deftest migration-0035-keywordizes-string-tags - (let [shape-id (uuid/next) - raw-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-defs (string-tag-defs)}) - raw-id (make-shape raw-id - {:type :svg-raw - :content (string-tag-content)})}}}} - data' (cfm/migrate-data data migration-id) - mask (get-in data' [:pages-index page-id :objects shape-id :svg-defs :a]) - content (get-in data' [:pages-index page-id :objects raw-id :content])] - (t/is (= :mask (:tag mask))) - (t/is (= :rect (get-in mask [:content 0 :tag])) "nested def tags too") - (t/is (= "userSpaceOnUse" (get-in mask [:attrs :mask-units]))) - (t/is (= :g (:tag content))) - (t/is (= :text (get-in content [:content 0 :tag])) "nested content tags too") - (t/is (= ["Hi"] (get-in content [:content 0 :content]))) - (t/is (= {} (get-in content [:content 1 :attrs])) "nil attrs become an empty map") - (t/is (= data' (cfm/migrate-data data' migration-id)) "re-running is stable"))) - -(t/deftest migration-0035-string-tag-file-passes-file-validation - ;; `migrate-file` validates the whole file data after migrating: a file - ;; with string node tags or nil node attrs must come out valid, or it - ;; cannot be opened. - (let [rect-id (uuid/next) - raw-id (uuid/next) - file (ctf/make-file {:name "String svg tags"}) - page-id (first (get-in file [:data :pages])) - rect (-> (cts/setup-shape {:id rect-id :type :rect :name "rect"}) - (assoc :svg-defs (string-tag-defs))) - raw (-> (cts/setup-shape {:id raw-id :type :svg-raw :name "raw"}) - (assoc :content (string-tag-content))) - file (-> file - (assoc :migrations (disj cfm/available-migrations migration-id)) - (update-in [:data :pages-index page-id :objects] assoc rect-id rect raw-id raw) - (update-in [:data :pages-index page-id :objects uuid/zero :shapes] conj rect-id raw-id)) - file' (cfm/migrate-file file {})] - (t/is (= :mask (get-in file' [:data :pages-index page-id :objects rect-id :svg-defs :a :tag]))) - (t/is (= :g (get-in file' [:data :pages-index page-id :objects raw-id :content :tag]))))) - -(t/deftest migration-0035-drops-map-valued-svg-attrs - ;; Files exported by old Penpot versions hold maps where an svg attr - ;; value should be, such as a `:filter` that once read - ;; `url(#filter_2)`. The closed `:svg-attrs` schema admits scalars - ;; only, so `migrate-file` must drop them or the file cannot be - ;; imported or opened. The values below are copied from the - ;; "Avataaars" and "Tutorial for beginners" templates. - (let [shape-id (uuid/next) - file (ctf/make-file {:name "Map-valued svg attrs"}) - page-id (first (get-in file [:data :pages])) - shape (-> (cts/setup-shape {:id shape-id :type :rect :name "rect"}) - (assoc :svg-attrs {:fillRule "evenodd" - :filter {(keyword "{") "{ \"url(#filter_2) nil}\""} - :mask {(keyword "url(-filter0-d-16837-160)") nil} - :style {:fill "red" - :filter {:a "b"}}})) - file (-> file - (assoc :migrations (disj cfm/available-migrations migration-id)) - (update-in [:data :pages-index page-id :objects] assoc shape-id shape) - (update-in [:data :pages-index page-id :objects uuid/zero :shapes] conj shape-id)) - file' (cfm/migrate-file file {}) - attrs (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs])] - (t/is (= {:fill-rule "evenodd" :style {:fill "red"}} attrs) - "map values are dropped, scalars are kept"))) - -(t/deftest migration-0035-turns-plain-map-svg-transform-into-matrix - ;; The svg defs renderer multiplies `:svg-transform` as a matrix; a - ;; plain map there renders as `matrix(NaN, ...)`. - (let [plain-id (uuid/next) - matrix-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {plain-id (make-shape plain-id - {:type :path - :svg-transform {:a 1.0 :b 0.0 :c 0.0 :d 1.0 :e 10.0 :f 20.0}}) - matrix-id (make-shape matrix-id - {:type :path - :svg-transform (gmt/matrix 2 0 0 2 0 0)})}}}} - data' (cfm/migrate-data data migration-id) - plain' (get-in data' [:pages-index page-id :objects plain-id :svg-transform]) - matrix' (get-in data' [:pages-index page-id :objects matrix-id :svg-transform])] - (t/is (gmt/matrix? plain')) - (t/is (= (gmt/matrix 1 0 0 1 10 20) plain')) - (t/is (= (gmt/matrix 2 0 0 2 0 0) matrix') "matrices are left as they are") - (t/is (= data' (cfm/migrate-data data' migration-id)) "re-running is stable"))) - -(t/deftest migration-0035-leaves-kebab-files-equal - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-attrs {:fill-rule "evenodd" - :stroke-width "2"} - :svg-defs {"g1" {:tag :linearGradient - :attrs {:id "g1" - :gradient-units "userSpaceOnUse"} - :content []}}})}}}} - data' (cfm/migrate-data data migration-id)] - (t/is (= data data') "kebab is a fixed point"))) - -(t/deftest migration-0035-is-idempotent - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (camel-shape shape-id)}}}} - data' (cfm/migrate-data data migration-id)] - (t/is (= data' (cfm/migrate-data data' migration-id))))) - -(t/deftest migration-0035-normalizes-flat-svg-viewbox-to-rect - ;; Carried over from the withdrawn 0021: legacy files hold - ;; `:svg-viewbox` as a plain map instead of a rect record. - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-viewbox {:x 1 :y 2 :width 3 :height 4}})}}}} - data' (cfm/migrate-data data migration-id) - viewbox (get-in data' [:pages-index page-id :objects shape-id :svg-viewbox])] - (t/is (grc/rect? viewbox) "flat viewbox becomes a rect record") - (t/is (= 1 (:x viewbox))) - (t/is (= 2 (:y viewbox))) - (t/is (= 3 (:width viewbox))) - (t/is (= 4 (:height viewbox))) - (t/is (= data' (cfm/migrate-data data' migration-id)) - "re-running is stable"))) - -(t/deftest migration-0035-passes-non-maps-through - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-attrs "junk" - :svg-defs "junk"})}}}} - data' (cfm/migrate-data data migration-id) - shape (get-in data' [:pages-index page-id :objects shape-id])] - (t/is (= "junk" (:svg-attrs shape)) "non-maps reach validation untouched") - (t/is (= "junk" (:svg-defs shape))))) - -(t/deftest migration-0035-junk-viewbox-becomes-default-rect - ;; Unlike `:svg-attrs`/`:svg-defs` (passed through to validation), - ;; `:svg-viewbox` goes through `make-rect`, which does not throw on - ;; junk: it falls back to the default rect. Inherited from 0021. - (let [shape-id (uuid/next) - page-id (uuid/next) - data {:pages-index - {page-id - {:objects - {shape-id (make-shape shape-id - {:type :rect - :svg-viewbox "junk"})}}}} - data' (cfm/migrate-data data migration-id) - viewbox (get-in data' [:pages-index page-id :objects shape-id :svg-viewbox])] - (t/is (grc/rect? viewbox) "junk viewbox becomes a rect, not an error") - (t/is (= 0 (:x viewbox))) - (t/is (= 0.01 (:width viewbox))))) - -(t/deftest migration-0035-runs-through-file-migration - ;; A file that recorded the withdrawn "0021-fix-shape-svg-attrs" (and - ;; everything else current) still needs migration: 0021 left - ;; `available-migrations`, which re-arms it for 0035. - (let [shape-id (uuid/next) - file (ctf/make-file {:name "Legacy camel svg attrs"}) - page-id (first (get-in file [:data :pages])) - shape (-> (cts/setup-shape {:id shape-id :type :rect}) - (assoc :svg-attrs {:fillRule "evenodd"})) - file (-> file - (assoc :migrations (-> cfm/available-migrations - (disj migration-id) - (conj "0021-fix-shape-svg-attrs"))) - (assoc-in [:data :pages-index page-id :objects shape-id] shape)) - file' (cfm/migrate-file file {})] - (t/is (cfm/need-migration? file) "new migration detected") - (t/is (not (cfm/need-migration? file')) "new migration recorded") - (t/is (contains? (:migrations file') migration-id) "migration id persisted") - (t/is (not (contains? cfm/available-migrations "0021-fix-shape-svg-attrs")) - "the withdrawn 0021 id stays out: its camel-restoring transform must never run again") - (t/is (= "evenodd" - (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs :fill-rule])) - "migration repaired file data before schema validation"))) diff --git a/common/test/common_tests/files_migrations_0037_test.cljc b/common/test/common_tests/files_migrations_0037_test.cljc new file mode 100644 index 0000000000..eff0afb82a --- /dev/null +++ b/common/test/common_tests/files_migrations_0037_test.cljc @@ -0,0 +1,371 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS SUBSIDIARY SL + +(ns common-tests.files-migrations-0037-test + (:require + [app.common.files.migrations :as cfm] + [app.common.geom.matrix :as gmt] + [app.common.geom.rect :as grc] + [app.common.types.file :as ctf] + [app.common.types.shape :as cts] + [app.common.uuid :as uuid] + [clojure.test :as t])) + +;; ====================================================================== +;; 0037-fix-shape-svg-attrs-and-defs +;; Stored svg attribute keys are kebab-case (issue #11947). Old birth and +;; the cleaner era stored camelCase React prop names, which the v3 reader +;; kebab-ized on import beyond repair. This migration converts them with +;; the same birth transforms: `:svg-attrs` and `:svg-defs` node attrs go +;; through the whitelist+kebab transform, svg-raw `:content` attrs are +;; kebab-ized spelling-only. It replaces "0021-fix-shape-svg-attrs" and +;; "0035-fix-shape-svg-attrs-and-defs" (ids withdrawn): files that +;; recorded either migrate again through this one. +;; ====================================================================== + +(def ^:private migration-id + "0037-fix-shape-svg-attrs-and-defs") + +(defn- make-shape + [shape-id shape] + (assoc shape :id shape-id)) + +(defn- camel-shape + [shape-id] + (make-shape shape-id + {:type :rect + :svg-attrs {:fillRule "evenodd" + :stroke-width "2" + :stroke-style "dotted" + :data-foo "drop-me"}})) + +(defn- camel-defs + [] + {"g1" {:tag :linearGradient + :attrs {:id "g1" + :gradientUnits "userSpaceOnUse" + :xlink:href "#base" + :data-x "drop-me"} + :content [{:tag :stop + :attrs {:offset "0" + :stopColor "#ffffff"} + :content []}]}}) + +(t/deftest migration-0037-converts-camel-svg-attrs-to-kebab-in-pages + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (camel-shape shape-id)}}}} + data' (cfm/migrate-data data migration-id) + attrs (get-in data' [:pages-index page-id :objects shape-id :svg-attrs])] + (t/is (= "evenodd" (:fill-rule attrs))) + (t/is (= "2" (:stroke-width attrs))) + (t/is (= "dotted" (:stroke-style attrs)) "penpot-extra-attrs survive") + (t/is (not (contains? attrs :data-foo)) "unknown attrs are dropped") + (t/is (not (contains? attrs :fillRule)) "no camel keys survive"))) + +(t/deftest migration-0037-converts-camel-svg-attrs-to-kebab-in-components + (let [shape-id (uuid/next) + component-id (uuid/next) + data {:components + {component-id + {:objects + {shape-id (camel-shape shape-id)}}}} + data' (cfm/migrate-data data migration-id) + attrs (get-in data' [:components component-id :objects shape-id :svg-attrs])] + (t/is (= "evenodd" (:fill-rule attrs))) + (t/is (not (contains? attrs :fillRule)) "no camel keys survive"))) + +(t/deftest migration-0037-normalizes-def-node-attrs + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-defs (camel-defs)})}}}} + data' (cfm/migrate-data data migration-id) + grad (get-in data' [:pages-index page-id :objects shape-id :svg-defs "g1"])] + (t/is (= :linearGradient (:tag grad)) "tags are untouched") + (t/is (= "g1" (get-in grad [:attrs :id])) ":id survives") + (t/is (= "userSpaceOnUse" (get-in grad [:attrs :gradient-units]))) + (t/is (= "#base" (get-in grad [:attrs :xlink-href]))) + (t/is (not (contains? (:attrs grad) :data-x)) "unknown def attrs are dropped") + (t/is (= "#ffffff" (get-in grad [:content 0 :attrs :stop-color])) + "nested stops are normalized"))) + +(t/deftest migration-0037-kebabizes-content-spelling-only + (let [shape-id (uuid/next) + page-id (uuid/next) + raw-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :path + :content [{:marker "untouched"}]}) + raw-id (make-shape raw-id + {:type :svg-raw + :content {:tag :g + :attrs {:strokeWidth "2" + :data-foo "keep-me"} + :content [{:tag :path + :attrs {:strokeLinecap "round"} + :content []}]}})}}}} + data' (cfm/migrate-data data migration-id) + path (get-in data' [:pages-index page-id :objects shape-id]) + raw (get-in data' [:pages-index page-id :objects raw-id]) + content (:content raw)] + (t/is (= [{:marker "untouched"}] (:content path)) + "non-svg-raw content is untouched") + (t/is (= "2" (get-in content [:attrs :stroke-width]))) + (t/is (= "keep-me" (get-in content [:attrs :data-foo])) + "unknown content keys survive") + (t/is (= "round" (get-in content [:content 0 :attrs :stroke-linecap]))))) + +(defn- string-tag-defs + [] + {:a {:tag "mask" + :attrs {:id "a" :maskUnits "userSpaceOnUse"} + :content [{:tag "rect" + :attrs {:width "10" :height "10" :fill "#FFF"} + :content []}]}}) + +(defn- string-tag-content + [] + {:tag "g" + :attrs {} + :content [{:tag "text" + :attrs {:fontSize "12"} + :content ["Hi"]} + {:tag "style" + :attrs nil + :content [".a{fill:red}"]}]}) + +(t/deftest migration-0037-keywordizes-string-tags + (let [shape-id (uuid/next) + raw-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-defs (string-tag-defs)}) + raw-id (make-shape raw-id + {:type :svg-raw + :content (string-tag-content)})}}}} + data' (cfm/migrate-data data migration-id) + mask (get-in data' [:pages-index page-id :objects shape-id :svg-defs :a]) + content (get-in data' [:pages-index page-id :objects raw-id :content])] + (t/is (= :mask (:tag mask))) + (t/is (= :rect (get-in mask [:content 0 :tag])) "nested def tags too") + (t/is (= "userSpaceOnUse" (get-in mask [:attrs :mask-units]))) + (t/is (= :g (:tag content))) + (t/is (= :text (get-in content [:content 0 :tag])) "nested content tags too") + (t/is (= ["Hi"] (get-in content [:content 0 :content]))) + (t/is (= {} (get-in content [:content 1 :attrs])) "nil attrs become an empty map") + (t/is (= data' (cfm/migrate-data data' migration-id)) "re-running is stable"))) + +(t/deftest migration-0037-string-tag-file-passes-file-validation + ;; `migrate-file` validates the whole file data after migrating: a file + ;; with string node tags or nil node attrs must come out valid, or it + ;; cannot be opened. + (let [rect-id (uuid/next) + raw-id (uuid/next) + file (ctf/make-file {:name "String svg tags"}) + page-id (first (get-in file [:data :pages])) + rect (-> (cts/setup-shape {:id rect-id :type :rect :name "rect"}) + (assoc :svg-defs (string-tag-defs))) + raw (-> (cts/setup-shape {:id raw-id :type :svg-raw :name "raw"}) + (assoc :content (string-tag-content))) + file (-> file + (assoc :migrations (disj cfm/available-migrations migration-id)) + (update-in [:data :pages-index page-id :objects] assoc rect-id rect raw-id raw) + (update-in [:data :pages-index page-id :objects uuid/zero :shapes] conj rect-id raw-id)) + file' (cfm/migrate-file file {})] + (t/is (= :mask (get-in file' [:data :pages-index page-id :objects rect-id :svg-defs :a :tag]))) + (t/is (= :g (get-in file' [:data :pages-index page-id :objects raw-id :content :tag]))))) + +(t/deftest migration-0037-drops-map-valued-svg-attrs + ;; Files exported by old Penpot versions hold maps where an svg attr + ;; value should be, such as a `:filter` that once read + ;; `url(#filter_2)`. The closed `:svg-attrs` schema admits scalars + ;; only, so `migrate-file` must drop them or the file cannot be + ;; imported or opened. The values below are copied from the + ;; "Avataaars" and "Tutorial for beginners" templates. + (let [shape-id (uuid/next) + file (ctf/make-file {:name "Map-valued svg attrs"}) + page-id (first (get-in file [:data :pages])) + shape (-> (cts/setup-shape {:id shape-id :type :rect :name "rect"}) + (assoc :svg-attrs {:fillRule "evenodd" + :filter {(keyword "{") "{ \"url(#filter_2) nil}\""} + :mask {(keyword "url(-filter0-d-16837-160)") nil} + :style {:fill "red" + :filter {:a "b"}}})) + file (-> file + (assoc :migrations (disj cfm/available-migrations migration-id)) + (update-in [:data :pages-index page-id :objects] assoc shape-id shape) + (update-in [:data :pages-index page-id :objects uuid/zero :shapes] conj shape-id)) + file' (cfm/migrate-file file {}) + attrs (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs])] + (t/is (= {:fill-rule "evenodd" :style {:fill "red"}} attrs) + "map values are dropped, scalars are kept"))) + +(t/deftest migration-0037-turns-plain-map-svg-transform-into-matrix + ;; The svg defs renderer multiplies `:svg-transform` as a matrix; a + ;; plain map there renders as `matrix(NaN, ...)`. + (let [plain-id (uuid/next) + matrix-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {plain-id (make-shape plain-id + {:type :path + :svg-transform {:a 1.0 :b 0.0 :c 0.0 :d 1.0 :e 10.0 :f 20.0}}) + matrix-id (make-shape matrix-id + {:type :path + :svg-transform (gmt/matrix 2 0 0 2 0 0)})}}}} + data' (cfm/migrate-data data migration-id) + plain' (get-in data' [:pages-index page-id :objects plain-id :svg-transform]) + matrix' (get-in data' [:pages-index page-id :objects matrix-id :svg-transform])] + (t/is (gmt/matrix? plain')) + (t/is (= (gmt/matrix 1 0 0 1 10 20) plain')) + (t/is (= (gmt/matrix 2 0 0 2 0 0) matrix') "matrices are left as they are") + (t/is (= data' (cfm/migrate-data data' migration-id)) "re-running is stable"))) + +(t/deftest migration-0037-leaves-kebab-files-equal + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-attrs {:fill-rule "evenodd" + :stroke-width "2"} + :svg-defs {"g1" {:tag :linearGradient + :attrs {:id "g1" + :gradient-units "userSpaceOnUse"} + :content []}}})}}}} + data' (cfm/migrate-data data migration-id)] + (t/is (= data data') "kebab is a fixed point"))) + +(t/deftest migration-0037-is-idempotent + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (camel-shape shape-id)}}}} + data' (cfm/migrate-data data migration-id)] + (t/is (= data' (cfm/migrate-data data' migration-id))))) + +(t/deftest migration-0037-normalizes-flat-svg-viewbox-to-rect + ;; Carried over from the withdrawn 0021: legacy files hold + ;; `:svg-viewbox` as a plain map instead of a rect record. + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-viewbox {:x 1 :y 2 :width 3 :height 4}})}}}} + data' (cfm/migrate-data data migration-id) + viewbox (get-in data' [:pages-index page-id :objects shape-id :svg-viewbox])] + (t/is (grc/rect? viewbox) "flat viewbox becomes a rect record") + (t/is (= 1 (:x viewbox))) + (t/is (= 2 (:y viewbox))) + (t/is (= 3 (:width viewbox))) + (t/is (= 4 (:height viewbox))) + (t/is (= data' (cfm/migrate-data data' migration-id)) + "re-running is stable"))) + +(t/deftest migration-0037-passes-non-maps-through + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-attrs "junk" + :svg-defs "junk"})}}}} + data' (cfm/migrate-data data migration-id) + shape (get-in data' [:pages-index page-id :objects shape-id])] + (t/is (= "junk" (:svg-attrs shape)) "non-maps reach validation untouched") + (t/is (= "junk" (:svg-defs shape))))) + +(t/deftest migration-0037-junk-viewbox-becomes-default-rect + ;; Unlike `:svg-attrs`/`:svg-defs` (passed through to validation), + ;; `:svg-viewbox` goes through `make-rect`, which does not throw on + ;; junk: it falls back to the default rect. Inherited from 0021. + (let [shape-id (uuid/next) + page-id (uuid/next) + data {:pages-index + {page-id + {:objects + {shape-id (make-shape shape-id + {:type :rect + :svg-viewbox "junk"})}}}} + data' (cfm/migrate-data data migration-id) + viewbox (get-in data' [:pages-index page-id :objects shape-id :svg-viewbox])] + (t/is (grc/rect? viewbox) "junk viewbox becomes a rect, not an error") + (t/is (= 0 (:x viewbox))) + (t/is (= 0.01 (:width viewbox))))) + +(t/deftest migration-0037-reruns-for-files-that-recorded-withdrawn-0021 + ;; A file that recorded the withdrawn "0021-fix-shape-svg-attrs" (and + ;; everything else current) still needs migration: 0021 left + ;; `available-migrations`, which re-arms it for 0037. + (let [shape-id (uuid/next) + file (ctf/make-file {:name "Legacy camel svg attrs"}) + page-id (first (get-in file [:data :pages])) + shape (-> (cts/setup-shape {:id shape-id :type :rect}) + (assoc :svg-attrs {:fillRule "evenodd"})) + file (-> file + (assoc :migrations (-> cfm/available-migrations + (disj migration-id) + (conj "0021-fix-shape-svg-attrs"))) + (assoc-in [:data :pages-index page-id :objects shape-id] shape)) + file' (cfm/migrate-file file {})] + (t/is (cfm/need-migration? file) "new migration detected") + (t/is (not (cfm/need-migration? file')) "new migration recorded") + (t/is (contains? (:migrations file') migration-id) "migration id persisted") + (t/is (not (contains? cfm/available-migrations "0021-fix-shape-svg-attrs")) + "the withdrawn 0021 id stays out of available-migrations") + (t/is (= "evenodd" + (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs :fill-rule])) + "migration repaired file data before schema validation"))) + +(t/deftest migration-0037-reruns-for-files-that-recorded-withdrawn-0035 + ;; A file that recorded 0035 holds camelCase keys when a client that + ;; loaded it before 0035 ran saved them afterwards (#13107). 0035 also + ;; left `available-migrations`, so 0037 must run on it again. + (let [shape-id (uuid/next) + file (ctf/make-file {:name "Legacy camel svg attrs"}) + page-id (first (get-in file [:data :pages])) + shape (-> (cts/setup-shape {:id shape-id :type :rect}) + (assoc :svg-attrs {:fillRule "evenodd"})) + file (-> file + (assoc :migrations (-> cfm/available-migrations + (disj migration-id) + (conj "0035-fix-shape-svg-attrs-and-defs"))) + (assoc-in [:data :pages-index page-id :objects shape-id] shape)) + file' (cfm/migrate-file file {})] + (t/is (cfm/need-migration? file) "new migration detected") + (t/is (not (cfm/need-migration? file')) "new migration recorded") + (t/is (contains? (:migrations file') migration-id) "migration id persisted") + (t/is (not (contains? cfm/available-migrations "0035-fix-shape-svg-attrs-and-defs")) + "the withdrawn 0035 id stays out of available-migrations") + (t/is (= "evenodd" + (get-in file' [:data :pages-index page-id :objects shape-id :svg-attrs :fill-rule])) + "migration repaired file data before schema validation"))) diff --git a/common/test/common_tests/runner.cljc b/common/test/common_tests/runner.cljc index d3cdb08456..29c80c981b 100644 --- a/common/test/common_tests/runner.cljc +++ b/common/test/common_tests/runner.cljc @@ -26,6 +26,7 @@ [common-tests.files-migrations-0034-test] [common-tests.files-migrations-0035-test] [common-tests.files-migrations-0036-test] + [common-tests.files-migrations-0037-test] [common-tests.files-migrations-test] [common-tests.files.comp-processors-test] [common-tests.files.helpers-test] @@ -144,6 +145,7 @@ 'common-tests.files-migrations-0034-test 'common-tests.files-migrations-0035-test 'common-tests.files-migrations-0036-test + 'common-tests.files-migrations-0037-test 'common-tests.files-migrations-test 'common-tests.files.comp-processors-test 'common-tests.files.helpers-test diff --git a/frontend/test/frontend_tests/plugins/wait_for_save_test.cljs b/frontend/test/frontend_tests/plugins/wait_for_save_test.cljs index e214d301ad..c9951aa657 100644 --- a/frontend/test/frontend_tests/plugins/wait_for_save_test.cljs +++ b/frontend/test/frontend_tests/plugins/wait_for_save_test.cljs @@ -40,6 +40,14 @@ [outcome] (some-> (:error outcome) .-code)) +(defn- saves + "The `update-file` commands the transport received. Every flow of the + editor shares the mocked transport and a lingering one can still reach + it, so a stray call must neither pass for a save nor release a wait on + one." + [requests] + (filterv #(= :update-file (first %)) @requests)) + (t/deftest ^:async empty-persistence-resolves-after-intake (await (with-persistence @@ -50,7 +58,7 @@ (let [outcome (await (await-outcome (persist/wait-for-save 2000)))] (t/is (contains? outcome :ok) "empty buffer and queue resolve after intake") - (t/is (empty? @requests) + (t/is (empty? (saves requests)) "nothing to save sends no update-file"))))))))) (t/deftest ^:async context-wait-for-save-resolves @@ -133,7 +141,7 @@ (await (async/wait-for #(seq (get-in @store [:persistence :buffer])) "commit is buffered")) (let [p (persist/wait-for-save 5000)] - (await (async/wait-for #(seq @requests) + (await (async/wait-for #(seq (saves requests)) "force-persist flushed the buffer")) (rx/error! response (ex-info "rejected" {:type :validation :code :invalid-data})) (let [outcome (await (await-outcome p))] @@ -189,7 +197,8 @@ (js/setTimeout (fn [] (ptk/emit! store (local-commit file-id))) 0) - (await (async/wait-for #(seq @requests) "force-persist sent the edit")) + (await (async/wait-for #(seq (saves requests)) + "force-persist sent the edit")) (rx/push! response {:revn 1}) (let [outcome (await (await-outcome p))] (t/is (contains? outcome :ok) @@ -206,7 +215,8 @@ (await (async/wait-for #(seq (get-in @store [:persistence :buffer])) "commit is buffered")) (let [p (persist/wait-for-save 5000)] - (await (async/wait-for #(seq @requests) "force-persist flushed the buffer")) + (await (async/wait-for #(seq (saves requests)) + "force-persist flushed the buffer")) (rx/push! response {:revn 1}) (let [outcome (await (await-outcome p))] (t/is (contains? outcome :ok) @@ -255,7 +265,7 @@ (await (async/wait-for #(seq (get-in @store [:persistence :buffer])) "commit is buffered")) (let [p (persist/wait-for-save 5000)] - (await (async/wait-for #(seq @requests) + (await (async/wait-for #(seq (saves requests)) "force-persist flushed the buffer")) (rx/push! response (thp/rejection (:id @commit))) (let [outcome (await (await-outcome p))] @@ -276,7 +286,7 @@ (await (async/wait-for #(seq (get-in @store [:persistence :buffer])) "commit is buffered")) (let [p (persist/wait-for-save 5000)] - (await (async/wait-for #(seq @requests) + (await (async/wait-for #(seq (saves requests)) "force-persist flushed the buffer")) ;; Rollback starts before settle can publish empty :saved; ;; never emit ::rolled-back (reload-delay case). From aa12e5208136804cbf8f80870bd4f36c69bee438 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 18 Nov 2026 12:51:30 +0100 Subject: [PATCH 4/5] :arrow_up: Update the system dependencies of the devenv and the images (#13144) * :arrow_up: Bump the JDK to 27.0.1.1 on devenv and the backend image The devenv image compiled the backend bundle with JDK 27 while the production image ran JDK 26. The runtime starts with --enable-preview, so a runtime line behind the compiler line is a silent trap rather than a working setup. Both pins now use Zulu 27.0.1.1 (zulu27.30.201-ca), the current GA of the line, with the same sums on both architectures. The jlink module list in the backend image still resolves on 27, so it does not change. Sums checked by downloading both tarballs; the jlink JRE built from them starts and reports 27.0.1.1. AI-assisted-by: deepseek-v4.1-flash * :fire: Remove the unused gitpod setup No workflow built docker/gitpod and its AdoptOpenJDK 16 install no longer matches the devenv. The README badge linked to a setup that no longer exists, so it goes with it. The historical changelog entry stays: CHANGES.md is generated from the milestones. AI-assisted-by: deepseek-v4.1-flash * :arrow_up: Bring the docker/ updates from develop Move the devenv and the production images to what develop already carries: - Base images to the current dhi.io digests. - Node 24.22.3 and pnpm 12.21.0 in the devenv image and in every production Dockerfile that ships pnpm. - Rust 1.99.0 and Serena 2.1.0, with SERENA_UPDATE_VERSION raised to match and a note that it must never be lower than the image pin. - tini as the exporter ENTRYPOINT. Devenv additions: PENPOT_DEVENV=true so the frontend compiles with the admin console disabled by default, xauth and libvulkan1 plus the GPU compose overlay, the MCP OAuth metadata route in nginx, and clipboard support in tmux. The JDK stays at 27.0.1.1 on both pins. AI-assisted-by: deepseek-v4.1-flash * :arrow_up: Finish the Node 24.22.3 bump outside docker/ The docker/ import brought Node 24.22.3 into the devenv and the image tags while .nvmrc and the two plugins-deploy workflows stayed on 24.22.2. Node stays on the 24.x line on every site: the plugins-deploy runtime pins follow .nvmrc, even though develop moved them to node@26.13.1 in 99db795966. AI-assisted-by: deepseek-v4.1-flash --- .github/workflows/plugins-deploy-api-doc.yml | 2 +- .../workflows/plugins-deploy-styles-doc.yml | 2 +- .nvmrc | 2 +- .serena/memories/workflow/docker-images.md | 3 +- .serena/memories/workflow/updating-node.md | 1 + README.md | 3 - docker/devenv/Dockerfile | 30 ++-- docker/devenv/docker-compose.gpu.yml | 14 ++ docker/devenv/docker-compose.main.yml | 8 +- docker/devenv/files/nginx.conf | 5 + docker/devenv/files/tmux.conf | 3 + docker/gitpod/Dockerfile | 122 --------------- docker/gitpod/files/nginx-mime.types | 100 ------------ docker/gitpod/files/nginx.conf | 145 ------------------ docker/gitpod/files/postgresql_init.sql | 3 - docker/images/Dockerfile.backend | 12 +- docker/images/Dockerfile.exporter | 10 +- docker/images/Dockerfile.frontend | 2 +- docker/images/Dockerfile.mcp | 10 +- docker/images/Dockerfile.media-processor | 8 +- docker/images/Dockerfile.storybook | 2 +- 21 files changed, 75 insertions(+), 412 deletions(-) create mode 100644 docker/devenv/docker-compose.gpu.yml delete mode 100644 docker/gitpod/Dockerfile delete mode 100644 docker/gitpod/files/nginx-mime.types delete mode 100644 docker/gitpod/files/nginx.conf delete mode 100644 docker/gitpod/files/postgresql_init.sql diff --git a/.github/workflows/plugins-deploy-api-doc.yml b/.github/workflows/plugins-deploy-api-doc.yml index ed7ec0e978..eb2a75c0e3 100644 --- a/.github/workflows/plugins-deploy-api-doc.yml +++ b/.github/workflows/plugins-deploy-api-doc.yml @@ -51,7 +51,7 @@ jobs: uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1 with: working-directory: plugins - runtime: node@24.22.2 + runtime: node@24.22.3 install: false - name: Install deps diff --git a/.github/workflows/plugins-deploy-styles-doc.yml b/.github/workflows/plugins-deploy-styles-doc.yml index 72b67fa1cb..262ae98af1 100644 --- a/.github/workflows/plugins-deploy-styles-doc.yml +++ b/.github/workflows/plugins-deploy-styles-doc.yml @@ -49,7 +49,7 @@ jobs: uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1 with: working-directory: plugins - runtime: node@24.22.2 + runtime: node@24.22.3 install: false - name: Install deps diff --git a/.nvmrc b/.nvmrc index 86456ddf02..22fbfc060a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v24.22.2 +v24.22.3 diff --git a/.serena/memories/workflow/docker-images.md b/.serena/memories/workflow/docker-images.md index 28d42bc9e7..3415c8247d 100644 --- a/.serena/memories/workflow/docker-images.md +++ b/.serena/memories/workflow/docker-images.md @@ -2,5 +2,6 @@ Node and pnpm pins: `mem:workflow/updating-node` and `mem:workflow/updating-pnpm`. Only the parts the Dockerfiles cannot show: -- JDK: the image tracks a non-LTS line, so there is no minor to pick — the last build of the line is the ceiling; moving line is a major and needs a real build to validate the `jlink` module list. +- JDK: two pins that move together — `docker/devenv/Dockerfile` (`setup-jvm` stage, full JDK) and `docker/images/Dockerfile.backend` (JDK + `jlink` runtime). Same build, same sums in both. They compile and run the same backend: `manage.sh` builds the bundle inside the devenv image (`build-backend-bundle` → `build "backend"`) and `backend/scripts/run.template.sh` starts the runtime with `--enable-preview`, which requires the runtime major to match the compiler major. A runtime line behind the compiler line is a silent trap. +- JDK line: tracks a non-LTS line, so there is no minor to pick — the last build of the line is the ceiling; moving line is a major and needs a real build to validate the `jlink` module list (`--add-modules` in `Dockerfile.backend`). JDK 27 keeps all of them; check with `bin/jlink --add-modules ` against the downloaded JDK before bumping. Source of the URL and both sums: the Azul metadata API (`api.azul.com/metadata/v1/zulu/packages/?java_version=&os=linux&arch=&java_package_type=jdk&archive_type=tar.gz&latest=true&release_status=ga&availability_types=CA`), then confirm the sums by downloading the tarball and running `sha256sum`. - ImageMagick: publish `penpotapp/imagemagick:` **before** bumping the `COPY --from` refs in the backend, exporter and devenv Dockerfiles; otherwise both builds break on the missing tag. diff --git a/.serena/memories/workflow/updating-node.md b/.serena/memories/workflow/updating-node.md index 5a05836745..f682513df0 100644 --- a/.serena/memories/workflow/updating-node.md +++ b/.serena/memories/workflow/updating-node.md @@ -18,6 +18,7 @@ No single source of truth: nothing reads `.nvmrc` at build time, and the version - Renovate also opens these bumps, on `renovate-*` branches and with its config living outside this repo; a manual bump and Renovate's must not diverge on any of the six sites. - A backport merge can deliver a newer Node into `docker/` and the plugins-deploy workflows while main's `.nvmrc` stays behind, because main receives partial backports of `.github/` and `docker/` from develop. Merging main into staging therefore conflicts on the pin lines: take main's set and finish the bump (`.nvmrc` plus the `packageManager` fields via `mem:workflow/updating-pnpm`), or the six sites drift. - The newer version wins in both directions. A maintenance→main merge (`main-2.18.x` into `main`) can carry the newer Node while `.nvmrc` and the `packageManager` fields stay on the older pair; then adopt the newer set and finish the bump on all six sites plus the 35 `packageManager` fields. +- Node stays on the 24.x line even when the rest of `.github/` moves on: `99db795966` (`update GitHub Actions`) took the two `plugins-deploy-*` `runtime:` pins to `node@26.13.1` on develop while `.nvmrc` stayed on `v24.22.3`. The project keeps every site on the `.nvmrc` value; resolve that conflict back to the 24.x pin instead of taking develop's. - Both workflows must stay valid YAML. The `python3` in the devenv has no `yaml` module, so validate with `uv run --with pyyaml python3 -c ...` instead of a bare import. ## Verification diff --git a/README.md b/README.md index ffd702aa31..831eaf8d8a 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,6 @@ Managed with Taiga.io - - Gitpod ready-to-code -

diff --git a/docker/devenv/Dockerfile b/docker/devenv/Dockerfile index 73294cb15d..6cd9b8cdfe 100644 --- a/docker/devenv/Dockerfile +++ b/docker/devenv/Dockerfile @@ -1,4 +1,4 @@ -FROM dhi.io/debian-base:trixie-debian13-dev@sha256:9b025768946856e44f9775005eb199f2e1820484ea27bb5c8bcbb187b80464dc AS base +FROM dhi.io/debian-base:trixie-debian13-dev@sha256:f90fd43cdf3dd94840b4dc3a2a39fd2a08578e40e7895535e2e20a1275ba6013 AS base ENV LANG='C.UTF-8' \ LC_ALL='C.UTF-8' \ @@ -66,8 +66,8 @@ RUN set -ex; \ FROM base AS setup-node -ENV NODE_VERSION=v24.22.2 \ - PNPM_VERSION=12.16.1 \ +ENV NODE_VERSION=v24.22.3 \ + PNPM_VERSION=12.21.0 \ PATH=/opt/node/bin:$PATH RUN set -eux; \ @@ -76,16 +76,16 @@ RUN set -eux; \ aarch64|arm64) \ OPENSSL_ARCH='linux-aarch64'; \ BINARY_URL="https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-arm64.tar.gz"; \ - NODE_SHA256='95c264150aceb7f3437a29fd6984924f5f8d1511ea3cbd6c508b83f6c555dae2'; \ + NODE_SHA256='261af2af250dfd7e9f25cf151d1b2713a0adf8f10a9ad116c4947f68627affe8'; \ PNPM_ARCH='arm64'; \ - PNPM_SHA256='f5847699e5d528f8f8e9bcfb385e58cb9fba7482af1b1aa7b70737be42277f81'; \ + PNPM_SHA256='6c5913a48c93b3a556b71c3bd9bf12c6bf9fbfbbbd2dcbd1d52a85c539751b9e'; \ ;; \ amd64|x86_64) \ OPENSSL_ARCH='linux-x86_64'; \ BINARY_URL="https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz"; \ - NODE_SHA256='361718c444e49af2ca5a110c83ba6a8901143f23ab285ebbef0341f391f482a9'; \ + NODE_SHA256='061ec3e3062115705b56b51fa9cc330ab50d34b6969387d4e4b1a50c6809acc2'; \ PNPM_ARCH='x64'; \ - PNPM_SHA256='565ff81174a14f6f7bd5d84c1b17e51031a80230d370a1fe24be5d16bd02a825'; \ + PNPM_SHA256='84c4773bcf4a217f4083cd7b2a91e4cee6103cf42426c1282ef37d308f55a410'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ @@ -150,12 +150,12 @@ RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \ aarch64|arm64) \ - ESUM='9fa5bf865783c43840101fcdc3a5222b60daf4fe11f26806247bf807c08aba38'; \ - BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_aarch64.tar.gz'; \ + ESUM='18875b92ad2535230a13175f718933f7cc0593b4affa2dab442815ec245dacbb'; \ + BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_aarch64.tar.gz'; \ ;; \ amd64|x86_64) \ - ESUM='ccbc15c4edbedfdcc03c2d29a2aa2c6daf9e6ffb4cda7dd5ece0fcbb37350267'; \ - BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_x64.tar.gz'; \ + ESUM='c4d7bf4c80a21e935187ecdcb111e4b2f14e1fdd18364974fe7f7da54b12bea0'; \ + BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_x64.tar.gz'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ @@ -187,7 +187,7 @@ ENV PATH=/opt/cargo/bin:$PATH \ RUSTUP_HOME=/opt/rustup \ CARGO_HOME=/opt/cargo \ RUSTUP_VERSION=1.28.2 \ - RUST_VERSION=1.91.0 \ + RUST_VERSION=1.99.0 \ EMSCRIPTEN_VERSION=4.0.6 WORKDIR /opt @@ -236,7 +236,9 @@ ENV CLJKONDO_VERSION=2026.10.20 \ UV_TOOL_DIR=/opt/uv/tools \ UV_TOOL_BIN_DIR=/opt/utils/bin \ UV_PYTHON_INSTALL_DIR=/opt/uv/python \ - SERENA_VERSION=1.7.0 + SERENA_VERSION=2.1.0 +# NOTE: When updating SERENA_VERSION, also update SERENA_UPDATE_VERSION in docker-compose.main.yml. +# The latter results in a dynamic update without rebuilding the image, so it must never be lower than SERENA_VERSION here. RUN set -ex; \ ARCH="$(dpkg --print-architecture)"; \ @@ -429,6 +431,8 @@ RUN set -ex; \ fontforge \ \ xvfb \ + xauth \ + libvulkan1 \ fonts-noto-color-emoji \ fonts-unifont \ libfontconfig1 \ diff --git a/docker/devenv/docker-compose.gpu.yml b/docker/devenv/docker-compose.gpu.yml new file mode 100644 index 0000000000..99c21037b0 --- /dev/null +++ b/docker/devenv/docker-compose.gpu.yml @@ -0,0 +1,14 @@ +services: + main: + environment: + - NVIDIA_DRIVER_CAPABILITIES=all + - PENPOT_GPU=1 + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] + volumes: + - /usr/share/vulkan/icd.d:/usr/share/vulkan/icd.d:ro diff --git a/docker/devenv/docker-compose.main.yml b/docker/devenv/docker-compose.main.yml index 219e348a56..6836861354 100644 --- a/docker/devenv/docker-compose.main.yml +++ b/docker/devenv/docker-compose.main.yml @@ -98,8 +98,14 @@ services: # Agentic devenv: set to a PyPI release version/tag to update Serena on startup, # leave empty to skip update and use the version baked into the image. - - SERENA_UPDATE_VERSION= + - SERENA_UPDATE_VERSION=2.1.0 - SHADOW_SERVER_URL=${SHADOW_SERVER_URL} + # Frontend dev devenv switch: makes the frontend compile with + # PENPOT_DEVENV=true so the admin-console is disabled by default + # (app.config/devenv-mode). `enable-admin-console` in config.js + # re-enables it. + - PENPOT_DEVENV=true + networks: - default diff --git a/docker/devenv/files/nginx.conf b/docker/devenv/files/nginx.conf index 5a0a81f091..9a3cfd3222 100644 --- a/docker/devenv/files/nginx.conf +++ b/docker/devenv/files/nginx.conf @@ -141,6 +141,11 @@ http { proxy_pass http://127.0.0.1:6061; } + location = /.well-known/oauth-authorization-server/api/mcp/oauth { + proxy_pass http://127.0.0.1:6060; + proxy_http_version 1.1; + } + location /api { proxy_pass http://127.0.0.1:6060/api; proxy_http_version 1.1; diff --git a/docker/devenv/files/tmux.conf b/docker/devenv/files/tmux.conf index 062c1622c7..349aa43fc7 100644 --- a/docker/devenv/files/tmux.conf +++ b/docker/devenv/files/tmux.conf @@ -6,5 +6,8 @@ set -g mouse off set -g history-limit 50000 setw -g mode-keys emacs +set -g set-clipboard on +set -g allow-passthrough on + bind-key -r C-n resize-pane -U bind-key -r C-m resize-pane -D diff --git a/docker/gitpod/Dockerfile b/docker/gitpod/Dockerfile deleted file mode 100644 index 30ec7da8fe..0000000000 --- a/docker/gitpod/Dockerfile +++ /dev/null @@ -1,122 +0,0 @@ -FROM gitpod/workspace-postgres - -# Install custom tools, runtimes, etc. -# For example "bastet", a command-line tetris clone: -# RUN brew install bastet -# -# More information: https://www.gitpod.io/docs/config-docker/ - -RUN set -ex; \ - brew install redis; \ - brew install imagemagick; \ - brew install ghostscript; \ - brew install mailhog; \ - brew install openldap; \ - brew install poppler; \ - sudo mkdir -p /var/log/nginx; \ - sudo chown gitpod:gitpod /var/log/nginx - -COPY files/nginx.conf /etc/nginx/nginx.conf -COPY files/nginx-mime.types /etc/nginx/mime.types - -USER root - -ENV NODE_VERSION=v16.17.0 \ - CLOJURE_VERSION=1.11.1.1165 \ - CLJKONDO_VERSION=2022.09.08 \ - BABASHKA_VERSION=0.9.162 \ - LANG=en_US.UTF-8 \ - LC_ALL=en_US.UTF-8 - -RUN set -ex; \ - useradd -m -g users -s /bin/bash penpot; \ - passwd penpot -d; \ - echo "penpot ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -RUN set -ex; \ - apt-get -qq update; \ - apt-get -qqy install \ - gconf-service \ - libasound2 \ - libatk1.0-0 \ - libatk-bridge2.0-0 \ - libcairo2 \ - libcups2 \ - libdbus-1-3 \ - libexpat1 \ - libfontconfig1 \ - libgcc1 \ - libgconf-2-4 \ - libgdk-pixbuf2.0-0 \ - libglib2.0-0 \ - libgtk-3-0 \ - libnspr4 \ - libpango-1.0-0 \ - libpangocairo-1.0-0 \ - libx11-6 \ - libx11-xcb1 \ - libxcb1 \ - libxcomposite1 \ - libxcursor1 \ - libxdamage1 \ - libxext6 \ - libxfixes3 \ - libxi6 \ - libxrandr2 \ - libxrender1 \ - libxshmfence1 \ - libxss1 \ - libxtst6 \ - fonts-liberation \ - libappindicator1 \ - libnss3 \ - libgbm1 \ - ; \ - rm -rf /var/lib/apt/lists/*; - -RUN set -ex; \ - curl -LfsSo /tmp/openjdk.tar.gz https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16%2B36/OpenJDK16-jdk_x64_linux_hotspot_16_36.tar.gz; \ - mkdir -p /usr/lib/jvm/openjdk16; \ - cd /usr/lib/jvm/openjdk16; \ - tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ - rm -rf /tmp/openjdk.tar.gz; - -# Install clojure cli -RUN set -ex; \ - curl -LfsSo /tmp/clojure.sh https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh; \ - chmod +x /tmp/clojure.sh; \ - /tmp/clojure.sh; \ - rm -rf /tmp/clojure.sh; - -# Install clj-kondo -RUN set -ex; \ - curl -LfsSo /tmp/clj-kondo.zip https://github.com/borkdude/clj-kondo/releases/download/v$CLJKONDO_VERSION/clj-kondo-$CLJKONDO_VERSION-linux-amd64.zip; \ - cd /usr/local/bin; \ - unzip /tmp/clj-kondo.zip; \ - rm /tmp/clj-kondo.zip; - -# Install babashka -RUN set -ex; \ - cd /tmp; \ - curl -LfsSo /tmp/babashka.tar.gz https://github.com/babashka/babashka/releases/download/v$BABASHKA_VERSION/babashka-$BABASHKA_VERSION-linux-amd64.tar.gz; \ - cd /usr/local/bin; \ - tar -xf /tmp/babashka.tar.gz; \ - rm -rf /tmp/babashka.tar.gz; - -USER gitpod - -ENV PATH="/usr/lib/jvm/openjdk16/bin:/usr/local/nodejs/bin:$PATH" \ - JAVA_HOME=/usr/lib/jvm/openjdk16 \ - PENPOT_SMTP_ENABLED=true \ - PENPOT_SMTP_HOST=localhost \ - PENPOT_SMTP_PORT=1025 \ - PENPOT_SMTP_USER= \ - PENPOT_SMTP_PASSWORD= \ - PENPOT_SMTP_SSL=false \ - PENPOT_SMTP_TLS=false \ - PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com \ - PENPOT_SMTP_DEFAULT_FROM=no-reply@example.com \ - PENPOT_DATABASE_URI="postgresql://localhost/penpot" \ - PENPOT_REDIS_URI="redis://localhost/0" - -# TODO Retrieve OpenLDAP from rroemhild/docker-test-openldap diff --git a/docker/gitpod/files/nginx-mime.types b/docker/gitpod/files/nginx-mime.types deleted file mode 100644 index 91f6aba0ac..0000000000 --- a/docker/gitpod/files/nginx-mime.types +++ /dev/null @@ -1,100 +0,0 @@ - -types { - text/html html htm shtml; - text/css css; - text/xml xml; - image/gif gif; - image/jpeg jpeg jpg; - application/javascript js; - application/javascript mjs; - application/atom+xml atom; - application/rss+xml rss; - - text/mathml mml; - text/plain txt; - text/vnd.sun.j2me.app-descriptor jad; - text/vnd.wap.wml wml; - text/x-component htc; - - image/avif avif; - image/png png; - image/svg+xml svg svgz; - image/tiff tif tiff; - image/vnd.wap.wbmp wbmp; - image/webp webp; - image/x-icon ico; - image/x-jng jng; - image/x-ms-bmp bmp; - - font/woff woff; - font/woff2 woff2; - - application/java-archive jar war ear; - application/json json; - application/mac-binhex40 hqx; - application/msword doc; - application/pdf pdf; - application/postscript ps eps ai; - application/rtf rtf; - application/vnd.apple.mpegurl m3u8; - application/vnd.google-earth.kml+xml kml; - application/vnd.google-earth.kmz kmz; - application/vnd.ms-excel xls; - application/vnd.ms-fontobject eot; - application/vnd.ms-powerpoint ppt; - application/vnd.oasis.opendocument.graphics odg; - application/vnd.oasis.opendocument.presentation odp; - application/vnd.oasis.opendocument.spreadsheet ods; - application/vnd.oasis.opendocument.text odt; - application/vnd.openxmlformats-officedocument.presentationml.presentation - pptx; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - xlsx; - application/vnd.openxmlformats-officedocument.wordprocessingml.document - docx; - application/vnd.wap.wmlc wmlc; - application/wasm wasm; - application/x-7z-compressed 7z; - application/x-cocoa cco; - application/x-java-archive-diff jardiff; - application/x-java-jnlp-file jnlp; - application/x-makeself run; - application/x-perl pl pm; - application/x-pilot prc pdb; - application/x-rar-compressed rar; - application/x-redhat-package-manager rpm; - application/x-sea sea; - application/x-shockwave-flash swf; - application/x-stuffit sit; - application/x-tcl tcl tk; - application/x-x509-ca-cert der pem crt; - application/x-xpinstall xpi; - application/xhtml+xml xhtml; - application/xspf+xml xspf; - application/zip zip; - - application/octet-stream bin exe dll; - application/octet-stream deb; - application/octet-stream dmg; - application/octet-stream iso img; - application/octet-stream msi msp msm; - - audio/midi mid midi kar; - audio/mpeg mp3; - audio/ogg ogg; - audio/x-m4a m4a; - audio/x-realaudio ra; - - video/3gpp 3gpp 3gp; - video/mp2t ts; - video/mp4 mp4; - video/mpeg mpeg mpg; - video/quicktime mov; - video/webm webm; - video/x-flv flv; - video/x-m4v m4v; - video/x-mng mng; - video/x-ms-asf asx asf; - video/x-ms-wmv wmv; - video/x-msvideo avi; -} diff --git a/docker/gitpod/files/nginx.conf b/docker/gitpod/files/nginx.conf deleted file mode 100644 index ca403adfd2..0000000000 --- a/docker/gitpod/files/nginx.conf +++ /dev/null @@ -1,145 +0,0 @@ -# This Nginx config file is optional. -# If you don't have this file, the Nginx config from the workspace-full docker image will be taken. - -worker_processes auto; -pid /var/run/nginx/nginx.pid; -include /etc/nginx/modules-enabled/*.conf; - -env GITPOD_REPO_ROOT; - -events { - worker_connections 768; - # multi_accept on; -} - -http { - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - # server_tokens off; - - # server_names_hash_bucket_size 64; - # server_name_in_redirect off; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - gzip on; - - gzip_vary on; - gzip_proxied any; - gzip_comp_level 3; - gzip_buffers 16 8k; - gzip_http_version 1.1; - - gzip_types text/plain text/css text/javascript application/javascript application/json application/transit+json; - - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - - # include /etc/nginx/sites-enabled/*; - - server { - set_by_lua $gitpod_repo_root 'return os.getenv("GITPOD_REPO_ROOT")'; - - listen 0.0.0.0:3449 default_server; - server_name _; - - client_max_body_size 5M; - charset utf-8; - - proxy_http_version 1.1; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Scheme $scheme; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - resolver 8.8.8.8; - - etag off; - - root $gitpod_repo_root/frontend/resources/public; - - location @handle_redirect { - set $redirect_uri "$upstream_http_location"; - set $redirect_host "$upstream_http_x_host"; - set $redirect_cache_control "$upstream_http_cache_control"; - - proxy_buffering off; - - proxy_set_header Host "$redirect_host"; - proxy_hide_header etag; - proxy_hide_header x-amz-id-2; - proxy_hide_header x-amz-request-id; - proxy_hide_header x-amz-meta-server-side-encryption; - proxy_hide_header x-amz-server-side-encryption; - proxy_pass $redirect_uri; - - add_header x-internal-redirect "$redirect_uri"; - add_header x-cache-control "$redirect_cache_control"; - add_header cache-control "$redirect_cache_control"; - } - - location /assets { - proxy_pass http://127.0.0.1:6060/assets; - recursive_error_pages on; - proxy_intercept_errors on; - error_page 301 302 307 = @handle_redirect; - } - - location /internal/assets { - internal; - alias $gitpod_repo_root/backend/assets; - add_header x-internal-redirect "$upstream_http_x_accel_redirect"; - } - - location /api { - proxy_pass http://127.0.0.1:6060/api; - } - - location /webhooks { - proxy_pass http://127.0.0.1:6060/webhooks; - } - - location /dbg { - proxy_pass http://127.0.0.1:6060/dbg; - } - - location /export { - proxy_pass http://127.0.0.1:6061; - } - - location /playground { - alias $gitpod_repo_root/experiments/; - add_header Cache-Control "no-cache, max-age=0"; - autoindex on; - } - - location /ws/notifications { - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_pass http://127.0.0.1:6060/ws/notifications; - } - - location / { - add_header Cache-Control "no-cache, max-age=0"; - - location ~ ^/(/|css|fonts|images|js|wasm) { - } - - location ~ ^/[^/]+/(.*)$ { - return 301 " /404"; - } - - try_files $uri /index.html$is_args$args =404; - } - } -} diff --git a/docker/gitpod/files/postgresql_init.sql b/docker/gitpod/files/postgresql_init.sql deleted file mode 100644 index 1766a643d2..0000000000 --- a/docker/gitpod/files/postgresql_init.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE DATABASE penpot; -CREATE USER penpot PASSWORD 'penpot'; -ALTER ROLE penpot SUPERUSER; diff --git a/docker/images/Dockerfile.backend b/docker/images/Dockerfile.backend index 3edb969257..c2f4c5e6b7 100644 --- a/docker/images/Dockerfile.backend +++ b/docker/images/Dockerfile.backend @@ -1,4 +1,4 @@ -FROM dhi.io/debian-base:trixie-debian13-dev@sha256:af61a3296b0c92f16969f11ce8c2a93722e84c9e5c1bb42ed6afec796be71b04 AS build +FROM dhi.io/debian-base:trixie-debian13-dev@sha256:f90fd43cdf3dd94840b4dc3a2a39fd2a08578e40e7895535e2e20a1275ba6013 AS build LABEL maintainer="Penpot " ENV LANG='C.UTF-8' \ @@ -27,12 +27,12 @@ RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \ aarch64|arm64) \ - ESUM='8ff07320636ef5b30f0d7e16687932df52255c3ef3ffd920a6aae3723511ce7f'; \ - BINARY_URL='https://cdn.azul.com/zulu/bin/zulu26.32.203-ca-jdk26.0.2.1-linux_aarch64.tar.gz'; \ + ESUM='18875b92ad2535230a13175f718933f7cc0593b4affa2dab442815ec245dacbb'; \ + BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_aarch64.tar.gz'; \ ;; \ amd64|x86_64) \ - ESUM='c6b810ca659e3293205444f47ac4af163396fd6d025c51fd5f767e628b2ceede'; \ - BINARY_URL='https://cdn.azul.com/zulu/bin/zulu26.32.203-ca-jdk26.0.2.1-linux_x64.tar.gz'; \ + ESUM='c4d7bf4c80a21e935187ecdcb111e4b2f14e1fdd18364974fe7f7da54b12bea0'; \ + BINARY_URL='https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_x64.tar.gz'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ @@ -53,7 +53,7 @@ RUN set -eux; \ --output /opt/jre; -FROM dhi.io/debian-base:trixie-debian13-dev@sha256:af61a3296b0c92f16969f11ce8c2a93722e84c9e5c1bb42ed6afec796be71b04 AS image +FROM dhi.io/debian-base:trixie-debian13-dev@sha256:f90fd43cdf3dd94840b4dc3a2a39fd2a08578e40e7895535e2e20a1275ba6013 AS image LABEL maintainer="Penpot " ENV LANG='C.UTF-8' \ diff --git a/docker/images/Dockerfile.exporter b/docker/images/Dockerfile.exporter index bb6fa216da..3d3b97b3de 100644 --- a/docker/images/Dockerfile.exporter +++ b/docker/images/Dockerfile.exporter @@ -1,4 +1,4 @@ -FROM dhi.io/node:24.22.2-debian13-dev@sha256:df819cfcb0de8a9e461bb8437d96d6fcfac341e565129e50597338756a88db5b +FROM dhi.io/node:24.22.3-debian13-dev@sha256:dee4bb11f4cb32ad31000287af8795f772ac801338a166a0e9fbbadd9674a2f8 LABEL maintainer="Penpot " ENV LANG=en_US.UTF-8 \ @@ -17,6 +17,7 @@ RUN set -ex; \ locales \ ca-certificates \ gzip \ + tini \ ; \ apt-get clean; \ rm -rf /var/lib/apt/lists/*; \ @@ -95,17 +96,17 @@ WORKDIR /opt/penpot/exporter # pnpm ships as a system binary (same tarball + SHA pin as # docker/devenv/Dockerfile); the generated ./setup expects it on PATH. # Corepack is gone from Node 25+, so nothing here may use it. -ARG PNPM_VERSION=12.16.1 +ARG PNPM_VERSION=12.21.0 RUN set -eux; \ ARCH="$(dpkg --print-architecture)"; \ case "${ARCH}" in \ aarch64|arm64) \ PNPM_ARCH='arm64'; \ - PNPM_SHA256='f5847699e5d528f8f8e9bcfb385e58cb9fba7482af1b1aa7b70737be42277f81'; \ + PNPM_SHA256='6c5913a48c93b3a556b71c3bd9bf12c6bf9fbfbbbd2dcbd1d52a85c539751b9e'; \ ;; \ amd64|x86_64) \ PNPM_ARCH='x64'; \ - PNPM_SHA256='565ff81174a14f6f7bd5d84c1b17e51031a80230d370a1fe24be5d16bd02a825'; \ + PNPM_SHA256='84c4773bcf4a217f4083cd7b2a91e4cee6103cf42426c1282ef37d308f55a410'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ @@ -126,4 +127,5 @@ RUN ./setup && chown -R penpot:penpot /opt/penpot/exporter USER penpot:penpot +ENTRYPOINT ["/usr/bin/tini", "-s", "--"] CMD ["node", "app.js"] diff --git a/docker/images/Dockerfile.frontend b/docker/images/Dockerfile.frontend index aba52d5bcc..1be6ee9680 100644 --- a/docker/images/Dockerfile.frontend +++ b/docker/images/Dockerfile.frontend @@ -1,4 +1,4 @@ -FROM dhi.io/nginx:1.31.8-debian13-dev@sha256:f69a0ea1762c51080fe96ce5f12103fb2977231308ae1784acd915bf63a0a1a2 +FROM dhi.io/nginx:1.31.8-debian13-dev@sha256:5f75855fe078ae96027706da06716fbe1c3dbb618fc603e61894e1b41adc56d7 LABEL maintainer="Penpot " ENV DEBIAN_FRONTEND=noninteractive diff --git a/docker/images/Dockerfile.mcp b/docker/images/Dockerfile.mcp index 4054a613b0..7d2d5987cf 100644 --- a/docker/images/Dockerfile.mcp +++ b/docker/images/Dockerfile.mcp @@ -1,4 +1,4 @@ -FROM dhi.io/node:24.22.2-debian13-dev@sha256:df819cfcb0de8a9e461bb8437d96d6fcfac341e565129e50597338756a88db5b AS build +FROM dhi.io/node:24.22.3-debian13-dev@sha256:dee4bb11f4cb32ad31000287af8795f772ac801338a166a0e9fbbadd9674a2f8 AS build LABEL maintainer="Penpot " ENV DEBIAN_FRONTEND=noninteractive @@ -11,7 +11,7 @@ WORKDIR /opt/penpot/mcp # pnpm ships as a system binary (same tarball + SHA pin as # docker/devenv/Dockerfile); ./setup expects it on PATH. # Corepack is gone from Node 25+, so nothing here may use it. -ARG PNPM_VERSION=12.16.1 +ARG PNPM_VERSION=12.21.0 RUN set -eux; \ apt-get -qq update; \ apt-get -qqy --no-install-recommends install curl ca-certificates gzip; \ @@ -20,11 +20,11 @@ RUN set -eux; \ case "${ARCH}" in \ aarch64|arm64) \ PNPM_ARCH='arm64'; \ - PNPM_SHA256='f5847699e5d528f8f8e9bcfb385e58cb9fba7482af1b1aa7b70737be42277f81'; \ + PNPM_SHA256='6c5913a48c93b3a556b71c3bd9bf12c6bf9fbfbbbd2dcbd1d52a85c539751b9e'; \ ;; \ amd64|x86_64) \ PNPM_ARCH='x64'; \ - PNPM_SHA256='565ff81174a14f6f7bd5d84c1b17e51031a80230d370a1fe24be5d16bd02a825'; \ + PNPM_SHA256='84c4773bcf4a217f4083cd7b2a91e4cee6103cf42426c1282ef37d308f55a410'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ @@ -42,7 +42,7 @@ RUN set -eux; \ RUN ./setup -FROM dhi.io/node:24.22.2-debian13@sha256:ce582f85254ceba6c572a854b8fb4008ced2f5d365c929f4f580360829037184 AS image +FROM dhi.io/node:24.22.3-debian13@sha256:84adaf3bdd9fa350e753078db2928a1584e481e11225d14f96014b17ffc96c5a AS image LABEL maintainer="Penpot " ENV LANG=en_US.UTF-8 \ diff --git a/docker/images/Dockerfile.media-processor b/docker/images/Dockerfile.media-processor index 218fd84ecd..f81a983399 100644 --- a/docker/images/Dockerfile.media-processor +++ b/docker/images/Dockerfile.media-processor @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM dhi.io/node:24.22.2-debian13-dev@sha256:df819cfcb0de8a9e461bb8437d96d6fcfac341e565129e50597338756a88db5b +FROM dhi.io/node:24.22.3-debian13-dev@sha256:dee4bb11f4cb32ad31000287af8795f772ac801338a166a0e9fbbadd9674a2f8 LABEL maintainer="Penpot " ENV LANG=en_US.UTF-8 \ @@ -58,7 +58,7 @@ WORKDIR /opt/penpot/media-processor # pnpm ships as a system binary (same tarball + SHA pin as # docker/devenv/Dockerfile); ./setup expects it on PATH. # Corepack is gone from Node 25+, so nothing here may use it. -ARG PNPM_VERSION=12.16.1 +ARG PNPM_VERSION=12.21.0 RUN set -eux; \ apt-get -qq update; \ apt-get -qqy --no-install-recommends install gzip; \ @@ -67,11 +67,11 @@ RUN set -eux; \ case "${ARCH}" in \ aarch64|arm64) \ PNPM_ARCH='arm64'; \ - PNPM_SHA256='f5847699e5d528f8f8e9bcfb385e58cb9fba7482af1b1aa7b70737be42277f81'; \ + PNPM_SHA256='6c5913a48c93b3a556b71c3bd9bf12c6bf9fbfbbbd2dcbd1d52a85c539751b9e'; \ ;; \ amd64|x86_64) \ PNPM_ARCH='x64'; \ - PNPM_SHA256='565ff81174a14f6f7bd5d84c1b17e51031a80230d370a1fe24be5d16bd02a825'; \ + PNPM_SHA256='84c4773bcf4a217f4083cd7b2a91e4cee6103cf42426c1282ef37d308f55a410'; \ ;; \ *) \ echo "Unsupported arch: ${ARCH}"; \ diff --git a/docker/images/Dockerfile.storybook b/docker/images/Dockerfile.storybook index bf67fabf88..25a007a82a 100644 --- a/docker/images/Dockerfile.storybook +++ b/docker/images/Dockerfile.storybook @@ -1,4 +1,4 @@ -FROM dhi.io/nginx:1.31.8-alpine3.24@sha256:7a4e9021737f414ad0f851efb939600690d9d092f51712ce6512bfd0a767ceae +FROM dhi.io/nginx:1.31.8-alpine3.24@sha256:ad079e1004e4ec4ec14dfc29612d542161a80bc4bf9735b8f6303dc45e588ce0 LABEL maintainer="Penpot " ARG BUNDLE_PATH="./bundle-storybook/" From eb7860fcd77a93e1f262beb46775abffa0e41ad7 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 18 Nov 2026 13:04:55 +0100 Subject: [PATCH 5/5] :bug: 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 --- .../main/data/workspace/notifications.cljs | 2 +- .../ui/workspace/file_restored_modal.cljs | 6 ++++-- .../data/workspace_notifications_test.cljs | 2 +- .../ui/file_restored_modal_test.cljs | 20 ++++++++++++++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/data/workspace/notifications.cljs b/frontend/src/app/main/data/workspace/notifications.cljs index 459e4e70b9..480c8c9d55 100644 --- a/frontend/src/app/main/data/workspace/notifications.cljs +++ b/frontend/src/app/main/data/workspace/notifications.cljs @@ -359,7 +359,7 @@ (modal/show :file-restored {:fullname (restorer-fullname state profile-id session-id) :label label - :created-at created-at + :date created-at ;; Made on the replaced version, so the reload drops them :unsaved (boolean (seq (dps/pending-file-changes state file)))})) (rx/empty)))))) diff --git a/frontend/src/app/main/ui/workspace/file_restored_modal.cljs b/frontend/src/app/main/ui/workspace/file_restored_modal.cljs index badadb4957..c4aee1305f 100644 --- a/frontend/src/app/main/ui/workspace/file_restored_modal.cljs +++ b/frontend/src/app/main/ui/workspace/file_restored_modal.cljs @@ -36,7 +36,9 @@ which was reloaded, and whether their edits not saved yet were lost." {::mf/register modal/components ::mf/register-as :file-restored} - [{:keys [fullname label created-at unsaved]}] + ;; The modal wrapper passes the props map without camelCasing its keys, + ;; so every prop of this component must be a one-word name. + [{:keys [fullname label date unsaved]}] (let [on-close (mf/use-fn #(st/emit! (modal/hide)))] [:div {:class (stl/css :modal-overlay)} [:div {:class (stl/css :modal-dialog) @@ -49,7 +51,7 @@ :class (stl/css :modal-title)} (tr "workspace.file-restored.title")] [:> text* {:as "p" :typography t/body-large} - (restored-message fullname label created-at)] + (restored-message fullname label date)] (when unsaved [:> text* {:as "p" :typography t/body-large} (tr "workspace.file-restored.unsaved-changes")]) diff --git a/frontend/test/frontend_tests/data/workspace_notifications_test.cljs b/frontend/test/frontend_tests/data/workspace_notifications_test.cljs index 0ad8a12697..c6b4d721b4 100644 --- a/frontend/test/frontend_tests/data/workspace_notifications_test.cljs +++ b/frontend/test/frontend_tests/data/workspace_notifications_test.cljs @@ -140,7 +140,7 @@ props (:props (shown-modal events))] (t/is (= "Ada" (:fullname props))) (t/is (= "Hand-off v2" (:label props))) - (t/is (= created-at (:created-at props))) + (t/is (= created-at (:date props))) (t/is (true? (:unsaved props))))) ;; Scenario: the restoring session left before its message arrived, so it diff --git a/frontend/test/frontend_tests/ui/file_restored_modal_test.cljs b/frontend/test/frontend_tests/ui/file_restored_modal_test.cljs index 169baa4573..983f88ab39 100644 --- a/frontend/test/frontend_tests/ui/file_restored_modal_test.cljs +++ b/frontend/test/frontend_tests/ui/file_restored_modal_test.cljs @@ -6,10 +6,14 @@ (ns frontend-tests.ui.file-restored-modal-test (:require + ["react-dom/server" :as rds] [app.common.time :as ct] + [app.main.data.modal :as modal] [app.main.ui.workspace.file-restored-modal :as frm] [app.util.i18n :as i18n] - [cljs.test :as t :include-macros true])) + [cljs.test :as t :include-macros true] + [cuerdas.core :as str] + [rumext.v2 :as mf])) (defn- message "The translation key and arguments of the restore message." @@ -32,3 +36,17 @@ (message "Ada" nil nil))) (t/is (= ["workspace.file-restored.message-anonymous"] (message nil nil nil))))) + +(defn- render-modal + "Markup of the registered `:file-restored` modal for the `props` map, + rendered the way the modal wrapper does it (`mf/element` with the map)." + [props] + (with-redefs [i18n/tr (fn ([key] key) ([key & args] (str/join "|" (into [key] args))))] + (rds/renderToStaticMarkup + (mf/element (get @modal/components :file-restored) props)))) + +(t/deftest the-modal-shows-the-date-of-an-unnamed-version + (let [created-at (ct/now) + markup (render-modal {:fullname "Ada" :date created-at :unsaved false})] + (t/is (str/includes? markup (str "workspace.file-restored.message-date|Ada|" + (ct/format-inst created-at "PPp"))))))