feat(pds): implement XRPC endpoints, auth, and TypeScript fixes - #3
Merged
Conversation
- Implement full XRPC endpoint suite (sync, repo, server identity) - Add bearer token authentication for write operations - Fix TypeScript module resolution for multiformats packages - Add environment variable validation with fail-fast startup - Implement health endpoint with version info - Add comprehensive integration tests (34 tests passing) - Follow Durable Objects best practices (RPC-first architecture) - Update documentation (EDGE_PDS_PLAN.md, CLAUDE.md) Completes Phase 3 (XRPC), Phase 6 (Identity), and Phase 7 (Auth). All TypeScript diagnostics resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replace manual CAR building and low-level encoding with official @atproto packages: - Replace manual CAR file building (~30 lines) with blocksToCarFile from @atproto/repo - Switch all CID operations to @atproto/lex-data (resolves deprecation warnings) - Use @atproto/lex-cbor for CBOR encoding/decoding in tests Dependencies: - Add @atproto/lex-cbor, @atproto/lex-data - Remove varint, @types/varint, cborg, uint8arrays (replaced by blocksToCarFile) - Remove @ipld/dag-cbor, multiformats (replaced by @atproto/lex-cbor) Files: - Delete src/types/modules.d.ts (no longer needed) - Delete test/types.d.ts (no longer needed) - Update src/account-do.ts: use blocksToCarFile and @atproto/lex-data CID - Update src/storage.ts: use @atproto/lex-data CID - Update test/storage.test.ts: use @atproto/lex-cbor for test fixtures All encoding and format operations now use official @atproto stable APIs. Tests: 34/34 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace manual protocol operations with official @atproto utilities for better standards compliance and maintainability. Record Key Generation: - Replace custom Date.now() + Math.random() with TID.nextStr() from @atproto/common-web - Ensures proper chronological ordering with microsecond precision - Provides monotonic incrementing per AT Protocol standard - Remove generateRkey() helper in favor of direct TID.nextStr() calls AT URI Construction: - Replace manual template literal URIs with AtUri.make() from @atproto/syntax - Ensures proper URI encoding and structure validation - Updated in account-do.ts (rpcListRecords, rpcCreateRecord) and repo.ts (getRecord) DID Validation: - Add ensureValidDid() validation in all XRPC endpoints that accept DID parameters - Validates DID format before processing requests - Updated: repo.ts (describeRepo, getRecord, listRecords), sync.ts (getRepo, getRepoStatus) Handle Validation: - Add ensureValidHandle() validation in server.ts resolveHandle endpoint - Validates handle format before processing requests Environment Variable Validation: - Move validation to module scope using cloudflare:workers env import - Validates once at worker startup instead of per-request - Worker fails fast at initialization if misconfigured - Remove test/env-validation.test.ts (incompatible with module-scope validation) Dependencies: - Add @atproto/common-web for TID utilities All protocol-adjacent operations now use official @atproto helpers for consistency and standards compliance. Tests: 28/28 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 30, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
ascorbic
added a commit
that referenced
this pull request
Aug 31, 2026
check.cirrus.earth gains a 'space conformance' view: point it at any spaces host and it runs the discovery and request-shape checks against it. It imports only the dependency-free package root, so the alpha crypto libs never enter the browser bundle (verified: no atproto-space/node markers in dist) — the credential, sync and host-role checks declare capabilities the browser cannot provide and are reported as not-testable rather than silently skipped. Third of the three runners, all over the same catalog: in-process (vitest), CLI, and now browser — each honest about what it can and cannot exercise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the core XRPC endpoints, authentication, and resolves all TypeScript diagnostic errors, completing Phases 3, 6, and 7 of the Edge PDS implementation plan.
Test Plan
All tests passing:
Technical Details
XRPC Endpoints Implemented
Tier 1: Sync (Federation)
com.atproto.sync.getRepo- Export repository as CAR filecom.atproto.sync.getRepoStatus- Get repository statusTier 2: Repository Operations
com.atproto.repo.describeRepo- Describe repository metadatacom.atproto.repo.getRecord- Get a single recordcom.atproto.repo.listRecords- List records in a collectioncom.atproto.repo.createRecord- Create a new record (authenticated)com.atproto.repo.deleteRecord- Delete a record (authenticated)Tier 3: Server Identity
com.atproto.server.describeServer- Server metadatacom.atproto.identity.resolveHandle- Handle resolutionTypeScript Fixes
moduleResolution: "bundler"to tsconfig.jsonsrc/types/modules.d.tsfor packages with broken exports@cloudflare/vitest-pool-workers/typesRpc.Serializable<T>for DO RPC return typesArchitecture Improvements
blockConcurrencyWhile🤖 Generated with Claude Code