Tighten bootstrap checkpoint boundary search · Entire

Tighten bootstrap checkpoint boundary search

76823bfmain·

Soph·3mo ago·3 files·+223 added/-3 removed

Sessions

407e0ab6035fView transcript

[?
Can you take a look at the go code (wasm) in /Users/soph/Work/entire/devenv/entire-io-worktree1 based a bit on that I wonder if something like this can be build:Codex·GPT-5.4·1 step](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-407e0ab6035f/index.html)

Changes

324 unmodified lines

Current rewrite note:

15. Materialized fallback path does not scale to large repos

Mdocs/rewrite-issue-list.md+1
444 unmodified lines

if bestIdx != -1 {
    return bestIdx, nil
}
...
}

Search Checkpoint Under Limit Function

func (p *checkpointPlanner) searchCheckpointUnderLimit(prevIdx int, prevHash plumbing.Hash, prevSpan int) (int, error) {
    lo := prevIdx + 1
    hi := len(p.chain) - 1

largestFit, smallestTooLarge := p.probeBounds(prevHash, lo, hi)
    if smallestTooLarge > hi {
        if largestFit >= lo {
            return largestFit, nil
        }
    }
    return -1, nil
}

Example Tests

tests := []struct {
    name             string
    lo               int
    hi               int
    prevSpan         int
    largestFit       int
    smallestTooLarge int
    want             int
} {
    {
        name: "probes midpoint between known fit and too large bounds",
        lo: 0,
        hi: 19,
        prevSpan: 8,
        largestFit: 7,
        smallestTooLarge: 15,
        want: 11,
    },
}

Additional Functions

func nextCheckpointProbeCandidate(lo, hi, prevSpan, largestFit, smallestTooLarge int) int {
   // some implementation...
}

Test Function Implementation

func TestSearchCheckpointUnderLimitFindsLargestFittingCheckpoint(t *testing.T) {
    // Implementation of test...
}