Skip to content

Commit 0636735

Browse files
committed
docs(appScope): update comment for upstream cmcAccessProvisionAppScopeHook (plan 61)
The 'forbidden' / 'item-already-exists' swallow still applies, but the *reason* it's expected has shifted: post-plan-61's upstream CMC fix (2026-05-26 dev+prod), `:_cmc:apps:<appCode>` is server-side auto-provisioned by `cmcAccessProvisionAppScopeHook` on access-create / access-update. The OAuth-grant client's streams.create still returns 'forbidden' (parent-permission check is checked before existence), but that's fine — the leaf already exists by the time the access is usable. No behavior change — just clearer about why the swallow is correct.
1 parent 2f4c542 commit 0636735

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

ts/cmc/appScope.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/**
22
* Idempotently provision streams under `:_cmc:apps` on a CMC-enabled account.
33
*
4-
* The CMC plugin auto-creates the `:_cmc:apps` parent but does not
5-
* auto-create the per-app children — each `:_cmc:apps:<appCode>` and its
6-
* sub-scopes (e.g. `:_cmc:apps:hds-collector:<collectorId>`) need explicit
7-
* `streams.create` calls. The two error modes are tolerated:
4+
* The CMC plugin owns the `:_cmc:apps` namespace. Per-app leaves
5+
* (`:_cmc:apps:<appCode>`) are auto-provisioned server-side by the
6+
* `cmcAccessProvisionAppScopeHook` (deployed plan-61, 2026-05-26) whenever
7+
* `accesses.create` / `accesses.update` references a matching permission;
8+
* sub-scopes (`:_cmc:apps:<appCode>:<subPath>`) are not.
89
*
9-
* - `'item-already-exists'` — the stream is already there (idempotent re-run).
10-
* - `'forbidden'` — happens on the appScope when the caller's OAuth-scoped
11-
* access has `manage` on `:_cmc:apps:<appCode>` but not on the parent
12-
* `:_cmc:apps` (the plugin-managed namespace). In that case the appScope
13-
* is typically pre-existing anyway because the CMC plugin auto-provisions
14-
* app-scope roots on first invite.
10+
* For an OAuth-grant access the client still calls `streams.create` here:
11+
* pryv checks parent-permission first (no `manage` on `:_cmc:apps` → returns
12+
* `'forbidden'`), so we tolerate that — by the time the access is usable
13+
* the upstream hook has already created the leaf. The `'item-already-exists'`
14+
* branch covers the personal-token-with-`:_cmc:apps`-manage path (registration
15+
* personal tokens have it; bridge-athena's onboarding used to depend on it).
1516
*
1617
* Hoisted in Plan 60 B1 from three independent copies that had drifted:
1718
* `doctor-dashboard/app/cmcDoctor.ts` (canonical, used here),

0 commit comments

Comments
 (0)