mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
Every gated branch operation flattened the whole op log only to count its changes, and the derive in the same request decoded those rows again. The count is not recoverable from the bytes: a row holds one compressed change vector whose length says nothing about the number of changes beside a squash that emits tens of thousands of them for a one-page delta. Each `file_branch_change` row now stamps `changes_count` at write time, in `persist-branch-file!` and in the squash `persist-branch-update!` writes, and `binfile/common.clj::get-branch-oplog-depth` sums the live rows. Migrations 0804 and 0805 add the column, fill it from the stored vectors, and make it NOT NULL, so a writer that omits it fails instead of recording an empty log. The gate keeps its place ahead of the derive in `get-branch-diff`, `merge-file-branch`, and `update-branch-from-main`, and a test pins that it counts the changes a row holds rather than the rows. Entry: pp:vcs:the-op-log-depth-check-pays-a-derive open -> done AI-assisted-by: deepseek-v4.1-flash Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro>