Skip to content

feat: Improve Bluesky API resiliency - #1956

Merged
dangeredwolf merged 4 commits into
mainfrom
bluesky-api-resiliency
Apr 16, 2026
Merged

dangeredwolf merged 4 commits into
mainfrom
bluesky-api-resiliency

Conversation

@dangeredwolf

@dangeredwolf dangeredwolf commented Apr 16, 2026 •

Copy link
Copy Markdown
Member

Improve Bluesky API resiliency in response to a major Bluesky outage that left the public API completely inoperable.

Summary by CodeRabbit

  • New Features

    • Added Bluesky proxy account support, credential-backed requests across Bluesky endpoints, and a new example Bluesky credentials entry; runtime-derived credential key is honored.
    • Added session caching and JWT management for Bluesky proxy tokens.
  • Bug Fixes

    • Improved upstream request handling with per-attempt timeouts, clearer error outcomes, and smarter retry/fallback to proxy accounts.
  • Tests

    • Added tests covering public vs proxy fallback and credential usage.
  • Tools

    • Updated credential validation and stripping utilities to support Bluesky account formats.

@dangeredwolf dangeredwolf self-assigned this Apr 16, 2026
@dangeredwolf dangeredwolf changed the title feat: bluesky api resiliency feat: Improve Bluesky API resiliency Apr 16, 2026
@coderabbitai

coderabbitai Bot commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds Bluesky proxy credential support and session management: new credentials config, in-memory JWT cache with refresh/create flows, credential-aware Bluesky XRPC execution with proxy-fallback using shuffled proxy accounts, and propagation of credential keys through Bluesky client and API handlers. (45 words)

Changes

Cohort / File(s) Summary
Configuration
credentials.example.json
Added top-level bluesky object with accounts array (identifier, appPassword, service).
Bluesky client & fetch
src/providers/bluesky/client.ts
Added BLUESKY_UPSTREAM_TIMEOUT_MS, BlueskyFetchOpts (credentialKey), new helpers (fetchXrpcOnce, executeBlueskyXrpc, executeBlueskyGetJson), per-attempt aborts, query helpers, centralized response handling, proxy-fallback/retry with shuffled proxy accounts; updated many fetch functions to accept opts.
Session management
src/providers/bluesky/session.ts
New module: in-memory session cache, in-flight dedupe, JWT exp parsing, getBlueskyAccessJwt, invalidateBlueskySession, and proxy cache key helpers.
Bluesky API handlers
src/providers/bluesky/...
src/providers/bluesky/conversation.ts, processor.ts, profile.ts, profileFollowers.ts, profileStatuses.ts, search.ts, statusLikes.ts, statusReposts.ts
Threaded credentialKey from c.env?.CREDENTIAL_KEY into downstream client calls; updated signatures and forwarded BlueskyFetchOpts where required.
Proxy credential infra
src/providers/twitter/proxy/types.ts, src/providers/twitter/proxy/credentials.ts
Added BlueskyProxyCredentials type and optional bluesky?.accounts[] to CredentialStore; added hasBlueskyProxyAccounts() and getShuffledBlueskyAccounts() helpers; minor robustness tweaks to Twitter account helper.
Credential tooling
tools/credential-tools.mjs, tools/stripcredentials.mjs
Validation and stripping updated to accept/validate bluesky.accounts (required fields, service normalization); tools now require at least one non-empty provider list among Twitter/Bluesky and emit sanitized Bluesky entries.
Tests
test/bluesky.client-upstream.test.ts
New Vitest suite mocking credential/session flows and asserting upstream fallback behavior, proxy Authorization header usage, NotFound handling, and preservation of public outage responses.

Sequence Diagram

sequenceDiagram
    participant Client as Client
    participant PublicAPI as Public API (Bluesky)
    participant CredMgr as Credential Manager
    participant Session as Session Cache
    participant ProxyPDS as Proxy PDS (Account)

    Client->>PublicAPI: XRPC request
    PublicAPI-->>Client: 5xx / Error or NotFound-like

    alt Fallback eligible (not NotFound-like)
        Client->>CredMgr: initCredentials(credentialKey)
        CredMgr-->>Client: credentials available

        Client->>Session: getBlueskyAccessJwt(account)
        alt Cached JWT valid
            Session-->>Client: accessJwt
        else need tokens
            Session->>ProxyPDS: refreshSession(refreshJwt) / createSession()
            ProxyPDS-->>Session: accessJwt + refreshJwt
            Session-->>Client: accessJwt
        end

        Client->>ProxyPDS: XRPC Request + Authorization: Bearer <jwt>
        alt 200 OK
            ProxyPDS-->>Client: Response
        else 401 Unauthorized
            Client->>Session: invalidateBlueskySession(account)
            Client->>Session: getBlueskyAccessJwt(nextAccount)
            Session-->>Client: next accessJwt
            Client->>ProxyPDS: Retry with next account
            ProxyPDS-->>Client: Response
        end
    else Not fallback eligible
        Client-->>Client: Return original error / NotFound
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

API

Poem

🐰 I hopped through commits with joy and zest,
New keys and JWTs tucked in my vest,
When public calls falter, proxies I try,
Shuffled accounts ready, I give them a try,
A rabbit's cheer for smoother Sky! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: Improve Bluesky API resiliency' directly and clearly describes the main objective of the changeset - implementing fallback/retry mechanisms and credential-based proxy request handling to improve robustness against Bluesky API outages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bluesky-api-resiliency

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
test/bluesky.client-upstream.test.ts (1)

3-29: Move these provider mocks into test/mocks/.

Keeping the credential/session mocks inline here will get hard to reuse as more fallback cases are added. Extracting them into test/mocks/ will keep the Miniflare test surface consistent with the rest of the suite.

As per coding guidelines, test/**/*.{ts,tsx}: Tests should run inside Miniflare (local Cloudflare Workers simulator) via @cloudflare/vitest-pool-workers and use extensive mocks in test/mocks/.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/bluesky.client-upstream.test.ts` around lines 3 - 29, Extract the inline
mocks (credMocks and sessionMocks) into separate files under test/mocks/ (e.g.,
test/mocks/blueskyCredentialsMock.ts and test/mocks/blueskySessionMock.ts) and
export the same mock objects/functions; then replace the inline vi.mock calls in
test/bluesky.client-upstream.test.ts with imports from those mock modules and
use them in the vi.mock(...) calls for
'../src/providers/twitter/proxy/credentials' and
'../src/providers/bluesky/session' so the test reuses shared mocks across the
suite while preserving the same exported symbols (initCredentials,
hasBundledEncryptedCredentials, hasBlueskyProxyAccounts,
getShuffledBlueskyAccounts, getBlueskyAccessJwt, invalidateBlueskySession).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/providers/bluesky/client.ts`:
- Around line 129-130: initCredentials(credentialKey) can throw and currently
bubbles out of executeBlueskyXrpc, breaking the graceful fallback; wrap the
initCredentials(credentialKey) call in a try/catch inside executeBlueskyXrpc (or
the surrounding init block), and on error log the failure (include credentialKey
context) and continue as if proxy init failed (i.e., do not rethrow and allow
the hasBlueskyProxyAccounts() false-path to run); ensure any state set by
successful init is only applied on success so downstream logic using
hasBlueskyProxyAccounts() behaves correctly.
- Around line 63-76: The timeout is being cleared immediately after fetch,
allowing res.text()/JSON parsing to block indefinitely; keep the AbortController
timeout (variable t) active through the body read and JSON parse. Move the
clearTimeout(t) so it runs only after awaiting res.text() and any JSON.parse,
and ensure all return paths (res.ok false, JSON parse success, JSON parse
failure, and any thrown errors) clear the timeout or otherwise cancel the timer
before returning so the timer does not leak; reference the existing
variables/functions: ac, t, fetch(url, { signal: ac.signal, headers }),
res.text(), clearTimeout(t).

In `@src/providers/bluesky/session.ts`:
- Around line 45-57: The timeout is being cleared immediately after fetch()
returns, allowing a server to stall after headers; keep the abort timer active
until the response body is fully read by moving clearTimeout(t) to after await
res.text()/body parsing in createSession (and similarly in refreshSession), so
the abort signal can still cancel slow body reads; update the blocks around
fetch → await res.text() → JSON.parse(...) in createSession and refreshSession
and only clear the timeout once the body has been consumed and parsed
(preserving existing checks for res.ok and the access/refresh JWT handling).

---

Nitpick comments:
In `@test/bluesky.client-upstream.test.ts`:
- Around line 3-29: Extract the inline mocks (credMocks and sessionMocks) into
separate files under test/mocks/ (e.g., test/mocks/blueskyCredentialsMock.ts and
test/mocks/blueskySessionMock.ts) and export the same mock objects/functions;
then replace the inline vi.mock calls in test/bluesky.client-upstream.test.ts
with imports from those mock modules and use them in the vi.mock(...) calls for
'../src/providers/twitter/proxy/credentials' and
'../src/providers/bluesky/session' so the test reuses shared mocks across the
suite while preserving the same exported symbols (initCredentials,
hasBundledEncryptedCredentials, hasBlueskyProxyAccounts,
getShuffledBlueskyAccounts, getBlueskyAccessJwt, invalidateBlueskySession).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b5274e5-35d4-44fc-a7ab-c7f426bce2dd

📥 Commits

Reviewing files that changed from the base of the PR and between 404fa68 and 85a292d.

📒 Files selected for processing (16)
  • credentials.example.json
  • src/providers/bluesky/client.ts
  • src/providers/bluesky/conversation.ts
  • src/providers/bluesky/processor.ts
  • src/providers/bluesky/profile.ts
  • src/providers/bluesky/profileFollowers.ts
  • src/providers/bluesky/profileStatuses.ts
  • src/providers/bluesky/search.ts
  • src/providers/bluesky/session.ts
  • src/providers/bluesky/statusLikes.ts
  • src/providers/bluesky/statusReposts.ts
  • src/providers/twitter/proxy/credentials.ts
  • src/providers/twitter/proxy/types.ts
  • test/bluesky.client-upstream.test.ts
  • tools/credential-tools.mjs
  • tools/stripcredentials.mjs

Comment thread src/providers/bluesky/client.ts Resolved
Comment thread src/providers/bluesky/client.ts Resolved
Comment thread src/providers/bluesky/session.ts Resolved
@KevSlashNull

Copy link
Copy Markdown
Contributor

didn't read the code because GitHub is stuck on loading, LGTM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/providers/bluesky/session.ts (1)

51-56: Validate the session payload before caching it.

These are external API responses, but the code only does a bare JSON.parse(...) + cast. A malformed payload with truthy non-string JWT fields can still be cached here and later produce broken Authorization headers. Please gate accessJwt / refreshJwt with a small zod schema or explicit string checks before storing them.

As per coding guidelines "Use TypeScript with Hono for routing, i18next for localization, and zod for API validation".

Also applies to: 81-86

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/providers/bluesky/session.ts` around lines 51 - 56, The parsed session
payload is accepted without validating that accessJwt and refreshJwt are
strings, allowing malformed truthy values to be cached; update the code in
src/providers/bluesky/session.ts (the block that parses JSON and returns {
accessJwt, refreshJwt, accessExpiresAtMs }) to validate the payload before
returning: either add a small zod schema (e.g., schema = z.object({ accessJwt:
z.string(), refreshJwt: z.string() })) and parse/throw if invalid, or perform
explicit type checks (typeof j.accessJwt === 'string' && typeof j.refreshJwt ===
'string') and return null on failure; apply the same validation to the second
occurrence that mirrors lines 81-86 and ensure accessExpiresAtMs still uses
parseJwtExpMs(j.accessJwt) fallback logic only after the JWTs are confirmed
valid.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/providers/bluesky/client.ts`:
- Around line 160-163: When attempt.status === 401, call
invalidateBlueskySession(cred) and then immediately re-acquire a fresh token via
getBlueskyAccessJwt(cred) and retry the request for that same cred exactly once
before continuing; implement logic inside the loop around the existing attempt
handling so that after invalidation you attempt the request again with the new
JWT (but ensure you only retry one extra time for that credential to avoid
infinite retries) and fall back to the existing continue behavior if the retried
request still fails.
- Around line 156-158: The current logic returns a proxy NotFound (the if using
isNotFoundError(attempt.status, attempt.body)) which can mask the original
public outage; update the handler in src/providers/bluesky/client.ts so that
when processing fallback proxy attempts you ignore/skip NotFound responses from
proxies if the original public request (e.g. variable publicAttempt or the
initial public response) already proved the record was not missing — only treat
a proxy NotFound as decisive if there was no prior public failure or if a proxy
actually succeeds; in practice change the isNotFoundError(attempt.status,
attempt.body) branch to preserve and return the original public failure unless a
proxy returns success.

---

Nitpick comments:
In `@src/providers/bluesky/session.ts`:
- Around line 51-56: The parsed session payload is accepted without validating
that accessJwt and refreshJwt are strings, allowing malformed truthy values to
be cached; update the code in src/providers/bluesky/session.ts (the block that
parses JSON and returns { accessJwt, refreshJwt, accessExpiresAtMs }) to
validate the payload before returning: either add a small zod schema (e.g.,
schema = z.object({ accessJwt: z.string(), refreshJwt: z.string() })) and
parse/throw if invalid, or perform explicit type checks (typeof j.accessJwt ===
'string' && typeof j.refreshJwt === 'string') and return null on failure; apply
the same validation to the second occurrence that mirrors lines 81-86 and ensure
accessExpiresAtMs still uses parseJwtExpMs(j.accessJwt) fallback logic only
after the JWTs are confirmed valid.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9ed424cb-85dc-410a-96c9-b06081f05cfe

📥 Commits

Reviewing files that changed from the base of the PR and between 85a292d and e2849bd.

📒 Files selected for processing (2)
  • src/providers/bluesky/client.ts
  • src/providers/bluesky/session.ts

Comment thread src/providers/bluesky/client.ts Resolved
Comment thread src/providers/bluesky/client.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/providers/bluesky/client.ts (1)

156-158: ⚠️ Potential issue | 🟠 Major

Do not let proxy NotFound override the original public failure.

At Line 156 and Line 171, returning proxy NotFound can convert a transient public outage into a false 404. Skip these proxy NotFound responses and continue trying other proxy accounts; if none succeed, return first as you already do at Line 179.

Suggested fix
-    if (isNotFoundError(attempt.status, attempt.body)) {
-      return { ok: false, status: attempt.status, body: attempt.body };
-    }
+    if (isNotFoundError(attempt.status, attempt.body)) {
+      continue;
+    }

...

-        if (isNotFoundError(attempt.status, attempt.body)) {
-          return { ok: false, status: attempt.status, body: attempt.body };
-        }
+        if (isNotFoundError(attempt.status, attempt.body)) {
+          continue;
+        }

Also applies to: 171-173

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/providers/bluesky/client.ts` around lines 156 - 158, The current logic
returns a proxy NotFound (when isNotFoundError(attempt.status, attempt.body) is
true), which can mask the original public error; change the loop in the Bluesky
client where attempts are iterated (referencing the attempt variable and
isNotFoundError helper) so that if a proxy attempt yields NotFound you
skip/continue to the next proxy account instead of returning; only if no proxy
succeeds return the previously saved first failure (the first variable) as
already done later. Ensure the same change is applied to both places handling
attempt results (the earlier branch and the later branch that mirrors it).
🧹 Nitpick comments (1)
src/providers/bluesky/client.ts (1)

41-44: Avoid emitting a trailing ? when there are no query params.

Small cleanup: this can reduce cache-key variance and noisy URLs.

Suggested refactor
 function buildXrpcUrl(baseUrl: string, path: string, params: BlueskyXrpcParams): string {
   const qs = paramsToSearchString(params);
-  return `${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`;
+  return qs
+    ? `${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`
+    : `${trimBaseUrl(baseUrl)}/xrpc/${path}`;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/providers/bluesky/client.ts` around lines 41 - 44, buildXrpcUrl currently
always appends "?${qs}" which emits a trailing question mark when
paramsToSearchString(params) returns an empty string; change buildXrpcUrl to
only append the query string segment when qs is non-empty (e.g., call
paramsToSearchString(params) and if it returns a truthy string, return
`${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`, otherwise return
`${trimBaseUrl(baseUrl)}/xrpc/${path}`) so URLs have no trailing '?' and cache
keys/noise are reduced.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/providers/bluesky/client.ts`:
- Around line 156-158: The current logic returns a proxy NotFound (when
isNotFoundError(attempt.status, attempt.body) is true), which can mask the
original public error; change the loop in the Bluesky client where attempts are
iterated (referencing the attempt variable and isNotFoundError helper) so that
if a proxy attempt yields NotFound you skip/continue to the next proxy account
instead of returning; only if no proxy succeeds return the previously saved
first failure (the first variable) as already done later. Ensure the same change
is applied to both places handling attempt results (the earlier branch and the
later branch that mirrors it).

---

Nitpick comments:
In `@src/providers/bluesky/client.ts`:
- Around line 41-44: buildXrpcUrl currently always appends "?${qs}" which emits
a trailing question mark when paramsToSearchString(params) returns an empty
string; change buildXrpcUrl to only append the query string segment when qs is
non-empty (e.g., call paramsToSearchString(params) and if it returns a truthy
string, return `${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`, otherwise return
`${trimBaseUrl(baseUrl)}/xrpc/${path}`) so URLs have no trailing '?' and cache
keys/noise are reduced.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0ec6a9f0-0b95-41e5-a29f-b9c0ffbb2d7e

📥 Commits

Reviewing files that changed from the base of the PR and between e2849bd and f6c5577.

📒 Files selected for processing (1)
  • src/providers/bluesky/client.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/providers/bluesky/client.ts (1)

41-44: Minor: Trailing ? in URL when no query params.

When params is empty, paramsToSearchString returns an empty string, resulting in URLs like https://api.bsky.app/xrpc/path?. Most servers handle this fine, but it's slightly unclean.

♻️ Optional fix
 function buildXrpcUrl(baseUrl: string, path: string, params: BlueskyXrpcParams): string {
   const qs = paramsToSearchString(params);
-  return `${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`;
+  return `${trimBaseUrl(baseUrl)}/xrpc/${path}${qs ? `?${qs}` : ''}`;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/providers/bluesky/client.ts` around lines 41 - 44, The buildXrpcUrl
function can produce a trailing '?' when paramsToSearchString(params) returns an
empty string; update buildXrpcUrl to only append the query string separator when
qs is non-empty (e.g., compute qs = paramsToSearchString(params) and return
`${trimBaseUrl(baseUrl)}/xrpc/${path}` when qs is empty, otherwise return
`${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`), referencing the buildXrpcUrl,
paramsToSearchString, and trimBaseUrl symbols to locate the change.
test/bluesky.client-upstream.test.ts (1)

32-39: Clear all hoisted mocks in beforeEach for test isolation.

Only initCredentials and getBlueskyAccessJwt are cleared, but invalidateBlueskySession and the other credential mocks retain call history between tests. As the test suite grows, this could cause flaky tests or false positives when asserting call counts.

♻️ Suggested fix
 beforeEach(() => {
   credMocks.initCredentials.mockClear();
+  credMocks.hasBundledEncryptedCredentials.mockClear();
+  credMocks.hasBlueskyProxyAccounts.mockClear();
+  credMocks.getShuffledBlueskyAccounts.mockClear();
   sessionMocks.getBlueskyAccessJwt.mockClear();
+  sessionMocks.invalidateBlueskySession.mockClear();
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/bluesky.client-upstream.test.ts` around lines 32 - 39, The tests only
clear credMocks.initCredentials and sessionMocks.getBlueskyAccessJwt in
beforeEach, leaving other hoisted mocks (e.g.,
credMocks.invalidateBlueskySession and any other credential/session mock
functions) with retained call history; update the setup to clear all mocks at
the start of each test by calling vi.clearAllMocks() (or explicitly mockClear()
the remaining mocks like credMocks.invalidateBlueskySession) in beforeEach so
initCredentials, invalidateBlueskySession, getBlueskyAccessJwt, and any other
hoisted mocks are reset before each test while keeping vi.restoreAllMocks() in
afterEach.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/providers/bluesky/client.ts`:
- Around line 41-44: The buildXrpcUrl function can produce a trailing '?' when
paramsToSearchString(params) returns an empty string; update buildXrpcUrl to
only append the query string separator when qs is non-empty (e.g., compute qs =
paramsToSearchString(params) and return `${trimBaseUrl(baseUrl)}/xrpc/${path}`
when qs is empty, otherwise return
`${trimBaseUrl(baseUrl)}/xrpc/${path}?${qs}`), referencing the buildXrpcUrl,
paramsToSearchString, and trimBaseUrl symbols to locate the change.

In `@test/bluesky.client-upstream.test.ts`:
- Around line 32-39: The tests only clear credMocks.initCredentials and
sessionMocks.getBlueskyAccessJwt in beforeEach, leaving other hoisted mocks
(e.g., credMocks.invalidateBlueskySession and any other credential/session mock
functions) with retained call history; update the setup to clear all mocks at
the start of each test by calling vi.clearAllMocks() (or explicitly mockClear()
the remaining mocks like credMocks.invalidateBlueskySession) in beforeEach so
initCredentials, invalidateBlueskySession, getBlueskyAccessJwt, and any other
hoisted mocks are reset before each test while keeping vi.restoreAllMocks() in
afterEach.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7d959697-1ae2-44c6-bdcd-39acbe455db1

📥 Commits

Reviewing files that changed from the base of the PR and between f6c5577 and 679ab7f.

📒 Files selected for processing (2)
  • src/providers/bluesky/client.ts
  • test/bluesky.client-upstream.test.ts

@dangeredwolf
dangeredwolf merged commit b79072a into main Apr 16, 2026
4 checks passed
@dangeredwolf
dangeredwolf deleted the bluesky-api-resiliency branch April 16, 2026 12:19
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