Skip to content

The DERIVED half of bootstrapSystemCapabilities also leaves the platform bucket unseeded when an organization holds the name — the #5876 guard skips instead of inserting #8536

Description

@os-zhuang

Found while implementing #8470. The PM ruled the derived half explicitly out of scope for that card, so this records the finding rather than changing it.

The mechanism

bootstrapSystemCapabilities looks a capability up by name across organizations (system context, no tenantId). #8470 fixes the CURATED half by scoping its lookup to the row the platform owns. The DERIVED half's lookup stays { name } — deliberately, because its own #5876 guard already refuses to overwrite a row it does not own:

if(isDerived&&row.managed_by!=='platform'){skippedAuthored+=1;continue;}

The guard is correct about what it protects. What it does not do is insert. So when an organization has authored a row for a name that a bootstrap permission set grants via systemPermissions[], the cross-organization lookup finds the org's row, the guard fires, and the loop continues — the platform's own derived placeholder is never created in the NULL-organization bucket.

That is the same shape as #8470's second harm ("the platform's row is never seeded"), on the half #8470 leaves alone. It became reachable for the same reason: #8461 widened sys_capability.name from installation-wide to per-organization uniqueness (ADR-0120 D1), so the two-row state exists at all.

Note this was measured as safe in #8470's own table (its row 1) — correctly, because that row asked whether the organization's label survives, and it does. The unseeded platform bucket is a different question that row did not ask.

Measured consequence: none, today

I checked the same question #8470 asked about the curated half, with the same method: no runtime path reads a sys_capability row. Grants (systemPermissions) and requirements (requiredPermissions) resolve capabilities by name; validateCapabilityReferences resolves against PLATFORM_CAPABILITY_NAMES plus stack declarations, never the table. So the effect is confined to the registry contents and to Setup's capability listings — the platform's own row for that name is simply absent.

That is why I am filing this rather than treating it as urgent, and why the severity judgment should be made by whoever decides whether the registry is supposed to be complete.

The open question this really turns on

Is the derived placeholder supposed to exist per-installation regardless of what organizations have authored — the same rule #8470 just established for curated names — or is "some row resolves this name somewhere" the intended contract for derived defaults? The #5876 reasoning ("the capability resolves and the authored copy is the better one") reads as the latter, but it was written when name was installation-wide unique, so "a row exists" and "a row exists in the platform bucket" were the same statement. #8461 separated them, and nothing has re-decided the derived half since.

Filed unassigned. Related to #8470; not blocked by it.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions