Skip to content

refactor(web): consolidate API layer onto @cipherbox/api-client#309

Merged
FSM1 merged 9 commits into
mainfrom
refactor/consolidate-api-client
Mar 22, 2026
Merged

refactor(web): consolidate API layer onto @cipherbox/api-client#309
FSM1 merged 9 commits into
mainfrom
refactor/consolidate-api-client

Conversation

@FSM1

@FSM1 FSM1 commented Mar 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Eliminates 3 separate HTTP client paths in the web app, consolidating onto the shared @cipherbox/api-client package
  • Adds 401 refresh interceptor with shared-promise deduplication to @cipherbox/api-client — fixes token refresh being broken on the web app
  • Removes ~8800 lines of duplicate orval-generated code (apps/web/src/api/)
  • Removes the standalone axios client (lib/api/client.ts) and fetch-based custom-instance.ts

Changes

@cipherbox/api-client (packages/api-client/src/instance.ts)

  • Added refreshAccessToken, withCredentials, onRefreshFailure to ApiClientConfig
  • 401 response interceptor retries once with new token, deduplicates concurrent refreshes
  • Skips retry for /auth/refresh to prevent infinite loops

Web app

  • Deleted: apps/web/orval.config.ts, entire apps/web/src/api/ directory, lib/api/client.ts
  • New: lib/api-config.ts (early setApiClientConfig with refresh + cookies), hooks/useHealthCheck.ts (thin react-query wrapper)
  • Rewritten: lib/api/auth.ts, lib/api/vault.ts, lib/api/ipfs.ts as thin adapters over @cipherbox/api-client
  • Updated imports: 11 consumer files switched from ../api/foo/foo to @cipherbox/api-client

Motivation

The web app had three HTTP client paths: orval-generated fetch (custom-instance.ts), hand-written axios (lib/api/client.ts), and bare axios/fetch (lib/api/ipfs.ts). Token refresh only existed on the axios client, which was only used during login. The orval-generated client (used for all normal operations) had zero 401 handling — so sessions died after 15min.

Test plan

  • @cipherbox/api-client builds clean
  • Web app builds clean (zero type errors)
  • All 23 web unit tests pass
  • Manual smoke test: login, browse files, upload/download, verify session survives >15min
  • Verify token refresh works (watch Network tab for POST /auth/refresh + successful retry)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a centralized health-check hook and early API client configuration to initialize the SDK at app startup.
  • Refactor

    • Switched app modules to use a consolidated generated API client and DTOs instead of local HTTP implementations.
    • Removed the custom HTTP client and in-app token-refresh coordination in favor of SDK-managed behavior.
  • Tests

    • Removed a legacy token-refresh test suite.
  • Chores

    • Simplified generation scripts, removed Orval/tooling and related helper scripts, and narrowed CI formatting checks.

FSM1 and others added 4 commits March 21, 2026 18:45
… to instance

- Add refreshAccessToken, withCredentials, and onRefreshFailure to ApiClientConfig
- Add shared-promise 401 response interceptor to getCachedInstance()
- Deduplicate concurrent refresh requests with same pattern as web's client.ts
- Skip retry for /auth/refresh URL to prevent infinite loops

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 6138361d088c
- Create lib/api-config.ts for early setApiClientConfig() at module load
- Import api-config in main.tsx before any auth API calls
- Rewrite lib/api/auth.ts as thin adapter delegating to api-client
- Rewrite lib/api/vault.ts as thin adapter delegating to api-client
- Rewrite lib/api/ipfs.ts with progress/cancel support via api-client
- Create hooks/useHealthCheck.ts replacing orval react-query hook
- Update all 11 consumer files to import from @cipherbox/api-client
- Remove redundant setApiClientConfig call in useAuth.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: f6790debadb5
- Remove entire apps/web/src/api/ directory (orval-generated react-query hooks)
- Remove apps/web/orval.config.ts (no longer needed)
- Remove apps/web/src/lib/api/client.ts (replaced by api-client instance)
- Remove apps/web/src/lib/api/__tests__/client-refresh.test.ts (tested at api-client level)
- Remove orval and axios-mock-adapter from web devDependencies
- Remove api:generate script from web package.json
- Update root api:generate to use @cipherbox/api-client generate + build
- Update CLAUDE.md to reference packages/api-client paths
- Add backward-compatible QuotaResponse/VaultResponse type aliases

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 21, 2026

Copy link
Copy Markdown

Walkthrough

Centralizes API client generation into @cipherbox/api-client, removes local Orval config and Axios-based client/tests, adds module-scope API client initialization (apps/web/src/lib/api-config.ts) and early import in main.tsx, and updates many web imports/hooks/services to use generated controllers and DTOs from @cipherbox/api-client.

Changes

Cohort / File(s) Summary
Generation scripts & root package
package.json, .claude/claude.md
api:generate now runs OpenAPI generation then @cipherbox/api-client generate+build; docs updated to require committing packages/api-client/src/generated/ and packages/api-client/src/models/.
Web-level Orval & helpers removed
apps/web/orval.config.ts, apps/web/scripts/fix-orval-imports.mjs, apps/web/package.json
Deleted local Orval config and import-fix script; removed web api:generate script and removed orval and axios-mock-adapter devDeps.
CI: api-spec job narrowed
.github/workflows/ci.yml
CI now formats/checks packages/api-client/openapi.json and diffs packages/api-client/ instead of apps/web/src/api/ artifacts.
Module-scope API init
apps/web/src/lib/api-config.ts, apps/web/src/main.tsx
Added api-config.ts that calls setApiClientConfig (baseUrl, withCredentials, get/refresh token, onRefreshFailure) and imports it early in main.tsx.
Removed Axios client & related tests
apps/web/src/lib/api/client.ts, apps/web/src/lib/api/__tests__/client-refresh.test.ts
Removed custom Axios instance, interceptors, coordinated refresh logic, and the refresh test suite.
New/changed hooks
apps/web/src/hooks/useHealthCheck.ts, apps/web/src/hooks/useAuth.ts
Added useHealthCheck (React Query wrapper over generated health controller); useAuth no longer configs client at login—relies on module-level init.
API wrappers migrated to generated client
apps/web/src/lib/api/*.ts (auth.ts, vault.ts, ipfs.ts, etc.)
Replaced local HTTP implementations and types with @cipherbox/api-client controller calls and DTO aliases; adjusted signatures/types where applicable (notably auth, vault, ipfs).
IPFS behavior adjusted
apps/web/src/lib/api/ipfs.ts
Uploads/unpin/get now call generated controllers; download now converts returned Blob to Uint8Array and uses controller-provided progress wiring instead of manual streaming logic.
Component/service import updates
apps/web/src/components/..., apps/web/src/services/..., apps/web/src/routes/Login.tsx
Many components and services now import controller functions and DTOs from @cipherbox/api-client; login/status UI switched to useHealthCheck.
Misc type/import tweaks
apps/web/src/lib/crypto/key-wrapping.ts, apps/web/src/components/file-browser/ShareDialog.tsx, ...
Small import/type updates to use DTO types from @cipherbox/api-client.

Sequence Diagram(s)

sequenceDiagram
  participant UI as "UI Component"
  participant ApiPkg as "@cipherbox/api-client"
  participant ApiConfig as "apps/web/lib/api-config (module)"
  participant AuthStore as "Auth Store"
  participant Server as "API Server"

  UI->>ApiPkg: call controller (e.g., GET /resource)
  ApiPkg-->>Server: HTTP request
  Server-->>ApiPkg: 401 Unauthorized
  ApiPkg->>ApiConfig: trigger refresh via authControllerRefresh
  ApiConfig->>Server: POST /auth/refresh
  Server-->>ApiConfig: 200 { accessToken }
  ApiConfig->>AuthStore: set accessToken, set authenticated
  ApiConfig->>ApiPkg: subsequent requests include new token
  ApiPkg->>Server: retry original request with new token
  Server-->>ApiPkg: 200 OK
  ApiPkg-->>UI: return data
  alt refresh fails
    ApiConfig->>AuthStore: clear stores / logout
    ApiPkg-->>UI: propagate error
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% 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 title clearly and specifically describes the main change: consolidating the web app's API layer onto the shared @cipherbox/api-client package, which is the central purpose of this refactor.

✏️ 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 refactor/consolidate-api-client

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

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)
apps/web/src/lib/api-config.ts (1)

32-37: Consider adding error handling for the dynamic import in onRefreshFailure.

The import().then() pattern could fail silently if the module fails to load. While rare, an unhandled rejection here would leave the user in an inconsistent state (refresh failed, but stores not cleared).

♻️ Add catch handler
   onRefreshFailure: () => {
     // Dynamic import to avoid circular dependency at module load time
     import('../lib/clear-user-stores').then(({ clearAllUserStores }) => {
       clearAllUserStores();
-    });
+    }).catch((err) => {
+      console.error('[api-config] Failed to clear user stores on refresh failure:', err);
+    });
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/src/lib/api-config.ts` around lines 32 - 37, The onRefreshFailure
handler uses a dynamic import of '../lib/clear-user-stores' and then calls
clearAllUserStores but has no error handling; wrap the import().then(...) with a
.catch that logs the import failure (e.g., via console.error or your logger) and
attempts a safe fallback to still clear stores (for example, call a local
safeClearAllUserStores routine or try a synchronous
require('../lib/clear-user-stores') and call clearAllUserStores if available).
Ensure the handler references onRefreshFailure and clearAllUserStores so
failures won't leave stores uncleared and the rejection is not silent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/src/lib/api/auth.ts`:
- Around line 67-76: Remove the unsafe `as` casts and use the generated DTO
types directly: in linkMethod stop casting data.loginType to
LinkMethodDtoLoginType and pass the union value (it already matches
LinkMethodDtoLoginType) so the call to authControllerLinkMethod uses the
generated enum; for identityControllerSendOtp and
identityControllerGetWalletNonce stop casting the returned shapes and instead
annotate/return the functions with the generated response types
SendOtpResponseDto and IdentityControllerGetWalletNonce200 (or accept those
promise results directly) so the adapter surface types match the
packages/api-client DTOs.

In `@apps/web/src/lib/api/ipfs.ts`:
- Around line 72-81: The progress-enabled download branch uses raw fetch (in
getApiClientConfig()/the file's fetch block) so it bypasses the shared axios
client and its refresh-and-retry interceptor (see the interceptor in
packages/api-client/src/instance.ts), causing failed 401s to never retry; fix by
routing the onProgress branch through the shared API client or by implementing
the same refresh-and-retry logic locally: use the axios instance from
`@cipherbox/api-client` (or call its request method) to perform the download
request so the interceptor can refresh tokens, and if you must use fetch because
of streaming, replicate the interceptor behavior by attempting a token refresh
and retrying the request on 401 (use the same token-refresh helper used by the
shared client) and ensure Authorization header is set from
getApiClientConfig().getAccessToken() before retrying.

---

Nitpick comments:
In `@apps/web/src/lib/api-config.ts`:
- Around line 32-37: The onRefreshFailure handler uses a dynamic import of
'../lib/clear-user-stores' and then calls clearAllUserStores but has no error
handling; wrap the import().then(...) with a .catch that logs the import failure
(e.g., via console.error or your logger) and attempts a safe fallback to still
clear stores (for example, call a local safeClearAllUserStores routine or try a
synchronous require('../lib/clear-user-stores') and call clearAllUserStores if
available). Ensure the handler references onRefreshFailure and
clearAllUserStores so failures won't leave stores uncleared and the rejection is
not silent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce8ee71c-43a7-45b6-9cac-5a9c12b37327

📥 Commits

Reviewing files that changed from the base of the PR and between ca356bb and 631ae67.

⛔ Files ignored due to path filters (122)
  • apps/web/src/api/auth/auth.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/custom-instance.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/device-approval/device-approval.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/health/health.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/identity/identity.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/invites/invites.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/ipfs/ipfs.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/ipns/ipns.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/addShareKeysDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/authMethodResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/authMethodResponseDtoType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/batchPublishIpnsDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/batchPublishIpnsResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/childKeyDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/childKeyDtoKeyType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/claimChildKeyDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/claimChildKeyDtoKeyType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/claimInviteDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/claimInviteResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createApprovalDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createInviteDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createInviteDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createShareDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createShareDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createShareResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/createShareResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deleteAccountDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deleteAccountResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/derivationInfoDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/derivationInfoDtoDerivationVersion.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/derivationInfoDtoMethod.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/desktopRefreshDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deviceApprovalControllerCreateRequest201.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deviceApprovalControllerGetPending200Item.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deviceApprovalControllerGetStatus200.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/deviceApprovalControllerGetStatus200Status.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/googleLoginDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/googleLoginDtoIntent.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/healthControllerCheck200.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/healthControllerCheck200Info.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/healthControllerCheck200InfoDatabase.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/identityControllerGetJwks200.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/identityControllerGetJwks200KeysItem.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/identityControllerGetWalletNonce200.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/identityTokenResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/index.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/initVaultDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteChildKeyDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteChildKeyDtoKeyType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteDataResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteDataResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteDataResponseDtoStatus.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteResponseDtoStatus.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteStatusResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/inviteStatusResponseDtoStatus.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/ipfsControllerUploadBody.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/ipnsControllerResolveRecordParams.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/linkMethodDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/linkMethodDtoLoginType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/loginDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/loginDtoLoginType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/loginResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/logoutResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/lookupUserResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/paginatedReceivedSharesDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/paginatedSentSharesDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/pendingRotationResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/pendingRotationResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/publishIpnsDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/publishIpnsEntryDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/publishIpnsEntryDtoRecordType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/publishIpnsResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/quotaResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/receivedShareResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/receivedShareResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/refreshDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/resolveIpnsResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/respondApprovalDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/respondApprovalDtoAction.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sendOtpDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sendOtpResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sentShareResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sentShareResponseDtoItemType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/shareInvitesControllerListInvitesParams.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/shareKeyEntryDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/shareKeyEntryDtoKeyType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/shareKeyResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/shareKeyResponseDtoKeyType.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sharesControllerGetReceivedSharesParams.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sharesControllerGetSentSharesParams.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/sharesControllerLookupUserParams.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/teeKeysDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/teeKeysDtoPreviousEpoch.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/teeKeysDtoPreviousPublicKey.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/testLoginDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/testLoginResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/tokenResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/unlinkMethodDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/unlinkMethodResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/unpinDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/unpinResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/updateEncryptedKeyDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/uploadResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultConfigResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultExportDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultExportDtoDerivationInfo.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultExportDtoDerivationMethod.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultResponseDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultResponseDtoInitializedAt.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/vaultResponseDtoTeeKeys.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/verifyOtpDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/verifyOtpDtoIntent.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/walletVerifyDto.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/models/walletVerifyDtoIntent.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/root/root.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/share-invites/share-invites.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/shares/shares.ts is excluded by !apps/web/src/api/**
  • apps/web/src/api/vault/vault.ts is excluded by !apps/web/src/api/**
  • packages/api-client/src/instance.ts is excluded by !packages/api-client/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/pnpm-lock.yaml
📒 Files selected for processing (23)
  • .claude/claude.md
  • apps/web/orval.config.ts
  • apps/web/package.json
  • apps/web/scripts/fix-orval-imports.mjs
  • apps/web/src/components/file-browser/ShareDialog.tsx
  • apps/web/src/components/layout/StatusIndicator.tsx
  • apps/web/src/components/vault/VaultExport.tsx
  • apps/web/src/hooks/useAuth.ts
  • apps/web/src/hooks/useHealthCheck.ts
  • apps/web/src/lib/api-config.ts
  • apps/web/src/lib/api/__tests__/client-refresh.test.ts
  • apps/web/src/lib/api/auth.ts
  • apps/web/src/lib/api/client.ts
  • apps/web/src/lib/api/ipfs.ts
  • apps/web/src/lib/api/vault.ts
  • apps/web/src/lib/crypto/key-wrapping.ts
  • apps/web/src/main.tsx
  • apps/web/src/routes/Login.tsx
  • apps/web/src/services/device-approval.service.ts
  • apps/web/src/services/invite.service.ts
  • apps/web/src/services/ipns.service.ts
  • apps/web/src/services/share.service.ts
  • package.json
💤 Files with no reviewable changes (4)
  • apps/web/scripts/fix-orval-imports.mjs
  • apps/web/src/lib/api/tests/client-refresh.test.ts
  • apps/web/orval.config.ts
  • apps/web/src/lib/api/client.ts

Comment thread apps/web/src/lib/api/auth.ts Outdated
Comment thread apps/web/src/lib/api/ipfs.ts Outdated
@codecov

codecov Bot commented Mar 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.28%. Comparing base (ca356bb) to head (7021cc8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/api-client/src/instance.ts 80.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
+ Coverage   49.83%   50.28%   +0.44%     
==========================================
  Files         114      115       +1     
  Lines        9126     9854     +728     
  Branches      699      716      +17     
==========================================
+ Hits         4548     4955     +407     
- Misses       4402     4722     +320     
- Partials      176      177       +1     
Flag Coverage Δ
api 82.76% <80.00%> (+0.92%) ⬆️
api-client 82.76% <80.00%> (+0.92%) ⬆️
core 82.76% <80.00%> (+0.92%) ⬆️
crypto 82.76% <80.00%> (+0.92%) ⬆️
desktop 28.64% <ø> (+2.73%) ⬆️
sdk 82.76% <80.00%> (+0.92%) ⬆️
sdk-core 82.76% <80.00%> (+0.92%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/api-client/src/instance.ts 77.90% <80.00%> (+77.90%) ⬆️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The web app no longer has its own orval-generated API client — it uses
@cipherbox/api-client directly. The CI verify step was failing because
the directory no longer exists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 8e48c657e32a
FSM1 and others added 2 commits March 21, 2026 19:45
…ownload

- Remove `as` casts in auth.ts adapter; use generated DTO types directly
  (SendOtpResponseDto, IdentityControllerGetWalletNonce200, LinkMethodDto)
- Add refresh-and-retry to the fetch-based download path in ipfs.ts so
  progress-enabled downloads don't bypass the shared 401 refresh flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 721639822c83
Route all IPFS downloads through ipfsControllerGet with
onDownloadProgress — same pattern as uploads. Eliminates the raw
fetch path that bypassed the shared axios instance and its 401
refresh interceptor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 09148ff766df

Copilot AI 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.

Pull request overview

Consolidates the web app’s API access onto the shared @cipherbox/api-client package, removing the legacy web-local orval client and adding shared refresh-on-401 handling in the api-client instance layer to keep sessions alive.

Changes:

  • Added configurable 401 refresh+retry interceptor (with shared refresh promise deduplication) to @cipherbox/api-client.
  • Replaced web-local generated/hand-rolled clients with thin adapters + early api-client configuration, and migrated imports across the web app.
  • Removed orval tooling and ~all of apps/web/src/api/* (generated client + models), updating CI generation checks accordingly.

Reviewed changes

Copilot reviewed 145 out of 146 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
pnpm-lock.yaml Removes web-only dev deps tied to orval + axios-mock-adapter.
packages/api-client/src/instance.ts Adds refresh-on-401 interceptor, withCredentials support, and refresh failure callback.
package.json Updates api:generate to regenerate/build @cipherbox/api-client instead of the web orval client.
apps/web/src/services/share.service.ts Switches shares API imports to @cipherbox/api-client.
apps/web/src/services/ipns.service.ts Switches IPNS API imports/types to @cipherbox/api-client.
apps/web/src/services/invite.service.ts Switches invites/share-invites API imports to @cipherbox/api-client.
apps/web/src/services/device-approval.service.ts Switches device approval API imports/types to @cipherbox/api-client with local type aliases.
apps/web/src/routes/Login.tsx Replaces orval react-query hook with useHealthCheck.
apps/web/src/main.tsx Ensures early api-client configuration via module import.
apps/web/src/lib/crypto/key-wrapping.ts Moves DTO type import to @cipherbox/api-client.
apps/web/src/lib/api/vault.ts Rewrites vault API access as thin adapter over @cipherbox/api-client.
apps/web/src/lib/api/ipfs.ts Rewrites IPFS API access over @cipherbox/api-client, keeping upload progress + streaming download option.
apps/web/src/lib/api/client.ts Deletes legacy axios client and its refresh interceptor.
apps/web/src/lib/api/auth.ts Rewrites auth API access as thin adapter over @cipherbox/api-client.
apps/web/src/lib/api/tests/client-refresh.test.ts Removes tests that covered refresh deduplication behavior in the web-local client.
apps/web/src/lib/api-config.ts Adds early setApiClientConfig with refresh + cookie support for web.
apps/web/src/hooks/useHealthCheck.ts New react-query wrapper hook for health checks using @cipherbox/api-client.
apps/web/src/hooks/useAuth.ts Removes direct setApiClientConfig usage; relies on lib/api-config.ts.
apps/web/src/components/vault/VaultExport.tsx Switches vault export API import to @cipherbox/api-client.
apps/web/src/components/layout/StatusIndicator.tsx Replaces orval health hook usage with useHealthCheck.
apps/web/src/components/file-browser/ShareDialog.tsx Switches shares API imports and DTO types to @cipherbox/api-client.
apps/web/src/api/vault/vault.ts Deletes web-local orval-generated vault client.
apps/web/src/api/share-invites/share-invites.ts Deletes web-local orval-generated share-invites client.
apps/web/src/api/root/root.ts Deletes web-local orval-generated root client.
apps/web/src/api/models/walletVerifyDtoIntent.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/walletVerifyDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/verifyOtpDtoIntent.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/verifyOtpDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultResponseDtoTeeKeys.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultResponseDtoInitializedAt.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultExportDtoDerivationMethod.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultExportDtoDerivationInfo.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultExportDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/vaultConfigResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/uploadResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/updateEncryptedKeyDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/unpinResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/unpinDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/unlinkMethodResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/unlinkMethodDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/tokenResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/testLoginResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/testLoginDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/teeKeysDtoPreviousPublicKey.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/teeKeysDtoPreviousEpoch.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/teeKeysDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sharesControllerLookupUserParams.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sharesControllerGetSentSharesParams.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sharesControllerGetReceivedSharesParams.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/shareKeyResponseDtoKeyType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/shareKeyResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/shareKeyEntryDtoKeyType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/shareKeyEntryDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/shareInvitesControllerListInvitesParams.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sentShareResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sentShareResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sendOtpResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/sendOtpDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/respondApprovalDtoAction.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/respondApprovalDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/resolveIpnsResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/refreshDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/receivedShareResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/receivedShareResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/quotaResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/publishIpnsResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/publishIpnsEntryDtoRecordType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/publishIpnsEntryDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/publishIpnsDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/pendingRotationResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/pendingRotationResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/paginatedSentSharesDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/paginatedReceivedSharesDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/lookupUserResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/logoutResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/loginResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/loginDtoLoginType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/loginDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/linkMethodDtoLoginType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/linkMethodDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/ipnsControllerResolveRecordParams.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/ipfsControllerUploadBody.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteStatusResponseDtoStatus.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteStatusResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteResponseDtoStatus.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteDataResponseDtoStatus.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteDataResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteDataResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteChildKeyDtoKeyType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/inviteChildKeyDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/initVaultDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/index.ts Deletes web-local orval-generated model barrel; now sourced from @cipherbox/api-client.
apps/web/src/api/models/identityTokenResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/identityControllerGetWalletNonce200.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/identityControllerGetJwks200KeysItem.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/identityControllerGetJwks200.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/healthControllerCheck200InfoDatabase.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/healthControllerCheck200Info.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/healthControllerCheck200.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/googleLoginDtoIntent.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/googleLoginDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deviceApprovalControllerGetStatus200Status.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deviceApprovalControllerGetStatus200.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deviceApprovalControllerGetPending200Item.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deviceApprovalControllerCreateRequest201.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/desktopRefreshDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/derivationInfoDtoMethod.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/derivationInfoDtoDerivationVersion.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/derivationInfoDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deleteAccountResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/deleteAccountDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createShareResponseDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createShareResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createShareDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createShareDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createInviteDtoItemType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createInviteDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/createApprovalDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/claimInviteResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/claimInviteDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/claimChildKeyDtoKeyType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/claimChildKeyDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/childKeyDtoKeyType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/childKeyDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/batchPublishIpnsResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/batchPublishIpnsDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/authMethodResponseDtoType.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/authMethodResponseDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/models/addShareKeysDto.ts Deletes web-local orval-generated model; now sourced from @cipherbox/api-client.
apps/web/src/api/ipns/ipns.ts Deletes web-local orval-generated IPNS client.
apps/web/src/api/ipfs/ipfs.ts Deletes web-local orval-generated IPFS client.
apps/web/src/api/invites/invites.ts Deletes web-local orval-generated invites client.
apps/web/src/api/identity/identity.ts Deletes web-local orval-generated identity client.
apps/web/src/api/health/health.ts Deletes web-local orval-generated health client.
apps/web/src/api/device-approval/device-approval.ts Deletes web-local orval-generated device-approval client.
apps/web/src/api/custom-instance.ts Deletes web-local fetch-based mutator used by orval client.
apps/web/src/api/auth/auth.ts Deletes web-local orval-generated auth client.
apps/web/scripts/fix-orval-imports.mjs Removes orval post-processing script (no longer needed).
apps/web/package.json Removes orval generation script + dev deps; retains tests/lint/build.
apps/web/orval.config.ts Deletes web-local orval config.
.github/workflows/ci.yml Updates generated-file formatting/diff checks to only track packages/api-client/.
.claude/claude.md Updates contributor guidance to commit generated api-client outputs from packages/api-client.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread apps/web/src/lib/api/ipfs.ts Outdated
Comment thread apps/web/src/lib/api/auth.ts
Comment thread apps/web/src/hooks/useHealthCheck.ts Outdated
Comment thread apps/web/src/lib/api-config.ts Outdated
Comment thread packages/api-client/src/instance.ts
Comment thread packages/api-client/src/instance.ts
Comment thread apps/web/src/lib/api/auth.ts Outdated
Comment thread apps/web/src/lib/api/auth.ts
Comment thread packages/api-client/src/instance.ts Outdated
FSM1 and others added 2 commits March 21, 2026 19:55
- auth.ts: use generated DTO return types instead of Promise<unknown>
- useHealthCheck: use Error instead of void for TError generic
- api-config.ts: add .catch() to dynamic import in onRefreshFailure
- instance.ts: apply withCredentials in createAxiosInstance, use safe
  header['Authorization'] assignment in interceptor
- Add unit tests for 401 refresh interceptor (5 tests covering retry,
  infinite loop prevention, onRefreshFailure, deduplication, config)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Collapse duplicate retry blocks in 401 interceptor into single path
- Conditionally spread onUploadProgress (skip no-op callback on uploads
  without progress tracking, matching onDownloadProgress pattern)
- Remove redundant setAuthenticated() from refresh callback (user is
  already authenticated when token refresh fires)
- Hardcode health check query config in useHealthCheck hook (both
  callers used identical options) and flatten the API

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3530b57e8692

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/web/src/lib/api-config.ts`:
- Around line 29-39: The current onRefreshFailure only calls clearAllUserStores
(a Zustand cleanup) and misses clearing React Query cache; move the full cleanup
into the React context logout implementation (useAuth().logout) so it calls
useQueryClient().invalidateQueries() (or clear/query cache) before calling
clearAllUserStores(), and update onRefreshFailure to invoke the context logout
when available (or fall back to the existing dynamic import +
window.location.reload() if logout cannot be reached) so both normal logout and
onRefreshFailure clear React Query state as well as Zustand stores.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38c92482-7ce5-407a-adf3-8d93091fb19a

📥 Commits

Reviewing files that changed from the base of the PR and between 47a8756 and 7021cc8.

⛔ Files ignored due to path filters (4)
  • packages/api-client/package.json is excluded by !packages/api-client/**
  • packages/api-client/src/__tests__/instance.test.ts is excluded by !packages/api-client/**
  • packages/api-client/src/instance.ts is excluded by !packages/api-client/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • apps/web/src/components/layout/StatusIndicator.tsx
  • apps/web/src/hooks/useHealthCheck.ts
  • apps/web/src/lib/api-config.ts
  • apps/web/src/lib/api/auth.ts
  • apps/web/src/lib/api/ipfs.ts
  • apps/web/src/routes/Login.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/layout/StatusIndicator.tsx

Comment thread apps/web/src/lib/api-config.ts
@FSM1 FSM1 merged commit bc06961 into main Mar 22, 2026
24 checks passed
@FSM1 FSM1 deleted the refactor/consolidate-api-client branch March 22, 2026 02:29
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