fix(artists): /api/artists id must equal account_id (drop leaked account_info.id)
Merged
SW
5mo ago+49+49+01234567890123456789-1-1-0123456789
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
...infospread with explicit typed fields (image/instruction/knowledges/label). - Set
id = account_idso.idand.account_idboth 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 ongetSystemPrompt's separateaccountWithDetails). account_idunchanged; chat frontend (keys onaccount_id) unaffected.
Tests (TDD)
- New RED→GREEN
getFormattedArtist.test.ts:id === account_id(neveraccount_info.id); no raw-field leak. - Updated
updateArtistHandlerexpectation (response now includesid = account_id). - Full
lib/artistssuite 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,labelfromaccount_info(no raw spread). - Set
id = account_idso/artists/{id}/socials|posts|fanswork. - Drop leaked fields:
job_title,role_type,company_name,organization; add tests and update handler expectation.
- Map only
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.