Skip to content

fix(pack): single-pack reuse and tolerant MIDX bitmap verification - #46

Merged
yordis merged 2 commits into
mainfrom
yordis/fix-pack-single-pack-reuse
Oct 29, 2026
Merged

yordis merged 2 commits into
mainfrom
yordis/fix-pack-single-pack-reuse

Conversation

@yordis

@yordis yordis commented Oct 29, 2026

Copy link
Copy Markdown
Member

- Stop setting pack.allowPackReuse=multi: multi-pack reuse produces thin
  packs whose delta bases are absent for a cloning client, ending in
  unresolved deltas and pack-objects crashes.
- Treat a failing rev-list --test-bitmap as non-fatal: Git selects only a
  subset of commits for a MIDX bitmap, so a branch tip is not guaranteed to
  have one. Ordinary traversal stays available and the fold can seal.
- Refresh the commit-graph before building the MIDX bitmap.
- Clear a stale multi-pack-index.lock left by a crashed writer.
- Back off exponentially per repository after repeated maintenance failures.

(cherry picked from commit 94cc5e1)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes pack serving config and MIDX concurrency around compaction; wrong locking or reuse settings could affect clone correctness or maintenance timing, but changes target known production failure modes.

Overview
Hardens MIDX / bitmap maintenance so compaction stops failing in loops and clones stay valid.

MIDX serialization: Adds an exclusive repo-local lock (walgit-midx.lock) around MIDX writes (history MIDX and verified bitmap builds). After acquiring it, stale objects/pack/multi-pack-index.lock from a crashed Git writer is removed; a live Git lock still blocks a second writer.

Bitmap build: Refreshes the reachable commit-graph before multi-pack-index write --bitmap. rev-list --test-bitmap failures are logged as warnings only—Git does not bitmap every branch tip, so that check must not abort pack lifecycle.

Clone safety: Sets pack.allowPackReuse to single instead of multi, because cross-pack delta reuse produced thin packs whose bases clients never received.

Maintenance: Per-repo exponential backoff (capped at 1h) after a failed maintenance unit, so broken repos are not repacked every pass; successes clear the backoff counter.

Reviewed by Cursor Bugbot for commit fcc33d2. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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: CHILL
  • Plan: Advanced
  • Run ID: 086a86b6-2396-4fb9-8988-ada9b0b5b21d
Commits

Reviewing files that changed from the base of the PR and between 2668870 and fcc33d2.

Files selected for processing: 4
  • crates/walgit-git/src/lib.rs
  • crates/walgit-git/src/midx.rs
  • crates/walgit-git/tests/midx.rs
  • crates/walgit-server/src/maintain.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 776bd4c. Configure here.

Comment thread crates/walgit-git/src/midx.rs
An age-based removal could steal the lock from a live bitmap write on a large repository, and pack sync and the pack lifecycle can both write the MIDX without sharing a lease.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis closed this Oct 29, 2026
@yordis yordis reopened this Oct 29, 2026
@yordis yordis closed this Oct 29, 2026
@yordis yordis reopened this Oct 29, 2026
@yordis
yordis merged commit 38660a2 into main Oct 29, 2026
10 of 15 checks passed
@yordis
yordis deleted the yordis/fix-pack-single-pack-reuse branch October 29, 2026 05:41
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.

1 participant