Skip to content

Commit ebe3cb6

Browse files
committed
chore(app-showcase): bind persona sets on kernel:bootstrapped; drop redundant everyone binding
The security plugin now auto-binds the app's isDefault set (showcase_member_default) to everyone at boot, so the app glue no longer needs to. Keep only the persona → set bindings the framework cannot infer, and move them from kernel:listening to the kernel:bootstrapped anchor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017bJWtKmZ2mFpRFAmmmoeqe
1 parent 6d6ed48 commit ebe3cb6

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

examples/app-showcase/src/data/seed/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const orgUnits = SeedSchema.parse({
165165
// [#2926 ②] Position ↔ permission-set bindings are NOT seeded here: the seed
166166
// loader runs before the security bootstrap creates the sys_position /
167167
// sys_permission_set rows, so the required name references cannot resolve.
168-
// They are ensured imperatively on kernel:listening instead (after every
168+
// They are ensured imperatively on kernel:bootstrapped instead (after every
169169
// kernel:ready handler, incl. the security bootstrap, has settled) — see
170170
// `src/security/bind-position-sets.ts` (wired via `onEnable`).
171171

examples/app-showcase/src/security/bind-position-sets.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@
1818
* registration order (`kernel.ts` `trigger`). The showcase AppPlugin starts
1919
* BEFORE the Security plugin, so an app hook on `kernel:ready` runs *before*
2020
* the security bootstrap has created the position/set rows — the rows never
21-
* appear from inside that hook. We therefore bind on **`kernel:listening`**,
22-
* the phase the kernel fires only AFTER every `kernel:ready` handler has
23-
* completed (`kernel.ts` Phase 4 / `lite-kernel.ts`), so the bootstrap rows are
21+
* appear from inside that hook. We therefore bind on **`kernel:bootstrapped`**,
22+
* the anchor the kernel fires only AFTER every `kernel:ready` handler has
23+
* settled (`kernel.ts` Phase 3.5 / `lite-kernel.ts`), so the bootstrap rows are
2424
* guaranteed present.
2525
*
26-
* `everyone → showcase_member_default` IS bound here. The security plugin only
27-
* auto-binds an app's `isDefault` set to `everyone` when that set is
28-
* application-owned; the showcase ships as a package, so its default lands in
29-
* `sys_audience_binding_suggestion` (pending admin confirmation) and is NOT
30-
* live until confirmed. Binding it here keeps the demo's baseline working out
31-
* of the box, idempotently and alongside the suggestion.
26+
* `everyone → showcase_member_default` is NOT bound here: the security plugin
27+
* auto-binds the app's `isDefault` set (resolved as its `fallbackPermissionSet`)
28+
* to `everyone` at boot. This list only carries the persona → set bindings the
29+
* framework cannot infer.
3230
*/
3331

3432
const BINDINGS: ReadonlyArray<readonly [position: string, permissionSet: string]> = [
35-
['everyone', 'showcase_member_default'],
3633
['contributor', 'showcase_contributor'],
3734
['manager', 'showcase_manager'],
3835
['exec', 'showcase_executive'],
@@ -106,12 +103,12 @@ export function registerShowcasePositionBindings(ctx: BindHostContext): void {
106103
ctx.logger?.info?.('[showcase] position bindings ensured', { created, total: BINDINGS.length });
107104
};
108105

109-
// Bind on `kernel:listening` — the phase that fires only after every
106+
// Bind on `kernel:bootstrapped` — the anchor that fires only after every
110107
// `kernel:ready` handler (incl. the security bootstrap that seeds the
111-
// position/set rows) has completed. Fall back to a deferred immediate run
108+
// position/set rows) has settled. Fall back to a deferred immediate run
112109
// if the host context somehow omits the hook registrar.
113110
if (typeof ctx.hook === 'function') {
114-
ctx.hook('kernel:listening', run);
111+
ctx.hook('kernel:bootstrapped', run);
115112
} else {
116113
setTimeout(() => void run(), 0);
117114
}

0 commit comments

Comments
 (0)