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

A moved group's commit is checked by atproto's Commit::verified

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:migration/commit-verified

What changes

A moved or imported group's commit is checked by atproto::Commit::verified. repo_writes (used by migration.rs and import.rs) used to check the CAR's commit against the group's DID and key itself. It now calls the crate, which also requires the commit's rev to be a TID.

The workspace moves from atproto 0.2.0 to 0.2.2 (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2sill5plitd, at://did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2skohreiylq). Those versions add streaming STAR-lite, CAR and tree readers and Commit::verified, none of which the host calls beyond this. car::read now refuses a length not written in its shortest form; this crate's own CARs, which a source host sends, never contain one.

Why

grain, knotless and the STAR-lite reader each checked a commit read from elsewhere, each a little differently: grain checked the TID, and knotless and the host did not. The check now lives once, in the crate.

How it was checked

The checks pass: the migration, import and account-move tests move groups between hosts and import repos, so they run repo_writes on real CARs. Their test repos had been signed at rev 3lz, which isn't a TID; they now use a real TID. The first run's e2e failure was a request-ordering check in a sites flow, and it passed on the rerun.

Shortcomings

A repo whose commit rev is not a TID is no longer moved or imported. Every PDS and this host write TIDs.

Approved

This swaps the hand-written commit check in repo_writes (migration.rs) for atproto::Commit::verified(bytes, group, key). It also moves the lockfile from atproto 0.2.0 to 0.2.2. The "0.2" requirement in Cargo.toml already allows 0.2.2, so no manifest change is needed.

The new call keeps the old DID and signature checks and adds the TID check on rev. The ? on .ok() keeps the function's Option contract. The diff is small and matches the description. The test and check runs were still queued when I looked, and web, docs and lexicons were skipped. I couldn't confirm that the migration and import tests pass on 0.2.2, including the stricter car::read. The 100% coverage gate should still hold, since the change removes lines and adds none that can go unrun.

Approved

Since my approval at 6e63f3b, the pull changes only the three test helpers (account_move.rs, import.rs, migration.rs). Each now signs its test commit with a valid TID, 3l5mz5mkbn22b, instead of "3lz". That is the fix Commit::verified needs, since the old rev would now be refused. The change is test-only and my earlier approval stands. The check run (fmt, clippy) passed. test and e2e were still running when I looked, so I haven't seen the migration and import tests pass on 0.2.2.

Merged as b2188ac