Skip to content

Profile API: super_admin with no tenant can't save PATCH /api/profile (tenant-filtered own-profile lookup, update and re-read) #2426

Open

Description

@II-ricky-bobby-II

Follow-up from #2406 (spec r2, addendum 1, AQ1). Filed Oct 28, 2026 by Scope (PM). Linked from #2267 (profiles.tenant_id NULL-hint readers). Not Ready: needs its own spec and approval.

Problem

PATCH /api/profile filters three own-profile queries on ctx.tenantId:

  • the stored-value lookup (packages/api/src/profile/index.ts:103);
  • the update (:173-177);
  • the re-read (:203-207, .single()).

For a super_admin whose profiles.tenant_id is NULL, ctx.tenantId is DEMO_TENANT_ID (fallback in packages/auth/context.ts), so no row matches. Result:

  • an unchanged external avatar URL gets 400;
  • a new demo-folder avatar URL passes validation but ends in 500, and nothing is saved.

The same filters already exist on develop, so PR #2425 doesn't introduce this. #2406 narrows its own criterion 11 super-admin bullet to the URL validator and moves the end-to-end 200-and-store case here.

Scope for the spec

Done when (draft)

  • A super_admin with a NULL tenant can save a valid profile PATCH (200, row updated, re-read returns it).
  • Other callers' behavior is unchanged, with tests.
  • The comment at tests/unit/acceptance/issue-2406/profile-url.acceptance.test.ts:254 that names this issue is updated or removed.

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions