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

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

A mirror's sync reads its packs only when an object is missing

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:serve/sync-no-packs

What changes

knotless-serve's sync of a mirror reads the repository record and its refs, but not the newest page of packs. Remote::heads is the snapshot without that page. Mirror::refresh leaves the page for fetch to read, and fetch reads it only when a ref names an object the mirror lacks, as after a push.

The repository settings page counts storage from the pack records each time it is shown. It no longer takes the count from the last sync. That was already what it did for any repository with more than one page of packs.

Why

The mirror sync line showed records_ms at about 1.2s of every sync on prod, even for small repositories. The PDS calls with debug logging on returned in about 220ms. The rest was the packs page's body. send stops its timer when the headers arrive, so the body didn't show in the logs. That page holds the inline packs: 0.93 MB for chadtmiller.com/knotless and 1.6–1.9 MB for pds.js, hatk and checkout-demo. Downloading it takes 0.6–0.8s from a laptop, and parsing it takes more. A sync that follows a ref change to objects the mirror already has needs none of it.

How it was checked

Measured from a laptop before the change: the packs page has a first byte at about 0.24s and is fully downloaded at 0.6–0.77s. Tests and coverage are left to CI. After it deploys, the mirror sync line's records_ms should drop to about what the refs read takes.

Changeset: none

Shortcomings

A sync after a push still reads the packs page, since the push's pack is what it lacks. The settings page now reads every pack record each time it is opened.

🤖 Generated with Claude Code

Approved

A mirror sync now calls the new Remote::heads, which reads the repository record and its refs but not the newest page of packs. Mirror::refresh passes None as first when that page is empty, and fetch reads the packs itself, but only after git.missing(wants) finds something absent. I read fetch.rs, and that logic holds. A repository with no packs just takes the None path, which is harmless. The settings page now counts storage from the pack records on every open, and the now-unused Entry.storage, Located.storage, Repo.storage and of_snapshot are removed. docs/design/serve.md is updated. Changeset: none is reasonable, since the user-visible effect is only speed.

I found nothing that must change. The snapshot callers I looked at, in the helper, the runner and the gateway, still read packs. The one other remote.follow path I saw re-snapshots through snapshot. I didn't wait on the checks. The repository gates coverage at 100%, so confirm test passes, including the packs_if early return and the heads path.

Merged as 32ed996