Repository navigation
feat(web): merge pull requests in the browser (fast-forward and disjoint merges) - #61
Merged
Merged
Conversation
|
Warning Review limit reachedNext included review available in 15 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (35)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A merge engine in a Web Worker: fast-forward detection, or a clean 3-way merge through isomorphic-git over a virtual fs backed by the browse readers, and a non-thin pack of only the objects the base lacks. The button states follow ux-dx-spec 5.7. A resumable step runner uploads through lib/storage (the merger's policy; Platform only after a priced confirm), writes the kind-0 manifest, publishes the kind-1 index fragment at its real packRef, moves the base branch (protected when it matches), and posts the merge event. Partial failures name which documents exist. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…retry Critical: the pack walk skipped a tree it had taken under different same-path parents, so a revert inside a PR or subtrees swapped across a merge could leave a blob out. It now memoizes by (tree, parents), with regression tests. As a hard net, before anything is uploaded, the new tip's closure is verified against the pack plus the base repo, and a gap stops the merge with nothing written. A merge run is tied to its base tip and head: a changed tip starts over, and the base ref is re-read just before the ref update, which stops if the branch moved. Binary or non-UTF-8 files both sides changed are conflicts (a text-only merge driver), never a corrupted clean merge. Protected patterns are read fresh for the ref update. The check worker aborts when superseded, and worker failures name their phase. sourceRefName goes into the message only when it is a legal ref name. The merge identity is required for merge commits only, the local timezone is used, and only mergers resolve the readers. Dead code and the unused buffer dependency removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Commits and trees are read as git reads them and checked as fsck would (one tree first, contiguous parents, then author and committer; git modes, names and order in trees). A merge refuses any history that fails, so a head carrying two tree/parent sets can no longer look like a fast-forward while git sees a revert. The closure check runs only against the base repo's own reader (never the fork fallback), and re-reads the head's commits, trees and blobs through it rather than trusting an index. The button waits for the base repo to load. The base must be an existing plain branch (check-ref-format, parity with dg's require_branch_ref) and the head a full oid, checked in the panel and again before any paid step. The pack walk decides tree against blob by the object and skips only on the same mode and oid, never on a gitlink. The check has a 100k-read budget and a 60 s timeout, and files over 1 MiB are conflicts. The title is one bounded line. Protected routing reads the complete config timeline. Private repos are not merged in the browser. The Platform price covers the index fragment, and the pack size and object count show before any upload. Each fix has a regression test that failed before it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Commits are checked on their raw bytes: they must begin with 'tree ', with no BOM (which decoders dropped) and no NUL in the header, and dates must not be zero-padded. Blob-mode entries must name blobs, never commits or tags. Tree names must be UTF-8 (isomorphic-git would rewrite others) and not look like .git on any filesystem, and .gitmodules must not be a symlink. After the three-way merge, the merged tree is audited against both sides: a path both sides changed where one changed its type (file to symlink) is a conflict, as git's 'distinct types'. Symlink and submodule targets are never invented. Every written tree passes the fsck order check, so check and run agree. Real git judges the result: merges over directories, symlinks, executables, gitlinks and non-ASCII names pass fsck --strict, log and clone, and a property test mutates commits and trees and asserts the web never accepts what git's object checks reject. These tests skip when git is not installed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Product decision: the browser never merges file contents. It fast-forwards, or writes a merge commit only when the two sides changed disjoint paths since their single merge base; a path (or an ancestor or descendant of it) touched by both, a directory one side emptied while the other added under it, and criss-cross histories are refused with 'Conflicts or overlapping changes - merge with dg pr merge'. Deletions that together empty a directory drop it, as git does. isomorphic-git, the diff3 driver and the in-memory fs are removed. fsck parity on every new commit and tree, fast-forwards included (checkMerge runs the pack walk too, so check and run agree): exact ports of is_ntfs_dot_generic (gi7eba fall-back names) and is_hfs_dot_generic; .gitmodules/.gitattributes only as files and never new or changed in the browser; .gitignore/.mailmap not as symlinks; null-oid entries; names over 4096 bytes; trees deeper than 2048; dates over 2^63-1; a NUL anywhere in a commit. The read budget counts distinct objects, repeated tree visits have their own cap, and a limit is a 'too large' refusal rather than an error. The commit's timezone is the one in force at its timestamp. git-parity.test.ts gains two differential properties against real git: the browser refuses exactly by the file-level rule and a clean merge is the tree git merge-tree --write-tree writes, and the web accepts nothing git fsck --strict rejects. reattack.test.ts holds the third review's repros. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
MalformedObjectError used a constructor parameter property, which Node's type stripping cannot run; master's render fuzz workers load this module that way. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
force-pushed
the
feat/web-launch-ux-c2
branch
from
September 27, 2026 10:23
e28485e to
762e82d
Compare
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Web launch UX "C2": maintainers and writers can merge a pull request in the browser. forge-v2, public repos, desktop. It stacks on #58 (C1).
What the browser merges. File contents are never merged in the browser (product decision).
Merge pull request #n from <branch>.dg pr merge" plus thedg pr checkoutline. That covers:fsck parity. Every commit and tree the base branch would gain is checked as
git fsck --strictdoes, fast-forwards included.checkMergeruns the same pack walk asrunMerge, so the button never offers a merge the run then refuses. The checks:.gitlook-alikes, using exact ports of git'sis_ntfs_dotgit,is_ntfs_dot_generic(including thegi7eba-style fall-back short names) andis_hfs_dot_generic;.gitmodulesand.gitattributesonly as files,.gitignoreand.mailmapnever as symlinks.A new or changed
.gitmodulesor.gitattributesanywhere is refused in the browser, because git checks their contents and the browser does not. A merge past the walk or read limits is refused as "too large", not reported as an error.The run. The step list is:
packManifestrefUpdate/protectedRefUpdate; the base tip is re-read first)mergeeventEvery step is resumable. A failure after the upload names exactly which documents already exist.
Removed: isomorphic-git, the diff3 text driver, and the in-memory git fs.
Tests
lib/merge/git-parity.test.ts(real git; skipped only when git is absent):git merge-tree --write-treeis clean and writes the identical tree oid.git fsck --strictrejects.FORGE_PARITY_CASES/FORGE_PARITY_SEED.lib/merge/reattack.test.ts: every repro from the third adversarial review. 20 of its 32 tests fail on the previous commit; the other 12 pin behaviour that must stay allowed (git-accepted names, the 2^63−1 date, 2048 levels, a duplicate parent, an unchanged.gitmodules, a clean rename). All 32 pass now.lib/merge/security.test.ts,engine.test.ts,runner.test.ts,verify.test.ts,locator.test.ts: earlier review regressions, the pack closure, and the step runner.pnpm typecheck,pnpm lint,pnpm testpass.e2e/v2-pulls.spec.tspassed 7/7 with the disjoint-path engine. c7 merges a divergent PR in the browser with a merge commit stored on Platform, and the PR folds as merged. The later review follow-ups did not touch that path. c7 will be run again against the deployed site after merge.🤖 Generated with Claude Code