Skip to content

feat: migrate manual artist save flow to dedicated update endpoint#1669

Merged
sweetmantech merged 4 commits intotestfrom
codex/artist-update-endpoints
Apr 17, 2026
Merged

feat: migrate manual artist save flow to dedicated update endpoint#1669
sweetmantech merged 4 commits intotestfrom
codex/artist-update-endpoints

Conversation

@arpitgupta1214
Copy link
Copy Markdown
Collaborator

@arpitgupta1214 arpitgupta1214 commented Apr 13, 2026

Summary

  • Migrate manual artist save calls from local /api/artist/profile to dedicated PATCH /api/artists/{id}.
  • Remove local profile route after cutover.
  • Centralize shared knowledge typing in types/knowledge.ts and align consumers.

Notes

  • Preserves existing manual settings behavior while switching transport to dedicated API.
  • Scoped to update capability (create flow remains separate).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 34 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 54 minutes and 34 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: a1e0fbb2-c68c-4542-8080-5d81daffbec0

📥 Commits

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

⛔ 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 codex/artist-update-endpoints

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.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 13, 2026

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

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

Request Review

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.

No issues found across 9 files

Confidence score: 5/5

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

Requires human review: This PR migrates core artist update logic to a new API endpoint and removes an existing route. Such refactors of API transport layers for core entities require human review.

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 <[email protected]>
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.

0 issues found across 4 files (changes from recent commits).

Requires human review: This PR migrates core business logic (artist updates) from local API routes to a new dedicated endpoint and introduces new authentication handling, which requires human review to ensure system-stable.

@arpitgupta1214
Copy link
Copy Markdown
Collaborator Author

E2E verification on Vercel preview

Preview: https://recoup-chat-git-codex-artist-update-44a903-recoupable-ad724970.vercel.app (HEAD cfd4154e)

Network shape (vs. legacy chat-local routes)

Endpoint Status
POST /api/artist/pin (legacy) 404 ✅ deleted
POST /api/artist/profile (legacy) 404 ✅ deleted

Pin toggle clicked in DevTools — default base URL (test-recoup-api)

Field Value
Method PATCH
URL https://test-recoup-api.vercel.app/api/artists/ab1c64cd-...
Body {"pinned":true}
Auth Authorization: Bearer <privy-token>
Status 405 — expected, api test branch doesn't have PATCH route until #431 lands

Pin toggle clicked again with recoup_api_override → api PR #431 preview

Field Value
Method PATCH
URL https://recoup-api-git-codex-artist-update-e-43aac8.../api/artists/ab1c64cd-...
Body {"pinned":true}
Status 200
Response body {"artist":{...,"pinned":true}}
Hook follow-up GET /api/artists? → 200 ✅

Confirms the migrated useArtistPinToggle hook calls the new PATCH surface with the correct shape and Privy bearer auth. The 405 on default base URL resolves automatically once api PR #431 merges to test.

Comment on lines +10 to +12
import type { Knowledge } from "@/types/knowledge";

export type Knowledge = {
url: string;
name: string;
type: string;
};
export type { Knowledge } from "@/types/knowledge";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

DRY - Why are you both importing and exporting the type from here?

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) <[email protected]>
@sweetmantech
Copy link
Copy Markdown
Collaborator

Fixed in ceb5814c — dropped the re-export from lib/supabase/artist/updateArtistProfile.tsx and redirected the two consumers (KnowledgeBaseSection, UpdateArtistInfoSuccess) at the canonical @/types/knowledge path.

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.

0 issues found across 3 files (changes from recent commits).

Requires human review: This PR migrates core artist data persistence from local API routes to a new external endpoint, involving authentication changes and logic refactoring.

@sweetmantech
Copy link
Copy Markdown
Collaborator

End-to-end test results — ✅ pin toggle routes through new PATCH endpoint

Tested on the preview deployment via Chrome DevTools MCP against the live test-recoup-api.vercel.app (which has the merged api #431 PATCH handler).

Test artist

  • AZALI (account_id: 9105f630-8e9f-4908-a2c4-3f68a6454c78)
  • Starting state: pinned: true

Observed requests

# Method URL Body Status
1 PATCH https://test-recoup-api.vercel.app/api/artists/9105f630-... {"pinned":false} 200
2 PATCH same {"pinned":true} 200

Both requests carried Authorization: Bearer <Privy JWT> and were cross-origin from the chat preview with proper CORS.

Verified behavior

  • Clicking Unpin artist in the sidebar hits the new PATCH /api/artists/{id} endpoint (not the legacy /api/artist/pin)
  • Minimal partial-update payload — only the changed field is sent (16 and 15 bytes respectively)
  • UI state reflects the server response — button label flips Unpin artistPin artist
  • All other fields (name, image, knowledges, socials) preserved across both round-trips
  • Privy bearer auth works for the cross-origin call
  • Final state left clean: AZALI re-pinned, matching pre-test

Out of scope (not tested this round)

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 17, 2026

Tip

For best results, initiate chat on the files or code changes.

@sweetmantech Excellent coverage on the pin toggle path — the request table is exactly the shape we'd want to see, and the round-trip preservation of non-pinned fields is a good implicit regression check.

Two thoughts before merge:

Profile update path (recommended before merge)
Since app/api/artist/profile/route.ts is explicitly in-scope for this migration, it'd be worth a quick smoke test of the name/instructions save flow to confirm:

  • The PATCH body includes the right fields (name, image, knowledges, socials)
  • The legacy /api/artist/profile returns 404 (matching the pin check arpitgupta1214 already ran)
  • The response is correctly reflected in the UI

This is the primary remaining untested surface from the PR objectives.

Concurrent pin toggles (not blocking this PR)
The race condition I flagged lives entirely in setAccountArtistPin.ts on the API side — it's an api PR #431 concern, not something this chat PR can address. No need to block merge here for that.

If you can run the profile update smoke test and it passes, this looks ready to ship. 🚀

@sweetmantech sweetmantech merged commit 81e5423 into test Apr 17, 2026
4 checks passed
@sweetmantech sweetmantech deleted the codex/artist-update-endpoints branch April 17, 2026 20:04
sweetmantech added a commit that referenced this pull request Apr 17, 2026
Promote test → main: artist update endpoints + chat pin cutover (#1669)
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