Skip to content

Promote test → main: artist update endpoints + chat pin cutover (#1669)#1688

Merged
sweetmantech merged 5 commits into
mainfrom
test
Apr 17, 2026
Merged

Promote test → main: artist update endpoints + chat pin cutover (#1669)#1688
sweetmantech merged 5 commits into
mainfrom
test

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Promotes chat PR #1669 (route artist pin toggles through PATCH /api/artists/{id}) from test to main.

Paired with api #431 (merged earlier into test and promoted). Verified end-to-end via Chrome DevTools MCP on preview:

  • PATCH /api/artists/{id} hit with {"pinned":false} → 200
  • PATCH /api/artists/{id} hit with {"pinned":true} → 200
  • UI state flips correctly, all other fields preserved
  • Privy bearer auth flowing cross-origin

CI on #1669: unit tests ✅, cubic reviewer ✅

🤖 Generated with Claude Code


Summary by cubic

Route artist updates and pin toggles through the unified backend PATCH /api/artists/{id} using Privy bearer auth, replacing chat-local endpoints. This simplifies the update flow and keeps the UI in sync with server state.

  • Refactors
    • useArtistPinToggle: optimistic pin flip, then saveArtist(accessToken, artistId, { pinned }); rolls back on error.
    • saveArtist: new signature (accessToken, artistId, payload); sends PATCH to ${getClientApiBaseUrl()}/api/artists/{id} with Authorization header.
    • Deleted legacy endpoints app/api/artist/pin and app/api/artist/profile, and toggleArtistPin Supabase helper.
    • useArtists: updates now call saveArtist with getAccessToken() and the current artistId.
    • Centralized Knowledge type in types/knowledge.ts; updated imports and typed ArtistRecord.knowledges.

Written for commit 81e5423. Summary will update on new commits.

arpitgupta1214 and others added 5 commits April 13, 2026 23:15
Replace the chat-local /api/artist/pin endpoint with the unified PATCH
artist endpoint. useArtistPinToggle now calls saveArtist with a
{ pinned } payload using a Privy bearer token, matching the profile save
flow. Removes the dead chat route and toggleArtistPin supabase helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback — the module was both importing Knowledge from
@/types/knowledge and re-exporting it from the same path. Drop the
re-export and point the two consumers (KnowledgeBaseSection,
UpdateArtistInfoSuccess) at the canonical @/types/knowledge source.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat: migrate manual artist save flow to dedicated update endpoint
@vercel

vercel Bot commented Apr 17, 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 Building Building Preview Apr 17, 2026 8:04pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 5 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 42 minutes and 5 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: 67775c89-64eb-4edd-921e-12536c191c1a

📥 Commits

Reviewing files that changed from the base of the PR and between 59ad27d and 81e5423.

⛔ Files ignored due to path filters (2)
  • types/Artist.tsx is excluded by none and included by none
  • types/knowledge.ts is excluded by none and included by none
📒 Files selected for processing (12)
  • app/api/artist/pin/route.ts
  • app/api/artist/profile/route.ts
  • components/VercelChat/tools/KnowledgeBaseSection.tsx
  • components/VercelChat/tools/UpdateArtistInfoSuccess.tsx
  • hooks/useArtistPinToggle.tsx
  • hooks/useArtists.tsx
  • lib/accounts/updateAccountProfile.ts
  • lib/files/getKnowledgeBaseText.ts
  • lib/saveArtist.tsx
  • lib/supabase/account_artist_ids/toggleArtistPin.ts
  • lib/supabase/artist/updateArtistProfile.tsx
  • lib/supabase/getArtistKnowledge.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.

@sweetmantech sweetmantech merged commit 8695996 into main Apr 17, 2026
2 of 3 checks passed

@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 14 files

Confidence score: 4/5

  • This PR is likely safe to merge, with one moderate robustness gap rather than a clear functional break in normal success paths.
  • In lib/saveArtist.tsx, calling response.json() before checking response.ok can throw a SyntaxError on non-JSON error bodies (such as 502/504), which may hide the true HTTP failure and make troubleshooting harder for users and developers.
  • Given the issue is scoped to error handling behavior (severity 5/10, high confidence) and not a confirmed core-flow regression, the overall merge risk remains low-to-moderate.
  • Pay close attention to lib/saveArtist.tsx - ensure HTTP status is validated before JSON parsing so gateway/server errors surface correctly.
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/saveArtist.tsx">

<violation number="1" location="lib/saveArtist.tsx:33">
P2: Check `response.ok` before calling `response.json()` to avoid a `SyntaxError` masking the real HTTP error when the server returns a non-JSON response (e.g., 502/504 gateway errors).</violation>
</file>

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

Comment thread lib/saveArtist.tsx
},
});
const data = await response.json();
const data: SaveArtistResponse = await response.json();

@cubic-dev-ai cubic-dev-ai Bot Apr 17, 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: Check response.ok before calling response.json() to avoid a SyntaxError masking the real HTTP error when the server returns a non-JSON response (e.g., 502/504 gateway errors).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At lib/saveArtist.tsx, line 33:

<comment>Check `response.ok` before calling `response.json()` to avoid a `SyntaxError` masking the real HTTP error when the server returns a non-JSON response (e.g., 502/504 gateway errors).</comment>

<file context>
@@ -1,13 +1,40 @@
     },
   });
-  const data = await response.json();
+  const data: SaveArtistResponse = await response.json();
+
+  if (!response.ok || !data.artist) {
</file context>
Fix with Cubic

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