~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.17.0 Latest 2 packages, 1 image

1
10

A fetch that stops partway leaves a mirror that cannot sync

Open
Open chadtmiller.com opened this issue 0 comments
kind/bugarea/storage

What happened

A mirror holding a commit but not its parents stays that way. fetch only asks whether the wanted tips are present, finds them, and returns, so nothing fetches the parents. settle then moves the refs, and mirror.sync returned:

git commit-graph: error: Could not read e16ea11d5c62edc114302693cd063aee594e382d
fatal: unable to parse commit e16ea11d5c62edc114302693cd063aee594e382d

Fetches land the newest packs first, so a fetch stopped partway leaves this state. Taking turns between fetches (Fetches into one mirror take turns) stops a sync from seeing another's unfinished work. It does not repair a mirror left by a fetch that never finished.

One idea for the fix: mark a mirror while a fetch lands packs and clear the mark when it finishes, so the next fetch that finds the mark walks the packs again rather than trusting the tips. Running the fetch in a task of its own, as settle does, would cover a dropped request but not a killed process.

How to see it

In a test against a real PDS, as in crates/knotless/tests/library.rs:

  1. Make six commits with knotless::commit::commit.
  2. Remove the repository's mirror directory, and open it again with Mirror::open.
  3. Read the pack that refs/heads/main's record names, fetch::download it, and git.index_pack it, with no other pack.
  4. Call mirror.sync.

That is how the state was made here. How a mirror gets there on its own was not seen happening: a killed process would do it, and so, from reading the code, would a request whose asker leaves, since the comment in Mirror::refresh says such a caller drops what it awaits, and fetch does not run in a task of its own as settle does.

What you expected

The sync fetches the parents, as they are in the repository's records.

Where

The library, in crates/knotless/src/fetch.rs and mirror.rs, at 444bee0d. It would reach whatever syncs a mirror: the CLI, knotless-serve and knotless-run.

🤖 Generated with Claude Code