Skip to content

Promote test to main#1699

Merged
sweetmantech merged 1 commit into
mainfrom
test
Apr 23, 2026
Merged

Promote test to main#1699
sweetmantech merged 1 commit into
mainfrom
test

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

@sweetmantech sweetmantech commented Apr 23, 2026

Promotes test to main.

Included

This is the chat-side complement of recoupable/api#464 and recoupable/docs#153 (both already on main).

🤖 Generated with Claude Code


Summary by cubic

Promotes test to main, migrating catalog fetching to the new /api/accounts/{id}/catalogs route with Privy Bearer auth. Replaces the legacy query-param endpoint and aligns chat with the current API.

  • New Features

    • Switch to ${getClientApiBaseUrl()}/api/accounts/{accountId}/catalogs and send Authorization: Bearer <Privy token>.
    • Add types/Catalog.ts and update getCatalogs/useCatalogs to use the new Catalog type.
  • Bug Fixes

    • Gate the query on authenticated from @privy-io/react-auth and a valid account id to avoid firing requests without a token (@tanstack/react-query).

Written for commit 99a7feb. Summary will update on new commits.

* feat: migrate getCatalogs to GET /api/accounts/{id}/catalogs

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.

* fix: gate useCatalogs on auth readiness

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>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 23, 2026

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

Project Deployment Actions Updated (UTC)
recoup-chat Ready Ready Preview Apr 23, 2026 8:02pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 2 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 48 minutes and 2 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: 3354c1e6-498b-4f94-958f-928387b74a9f

📥 Commits

Reviewing files that changed from the base of the PR and between d31c6da and 99a7feb.

⛔ 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 test

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.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Confidence score: 3/5

  • There is a concrete regression risk in lib/catalog/getCatalogs.ts: accountId is inserted into a URL path segment without encoding, which can cause malformed or misrouted requests for certain values.
  • Given the medium severity (6/10) and high confidence (9/10), this is more than a cosmetic issue and could impact users in real request flows.
  • Pay close attention to lib/catalog/getCatalogs.ts - ensure accountId is URL-encoded before path construction to prevent routing errors.
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="lib/catalog/getCatalogs.ts">

<violation number="1" location="lib/catalog/getCatalogs.ts:24">
P2: Encode `accountId` before inserting it into the URL path segment to avoid malformed or misrouted requests.</violation>
</file>

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

try {
const response = await fetch(
`https://api.recoupable.com/api/catalogs?account_id=${accountId}`,
`${getClientApiBaseUrl()}/api/accounts/${accountId}/catalogs`,
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

P2: Encode accountId before inserting it into the URL path segment to avoid malformed or misrouted requests.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/catalog/getCatalogs.ts, line 24:

<comment>Encode `accountId` before inserting it into the URL path segment to avoid malformed or misrouted requests.</comment>

<file context>
@@ -1,25 +1,34 @@
   try {
     const response = await fetch(
-      `https://api.recoupable.com/api/catalogs?account_id=${accountId}`,
+      `${getClientApiBaseUrl()}/api/accounts/${accountId}/catalogs`,
       {
         method: "GET",
</file context>
Suggested change
`${getClientApiBaseUrl()}/api/accounts/${accountId}/catalogs`,
`${getClientApiBaseUrl()}/api/accounts/${encodeURIComponent(accountId)}/catalogs`,
Fix with Cubic

@sweetmantech sweetmantech merged commit ec68f61 into main 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