chadtmiller.com/knotless
git that lives in your Atmosphere account
knotless-serve: repositories are read by the atproto crate's readers
MergedThis moves archive.rs onto atproto 0.2.1's star_lite::Reader, car::read, Commit::from_bytes and mst::Tree::read. It drops the file's own STAR-lite, MST and varint code, and the diff matches the body.
- Reading:
readbuffers the first bytes to look for the STAR-lite magic. It then feeds chunks to the reader, or collects the rest of the body for a CAR. The 256 MiB bound is still counted per chunk inBody::chunk. The commit's DID and signature are still checked for the CAR path.keptand the collection filter are unchanged. - Tests: they now cover each refusal and feed the fixture 1, 7 and all bytes at a time. That covers chunk boundaries.
- Docs:
docs/design/serve.mdis updated. No changeset is needed, because onlyknotless-servechanged. - Cargo.toml and ciborium: the
streamfeature on reqwest is dev-only, for the test helper.ciboriumandsha2are still used elsewhere in the crate, so the unused-dependency lint won't fire. - Checks:
check,test,docsande2ewere still running or queued when I read them. Thetestcheck holds the 100% coverage gate, so it's worth watching. - Behaviour change: the stricter refusals (non-v3 commits and non-canonical DRISL now fail the backfill) are the intended change and the body states them. I'm not asking for anything on them.
Since my approval at ce11543, the pull bumps atproto to 0.2.2 and has the CAR path call Commit::verified(commit, did, key). That replaces the DID and signature checks archive.rs did itself. This also removes one of the shortcomings the body lists, the duplicated commit check. The tests now expect the crate's messages ("a commit for another account", "a commit the account's key did not sign"), and the change is small and consistent. The check, e2e, docs and test checks were still running or queued when I read them. The test check holds the coverage gate, so watch it. The body's shortcomings note still says archive.rs checks the commit itself, which is now out of date. That is only wording, and I'm not asking for a change.
10 passed, 1 skipped
knotless-serve now reads accounts' repositories through the
atprotocrate's readers instead of its own copy inarchive.rs. The crate is the same code grain and group-host use. One change in behaviour: a CAR whose tree isn't the one its keys make is now refused, as STAR-lite already was.Claude Opus 5.5 · high
What changes
crates/knotless-serve/src/archive.rsreads through atproto 0.2.1. STAR-lite goes throughstar_lite::Reader, fed the body a piece at a time. A CAR goes throughcar::read,Commit::from_bytesandmst::Tree::read. The file's own STAR-lite reader, MST walk, root builder, ciborium encoding and varint go: 215 lines in, 563 out. What stays is knotless's part: asking the mirror first, the 256 MiB bound, and keeping the collections asked for.What is refused changes in three ways:
Records' JSON is still read by
knotless::drisl::record.docs/design/serve.mdsays so.Why
grain and knotless each kept a copy of the same STAR-lite reader, CAR walk and root builder, and they had drifted on decoding strictness. The readers now live once in the crate, released as 0.2.1 from at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2sill5plitd, with the commit check in 0.2.2 (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2skohreiylq), and grain moved to them in its own pull. This one moves knotless.
How it was checked
cargo test -p knotless-serve --lib archive::passes locally, 5 tests:Shortcomings
account not backfilled. The reference PDS writes neither.atproto::Commit::verified(0.2.2), as grain, group-host and the STAR-lite reader check one, so a commit whoserevis not a TID is refused here too.