Promote test → main: artist update endpoints + chat pin cutover (#1669)#1688
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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, callingresponse.json()before checkingresponse.okcan throw aSyntaxErroron 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.
| }, | ||
| }); | ||
| const data = await response.json(); | ||
| const data: SaveArtistResponse = await response.json(); |
There was a problem hiding this comment.
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>
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:
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.useArtistPinToggle: optimistic pin flip, thensaveArtist(accessToken, artistId, { pinned }); rolls back on error.saveArtist: new signature(accessToken, artistId, payload); sendsPATCHto${getClientApiBaseUrl()}/api/artists/{id}withAuthorizationheader.app/api/artist/pinandapp/api/artist/profile, andtoggleArtistPinSupabase helper.useArtists: updates now callsaveArtistwithgetAccessToken()and the currentartistId.Knowledgetype intypes/knowledge.ts; updated imports and typedArtistRecord.knowledges.Written for commit 81e5423. Summary will update on new commits.