← Back to Pull requests

Settle fast-forwards the pruned planning store cannot #137

Closed
unknown closed this pull request without merging on Nov 04, 2026 12:57 UTC
View on GitHub
unknown unknown commented on Nov 04, 2026 05:30 UTC
Author

Why

The planning fetch names every target ref as a have, so a branch tip the target already holds under another ref is pruned from the pack. ReachesCommit then aborted the whole sync:

error: sync: build plans: check fast-forward for refs/heads/upstream/nixos-unstable:
  load source commit 0bb2eedc…: object not found

A NixOS/nixpkgs mirror hits this whenever nixos-unstable advances to a commit master already delivered, i.e. routinely. No flag avoids it: the error fires before the force path.

What

  • Carries #79 (@Soph, approved by pjbgf) rebased onto main: CheckAncestry returns reachable / unreachable / indeterminate instead of crashing on a pruned start commit. On its own that still blocks the ref.

  • Adds PlanConfig.ResolveAncestry: an indeterminate check is settled by one tree:0 commit-graph fetch of the tip with only that ref's own target hash as have (the same FetchCommitParents bootstrap uses). AncestryFromParents answers from the result, so a real fast-forward updates and a rewind blocks as not an ancestor. The extra round trip happens only for refs the pruned store cannot settle. A source that cannot serve it (v1, no filter) keeps #79's block, with the failure in the reason.
  • Verification

  • Unit: TestAncestryFromParents, TestPlanRefResolvesIndeterminateAncestry (resolver answers, resolver failure keeps the block, settled checks never call it), plus #79's tests.

  • Integration: TestRun_IntegrationFastForwardsTipTheTargetHolds reproduces the nixpkgs shape against the in-process v2 server (which prunes with revlist.Objects): seed master + trailing, advance trailing to a commit master already delivered → 1 push, 0 blocks, target ref moved; then rewind it → blocked as not an ancestor, target untouched.

  • Not run locally; CI runs the suite.
  • Closes #79.

    🤖 Generated with Claude Code

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Medium Risk

    Changes core fast-forward planning for every sync when the pruned store cannot prove ancestry; incorrect resolver logic could allow bad updates or block valid ones, though force and explicit blocks remain as safeguards.

    > Overview

    Fixes sync runs that aborted during plan build when a branch’s new tip was already on the target under another ref (e.g. nixos-unstable catching up to a commit master already had). The planning fetch advertises all target refs as haves, so those tips are pruned from the local store and the old ancestry helper failed with load source commit …: object not found.

    > ReachesCommit is replaced by CheckAncestry, which returns reachable / unreachable / indeterminate when the walk hits pruned objects instead of treating missing commits as hard errors. PlanRef blocks indeterminate cases with an actionable message (or honors --force) instead of failing the whole sync.

    > PlanConfig.ResolveAncestry lets the sync session settle indeterminate refs with one tree:0 commit-graph fetch of the source tip using only that ref’s target hash as the have; AncestryFromParents interprets the result so real fast-forwards become updates and rewinds stay blocked. Sources that cannot serve that fetch (e.g. protocol v1) keep the ref blocked and surface the error in the block reason. Wiring lives in syncSession.resolveAncestry during BuildPlans.

    > Adds unit coverage for the new ancestry semantics and resolver behavior, renames the benchmark to BenchmarkCheckAncestry, and adds integration test TestRun_IntegrationFastForwardsTipTheTargetHolds for the nixpkgs-shaped scenario. CHANGELOG documents the fix (builds on #79).

    > <sup>Reviewed by Cursor Bugbot for commit b4b2be3003ea97acd23d954b7755813eefde0022. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 488 lines (+366 / -122) across 6 files Reviewer: pjbgf Review duration: 447m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.47) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 488 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.370
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #137"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%