Skip to content

Profile fixes#133

Closed
Kzoeps wants to merge 15 commits into
hypercerts-org:developfrom
Kzoeps:profile-fixes
Closed

Profile fixes#133
Kzoeps wants to merge 15 commits into
hypercerts-org:developfrom
Kzoeps:profile-fixes

Conversation

@Kzoeps
Copy link
Copy Markdown
Contributor

@Kzoeps Kzoeps commented Feb 16, 2026

Summary by CodeRabbit

  • New Features

    • Rich text utilities for automatic facet detection from text (URLs, hashtags, mentions)
    • URI validation for attachment content
    • Dual profile system supporting Bluesky and Certified profiles
    • OAuth handle resolver configuration
    • PDS auto-detection from OAuth sessions
  • Breaking Changes

    • Profile API redesigned with separate methods for Bluesky vs Certified profiles
    • Repository retrieval now returns a Promise
    • Explicit PDS URL configuration removed in favor of auto-detection
  • Documentation

    • Added Beads issue tracker setup and configuration guides
    • Enhanced JSDoc coverage for collection and profile methods

aspiers and others added 15 commits February 16, 2026 12:32
- Add RichText utility (src/lib/rich-text.ts) with createFacetsFromText()
  and createFacetsFromTextSync() for auto-detecting mentions, URLs, hashtags
- Add comprehensive tests for RichText utility (11 tests)
- Export RichText utilities from main index
- Enhance JSDoc for createCollection, updateCollection, createProject,
  updateProject with avatar/banner examples
- Update spec file to mark Change 2 and Change 3 as complete
Without this patch, blob uploads always use the PDS endpoint
(com.atproto.repo.uploadBlob) regardless of server type, and profile
operations incorrectly route through non-existent com.sds.repo.*
endpoints. This causes blob uploads to fail on SDS servers because the
repository DID is never passed.

This patch solves the problem by:

1. Using com.sds.repo.uploadBlob with the repo query parameter for SDS
   servers, and com.atproto.repo.uploadBlob for PDS servers
2. Removing incorrect SDS routing from profile operations — SDS servers
   override standard ATProto endpoints rather than exposing separate ones
3. Extracting a shared BlobOperations interface with dependency injection,
   eliminating duplicate blob upload code across HypercertOperationsImpl,
   ProfileOperationsImpl, and BlobOperationsImpl
4. Adding a ProfileOperationsImpl.create() method for creating new
   profiles without the read-modify-write pattern
5. Refactoring applyParamsToProfile with helper methods to reduce
   duplication

Co-authored-by: Claude <noreply@anthropic.com>
- Document CreateLocationParams with examples for string, URL, Blob, and structured formats
- Add documentation for LocationParams union type
- Add JSDoc to resolveLocationValue explaining format handling
- Add examples to createLocationRecord method

Closes hypercerts-sdk-38n
- Add test for attachLocation with simple text string (beta.13+ format)
- Add test for attachLocation with geo: URI string
- Add test for createCollection with simple text location string
- Verify strings get wrapped in URI ref format

Closes hypercerts-sdk-d2e
- @hypercerts-org/sdk-core: 0.10.0-beta.8
- @hypercerts-org/sdk-react: 0.10.0-beta.9
@Kzoeps Kzoeps self-assigned this Feb 16, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: bcd0492

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hypercerts-org/sdk-core Minor
@hypercerts-org/sdk-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 16, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces comprehensive SDK enhancements including PDS auto-detection from OAuth sessions, a dual profile API supporting both Bluesky and Certified profiles, blob operations dependency injection, RichText facet utilities, URI validation, and handleResolver configuration. Also integrates Beads issue tracking and updates React SDK hooks accordingly.

Changes

Cohort / File(s) Summary
Beads Integration
.beads/.gitignore, .beads/README.md, .beads/config.yaml, .beads/issues.jsonl, .beads/metadata.json, .gitattributes
Adds Beads AI-native issue tracker with configuration, documentation, metadata, gitignore rules, and custom merge driver for JSONL files.
Configuration & OAuth
packages/sdk-core/src/core/config.ts, packages/sdk-core/src/auth/OAuthClient.ts, packages/sdk-core/src/testing/mocks.ts, packages/sdk-core/tests/utils/fixtures.ts, packages/sdk-core/tests/core/config.test.ts
Removes configurable PDS from ServerConfigSchema; adds handleResolver field for handle resolution during OAuth; updates OAuth client and test fixtures to use handleResolver instead of servers.pds.
PDS Auto-Detection & Session Handling
packages/sdk-core/src/core/SDK.ts, packages/sdk-core/tests/core/SDK.test.ts
Adds sessionPdsMap caching, resolveSessionPds() method, makes repository() async with auto-detection logic, caches PDS URLs from OAuth token info; comprehensive test coverage for cache hit/miss and resolution flows.
Blob Operations Refactoring
packages/sdk-core/src/repository/BlobOperationsImpl.ts, packages/sdk-core/src/repository/Repository.ts, packages/sdk-core/tests/repository/BlobOperationsImpl.test.ts, packages/sdk-core/tests/utils/mocks.ts
Extracts BlobOperations abstraction; adds isSDS flag for SDS-specific uploads; introduces uploadViaSDS method; updates constructor signatures across repository implementations; adds comprehensive mocking utilities.
Profile API Split (Bluesky & Certified)
packages/sdk-core/src/repository/ProfileOperationsImpl.ts, packages/sdk-core/src/repository/interfaces.ts, packages/sdk-core/src/services/hypercerts/types.ts, packages/sdk-core/tests/repository/ProfileOperationsImpl.test.ts
Replaces generic profile methods with dual-profile API: getBskyProfile/createBskyProfile/updateBskyProfile and getCertifiedProfile/createCertifiedProfile/updateCertifiedProfile; adds upsert variants; extensive image handling for both profile types; new parameter types.
Hypercert Operations & Utilities
packages/sdk-core/src/repository/HypercertOperationsImpl.ts, packages/sdk-core/src/lib/blob-url.ts, packages/sdk-core/src/lib/url-utils.ts, packages/sdk-core/src/lib/rich-text.ts, packages/sdk-core/tests/repository/HypercertOperationsImpl.test.ts, packages/sdk-core/tests/lib/*
Refactors blob handling with BlobOperations injection; adds utilities for blob URL construction, URI validation (isValidUri), and RichText facet detection (createFacetsFromText/createFacetsFromTextSync); comprehensive validation for attachments.
Type & Export Updates
packages/sdk-core/src/index.ts, packages/sdk-core/src/lexicons.ts, packages/sdk-core/src/repository/types.ts, packages/sdk-core/src/types.ts
Exports new utilities (getBlobUrl, extractCidFromImage, isValidUri, RichText facets); adds ACTOR_PROFILE lexicon; exposes BSKY_PROFILE and CERTIFIED_PROFILE collection constants; adds deprecated BlobUploadResult type.
React SDK Hook Changes
packages/sdk-react/src/hooks/useProfile.ts, packages/sdk-react/src/hooks/useRepository.ts, packages/sdk-react/src/types.ts, packages/sdk-react/src/utils/ssr.ts, packages/sdk-react/tests/hooks/useProfile.test.tsx
Renames useProfile's update→save and isUpdating→isSaving; switches to getCertifiedProfile/upsertCertifiedProfile; refactors useRepository to use useQuery for explicit repository fetching; adds banner field to Profile type.
Package Metadata & Dependencies
packages/sdk-core/package.json, packages/sdk-core/CHANGELOG.md, packages/sdk-react/package.json, packages/sdk-react/CHANGELOG.md
Bumps sdk-core to 0.10.0-beta.8 and sdk-react to 0.10.0-beta.9; updates @atproto/api and @hypercerts-org/lexicon dependencies; adds multiformats and @types/* devDependencies; updates check scripts.
Changesets
.changeset/*, .changeset/pre.json
Documents breaking changes (PDS removal, profile API split, blob operations), new features (RichText utilities, URI validation, handleResolver), and enhanced JSDoc coverage across multiple changeset files.
Documentation & Specifications
AGENTS.md, CERTS_SDK.md, specs/02-repository-and-lexicons.md, specs/04-react-and-clients.md, specs/06-sdk-api-refinement.md, packages/sdk-core/README.md
Updates documentation to reflect PDS auto-detection narrative, handleResolver usage, dual-profile API, session-based PDS routing; adds session completion workflow guidance; updates SDK initialization examples.
Build Configuration
turbo.json
Simplifies task dependencies: removes install task; updates lint/test to depend on build; removes typecheck dependencies; refactors check and format:check as standalone tasks.
Test Infrastructure & Fixtures
packages/sdk-core/tests/utils/repository-fixtures.ts, packages/sdk-react/src/testing/factory.tsx, packages/sdk-react/src/testing/mocks.ts, packages/sdk-react/tests/testing/mocks.test.ts, packages/sdk-react/tests/utils/fixtures.ts
Updates mock implementations for new blob operations, profile hooks (save/isSaving), and repository handling; updates workScope typing for Hypercert mocks; expands test fixtures with handleResolver and new query keys.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ATProtoSDK
    participant OAuth
    participant Session
    participant PDS as PDS (from Token)

    Note over Client,PDS: PDS Auto-Detection Flow
    
    Client->>OAuth: Initiate OAuth flow with handleResolver
    OAuth->>Session: Create session after callback
    Note over Session: tokenInfo.aud contains PDS URL
    
    Client->>ATProtoSDK: callback(params)
    ATProtoSDK->>Session: Extract aud from tokenInfo
    ATProtoSDK->>ATProtoSDK: Cache PDS URL in sessionPdsMap[did]
    
    Client->>ATProtoSDK: repository(session)
    ATProtoSDK->>ATProtoSDK: Check sessionPdsMap cache
    alt Cache Hit
        ATProtoSDK->>ATProtoSDK: Use cached PDS URL
    else Cache Miss
        ATProtoSDK->>ATProtoSDK: resolveSessionPds(session)
        ATProtoSDK->>Session: Extract aud from tokenInfo
        ATProtoSDK->>ATProtoSDK: Cache new PDS URL
    end
    ATProtoSDK-->>Client: Return Repository with resolved PDS
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Suggested reviewers

  • aspiers
  • bitbeckers

🐰 Hops excitedly through the diffs

Sessions now find their own PDS home,
Profiles split bravely—Bluesky and Cert roam,
Blobs flow through operators with care,
RichText facets dance everywhere!
From OAuth's sweet token, discovery's born—
The SDK rises, reimagined and worn! 🌟

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kzoeps Kzoeps closed this Feb 16, 2026
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.

2 participants