Skip to content

fix(revision): reject stale synthetic-merge bases before current-base qualification - #1641

Merged
EffortlessSteven merged 1 commit into
mainfrom
fix/1569-stale-synthetic-merge-base
Nov 4, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
fix/1569-stale-synthetic-merge-base

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Defect

#1569 (P1 evidence-identity defect under #840 / #950). In the merge-result branch of admit_revision (src/revision_admission.rs:406-436 at main c6bc743b), admission validated only that parents[1] equals the supplied PR head and never compared parents[0] to the resolved base_ref tip (src/revision_admission.rs:381). GitHub's refs/pull/N/merge refreshes lazily, so a synthetic merge built against a preceding base revision passed current-base qualification while diffs and proofs ran against different base content — the exact hosted subject recorded in the issue (declared base 9007bdb6 vs. actual merge parent d0b0f032).

Fix

Before admitting a merge result with ReviewSemantics::MergeResult, compare its base-side parent (parents[0]) to the resolved base_ref tip and fail admission on mismatch, mirroring how the other admission negatives bail! in the same branch. The message names the resolved tip, the offending parent, the reviewed checkout, and the actionable recovery (rebuild the synthetic merge against the current base tip), satisfying the issue's criterion 2. Legitimate candidate-head and merged-on-current-base flows are unchanged; no schema, verifier, or policy surfaces are touched.

Regression test

stale_merge_bases_are_rejected_but_current_merges_admit (in the module's existing git-DAG test style, satisfying issue criterion 4's disposable DAG): builds base B and head H, merges M(B,H), advances the target to B2 without rebuilding M, and asserts admission of M with base B2 fails (not the base-side parent / rebuild the synthetic merge, naming B2), then asserts a fresh M2(B2,H) admits as merge_result. Discrimination verified: with the production check removed (test retained), the test fails with "stale-base merge must not be admitted"; with the fix restored it passes.

Validation (from F:/Temp/fix-1569, CARGO_TARGET_DIR=H:/Code/Rust/ub-review/target)

  • cargo fmt --all --check — clean.
  • cargo clippy --locked --workspace --all-targets — warning set byte-identical to an origin/main baseline captured by stashing the diff (6 pre-existing warnings, incl. the tolerated src/proof/red_green.rs:385; fixture_status dead-code in test "cli" and two in test pr_context_hydration). No new warnings.
  • cargo test --locked --bin ub-review revision_admission — 18 passed, 0 failed.

Known gaps

  • Windows host: Unix-gated tests (e.g. symlink_target_is_part_of_the_admitted_tree_and_repeats_stably) were skipped locally; the Linux gate covers them.
  • The issue's broader criteria (artifact/verifier consumer labeling of currentness, historical/non-current qualification states, comparison-base override documentation, incident-corpus reference) are separate leaves; this PR owns only the admission rejection and its regression test.
  • Gate dispatched on the branch; not awaited per handoff instructions.

Fixes #1569

… qualification

The merge-result branch of admit_revision validated only the head-side
parent against the supplied PR head and never compared the base-side
parent to the resolved base_ref tip, so a lazily refreshed synthetic
merge built on an older base revision was admitted as current-base.
The merge result is now rejected with actionable recovery text when
parents[0] differs from the resolved base tip; merges rebuilt on the
current base still admit.

Fixes #1569
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 151 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 00aab6d2-76c9-4824-bd58-365eb4c147bf
Commits

Reviewing files that changed from the base of the PR and between c6bc743 and aafb313.

Files selected for processing: 1
  • src/revision_admission.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven
EffortlessSteven merged commit 61f4114 into main Nov 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(revision): expose stale synthetic-merge base before claiming current-base qualification

1 participant