Skip to content

Seam (enterprise organizations package): its ensureDefaultOrganization wiring still triggers on grant inserts, which never fire on a fresh walled rig — adopt the exported isDefaultOrganizationBootstrapTrigger #13689

Description

@os-steve

Filed by the domain:services PM seat (#6021) under the multi-repo seam rule, as the coordination half of #11973 (platform-admin re-anchor L3). Provenance: PR #13685 §"The interim window L4 opened", which names this rather than assuming it closed.

⛔ Why this card lives in objectstack and not at destination. The fix lands in the enterprise organizations package, which is out of this repo. It has no repo:* lane label (checked: repo:enterprise does not exist in this repo's label set) and is outside the PM session's GitHub scope, so the file-at-destination rule cannot be executed by this seat. The substance here is the ordering — objectstack published the predicate, the enterprise wiring must adopt it — which is what a seam card is for. A maintainer must route the implementation half; this card is the objectstack-side anchor and the named-reader queue entry, not the implementation.

Named readers (the seam rule requires this, not just the label)

The defect

ensureDefaultOrganization is exported from @objectstack/plugin-auth and reused by the enterprise organizations package with its own wiring, which fires on sys_user_permission_set inserts (the pre-L3 trigger).

After L4 (#11974, landed b9972720f), bootstrap under a walled posture no longer grants — so on a fresh walled rig no sys_user_permission_set insert ever happens. The enterprise wiring's trigger therefore never fires from the event side.

L3 (#11973 / PR #13685) fixed this in-repo and shrank the out-of-repo half, but did not close it:

before L3 after L3
plugin-auth's own wiring grant inserts only isDefaultOrganizationBootstrapTriggersys_user insert/create, sys_user update touching email/email_verified, plus the legacy grant-insert arm
enterprise package's wiring grant inserts only unchanged — still grant inserts only
fresh-walled-rig window forever until the next process start (their kernel:ready pass now resolves a config-anchored admin, because L3 re-pointed the population, and the function signature did not change)

So the enterprise package is not broken — its calls keep working and its kernel:ready path recovers — but its event-driven bootstrap is dead on fresh walled rigs, and a rig that never restarts never bootstraps.

The fix

One import. The predicate was exported precisely so the two triggers cannot drift:

import { isDefaultOrganizationBootstrapTrigger } from '@objectstack/plugin-auth';

// replace the hand-spelled grant-insert condition with:
if (isDefaultOrganizationBootstrapTrigger(opCtx)) { /* … */ }

Published surface confirmed on this repo's side at PR #13685's head df17ff0a7: packages/plugins/plugin-auth/src/index.ts:13 is export * from './ensure-default-organization.js';, and the predicate is a top-level export function in that module. It takes { object?, operation?, data? } and returns boolean — no plugin-auth internals cross the seam.

⛔ What this card is NOT

Acceptance

Blocks: #11973 (partially — the coordination half only).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions