fix(artists): /api/artists id must equal account_id (drop leaked account_info.id)

Merged
SW
5mo ago
+49-1

Part of recoupable/chat#1833 (enabler). Base: main.

Problem

getFormattedArtist did ...info over the raw account_info row, leaking account_info.id into the /api/artists response as id — but the sub-resources /api/artists/{id}/socials|posts|fans key on account_id. An agent that takes the list's id and calls /artists/{id}/socials always 404s. Reproduced live on the Apache→OneRPM run: id=33adb9fe (account_info.id) → "Artist not found"; account_id=ebae4bb9 → success. Direct contributor to that email's fabrication.

Fix

  • Replace the blind ...info spread with explicit typed fields (image/instruction/knowledges/label).
  • Set id = account_id so .id and .account_id both resolve for sub-resources (most forgiving for LLM callers).
  • Drops the other dead leaks (job_title/role_type/company_name/organization) — unused on this object (only read on getSystemPrompt's separate accountWithDetails).
  • account_id unchanged; chat frontend (keys on account_id) unaffected.

Tests (TDD)

  • New RED→GREEN getFormattedArtist.test.ts: id === account_id (never account_info.id); no raw-field leak.
  • Updated updateArtistHandler expectation (response now includes id = account_id).
  • Full lib/artists suite green (97), tsc + eslint clean.

🤖 Generated with Claude Code


Summary by cubic

Fixes /api/artists to set id = account_id so /artists/{id}/socials|posts|fans resolve without 404s. Removes leaked account_info.id and unused fields from responses.

  • Bug Fixes
    • Map only image, instruction, knowledges, label from account_info (no raw spread).
    • Set id = account_id so /artists/{id}/socials|posts|fans work.
    • Drop leaked fields: job_title, role_type, company_name, organization; add tests and update handler expectation.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed artist pages and related endpoints so the displayed artist ID now consistently matches the correct account-based identifier.
    • Improved artist data rendering to avoid accidental carryover of unrelated fields, ensuring the returned details are accurate and predictable.