WS8 PR C: address review (firm-layer resilience, listUsers paging, email, skeleton)

↗ view on GitHub · sloth-ninja · 2026-07-22 · f0c3edb5

Approve-with-fixes follow-up:
- userApiKeys: wrap the firm layer in try/catch in getUserApiKeys and
  getUserApiKeyStatus - any organisation_api_keys read error is logged with a
  scoped tag and the firm layer skipped (env fallback intact), so a transient
  error can never break chat key resolution or profile status for a whole firm.
  New tests cover both paths.
- organisations.listOrganisationMembers: paginate auth.admin.listUsers until
  drained (guarded at 20 pages); perPage is a project-wide cap, not per-firm.
- organisations.setMemberRole: last-admin count now filters via normaliseRole
  so it can't miscount non-normalised data; success payload now populates the
  member's email (degrades to null on lookup failure).
- firm-settings: FirmApiKeysSection gains a loading skeleton so "Not set" never
  flashes before status loads.
- BUILD_LOG: document the last-admin recovery path (operator re-promotes via
  service_role SQL) + updated test count (201).

Verified: backend tsc clean, vitest 201/201; frontend tsc clean, eslint src
34 errors/77 warnings (main baseline).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents 9fba26ab
Stats 6 files changed , +177 , -51
Part of WS8 PR C: firm API keys, admin area, member roles

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-f0c3edb5.md from inside the repo you want the change in.

⬇ Download capture-commit-f0c3edb5.md