Repository navigation
feat: label merges that do not contain their PR; request changes blocks merge (E3) - #373
Conversation
…ks merge A merge transition only has to name a commit the base once held, so a member could mark any PR merged by naming an old tip. A shared reader rule (forge-core merge_check, web merge-content.ts, merge_content__* vectors) now labels a recorded merge as containing the PR, a squash or a rebase of it, or not containing it. The web shows it next to a merged PR's state; dg pr verify fetches and checks; dg pr view says it when the commits are local. dg pr merge --event-only refuses a commit that does not contain the PR, and refuses writers on a protected base. With required approvals, a standing request for changes from a reviewer whose approval would count now blocks the merge in both clients until they approve or the review is dismissed (meets_policy blockedBy, policy__* vectors). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A squash that leaves alone a path the base already changed like the PR now counts. dg treats a failed or shallow ancestry walk as unknown, checks the head as it was at the merge, skips merges whose commit was never a base tip (as the web does), fetches every branch when the base was deleted, and no longer fails when the PR head cannot be fetched. Both clients stop after the merge is known not to build on the base. Combined paths sort by code point via compareStrings. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (56)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds Git-based checks for whether recorded merges contain pull-request changes. It exposes those checks in CLI and web views and adds a guard for event-only merges. Approval policy results also identify eligible reviewers whose current change requests block merging. ChangesRecorded merge integrity
Change-request review policy
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~60 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant User
participant DgVerify
participant ScratchRepo
participant MergeRules
User->>DgVerify: request verification for a repository and pull request
DgVerify->>ScratchRepo: fetch base and pull request objects
DgVerify->>ScratchRepo: read merge ancestry and tree changes
DgVerify->>MergeRules: pass Git-derived merge facts
MergeRules-->>DgVerify: return verdict and combined paths
DgVerify-->>User: print JSON or text result
Merge Risk: ⚪ Minimal · up to The identified concerns do not block merge verification or event-only merge safeguards. No actionable merge-blocking issue remains after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change strengthens merge checks and review blocking, but a positive squash or rebase result does not establish that every PR change survived in overlapping files. That matters when verifying that a security-sensitive fix landed. Writer and maintainer requirements limit exposure; concurrency and final enforcement remain only partially verified. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
What
Readers can now tell when a recorded merge does not contain its pull request, and a standing request for changes blocks merging.
dg pr verify <repo> <n>fetches the base and the head and says the same;dg pr viewsays it when the current repository already has the commits.dg pr merge --event-onlyrefuses a commit that does not contain the PR, and refuses a writer on a protected base (only a maintainer can push there, so only a maintainer can record a merge there).dg, until they approve or the review is dismissed. A maintainer can still bypass it, and the bypass is recorded.Why
Consensus admits a merge transition naming any commit the base once held, and a merged PR is final. With stock
dg, a writer on a protected base could permanently mark any open PR "merged" by naming an old tip ofmain, and readers showed it as an ordinary merge. Platform cannot read git, so this has to be a reader rule. Request changes was computed but never blocked anything, unlike GitHub.How
forge_core::rules::merge_check/forge-web/lib/rules/merge-content.ts, with 19merge_content__*conformance vectors run in both languages. It works from git facts: whether the head is in the merge, whether the merge is built on the base's previous tip, and three tree-level diffs. A fact that can't be read givesunknown, nevermissing.git merge-base --is-ancestorandgit diff-tree. A shallow repository or a failed walk counts as unknown. The web gathers them through the PR comparison's object readers once the comparison has loaded, so the page makes no extra Platform requests.meets_policy/meetsPolicyreturnblockedBy. 7 newpolicy__*vectors, and the existing ones gain the field.docs/guides/collaborating.md,docs/contracts/forge-v2.md(both conventions).How tested
clippy -D warnings, andcargo test -p dg -p forge-core. Web: tsc, eslint and the full vitest run (5,675 tests, including a newmerge-check.test.tsagainst real git objects). dg has a git-backed unit test covering a merge commit, a squash, an unrelated commit and an old tip.2D3Akz31nwDupidzP4hJ16s8tqjByYe55Vtg1iQN1MrZ/mp-merge-a:--event-onlynaming an old tip: refused with "does not contain PR build: make the Rust workspace buildable and pin the Platform SDK #1" (E201).--event-onlyon a protectedmain: refused (E601).dg pr verifyanddg pr viewprint! merged as fc857f6c9986: does not contain this PR's commits, and the web labels it in red.dg pr merge --squashgives "is a squash of this PR";--no-ffgives "contains this PR's commits".dg pr mergeis refused with "changes requested by 1 reviewer" (E804), and the web merge box names it./Users/pasta/workspace/dash-forge-qa/evidence/p0/merge-power/. It holds the dg transcriptsmp-merge-a-*.txt/.jsonand the screenshotsafter-pr1-fake-merge-{dark,light,390-dark}.png,after-pr2-squash-light.png,after-pr3-merge-commit-light.png,after-pr4-changes-requested-light.png, plus thebefore-*ones from forge.dashhq.org.Limits
🤖 Generated with Claude Code
Summary by CodeRabbit
dg pr verifyto report whether a recorded merge contains a pull request’s changes, including through a squash or rebase.