mirror of
https://github.com/penpot/penpot.git
synced 2026-10-30 06:20:32 +00:00
Swap the storage and materialization layer of file branching to remove the per-branch data duplication, keeping the RPC contracts and the frontend unchanged. - file_branch_change (0154): one row per branch save, the blob-encoded change vector, ordered by revn; branch files store no data payload. - Read path: app.binfile.common/get-file* derives the branch file data by replaying the op log over the pinned merge-base snapshot, carrying the base's version and migration set so need-migration? stays quiet. - Save path: update-file routes branch files to persist-branch-file!, which appends the vector to the op log and updates the file row without any file_data write. - Creation: create-file-branch no longer duplicates main's data; it inserts an empty branch file row, grants the creator, and copies the library rels. - update-branch-from-main squashes the op log after integrating main's changes: the repositioned base already carries main's side, so the log is replaced with the net branch-only changes. - Kept (keep-branch) branches retain the base pin: their state is derived, so releasing the pin would leave them unreadable after GC. Tests: backend-tests.rpc-file-branch-oplog-test asserts the storage and derivation invariants; the existing branch, file, binfile, snapshot, thumbnail, and pull request suites pass unchanged against the swapped engine (84 tests, 1487 assertions, 0 failures).