mirror of
https://github.com/penpot/penpot.git
synced 2026-11-22 18:30:34 +00:00
4 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d446926202
|
🐛 Fix compile warnings in the frontend test tree (#13109)
* 🐛 Fix compile warnings in the frontend test tree The frontend test build printed 25 analyzer warnings, all of them in test namespaces: 7 :fn-arity and 18 :infer-warning. The arity ones were latent bugs. Both builds use the :esm target, where a call that crosses a namespace boundary becomes a plain JS call, so CLJS arity dispatch never runs and the missing argument arrives as undefined instead of throwing: the warning was the only signal. One `wait-for` call had no message, and five `interaction-proxy` calls still passed five arguments after the six-argument signature landed in #11621. The rest were JS property reads whose target type could not be inferred (proxies, atoms, awaited promises). A `^js` hint on the target fixes them, the convention already used under src/. Inside `set!` a form-level hint does not reach the target, so the two per-side stroke widths bind the stroke first. Test behavior is unchanged: the same 27 tests in shape-bugfixes-test keep their 63 assertions, and the full frontend suite passes (1901 tests, 7686 assertions). The memories record why `:fn-arity` cannot be ignored in this build and how to force a clean recompile before checking for warnings. AI-assisted-by: deepseek-v4.1-flash * ♻️ Split the tokens plugin tests into one test per case `tokens_test.cljs` drove five tests from `doseq` tables, one of them a nested loop over three catalogs and seventeen mutations. A failure only named the case through its `t/testing` label, and the nested one shared a single store across all fifty-one combinations. Each row is now a test of its own: twelve stroke property edits, four `tokensSource` rejections, seventeen catalog mutations (each asserting the local, source and other connected catalog), five activation changes and three token application paths, taking the namespace from 67 to 104 tests. Fixtures (`stroke-tokens-fixture`, `external-tokens-fixture`, ...) keep the arrangement in one place, and every test builds a fresh store. Two helpers return JS objects with `^js` on their names, so the test bodies stay free of interop hints. Assertions drop from 430 to 345 because the cross product no longer repeats `isEditableTokens` and `tokens-unchanged?` once per catalog and mutation; every write is still asserted against the three catalogs. `mem:testing` now says tables are for short identical bodies only; `frontend/testing` records the `defn ^js` return-tag trick. Verified: namespace 104 tests / 345 assertions, full frontend suite 1938 tests / 7601 assertions, 0 failures; test build 0 warnings; cljfmt and clj-kondo clean. AI-assisted-by: deepseek-v4.1-flash * 📎 Apply suggestion from @elenatorro Co-authored-by: Elena Torró <elenatorro@gmail.com> Signed-off-by: Andrey Antukh <niwi@niwi.nz> --------- Signed-off-by: Andrey Antukh <niwi@niwi.nz> Co-authored-by: Elena Torró <elenatorro@gmail.com> |
||
|
|
34c702bc80
|
✨ Add table partitioning for file-change (#12417)
* ✨ Partition file_change by file_id Partition `file_change` by `HASH (file_id)` in 16 partitions, with the same bounds as `file_data`, so a join between them is resolved partition by partition. The primary key becomes `(file_id, id)`, which a partitioned table needs, and every access filters by `file_id`. The new table carries a `kind` column (1 snapshot, 2 revision) as a reserve: the queries still tell them apart by the label, and `kind` takes over when they are rewritten. The payload of a snapshot stays in `file_data`; the `data` column is kept for reading old `legacy-db` payloads. The four snapshot commands require `file-id`, because it prunes the partition. The objects GC locks and deletes by the pair, in batches. The old table is kept as `file_change_legacy` as the way back. The automatic migration refuses to run above 10 GiB or 2M rows and points to the runbook; big instances partition online with that runbook, which copies by id, follows the `updated_at` watermark in delta passes and checks that no row of the source is missing from the target. Closes #12416 AI-assisted-by: deepseek-v4.1-flash * 🐛 Address the review of the file_change partition The production runbook promised a rollback it did not have: the section was a sketch, and its statements could write to the table about to be dropped. The rollback is removed, and so is every comment that described it. `file_change_legacy` stays as a frozen copy of the previous layout. The cutover check now aborts the transaction when a row of the old table is missing in the new one, instead of leaving the decision to the operator. The five secondary indexes of the new table are built after the last delta pass: the bulk and the delta passes only need the primary key, so the batches no longer maintain them. The copy of 0158 is now replayed in a test against the pre-0158 shape with a labelled and an unlabelled row, plus an empty instance that must leave no legacy table behind. The updated_at assertion of the snapshot mutations is bounded by the test clock, and the repair revision stops writing the `features` of the file, like the normal save. AI-assisted-by: deepseek-v4.1-flash * 📎 Fix linter issues * 🐛 Fix stale helper call in rpc_file_snapshot_test The suite does not load: `th/run-pending-tasks!` does not exist in backend-tests.helpers. The pending jobs runner is `run-pending-jobs` (no arguments), the name every other call site of the suite uses. AI-assisted-by: inkling-2-small-free * 📚 Align the partition change with the 2.20.0 milestone 2.19.0 is already shipped; this work targets 2.20.0. The operations file of the partition procedure carries the 2.20.0 prefix, the references that point at it (the migration, the runbook table and the memory) follow, and the RPC doc/changes tags of the snapshot commands record 2.20 as the release that makes `file-id` required. AI-assisted-by: inkling-2-small-free * 🐛 Fix review findings on the partition rebase The 0157 legacy test was missed by the rebase and inserted file_change rows without the new mandatory `kind` column, so the backend suite fails against the migrated schema. The inserts now carry `:kind` (snapshot-kind for the labelled rows, revision-kind for the rest). The post-cutover verification block of the runbook terminates the first query with a semicolon so the block pastes into psql without a syntax error. The guard message of the migration names the step (0158-partition-file-change) instead of "0158", ambiguous since two migrations share that number. Closes #12416 AI-assisted-by: inkling-2-small-free * 🐛 Fix the stale label in the snapshot restore test The rename block of snapshots-crud runs before the restore block, so the restored version is already named "label1-updated" when the restore publishes its message. The command names the version by the label the row has at that moment, not by the one it had when it was created, so the test was asserting a stale value. Assert the current label, and say why in the comment. AI-assisted-by: deepseek-v4.1-flash * ♻️ Split the version event tests into one test per command The workspace version events and the plugin proxy send the file-id of the open file on every snapshot command, because the command needs it to prune the partition of file_change. Both tests checked that with a doseq and t/testing blocks, so a failure named the whole group and not the command that broke. Give each command its own test. The workspace ones share a helper that runs the event and returns the command and params it sends; the plugin ones keep their own mock of rp/cmd!. AI-assisted-by: deepseek-v4.1-flash |
||
|
|
81c3b3cd56
|
📎 Update copyright name on file header (#11346) | ||
|
|
f993f203bd
|
🐛 Fix problems with plugins API (#10412)
* ✨ Adds static dispatch safe stubs in tests * 🐛 Fix shapesColors metadata key to match ColorShapeInfo * 🐛 Fix CommentThread.remove rejecting the owner's own threads * 🐛 Fix page.removeCommentThread throwing on a spurious Promise * ✨ Implement ShapeBase.swapComponent in the plugin API * ✨ Expose File.revn in the plugin API * 🐛 Fix FileVersion.createdAt calling Luxon method on a js/Date * 🐛 Fix plugin font/typography application to text and ranges * 🐛 Default plugin overlay interaction position for non-manual types * 🐛 Fix plugin interaction setters passing an id-only shape * 🐛 Fix grid addColumnAtIndex rejecting valid track types * 🐛 Expose libraryId on library color/typography/component proxies * ✨ Implement LibraryTypography.setFont in the plugin API * 🐛 Fix typography.applyToTextRange reading unexposed range bounds * 🐛 Fix utils.geometry.center argument mismatch * 🐛 Fix localStorage.removeItem calling getItem * 🐛 Fix shape backgroundBlur proxy key casing * 🐛 Report boolean shape type as 'boolean' in the plugin API * 🐛 Return the resulting paths from plugin flatten * 🐛 Make plugin z-order methods act on the target shape * 🐛 Make is-variant-container? return a boolean * ✨ Implement Group.isMask in the plugin API * 🐛 Return a shape proxy from TextRange.shape * 🐛 Return the duplicated set from TokenSet.duplicate * 🐛 Fix theme addSet/removeSet reading set name with a keyword * 🐛 Accept string fontFamilies token value in the plugin API * 🐛 Fix combineAsVariants ignoring the passed component ids * 🐛 Fix board removeRulerGuide ignoring its argument * 🐛 Fix board guides setter schema and parser * 🐛 Avoid 0-byte allocation when syncing empty grid tracks * 🐛 Validate grid track indices in the plugin API * 🐛 Return null for empty input in group() and centerShapes() * 🐛 Return TokenTypographyValue[] from a typography token's resolvedValue * 🐛 Return TokenShadowValue[] from a shadow token's resolvedValue * 🐛 Return string[] from a fontFamilies token's resolvedValue * 🐛 Clear mutually-exclusive reps when setting LibraryColor gradient/image * 🐛 Add readonly tags to types, deprecate Image type * 📚 Update plugins changelog |