mirror of
https://github.com/penpot/penpot.git
synced 2026-11-24 19:50:37 +00:00
9 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e6eb8bcd5a
|
✨ Add pgjdbc prepared statement cache settings (#13099)
* ✨ Add pgjdbc prepared statement cache settings Expose pgjdbc's server-side prepared statement cache as three optional backend variables: PENPOT_DATABASE_PREPARE_THRESHOLD, PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_QUERIES and PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_SIZE (bytes, converted to whole MiB for the driver, rounding up). When unset, the driver defaults apply (5 executions, 256 entries, 5 MiB), so the behavior is unchanged. The values reach Hikari as dataSourceProperties strings, because pgjdbc only reads String values; flushCacheOnDdl stays at its default. Closes #13092 AI-assisted-by: inkling-2-small-free * ♻️ Sync the pool options schema with the code The integrant pool options schema validated a ::connect-timeout option that nothing reads, while the keys the code consumes (::connection-timeout, ::idle-timeout, ::max-lifetime) were missing from it. The schema now declares the three, matching the code and the defaults map. The removed key was not referenced anywhere else. Follow-up to #13092. AI-assisted-by: inkling-2-small-free * ♻️ Rename the prepared statement cache threshold setting Keep the three knobs under one name in the configuration: PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_THRESHOLD PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_QUERIES PENPOT_DATABASE_PREPARED_STATEMENT_CACHE_SIZE The old PENPOT_DATABASE_PREPARE_THRESHOLD read as a verb and was the only one of the three that did not name the prepared statement cache. Fix the documentation of the values: 0 in either cache value disables the cache, not only the size, and -1 prepares a statement from its first execution and forces binary transfer, which is what pgjdbc does. Cover the -1 threshold end to end: it already decoded and validated, but nothing proved that it reaches the driver. The tests also pin 0, so a falsy check cannot silently drop it. Closes #13092 AI-assisted-by: deepseek-v4.1-flash * ♻️ Fix the prepared statement cache contracts The threshold schema accepted any integer, but the driver clamps every negative to -1 and turns on binary transfer, so a typo like -10 changed the wire protocol instead of failing at boot. Both schemas now declare {:min -1}: -1 and the non-negatives stay valid. The tests compared our own dataSourceProperties literals with our own literals, which cannot catch the failure the feature fears (a property the driver ignores). They now read the threshold back from a real connection: 5 with no options, 1 and 0 when configured. The size ceiling is covered one byte over a MiB, and queries=0 too. The docs, the app.db comment and the memory described the threshold 0 as disabling the cache. It does not: 0 stops the server-side prepared statements while the driver's cache of parsed queries stays in use, bounded by the other two values. The same texts lost the pg_prepared_statements pointer (the view only lists the session that runs the query) together with the flushCacheOnDdl and PgBouncer sentences, and the section now carries its version marker. Closes #13092 AI-assisted-by: deepseek-v4.1-flash * 💄 Format the prepared statement cache pool test The continuation arguments of the two with-connection calls were aligned under the options map instead of two spaces past the form, which cljfmt rejects. Local verification missed it because `./scripts/ci backend --test` runs the tests only: lint and format are separate tasks, so the pre-push check is the whole `./scripts/ci backend` or an explicit --lint/--fmt. AI-assisted-by: deepseek-v4.1-flash * ♻️ Address the review of the prepared statement cache The pool startup line shows the three values, so the configured cache is visible without reading the environment back; a nil means the driver default. bytes->mib-ceil uses Math/ceilDiv: the same rounding in one expression, and the size schema already rejects negatives. The cache-limit tests count a closed statement in pg_prepared_statements instead of comparing the property literals. A closed statement stays prepared in the server only while the driver's cache holds it, which is what tells an accepted property from an effective one; the positive case keeps the cache enabled with a sub-MiB size. The config test drops the groups that only exercised the decoder and keeps the ones that pin the accepted range. The manual and the memory note that a query parameter of the same name in PENPOT_DATABASE_URI wins over the variable: pgjdbc ignores the Properties value when the URL carries it. AI-assisted-by: deepseek-v4.1-flash AI-assisted-by: claude-opus-5-5 |
||
|
|
114ce6ec03
|
✨ Make legacy-db file data read-only (#13102)
legacy-db is no longer a write backend: fdata/upsert! rejects it (:legacy-backend-read-only), handle-persistence stops writing file.data and file_change.data, and the update-params schema of fdata no longer accepts it. Reading old payloads keeps working, and the file-data-backend default stays db. The configuration guide, the backend config (a startup warning reads PENPOT_FILE_DATA_BACKEND=legacy-db as db instead of failing every save) and the storage memories say so, with the upgrade note for deployments that still set the variable. AI-assisted-by: deepseek-v4.1-flash AI-assisted-by: inkling-2-small-free |
||
|
|
9d898b8b31
|
🔧 Normalize the tenant to lowercase (#12843)
An operator writing `PENPOT_TENANT=ACME` and one writing `acme` name the same tenant: the value is compared as an exact string in the keys and rows it lands in, and one uppercase letter would otherwise split one tenant into two. The value is normalized when the configuration is read, so nothing downstream has to care about case, and the validated form accepts only lowercase labels from then on. AI-assisted-by: deepseek-v4.1-flash |
||
|
|
9abcfebf60
|
✨ Run binfile import and export as durable jobs (#12056)
* ✨ Run binfile import and export as durable jobs Import and export of `.penpot` files become durable jobs: two commands create them and answer at once with a job id the caller follows, while a worker of the `binfile` queue does the work. Each job keeps its own ledger (owner, params frozen at creation, result, progress history and an expiry), and the legacy commands and their SSE keep working. Why: both operations ran inside the request. A large import held it open for minutes, progress only existed while the caller kept the stream open, and a client that went away left work nobody recorded, retried or could cancel. The unified `job` substrate already dispatched, leased, retried and logged events, but it had no user-facing ledger. How: - The substrate gains the pieces a user-facing job needs: optional job-def metadata (family, resource-role), an expiry on submit, the owner in the runner context, and job resources in their own bucket, written with the profile of the job and never deduplicated. - One generic command per family: the caller names the job and sends its business params, the registry checks the family, the job-def decodes and validates, and permission and quota are checked first. - Progress taps of the core become milestones of the job: a shared stage vocabulary with self-contained counters, throttled heartbeats, and an interrupt that stops the run inside its own transaction on cancel. - Cancel reaches pending and running jobs from both modals, and closing a modal mid-run cancels the job it was following. - The export re-checks the read permission at run time and answers with the package descriptor; the import re-checks the edition permission, runs the core in a transaction so a cancellation rolls it back, and releases the consumed package and its temporary copy. AI-assisted-by: deepseek-v4.1-flash * ♻️ Handle externally-cancelled binfile jobs end to end The `cancelled` outcome of a job nobody followed no longer hangs its screens: the data layers emit an explicit terminal message for it. - The export emits `{:cancelled true}` per file and the modal paints a neutral cancelled row instead of success; a message without an artifact never reaches the download branch. - The import closes every entry with a dedicated cancelled message through the existing error rendering, so the wizard completes. - Both flows are pinned by data-layer tests, including the red state they replace. Also in this change: the progress-contract comment of the management API, early business-params validation in create-import-job (before assembling the upload), a `release-resource` helper without fabricated job ids, a note on the heartbeat write cost, and a memory cleanup. AI-assisted-by: muse-spark-1.3-contributor * ♻️ Pre-translate the cancelled import message The cancelled entry of the import wizard carried its message as a key for the UI to translate, which needed a rehash marker comment. Like its neighboring errors, it now translates eagerly in the data layer: the literal call keeps rehash clean with no marker, and the tests assert through the same call instead of the raw key. AI-assisted-by: muse-spark-1.3-contributor * ♻️ Move cancelled strings under generic labels keys The dashboard-specific cancelled key never shipped: before use it moves under `labels.*` next to the generic strings both flows already use, with Spanish translations following the established wording. AI-assisted-by: muse-spark-1.3-contributor * ✨ Add minor improvements * ♻️ Rename export job command to create-export-binfile-job Export now has one command per job type, the shape the :export-assets command needs: create-export-binfile-job freezes exactly the :export-binfile job, so :name no longer travels in the body and only :params does. Import keeps the generic envelope. submit-job reads the queue from the job-def metadata ::jobs/queue-name (falling back to :binfile), read by the command and never by the substrate, so a job-def can route its work to another queue without a change in the command. The rename reaches the frontend and the tests: the binfile export is asked for under its own name, and the exporter service keeps create-export-job. AI-assisted-by: deepseek-v4.1-flash * ✨ Polish the import and export status rows The status row of a file already carries what the file is doing, so the generic "Uploading file…"/"Downloading file…" lines are gone: the import wizard drops its own (the export one went with the jobs refactor), along with the now-unused style. In the export, every file is queued up front, even the ones whose job is created only after the previous one is over, and a file stays queued until its first milestone: a worker picking the job up no longer ends the queue. The queued text is a step smaller than the milestone. AI-assisted-by: deepseek-v4.1-flash * 🐛 Show the cancelled export and fix the import error The cancelled export was unreachable: mark-file-cancelled sets :loading false and the label lived inside the loading branch, so a cancelled file only painted a neutral notification. The terminal state now carries the label, and the export flags lose the `?` suffix (predicates keep it; a data prop is not a question). The import wizard rendered (:error entry) through tr, but every producer writes user-facing text (a hint or a translated label), never a key: it renders the text as-is now, and the dynamic-key ignores and the stale comment are gone. The total-text-limit comment no longer references the 200MiB it replaced; the value is 500MiB in develop already. AI-assisted-by: deepseek-v4.1-flash * ♻️ Reflect the real job params in the creation commands The creation commands declared their params as an open empty map, so the RPC contract and the generated docs said nothing about them. Each command now imports the schema from the job namespace (`export-binfile/schema:params`, `import-binfile/schema:create-params`), and the RPC validates the business params before the command runs. The job-def still owns the params and re-validates the assembled ones at run time. The commands no longer decode the params again: the RPC did it. Import joins export as one command per job type: `create-import-job` becomes `create-import-binfile-job`, its body no longer carries `:name` and the job-def is resolved by name like export's. Its creation schema keeps the version optional, because the command reads it from the package header when the caller does not say it, and fills the manifest metadata kept for audit. A version out of range is now refused by the schema (`:params-validation`) instead of the command's own `:unsupported-version` check, which is gone. AI-assisted-by: deepseek-v4.1-flash * 🐛 Stop the test system from running job runners The test system is main/system-config plus main/worker-config with a few components dissoc'ed. The runners of default, webhook and cron were listed by hand; the binfile runner added with the durable binfile jobs was not, so a real penpot/job-runner/binfile/0 thread ran during the whole suite. That runner races the tests that drive the loop by hand (run-batch plus run-worker-loop): it takes the job the test just dispatched and completes it, and the test then reads a state it did not produce. That is the reported flake of binfile-jobs-integration-test, whose middle assertion waits for a runner of another queue to not take the job. It only reproduced in CI: in the devenv PENPOT_TENANT makes the tenant baked into main/worker-config differ from the one the test builds, so the two used different queue keys locally. Drop every [<profile> :app.worker/runner] by key shape instead of listing the known queues, so a new queue cannot bring the race back. AI-assisted-by: deepseek-v4.1-flash * ✨ Upload the package one chunk at a time and as a percentage The upload milestone counts chunks, not units of work, so the row wrote "Uploading the package 3/9" over a file the user had uploaded once: it read as if nine packages were on their way. Write the stage as a percentage of the file instead ("Uploading file… (33%)"), and make the English text of the stage say file, not package. The chunks also go one at a time now (concat-all instead of merge-all with two in flight), so the percentage moves in a straight line instead of jumping. upload-blob-chunked is the generic uploader, so media and font uploads become sequential too. AI-assisted-by: deepseek-v4.1-flash * 🌐 Complete the Spanish catalogue es.po was 25 keys short of en.po: the 15 that the durable binfile jobs introduced (14 jobs.progress.stage.* and labels.queued) plus 10 gaps that predate them (errors.connection-error, errors.save-retrying, the find shortcuts, workspace.header.retrying, workspace.tokens.stroke-width and the mcp session labels). sync -l es then sorts the entries, syncs the #: comments from en and drops the 7 dashboard.import.progress.* keys en no longer has. The msgid sets of en and es are now identical (0 missing, 0 extra). AI-assisted-by: deepseek-v4.1-flash * ♻️ Move the job status keys into the jobs namespace The three status words the durable import and export rows render were filed under labels.*, next to the generic labels bucket, while their progress stages live under jobs.progress.stage.*: the strings of one feature sat in two places. Rename them so the whole job vocabulary is one namespace: labels.queued -> jobs.queued labels.export-cancelled -> jobs.export-cancelled labels.import-cancelled -> jobs.import-cancelled No other locale has these keys yet, so the rename costs no translation. The convention (a key names the feature that renders it; labels.* holds the generic reusable words) is written down in the frontend/translations memory. AI-assisted-by: deepseek-v4.1-flash * 🔥 Remove the translation keys nothing references Six keys of en.po (and of es.po, which now mirrors it) have no (tr ...) call site left in frontend/src or common/src, and no literal reference either: labels.uploading-file a duplicate of jobs.progress.stage.upload since the upload stage says "Uploading file…" labels.downloading-file dead since the durable jobs replaced the old import and export progress rows inspect.attributes.stroke.alignment.center inspect.attributes.stroke.alignment.inner inspect.attributes.stroke.alignment.outer workspace.toolbar.mcp-connect-here The first two are leftovers of the durable binfile jobs, the other four predate them. Both catalogues keep an identical msgid set afterwards. AI-assisted-by: deepseek-v4.1-flash |
||
|
|
a9bf53adbf
|
Revert "🐛 Preserve path segments when joining backend URIs (#12152)" (#12156)
This reverts commit 2a6e92a7d9a5520365276f7b9a6ae59d478159ee. |
||
|
|
2a6e92a7d9
|
🐛 Preserve path segments when joining backend URIs (#12152) | ||
|
|
d3ca9a0b83
|
✨ Add unified jobs substrate replacing legacy one-shot task system (#11542)
* 🎉 Move backend jobs to the unified job table substrate Replace the generic 'task' table with a unified 'job' table as the durable substrate for all backend jobs, and migrate every producer and consumer to it. The legacy 'task' table stops receiving writes but stays dormant (still cleaned by tasks-gc); upload-session chunking and the other post-branch upstream changes are preserved. New 0154 migration creates the 'job' table: dispatch and lifecycle columns (name, queue, priority, scheduled_at, retries, status, timestamps, props) plus optional user-facing ledger columns (profile_id, target, progress, error, result, resource_id, expires_at). No modified_at trigger: the application updates it on every write for lease and orphan detection. Partial indexes cover the dispatcher claim query, orphan scanning, and per-profile listing. New app.jobs public API: submit!/invoke!, heartbeats and progress reporting, a precompiled job-def registry (name, schema, handler, decoder, validator), an ephemeral request/response mode, and a management API for external workers. The dispatcher claims new/retry rows (FOR UPDATE SKIP LOCKED) with a plain JSON redis payload and marks lease-expired running rows as orphaned; the runner executes per-queue with the same retry conventions. New jobs GC (daily): deletes expired rows and retains internal terminal rows per :jobs-retention, touching referenced storage objects so storage-gc-touched reclaims them. Job resources live in a dedicated job-resource bucket with a reclaim branch in storage-gc-touched. All production call-sites (sendmail, delete-object, demo-purge, file-gc, offload, webhooks, quotes, nitrate bulk delete, snapshots, telemetry) and the ten cron tasks now submit through app.jobs; cron is a pure scheduler and the legacy worker registry, task-table inserts, and per-namespace handlers are removed. Includes migrations, dispatcher, runner, jobs, request/response, jobs GC, management API, and cron test suites. AI-assisted-by: glm-5.3-flash AI-assisted-by: muse-spark-1.3-contributor AI-assisted-by: kimi-k3 AI-assisted-by: mimo-v2.5 * ✨ Address review comments on jobs substrate Resolves the four open review threads on the jobs PR. Orphaned jobs are now marked aborted, a system-side terminal state with no retry: the dispatcher sweep stores the end event with outcome aborted in a single bulk insert in the same transaction, records the terminal outcome next to the orphaned counter, and reports an error log; orphans keep alerting through the log and the counter, with no user notification. The aborted state is terminal everywhere: the status CHECK, the sweep, the lifecycle writers, the jobs GC retention, the backlog gauges and the user status mapping, with tests covering each transition. The claim comment, the 2.20 doc version and the legacy task table notes are corrected, and objects-gc heartbeats per chunk. AI-assisted-by: muse-spark-1.3-contributor |
||
|
|
69111accfe | 📎 Fix copyright owner on several files | ||
|
|
a91d81c695 | 🎉 Add link preview metadata for shared links |