Skip to content

feat(chat): migrate GET /api/accounts/{id}/catalogs#1691

Merged
sweetmantech merged 2 commits into
testfrom
feat/account-catalogs-migration-chat
Apr 23, 2026
Merged

feat(chat): migrate GET /api/accounts/{id}/catalogs#1691
sweetmantech merged 2 commits into
testfrom
feat/account-catalogs-migration-chat

Conversation

@arpitgupta1214

@arpitgupta1214 arpitgupta1214 commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Cut getCatalogs / useCatalogs over to GET /api/accounts/{id}/catalogs on recoup-api.vercel.app with Privy Bearer auth; id moves from query to path. New types/Catalog.ts replaces the Supabase-coupled type.

Test plan

  • /catalogs preview renders catalog list
  • DevTools shows GET …/api/accounts/<uuid>/catalogs with Authorization: Bearer …, status 200
  • Signed-out path surfaces the "No access token" error

Repoints the chat caller off the legacy Agent API host onto the
new nested route on recoup-api.vercel.app. Adds Privy Bearer auth
and threads the access token through useCatalogs.
@vercel

vercel Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Apr 21, 2026 7:54pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@arpitgupta1214 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 39 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 39 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 60e8aa85-85cf-4b09-979f-153af7e8e4bb

📥 Commits

Reviewing files that changed from the base of the PR and between 2c3b55c and 8df7ed3.

⛔ Files ignored due to path filters (1)
  • types/Catalog.ts is excluded by none and included by none
📒 Files selected for processing (2)
  • hooks/useCatalogs.ts
  • lib/catalog/getCatalogs.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/account-catalogs-migration-chat

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7c9381edc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread hooks/useCatalogs.ts Outdated
if (!accessToken) throw new Error("No access token");
return getCatalogs(accountId, accessToken);
},
enabled: !!accountId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate catalog query on auth readiness

The query is enabled as soon as accountId exists, but this migrated path now requires a Privy bearer token and queryFn throws when getAccessToken() returns null. In the startup window where account data is loaded before Privy auth is ready, this puts the Catalogs page into an error state ("No access token") instead of waiting, and it may not recover until a manual refetch/focus. Please include auth readiness (e.g., authenticated/ready) in the enabled predicate so the request only runs once a token can be issued.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: API migration involving endpoint changes and new authentication requirements; carries risk of breaking the feature if not synchronized with backend deployment.

Add `authenticated` from usePrivy() to the query's `enabled` flag so the
request doesn't fire with an empty Bearer token before Privy resolves.
Matches the canonical pattern in useAccountOrganizations.ts /
useSandboxes.ts.

Note: pnpm lint / typecheck not run — node_modules missing in worktree.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="hooks/useCatalogs.ts">

<violation number="1" location="hooks/useCatalogs.ts:18">
P2: Gating the query with `authenticated` suppresses the `No access token` error path and can produce a silent empty-state instead of an auth error.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread hooks/useCatalogs.ts
if (!accessToken) throw new Error("No access token");
return getCatalogs(accountId, accessToken);
},
enabled: !!accountId && authenticated,

@cubic-dev-ai cubic-dev-ai Bot Apr 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Gating the query with authenticated suppresses the No access token error path and can produce a silent empty-state instead of an auth error.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At hooks/useCatalogs.ts, line 18:

<comment>Gating the query with `authenticated` suppresses the `No access token` error path and can produce a silent empty-state instead of an auth error.</comment>

<file context>
@@ -15,7 +15,7 @@ const useCatalogs = (): UseQueryResult<CatalogsResponse> => {
       return getCatalogs(accountId, accessToken);
     },
-    enabled: !!accountId,
+    enabled: !!accountId && authenticated,
     staleTime: 5 * 60 * 1000, // 5 minutes
     refetchOnWindowFocus: false,
</file context>
Suggested change
enabled: !!accountId && authenticated,
enabled: !!accountId,
Fix with Cubic

@arpitgupta1214 arpitgupta1214 changed the title feat: migrate getCatalogs to GET /api/accounts/{id}/catalogs feat(chat): migrate GET /api/accounts/{id}/catalogs Apr 22, 2026
@sweetmantech sweetmantech merged commit 99a7feb into test Apr 23, 2026
4 checks passed
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