Skip to content

feat(id): id-import-atproto — verified AT Protocol read slice - #16783

Merged
dezren39 merged 2 commits into
mainfrom
xaltha/13787-atproto-read
Nov 29, 2026
Merged

dezren39 merged 2 commits into
mainfrom
xaltha/13787-atproto-read

Conversation

@dezren39

@dezren39 dezren39 commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

First slice of #13787 (AT Protocol read compatibility), scoped in the claim comment on the issue: the verified read path as a new leaf crate, pkgs/id/crates/id-import-atproto.

What's in

  • DID resolution — did:plc by audit-log chain verification (entry CIDs recomputed, prev links, rotation-key signatures; the DID document is derived from the final verified op; legacy create genesis ops supported). This is the issue's open question 1 answered with its own recommendation: (b) verify the chain, trust plc.directory only for availability. did:web via /.well-known/did.json with id match. Handle resolution via DNS TXT / well-known with the bidirectional alsoKnownAs check.
  • Verified repo ingest — CAR v1 reader; every block's hash checked against its CID; commit signature verified against the repo key from the verified DID document; rev monotonicity against the caller's last accepted rev; full MST walk (prefix reconstruction, fanout-4 layer checks, strictly-increasing keys); every record block present. Unknown lexicons stay opaque verbatim records.
  • Provenance manifest — per-ingest manifest (DID, handle, PDS, repo key, commit, rev, record CIDs); diff emits deletion marks (last known CID, deleted: true) for records that vanish upstream, so mirrors honour deletions deliberately rather than by silence.
  • Light PDS reads — describeRepo/listRecords/getRecord/getRepo as a separate, explicitly unverified path, so a light read can never be mistaken for a verified one.
  • Transport is injected (the id-import-notion pattern): the crate does no network I/O and every test runs offline against fakes, with oracle-named tests for each verification property (tampered block, wrong key, broken PLC prev link, high-S signature, rev regression, …).

Remainder on #13787 (not this PR): applying ingested records into id's store/events and a CLI surface; live follow (subscribeRepos/Jetstream-shaped); blob fetching/referencing policy.

Verification: remote dispatch of cargo test -p id-import-atproto at the exact head; results posted on this PR before merge.

Refs #13787

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-29T12:59:10Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch/workspace/github-work/w0647-l10",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch/workspace/github-work/w0647-l10",
      "repo": "developing-today/code",
      "branch": "xaltha/13787-atproto-read",
      "sha": "9fc482badb1f253e2a748256d06634a0b2b0c7f7"
    },
    "auth_subject": "xaltha",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…13787)

New leaf crate pkgs/id/crates/id-import-atproto (no id-* deps, transport
injected, the id-import-notion shape):

- DID resolution: did:plc via audit-log chain verification (entry CIDs,
  prev links, rotation-key signatures; document derived from the final
  op; legacy create genesis supported), did:web via /.well-known/did.json,
  handle resolution via DNS TXT / well-known with the bidirectional
  alsoKnownAs check.
- Verified repo ingest: CAR v1 reader, per-block hash checks, commit
  signature verification against the DID document's repo key, rev
  monotonicity, full MST walk (prefix reconstruction, fanout-4 layer
  checks, in-order keys), record-block presence.
- Provenance manifests with deletion marks (diff emits last-known-CID
  tombstones for records that vanish upstream).
- Light PDS reads (describeRepo/listRecords/getRecord/getRepo) kept as a
  separate, explicitly unverified path.
- Hand-rolled CIDv1/dag-cbor, canonical DAG-CBOR codec, and base32/58
  primitives; signing via k256/p256 on the ecdsa 0.16 line they use.
  Oracle-named tests throughout, all offline (injected fakes).

Refs #13787. Remainder on the issue: CLI/store application of ingested
records, live follow, blob fetching.
@coderabbitai

coderabbitai Bot commented Nov 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 28 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: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bd50bdec-4229-4dcf-ad25-fb250b93bf56
Commits

Reviewing files that changed from the base of the PR and between 5b48d26 and 5afc713.

Files ignored due to path filters: 1

  • pkgs/id/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 14

  • pkgs/id/Cargo.toml
  • pkgs/id/crates/id-import-atproto/Cargo.toml
  • pkgs/id/crates/id-import-atproto/src/car.rs
  • pkgs/id/crates/id-import-atproto/src/cbor.rs
  • pkgs/id/crates/id-import-atproto/src/cid.rs
  • pkgs/id/crates/id-import-atproto/src/did.rs
  • pkgs/id/crates/id-import-atproto/src/error.rs
  • pkgs/id/crates/id-import-atproto/src/lib.rs
  • pkgs/id/crates/id-import-atproto/src/manifest.rs
  • pkgs/id/crates/id-import-atproto/src/mst.rs
  • pkgs/id/crates/id-import-atproto/src/pds.rs
  • pkgs/id/crates/id-import-atproto/src/plc.rs
  • pkgs/id/crates/id-import-atproto/src/repo.rs
  • pkgs/id/crates/id-import-atproto/src/resolve.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

@dezren39

Copy link
Copy Markdown
Member Author

Verification dispatched at exact head 9fc482bad: fleet-command run 46265072133 — cargo test -p id-import-atproto + cargo clippy -p id-import-atproto --all-targets in the pkgs/id nix dev shell. Conclusion will be posted here before merge. (Lane 0647-L10R; the queue broker tunnel is down fleet-side, so this lane runs the fallback route per the work-loop core.)

@dezren39

Copy link
Copy Markdown
Member Author

Run 46265072133 attribution (CI log read): FAILURE was environmental, before any compilation — cargo could not open ecdsa-0.16.9.crate in the fleet runner's shared cargo cache (Permission denied, os error 13); the cache slot for the newly resolved crate version is poisoned. No code compiled, so nothing about the change is implicated. Re-dispatched as run 46267438160 with a fresh per-run CARGO_HOME at the same head 9fc482bad.

- mst::collect_records: name the block-source lifetime ('a) — E0106.
- cbor Decoder tag-42 branch: copy the link bytes out of the decoder
  borrow before error handling borrows it again — E0502.
- pds::PdsClient: manual Debug impl (a dyn Fetcher is not Debug) and
  scope the test's client so the fetcher borrow ends before asserting
  on it — E0277/E0609.

Run 46267438160 (fresh CARGO_HOME) reached compilation and reported
exactly these; the earlier run 46265072133 never compiled (poisoned
shared cargo cache slot for ecdsa-0.16.9.crate).
@dezren39

Copy link
Copy Markdown
Member Author

Run 46267438160 attribution: with a fresh CARGO_HOME the build reached compilation and failed on four real errors in the new crate (missing lifetime on mst::collect_records, a borrow conflict in the CBOR tag-42 branch, PdsClient Debug over a trait object, and the pds test asserting through the client borrow). All four fixed in 5afc713, pushed. Re-dispatched at exact head 5afc713: run 46272942359 (https://github.com/developing-today/fleet/actions/runs/46272942359).

@dezren39
dezren39 merged commit 3c6ffe1 into main Nov 29, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/13787-atproto-read branch November 29, 2026 14:54
@dezren39

Copy link
Copy Markdown
Member Author

Post-merge verification status (lane 0647-L10R): this PR merged at 5afc713 while run 46272942359 was still queued; that run then failed at checkout (branch deleted on merge — command never ran). Post-merge runs against main: 46278177479 and 46281309620 both died in nix flake evaluation before the command ran (the runner checkout's .git/fleet-credentials.config is locked/permissions-blocked for the vscode user — a fleet-runner venue defect, reproduced twice). Workaround dispatched as run 46283942741 (copies pkgs/id out of the git tree before nix develop, fresh CARGO_HOME): it is still QUEUED — as of this comment the fleet-command queue shows 30 runs queued and zero in progress, i.e. the runner pool is stalled fleet-side. When the pool recovers, 46283942741's conclusion is the verification of record for this crate on main; if it is red, lane 0647-L10R (or the on-duty lane) fixes forward with a follow-up PR. The compile fixes in 5afc713 were written directly from run 46267438160's compiler errors (E0106/E0502/E0277/E0609), but the test suite has not yet had a completed run — stated plainly so nobody reads this merge as test-verified.

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