← Back to Pull requests

relay: leave unchanged independent-history tips out of the haves #138

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

A relay fetch offers the source every target tip as a have. For refs that each carry their own history, such as one orphan history per session checkpoint, those tips cannot shorten the pack the run needs. A repository with about 4,000 checkpoint refs sends about 4,000 have lines on a run that moved one branch, and the count grows by one per checkpoint.

This adds RefScope.IndependentHistoryRefPrefixes: literal prefixes of target ref names, such as refs/entire/checkpoints/. Under those prefixes, a target ref is offered as a have only when the run updates it, as its own old value. Every other target tip is offered as before. Which refs are synced or pruned does not change, and with the option empty the behaviour is identical to today.

Where it applies:

  • Replicate relays and sync's incremental relay.

  • Not sync's closure fetch for fast-forward checks, which runs before any plan exists, and not bootstrap. Both still offer every tip.
  • Why it's safe: in a sample of 21 checkpoint refs from a real checkpoint repository, each had 1–3 commits and its own root, and none shared an object with another. So leaving their unchanged tips out cannot make a pack larger by more than a few small identical objects.

    Tests:

  • Unit tests for planner.FetchHaves and for prefix validation.

  • In-process integration tests that record the have lines of every source fetch and check that the target's refs match the source exactly, with every commit, tree and blob reachable from them readable. They cover a branch update (with the option and as a baseline without it), a new checkpoint ref, an update to an existing checkpoint ref, sync mode's two fetches, and a prune-only run (no fetch).

  • Two integration tests name the prefix over refs that do share history (a new ref built on an existing one under the prefix, and a branch moved onto a commit the target holds only under the prefix). Both leave a complete copy; the cost is a larger pack.

  • go test -race ./..., the git-http-backend suite and mise run lint pass.
  • Trail: https://entire.com/gh/entireio/-/trails/2748

    🤖 Generated with Claude Code

    <!-- entire-shadow-pr -->

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Medium Risk

    Opt-in relay negotiation change could affect pack contents and bandwidth if prefixes are misconfigured, but default behavior is unchanged and correctness paths (closure fetch, materialized) still use full haves.

    > Overview

    Adds RefScope.IndependentHistoryRefPrefixes so relay fetches stop advertising thousands of unchanged target tips (e.g. per-session checkpoint refs) as haves when they cannot shorten the pack.

    > planner.FetchHaves builds the have set from target tips and push plans: refs under the configured prefixes are omitted unless the run updates that ref, in which case only its current target tip is offered. Replicate and sync incremental relay pass this filtered map into their strategies; sync’s upfront closure fetch for fast-forward checks and bootstrap still use every target tip. Sync/prune scope is unchanged.

    > The field is wired through syncer.Config, stable and unstable clients, with ValidateIndependentHistoryRefPrefixes (must start with refs/) at the request edge. Unit and integration tests cover planner behavior and v2 have lines on replicate/sync runs.

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

    <!-- /CURSOR_SUMMARY -->

    Diff: 447 lines (+335 / -112) across 5 files Reviewer: pjbgf Review duration: 300m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 447 lines diff across 5 files
    0.45
    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%
    60%
    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.365
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #138"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 45.4% (MEDIUM) · Higher = larger blast radius
    45.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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17.9% · Safe to merge
    17.9%