mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
The source notes on files_branch.clj listed 32 review findings. This commit fixes the 21 that are defects of the code; each fix carries a regression test that failed before it and passes after. Concurrency: merge, update from main, rename, archive and delete now re-read the branch row under the advisory lock and work off that row, so a concurrent merge or update can no longer leave a ten-year base pin behind or release a superseded base twice. Delete and archive take the branch file lock, create and reopen of a pull request refuse a branch that a concurrent merge closed, and create checks the branch quota under the lock. Merge, update and delete publish their msgbus messages only after the transaction commits. Merge, update and materialize re-validate after the repair: merge and update refuse a result that stays invalid, materialize logs it. The change log row carries the repair changes, and the three paths drop the cached file summary under :redis-cache. Contracts: a :conflict refusal answers 409 instead of 500, resolution values must be :main or :branch, and update from main accepts the expected-main-revn token the frontend now sends from a loaded diff. Smaller fixes: create refuses a blank name, writes no file_data row, and a rename reaches the branch file's own name. Deleting a kept merged branch keeps its merged status. get-branch-diff reports the creation time of the current base snapshot. Rename, archive and delete report their duration and outcome. An image used only by a library colour is copied into the target file. Dead fallbacks and dead deleted-at checks are gone. AI-assisted-by: claude-opus-5-5