Repository navigation
fix(rules,dg,web): ref forced back to an earlier tip, and PR bases that do not exist (D-600, D-501) - #65
Merged
Conversation
|
Warning Review limit reachedNext included review available in 33 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 selected for processing (36)
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 |
…en no tips D-600: a prevOid names a commit, not a document, so a ref that revisits a tip (A -> B -> force A) let the stale A -> B update supersede the newest one while the newest superseded it back, and the ref read as deleted in every client. resolve_ref now folds in the consensus clock order, with the prevOid chain ordering only updates inside one block, and supersession only looks forward, so a non-null newest update is always a head. Rust and TS ports, eight resolve_ref vectors and an exhaustive property test. D-501: pr_base_tips (Rust) / prBaseTips (TS) give a base that was no branch when the PR was opened no tips, so a merge into a branch created later never counts. Vectors pr_base_tips__* and fold_pr_v2__merge_into_base_*. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e it on merge D-501: dg pr create --base naming a branch the target does not have (never pushed, a typo, or deleted) is refused with E102 before anything is written, and the web's new-PR page blocks it with the reason. dg pr merge refuses a base that was no branch when the PR was opened, and refuses to push to a deleted base (it would re-create it). Readers (forge-core patch_view, forge-web readPull) fold the base through pr_base_tips, so a PR 'merged' by creating its base reads open. CLI e2e scenario 16 (A -> B -> force A -> B, and the base checks) and the Playwright spec pr-base.spec.ts. forge-v2.md documents the clock-order ref fold (D-600) and the base-at-open rule. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…-remote failures The e2e scenario ran ls-remote inside a command substitution, so a failure or flake only left the subshell and read as a wrong tip; it now runs at the top level. Renumbered to 17 (16 is taken by the private-repo branch). causal_order uses chunk_by and drops a redundant guard (both ports); read_merge_base takes the PR's open time and calls pr_base_tips directly; the conformance harnesses share one merge/pr base-tips arm; resolve_head returns a PrHead struct. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…erge needs a live base Review follow-up: when every same-block update waits on a chain cycle, causal_order now picks the smallest-id update that lies on the cycle, not one merely downstream of it (which then sorted before its own predecessor). Both ports, vector resolve_ref__ref_same_createdat_cycle_placed_before_its_downstream. tipOidOf takes heads[0] so the provisional tip has one definition. D-501 against C2's browser merge: the merge panel built on pullBase's tip, which falls back to the PR's historical tip for a deleted base, so a browser merge could push to and re-create a deleted base, or merge into a base missing when the PR was opened. mergeBaseTip gives the live branch tip only, and '' (refused by mergeRefProblem) in both cases. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PastaPastaPasta
force-pushed
the
fix/ref-rule-and-pr-base
branch
from
September 27, 2026 11:17
8d7bec2 to
5b339f9
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.
Fixes two S1 defects from QA wave 1: D-600 and D-501.
D-600: force-pushing back to an earlier tip made the ref read as deleted
A push sequence of A → B →
git push --forceA made the ref resolve as unborn in every client. The Mirror Action wiped a mirror's default branch this way (evidence:integrations/T-ABA,T-IMP/44-45).Cause.
resolve_reflet aprevOidmatch supersede an update regardless of the clock, on the assumption that tip chains are acyclic. But aprevOidnames a commit, not a document, and a ref can hold the same commit twice. The oldA → Bupdate'sprevOid(A) equals the newest tip, so each of the two updates superseded the other. That left zero heads, which reads as Unborn.Fix. The fix is in the shared rules, in Rust (
forge-core::rules) and TypeScript (forge-web/lib/rules/resolveRef.ts).$createdAtis block time and is required on both ref types.prevOidchain orders updates only inside one block (causal_order/causalOrder): Kahn's sort by$id, with a chain cycle broken at its smallest-$idmember.Vectors. New
resolve_ref__vectors:ref_force_back_to_earlier_tipref_force_back_then_forward_again(A→B→A→B)ref_force_back_to_first_of_threeref_force_back_without_prevref_force_back_then_repush_same_tip(the mirror's real history)ref_deleted_then_recreated_at_earlier_tipref_same_createdat_mutual_chain_uses_idref_same_createdat_chain_breaks_tieref_same_createdat_cycle_placed_before_its_downstreamThere is also an exhaustive property test: a ref is unborn exactly when its causally newest update is a deletion, and the result does not depend on input order. It fails on the old code.
D-501: a PR against a nonexistent base could be "merged" by creating that base
pr_base_tips/prBaseTips: a base that had no valid tip when the PR was opened has no tips, so no merge into it ever counts. Readers use it: forge-corepatch_viewand forge-webreadPull. Vectorspr_base_tips__*andfold_pr_v2__merge_into_base_{created_after_open_inert,present_at_open_counts}. This applies to merge events already on chain: a PR that read as merged only because its merge created its base now reads open.dg pr createrefuses a--basethat is not a live branch of the target (E102, nothing written). That covers a branch that was never pushed, a typo, and a deleted branch.dg pr mergerefuses a base that was missing when the PR was opened, and refuses to push to a deleted base, which would re-create it.--event-onlycan still record a merge into a base deleted since.?base=or a kept draft) is blocked with the reason. The same goes for a repo with no branches.pullBase's tip, which falls back to the PR's historical tip when the base is deleted. So the browser merge could re-create a deleted base, or merge into a base that was missing when the PR was opened.mergeBaseTipnow passes only the live branch tip, and''(refused bymergeRefProblem) in both cases.docs/contracts/forge-v2.md§6 documents the clock-order fold and the base-at-open rule.Tests
17-ref-force-back-and-pr-base.sh, run live on moutai as a freshly minted identity:ref did not converge to pushed tip.ls-remoteand a fresh clone;pr createrefuses a missing or deleted base;pr mergerefuses and leaves the deleted base unrecreated.pr-base.spec.ts(read-only, moutai fixture): fails against the old build (the button stays live, no alert) and passes on this branch.mergeBaseTipcases.clippy -D warnings.dg,pr create --base d501/before-does-not-existwas accepted, andpr mergepushedrefs/heads/d501/before-does-not-existand marked the PR merged.Evidence:
dash-forge-qa/evidence/impl/fix-ref-rule-and-pr-base/.Notes
tipOidOf, stale comments, and a per-iteration array copy.data-contracts.mdis the historical v1 design record and was left unchanged. The fold uses the patch's original base, so a retargeted PR still merges against it; that was already the case, and it is now documented.🤖 Generated with Claude Code