@fuzdev/fuz_app 0.159.0 → 0.160.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +7 -2
- package/dist/actions/protocol.d.ts +7 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +19 -4
- package/dist/auth/CLAUDE.md +32 -11
- package/dist/auth/account_schema.d.ts +2 -2
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +2257 -400
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +103 -99
- package/dist/auth/role_grant_offer_actions.d.ts +6 -3
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +15 -6
- package/dist/auth/role_grant_offer_notifications.d.ts +1364 -255
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +100 -47
- package/dist/auth/role_grant_offer_schema.d.ts +90 -22
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +40 -39
- package/dist/auth/scope_kind_schema.d.ts +6 -1
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +8 -3
- package/dist/auth/scope_kind_schema_fuz.d.ts +30 -0
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -0
- package/dist/auth/scope_kind_schema_fuz.js +29 -0
- package/dist/testing/CLAUDE.md +15 -8
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +15 -3
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +60 -17
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +2 -1
- package/dist/ui/CLAUDE.md +4 -4
- package/dist/ui/admin_accounts_state.svelte.d.ts +8 -8
- package/dist/ui/role_grant_offers_state.svelte.d.ts +9 -9
- package/dist/ui/role_grant_offers_state.svelte.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `ScopeKindName`
|
|
3
|
+
* (`auth/scope_kind_schema.ts`), under the same name, for schemas written in
|
|
4
|
+
* fuz_schema.
|
|
5
|
+
*
|
|
6
|
+
* Both are built from the constants `scope_kind_schema.ts` exports, so the
|
|
7
|
+
* bound, the grammar and the two messages can't drift apart. They give every
|
|
8
|
+
* input the same verdict and output, and write the same JSON Schema
|
|
9
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
10
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
11
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
12
|
+
*
|
|
13
|
+
* The export is `@nodocs` while the Zod `ScopeKindName` stays, as the docs
|
|
14
|
+
* build refuses two exports of one name.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
|
+
/**
|
|
20
|
+
* Valid scope-kind name: runs of lowercase letters joined by single
|
|
21
|
+
* underscores, at most `SCOPE_KIND_LENGTH_MAX` UTF-16 code units, the twin of
|
|
22
|
+
* the Zod `ScopeKindName`. A string it refuses gets the Zod one's message; a
|
|
23
|
+
* value that is no string, fuz_schema's.
|
|
24
|
+
*
|
|
25
|
+
* @nodocs
|
|
26
|
+
*/
|
|
27
|
+
export declare const ScopeKindName: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
28
|
+
/** @nodocs */
|
|
29
|
+
export type ScopeKindName = Infer<typeof ScopeKindName>;
|
|
30
|
+
//# sourceMappingURL=scope_kind_schema_fuz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope_kind_schema_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAUhF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,0MAGzB,CAAC;AACF,cAAc;AACd,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@fuzdev/fuz_schema` twin of the Zod `ScopeKindName`
|
|
3
|
+
* (`auth/scope_kind_schema.ts`), under the same name, for schemas written in
|
|
4
|
+
* fuz_schema.
|
|
5
|
+
*
|
|
6
|
+
* Both are built from the constants `scope_kind_schema.ts` exports, so the
|
|
7
|
+
* bound, the grammar and the two messages can't drift apart. They give every
|
|
8
|
+
* input the same verdict and output, and write the same JSON Schema
|
|
9
|
+
* (`maxLength` and `pattern`); a string both too long and outside the grammar
|
|
10
|
+
* gets the one length issue from this twin, as its `pipe` stops at the first
|
|
11
|
+
* failing step, where the Zod one adds the grammar issue after it.
|
|
12
|
+
*
|
|
13
|
+
* The export is `@nodocs` while the Zod `ScopeKindName` stays, as the docs
|
|
14
|
+
* build refuses two exports of one name.
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import { message, pipe, regex } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
|
+
import { bounded_string } from '../primitive_schemas_fuz.js';
|
|
20
|
+
import { SCOPE_KIND_LENGTH_MAX, SCOPE_KIND_NAME_LENGTH_MESSAGE, SCOPE_KIND_NAME_PATTERN_MESSAGE, SCOPE_KIND_NAME_REGEX } from './scope_kind_schema.js';
|
|
21
|
+
/**
|
|
22
|
+
* Valid scope-kind name: runs of lowercase letters joined by single
|
|
23
|
+
* underscores, at most `SCOPE_KIND_LENGTH_MAX` UTF-16 code units, the twin of
|
|
24
|
+
* the Zod `ScopeKindName`. A string it refuses gets the Zod one's message; a
|
|
25
|
+
* value that is no string, fuz_schema's.
|
|
26
|
+
*
|
|
27
|
+
* @nodocs
|
|
28
|
+
*/
|
|
29
|
+
export const ScopeKindName = pipe(bounded_string({ max: SCOPE_KIND_LENGTH_MAX, max_message: SCOPE_KIND_NAME_LENGTH_MESSAGE }), message(regex(SCOPE_KIND_NAME_REGEX), SCOPE_KIND_NAME_PATTERN_MESSAGE));
|
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -1625,19 +1625,26 @@ globalSetup handle.
|
|
|
1625
1625
|
### `cross_backend/role_grant_offer_notification_ws.ts` — `describe_role_grant_offer_notification_ws_tests`
|
|
1626
1626
|
|
|
1627
1627
|
Real-upgrade coverage of the consentful-role-grants WS notification fan-out —
|
|
1628
|
-
the
|
|
1628
|
+
the server-initiated notifications (`received` → recipient,
|
|
1629
1629
|
`accepted`/`declined` → grantor, `retracted` → recipient, flat
|
|
1630
|
-
`
|
|
1631
|
-
superseded sibling's grantor on **both**
|
|
1630
|
+
`role_grant_revoked` → revokee, global and scoped, and
|
|
1631
|
+
`role_grant_offer_supersede` → each superseded sibling's grantor on **both**
|
|
1632
|
+
the accept- and revoke-cascade paths).
|
|
1632
1633
|
`describe_role_grant_offer_notification_ws_tests({setup_test, capabilities,
|
|
1633
|
-
base_url, ws_path, ws_required_roles?})` opens the
|
|
1634
|
+
base_url, ws_path, ws_required_roles?, scoped_role?, scope_kind?})` opens the
|
|
1635
|
+
affected counterparty's socket
|
|
1634
1636
|
(`create_admitted_ws_transport` — a targeted notification reaches only an
|
|
1635
1637
|
admitted connection, and the handshake alone doesn't say it is one), drives the
|
|
1636
1638
|
lifecycle RPC over `fixture.transport`, then
|
|
1637
|
-
strict-parses the delivered frame against its canonical
|
|
1638
|
-
`auth/role_grant_offer_notifications.ts` (
|
|
1639
|
-
field / null / datetime / the flat
|
|
1640
|
-
|
|
1639
|
+
strict-parses the delivered frame against its canonical `@fuzdev/fuz_schema`
|
|
1640
|
+
params schema from `auth/role_grant_offer_notifications.ts` (`parse_or_throw`;
|
|
1641
|
+
the guard against serialization drift — field / null / datetime / the flat
|
|
1642
|
+
revoke shape with its `scope_kind` and `scope_id` / the supersede `reason` +
|
|
1643
|
+
`cause_id`). The scoped-revoke case has the keeper assign `scoped_role`
|
|
1644
|
+
(default `SPINE_PARTICIPANT_ROLE`; `spine_suites` passes
|
|
1645
|
+
`suite_roles.conferral`) in a `scope_kind` scope (default `'space'`, `null`
|
|
1646
|
+
for a builtin role, which skips the case), revokes it, and holds the frame to
|
|
1647
|
+
that pair. Every case also opens a **bystander** — a third account's
|
|
1641
1648
|
admitted socket, party to nothing the case drives — and once the targeted
|
|
1642
1649
|
frame has landed sends a `heartbeat` on it and asserts it received nothing
|
|
1643
1650
|
but the answers to its own requests. The barrier is what makes the silence
|
|
@@ -45,7 +45,7 @@ export interface SpineRpcEndpointsOptions {
|
|
|
45
45
|
/**
|
|
46
46
|
* WS notification sender threaded into the role-grant-offer sub-factory for
|
|
47
47
|
* server-initiated fan-out (`role_grant_offer_received` / `_accepted` /
|
|
48
|
-
* `_declined` / `_retracted` / `_supersede`, flat `
|
|
48
|
+
* `_declined` / `_retracted` / `_supersede`, flat `role_grant_revoked`).
|
|
49
49
|
*
|
|
50
50
|
* **Shared-instance trap.** Pass the SAME `ConnectionRegistry`
|
|
51
51
|
* instance the WS endpoint registers connections against — the registry
|
|
@@ -16,12 +16,24 @@ export interface RoleGrantOfferNotificationWsTestOptions extends WsEndpointTarge
|
|
|
16
16
|
* that close instead of the notification frame.
|
|
17
17
|
*/
|
|
18
18
|
readonly ws_required_roles?: ReadonlyArray<string>;
|
|
19
|
+
/**
|
|
20
|
+
* The role the scoped-revoke case assigns in a scope and revokes — one the
|
|
21
|
+
* backend's registry holds with the `admin` grant path. Default
|
|
22
|
+
* `SPINE_PARTICIPANT_ROLE`, the spine's own.
|
|
23
|
+
*/
|
|
24
|
+
readonly scoped_role?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A scope kind `scoped_role` applies to, for the scoped-revoke case; `null`
|
|
27
|
+
* skips that case. Default `'space'` (the spine participant's), or `null`
|
|
28
|
+
* for a builtin role, which is global-only.
|
|
29
|
+
*/
|
|
30
|
+
readonly scope_kind?: string | null;
|
|
19
31
|
}
|
|
20
32
|
/**
|
|
21
|
-
* Register the role-grant-offer WS notification suite —
|
|
33
|
+
* Register the role-grant-offer WS notification suite — cases over a real
|
|
22
34
|
* upgrade, one per server-initiated notification (received / accepted /
|
|
23
|
-
* declined / retracted / revoke + supersede on both the
|
|
24
|
-
* cascades). Each opens the affected counterparty's socket, drives the
|
|
35
|
+
* declined / retracted / revoke, global and scoped, + supersede on both the
|
|
36
|
+
* accept and revoke cascades). Each opens the affected counterparty's socket, drives the
|
|
25
37
|
* lifecycle RPC, and strict-parses the delivered frame against its canonical
|
|
26
38
|
* params schema. Gated on `capabilities.ws`.
|
|
27
39
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"role_grant_offer_notification_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/role_grant_offer_notification_ws.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAsF9B,OAAO,EAAE,KAAK,mBAAmB,EAAW,MAAM,mBAAmB,CAAC;AAKtE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAmB,KAAK,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAKjG,2EAA2E;AAC3E,MAAM,WAAW,uCAAwC,SAAQ,gBAAgB;IAChF,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,+CAA+C,GAC3D,SAAS,uCAAuC,KAC9C,IA6eF,CAAC"}
|
|
@@ -2,13 +2,16 @@ import '../assert_dev_env.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Cross-process **role-grant-offer lifecycle WS notification** suite — the
|
|
4
4
|
* machinery proof for the consentful-role-grants notification fan-out across
|
|
5
|
-
* any spine backend. Covers
|
|
5
|
+
* any spine backend. Covers every server-initiated notification of the
|
|
6
|
+
* lifecycle:
|
|
6
7
|
*
|
|
7
8
|
* - `role_grant_offer_received` → recipient (offer created)
|
|
8
9
|
* - `role_grant_offer_accepted` → grantor (recipient accepts)
|
|
9
10
|
* - `role_grant_offer_declined` → grantor (recipient declines)
|
|
10
11
|
* - `role_grant_offer_retracted` → recipient (grantor retracts)
|
|
11
|
-
* - `
|
|
12
|
+
* - `role_grant_revoked` (flat, omits `revoked_by`) → revokee (active grant
|
|
13
|
+
* revoked by the `role_grant_revoke` action), for a global grant and a
|
|
14
|
+
* scoped one unless `scope_kind` is `null`
|
|
12
15
|
* - `role_grant_offer_supersede` → each superseded sibling's grantor, fired on
|
|
13
16
|
* BOTH the accept-cascade (`reason: 'sibling_accepted'`) and the
|
|
14
17
|
* revoke-cascade (`reason: 'role_grant_revoked'`)
|
|
@@ -58,29 +61,36 @@ import '../assert_dev_env.js';
|
|
|
58
61
|
* @module
|
|
59
62
|
*/
|
|
60
63
|
import { assert, describe } from 'vitest';
|
|
64
|
+
import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
|
|
61
65
|
import { rpc_call } from '../rpc_helpers.js';
|
|
62
66
|
import { WS_ADMISSION_PROBE_ID } from '../transports/ws_transport.js';
|
|
63
67
|
import { is_notification_with, is_response_for } from '../transports/ws_client.js';
|
|
64
|
-
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
68
|
+
import { ROLE_ADMIN, is_builtin_role } from '../../auth/role_schema.js';
|
|
65
69
|
import { WS_CLOSE_PERMISSION_REVOKED } from '../../actions/transports.js';
|
|
66
|
-
import { ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD,
|
|
70
|
+
import { ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, ROLE_GRANT_REVOKED_NOTIFICATION_METHOD, RoleGrantOfferReceivedParams, RoleGrantOfferAcceptedParams, RoleGrantOfferDeclinedParams, RoleGrantOfferRetractedParams, RoleGrantOfferSupersedeParams, RoleGrantRevokedParams } from '../../auth/role_grant_offer_notifications.js';
|
|
67
71
|
import { test_if } from './capabilities.js';
|
|
68
72
|
import { create_active_role_grant, create_pending_role_grant_offer } from './role_grant_cross_helpers.js';
|
|
69
|
-
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
73
|
+
import { SPINE_PARTICIPANT_ROLE, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
70
74
|
import { open_session_ws } from './ws_endpoint.js';
|
|
71
75
|
/** The request id the bystander's barrier `heartbeat` goes out under. */
|
|
72
76
|
const BYSTANDER_BARRIER_ID = 'bystander_barrier';
|
|
73
77
|
/**
|
|
74
|
-
* Register the role-grant-offer WS notification suite —
|
|
78
|
+
* Register the role-grant-offer WS notification suite — cases over a real
|
|
75
79
|
* upgrade, one per server-initiated notification (received / accepted /
|
|
76
|
-
* declined / retracted / revoke + supersede on both the
|
|
77
|
-
* cascades). Each opens the affected counterparty's socket, drives the
|
|
80
|
+
* declined / retracted / revoke, global and scoped, + supersede on both the
|
|
81
|
+
* accept and revoke cascades). Each opens the affected counterparty's socket, drives the
|
|
78
82
|
* lifecycle RPC, and strict-parses the delivered frame against its canonical
|
|
79
83
|
* params schema. Gated on `capabilities.ws`.
|
|
80
84
|
*/
|
|
81
85
|
export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
82
86
|
const { setup_test, capabilities, ws_required_roles = [] } = options;
|
|
83
87
|
const revoke_closes_the_socket = ws_required_roles.includes(ROLE_ADMIN);
|
|
88
|
+
const scoped_role = options.scoped_role ?? SPINE_PARTICIPANT_ROLE;
|
|
89
|
+
const scope_kind = options.scope_kind === undefined
|
|
90
|
+
? is_builtin_role(scoped_role)
|
|
91
|
+
? null
|
|
92
|
+
: 'space'
|
|
93
|
+
: options.scope_kind;
|
|
84
94
|
// -- shared helpers -------------------------------------------------------
|
|
85
95
|
/**
|
|
86
96
|
* Open a WS transport on an account's session, admitted before it resolves:
|
|
@@ -158,7 +168,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
158
168
|
const frame = await recipient_ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, (p) => p.offer.to_account_id === recipient.account.id), 5000);
|
|
159
169
|
// Params strict-parse against the canonical wire schema — guards
|
|
160
170
|
// the serialization against field/null/datetime drift.
|
|
161
|
-
const params = RoleGrantOfferReceivedParams
|
|
171
|
+
const params = parse_or_throw(RoleGrantOfferReceivedParams, frame.params);
|
|
162
172
|
assert.strictEqual(params.offer.to_account_id, recipient.account.id);
|
|
163
173
|
assert.strictEqual(params.offer.role, ROLE_ADMIN);
|
|
164
174
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
@@ -183,7 +193,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
183
193
|
const accepted = await rpc(fixture, 'role_grant_offer_accept', { offer_id: offer.id }, recipient.create_session_headers());
|
|
184
194
|
assert.isTrue(accepted.ok, `accept failed: ${JSON.stringify(accepted)}`);
|
|
185
195
|
const frame = await grantor.wait_for(is_notification_with(ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, (p) => p.offer.id === offer.id), 5000);
|
|
186
|
-
const params = RoleGrantOfferAcceptedParams
|
|
196
|
+
const params = parse_or_throw(RoleGrantOfferAcceptedParams, frame.params);
|
|
187
197
|
assert.strictEqual(params.offer.id, offer.id);
|
|
188
198
|
assert.isNotNull(params.offer.accepted_at);
|
|
189
199
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
@@ -207,7 +217,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
207
217
|
const declined = await rpc(fixture, 'role_grant_offer_decline', { offer_id: offer.id, reason: 'no thanks' }, recipient.create_session_headers());
|
|
208
218
|
assert.isTrue(declined.ok, `decline failed: ${JSON.stringify(declined)}`);
|
|
209
219
|
const frame = await grantor.wait_for(is_notification_with(ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, (p) => p.offer.id === offer.id), 5000);
|
|
210
|
-
const params = RoleGrantOfferDeclinedParams
|
|
220
|
+
const params = parse_or_throw(RoleGrantOfferDeclinedParams, frame.params);
|
|
211
221
|
assert.strictEqual(params.offer.id, offer.id);
|
|
212
222
|
// Decline reason rides inside the offer row, not a sibling field.
|
|
213
223
|
assert.strictEqual(params.offer.decline_reason, 'no thanks');
|
|
@@ -233,7 +243,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
233
243
|
const retracted = await rpc(fixture, 'role_grant_offer_retract', { offer_id: offer.id }, fixture.create_session_headers());
|
|
234
244
|
assert.isTrue(retracted.ok, `retract failed: ${JSON.stringify(retracted)}`);
|
|
235
245
|
const frame = await recipient_ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, (p) => p.offer.id === offer.id), 5000);
|
|
236
|
-
const params = RoleGrantOfferRetractedParams
|
|
246
|
+
const params = parse_or_throw(RoleGrantOfferRetractedParams, frame.params);
|
|
237
247
|
assert.strictEqual(params.offer.id, offer.id);
|
|
238
248
|
assert.strictEqual(params.offer.to_account_id, recipient.account.id);
|
|
239
249
|
assert.isNotNull(params.offer.retracted_at);
|
|
@@ -249,7 +259,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
249
259
|
});
|
|
250
260
|
test_if(capabilities.ws, revoke_closes_the_socket
|
|
251
261
|
? 'revoke closes the revokee WS gated on the revoked role'
|
|
252
|
-
: 'revoke delivers a flat
|
|
262
|
+
: 'revoke delivers a flat role_grant_revoked to the revokee WS', async () => {
|
|
253
263
|
const fixture = await setup_test();
|
|
254
264
|
const revokee = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
255
265
|
const role_grant_id = await create_active_role_grant(fixture, revokee, {
|
|
@@ -261,13 +271,15 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
261
271
|
try {
|
|
262
272
|
const revoked = await rpc(fixture, 'role_grant_revoke', { actor_id: revokee.actor.id, role_grant_id, reason: 'cleanup' }, fixture.create_session_headers());
|
|
263
273
|
assert.isTrue(revoked.ok, `revoke failed: ${JSON.stringify(revoked)}`);
|
|
264
|
-
const is_revoke_frame = is_notification_with(
|
|
274
|
+
const is_revoke_frame = is_notification_with(ROLE_GRANT_REVOKED_NOTIFICATION_METHOD, (p) => p.role_grant_id === role_grant_id);
|
|
265
275
|
// Flat params — guards the no-`offer`-wrapper, `revoked_by`-omitted
|
|
266
276
|
// shape against drift.
|
|
267
277
|
const assert_flat_revoke = (frame) => {
|
|
268
|
-
const params =
|
|
278
|
+
const params = parse_or_throw(RoleGrantRevokedParams, frame.params);
|
|
269
279
|
assert.strictEqual(params.role_grant_id, role_grant_id);
|
|
270
280
|
assert.strictEqual(params.role, ROLE_ADMIN);
|
|
281
|
+
assert.strictEqual(params.scope_kind, null);
|
|
282
|
+
assert.strictEqual(params.scope_id, null);
|
|
271
283
|
assert.strictEqual(params.reason, 'cleanup');
|
|
272
284
|
assert.notProperty(frame.params, 'revoked_by');
|
|
273
285
|
};
|
|
@@ -295,6 +307,37 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
295
307
|
await bystander_ws.close();
|
|
296
308
|
}
|
|
297
309
|
});
|
|
310
|
+
test_if(capabilities.ws && scope_kind !== null, 'a scoped revoke delivers its scope_kind and scope_id to the revokee WS', async () => {
|
|
311
|
+
const fixture = await setup_test();
|
|
312
|
+
// `ROLE_ADMIN` opens a socket gated on it; the scoped revoke below takes
|
|
313
|
+
// no global grant, so a gated socket stays open
|
|
314
|
+
const revokee = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
315
|
+
const scope_id = '44444444-4444-4444-8444-444444444444';
|
|
316
|
+
const assigned = await rpc(fixture, 'role_grant_assign', { to_account_id: revokee.account.id, role: scoped_role, scope_kind, scope_id }, fixture.create_session_headers());
|
|
317
|
+
assert.isTrue(assigned.ok, `assign failed: ${JSON.stringify(assigned)}`);
|
|
318
|
+
const { role_grant_id } = assigned.result;
|
|
319
|
+
const bystander_ws = await open_bystander(fixture);
|
|
320
|
+
try {
|
|
321
|
+
const revokee_ws = await open_ws(revokee);
|
|
322
|
+
try {
|
|
323
|
+
const revoked = await rpc(fixture, 'role_grant_revoke', { actor_id: revokee.actor.id, role_grant_id }, fixture.create_session_headers());
|
|
324
|
+
assert.isTrue(revoked.ok, `revoke failed: ${JSON.stringify(revoked)}`);
|
|
325
|
+
const frame = await revokee_ws.wait_for(is_notification_with(ROLE_GRANT_REVOKED_NOTIFICATION_METHOD, (p) => p.role_grant_id === role_grant_id), 5000);
|
|
326
|
+
const params = parse_or_throw(RoleGrantRevokedParams, frame.params);
|
|
327
|
+
assert.strictEqual(params.role, scoped_role);
|
|
328
|
+
assert.strictEqual(params.scope_kind, scope_kind);
|
|
329
|
+
assert.strictEqual(params.scope_id, scope_id);
|
|
330
|
+
assert.strictEqual(params.reason, null);
|
|
331
|
+
await assert_bystander_heard_nothing(bystander_ws);
|
|
332
|
+
}
|
|
333
|
+
finally {
|
|
334
|
+
await revokee_ws.close();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
finally {
|
|
338
|
+
await bystander_ws.close();
|
|
339
|
+
}
|
|
340
|
+
});
|
|
298
341
|
test_if(capabilities.ws, 'accept of a sibling delivers role_grant_offer_supersede to the other grantor WS', async () => {
|
|
299
342
|
const fixture = await setup_test();
|
|
300
343
|
// Three identities: keeper (grantor 1, socket), a second admin grantor
|
|
@@ -314,7 +357,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
314
357
|
const accepted = await rpc(fixture, 'role_grant_offer_accept', { offer_id: grantor2_offer.id }, recipient.create_session_headers());
|
|
315
358
|
assert.isTrue(accepted.ok, `accept failed: ${JSON.stringify(accepted)}`);
|
|
316
359
|
const frame = await grantor1_ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, (p) => p.offer.id === keeper_offer.id), 5000);
|
|
317
|
-
const params = RoleGrantOfferSupersedeParams
|
|
360
|
+
const params = parse_or_throw(RoleGrantOfferSupersedeParams, frame.params);
|
|
318
361
|
assert.strictEqual(params.offer.id, keeper_offer.id);
|
|
319
362
|
assert.strictEqual(params.reason, 'sibling_accepted');
|
|
320
363
|
// cause_id points at the accepted sibling (grantor 2's offer).
|
|
@@ -348,7 +391,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
348
391
|
const revoked = await rpc(fixture, 'role_grant_revoke', { actor_id: revokee.actor.id, role_grant_id }, fixture.create_session_headers());
|
|
349
392
|
assert.isTrue(revoked.ok, `revoke failed: ${JSON.stringify(revoked)}`);
|
|
350
393
|
const frame = await grantor_ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, (p) => p.offer.id === sibling_offer.id), 5000);
|
|
351
|
-
const params = RoleGrantOfferSupersedeParams
|
|
394
|
+
const params = parse_or_throw(RoleGrantOfferSupersedeParams, frame.params);
|
|
352
395
|
assert.strictEqual(params.offer.id, sibling_offer.id);
|
|
353
396
|
assert.strictEqual(params.reason, 'role_grant_revoked');
|
|
354
397
|
// cause_id points at the revoked role_grant.
|
|
@@ -165,10 +165,11 @@ export interface SpineSuiteRoles {
|
|
|
165
165
|
*/
|
|
166
166
|
readonly cell_grant?: string;
|
|
167
167
|
/**
|
|
168
|
-
* The admin-grantable role `role_grant_offer_lifecycle` offers
|
|
169
|
-
* `role_grant_participation` confers
|
|
168
|
+
* The admin-grantable role `role_grant_offer_lifecycle` offers,
|
|
169
|
+
* `role_grant_participation` confers, and `role_grant_offer_notification_ws`
|
|
170
|
+
* assigns in a scope and revokes. Default `SPINE_PARTICIPANT_ROLE`;
|
|
170
171
|
* `ROLE_ADMIN` serves a backend with only the builtin roles (the scoped
|
|
171
|
-
* assign
|
|
172
|
+
* assign and scoped revoke cases then skip, as a builtin is global-only).
|
|
172
173
|
*/
|
|
173
174
|
readonly conferral?: string;
|
|
174
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,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AM,CAAC;CACrB;AAiCD;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,GACvC,eAAe,mBAAmB,EAClC,WAAW,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,KACpD,IAgBF,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,8BAA8B,GAC1C,eAAe,mBAAmB,EAClC,QAAQ,aAAa,CAAC,cAAc,CAAC,KACnC,IAiCF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GACvC,QAAQ,sCAAsC,EAC9C,SAAS,uBAAuB,KAC9B,IAoCF,CAAC"}
|
|
@@ -402,7 +402,8 @@ const SUITE_ENTRIES = {
|
|
|
402
402
|
capabilities: c.config.capabilities,
|
|
403
403
|
base_url: c.config.base_url,
|
|
404
404
|
ws_path: c.config.ws_path,
|
|
405
|
-
ws_required_roles: c.options.ws_required_roles
|
|
405
|
+
ws_required_roles: c.options.ws_required_roles,
|
|
406
|
+
scoped_role: c.options.suite_roles?.conferral
|
|
406
407
|
}),
|
|
407
408
|
describe: describe_role_grant_offer_notification_ws_tests,
|
|
408
409
|
required: { setup_test: true, capabilities: true, base_url: true, ws_path: true }
|
package/dist/ui/CLAUDE.md
CHANGED
|
@@ -60,8 +60,8 @@ because `$state.raw` expects reference swaps.
|
|
|
60
60
|
reducer — `subscribe(subscribe_fn)` is a thin subscription adapter over
|
|
61
61
|
it. Six methods land on the reducer: `role_grant_offer_received` /
|
|
62
62
|
`_retracted` / `_accepted` / `_declined` / `_supersede` all merge a
|
|
63
|
-
`{offer}` payload; `
|
|
64
|
-
lifecycle lives in auth/role_grants state). The
|
|
63
|
+
`{offer}` payload; `role_grant_revoked` is ignored at this layer (role_grant
|
|
64
|
+
lifecycle lives in auth/role_grants state). The notification specs and
|
|
65
65
|
their payload shapes are defined in `auth/role_grant_offer_notifications.ts`
|
|
66
66
|
(see `auth/CLAUDE.md` §WS notifications).
|
|
67
67
|
|
|
@@ -407,8 +407,8 @@ destructive actions.
|
|
|
407
407
|
`incoming` (recipient-side pending, soonest-expiry first),
|
|
408
408
|
`outgoing` (grantor-side pending, newest-created first), `history`
|
|
409
409
|
(all known, newest-created first). Reducer `apply_notification`
|
|
410
|
-
handles the
|
|
411
|
-
`
|
|
410
|
+
handles the role-grant-offer notification methods;
|
|
411
|
+
`role_grant_revoked` is deliberately ignored here (auth/role_grants
|
|
412
412
|
concern). `reset()` clears every slot + the Map.
|
|
413
413
|
|
|
414
414
|
## State primitives
|
|
@@ -101,22 +101,22 @@ export declare class AdminAccountsState {
|
|
|
101
101
|
#private;
|
|
102
102
|
readonly list: AsyncSlot<void, string>;
|
|
103
103
|
readonly grant: KeyedAsyncSlot<string, {
|
|
104
|
-
id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
105
|
-
from_actor_id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
106
|
-
to_account_id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
107
|
-
to_actor_id: (string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">) | null;
|
|
108
|
-
role: string;
|
|
109
|
-
scope_kind: string | null;
|
|
110
|
-
scope_id: (string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">) | null;
|
|
111
104
|
message: string | null;
|
|
105
|
+
id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
112
106
|
created_at: string;
|
|
113
107
|
expires_at: string;
|
|
108
|
+
role: string;
|
|
109
|
+
scope_kind: string | null;
|
|
110
|
+
scope_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
111
|
+
from_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
112
|
+
to_account_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
113
|
+
to_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
114
114
|
accepted_at: string | null;
|
|
115
115
|
declined_at: string | null;
|
|
116
116
|
decline_reason: string | null;
|
|
117
117
|
retracted_at: string | null;
|
|
118
118
|
superseded_at: string | null;
|
|
119
|
-
resulting_role_grant_id:
|
|
119
|
+
resulting_role_grant_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
120
120
|
}, string>;
|
|
121
121
|
readonly revoke: KeyedAsyncSlot<string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">, void, string>;
|
|
122
122
|
readonly retract: KeyedAsyncSlot<string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">, void, string>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Reactive state for the consentful-role-grants offer flow.
|
|
3
3
|
*
|
|
4
4
|
* Maintains one offer cache keyed by id, seeded by the RPC list/history
|
|
5
|
-
* actions and kept live by the
|
|
5
|
+
* actions and kept live by the role-grant-offer WebSocket notifications.
|
|
6
6
|
* `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
|
|
7
7
|
* are derived views; `history` is the full cache ordered newest-first for
|
|
8
8
|
* the grantor/admin history view.
|
|
@@ -99,22 +99,22 @@ export declare class RoleGrantOffersState {
|
|
|
99
99
|
readonly list: AsyncSlot<void, string>;
|
|
100
100
|
readonly list_history: AsyncSlot<void, string>;
|
|
101
101
|
readonly create: AsyncSlot<{
|
|
102
|
-
id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
103
|
-
from_actor_id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
104
|
-
to_account_id: string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">;
|
|
105
|
-
to_actor_id: (string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">) | null;
|
|
106
|
-
role: string;
|
|
107
|
-
scope_kind: string | null;
|
|
108
|
-
scope_id: (string & import("@fuzdev/fuz_schema/schema.js").Brand<"Uuid">) | null;
|
|
109
102
|
message: string | null;
|
|
103
|
+
id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
110
104
|
created_at: string;
|
|
111
105
|
expires_at: string;
|
|
106
|
+
role: string;
|
|
107
|
+
scope_kind: string | null;
|
|
108
|
+
scope_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
109
|
+
from_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
110
|
+
to_account_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
111
|
+
to_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
112
112
|
accepted_at: string | null;
|
|
113
113
|
declined_at: string | null;
|
|
114
114
|
decline_reason: string | null;
|
|
115
115
|
retracted_at: string | null;
|
|
116
116
|
superseded_at: string | null;
|
|
117
|
-
resulting_role_grant_id:
|
|
117
|
+
resulting_role_grant_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
118
118
|
}, string>;
|
|
119
119
|
/** Per-offer accept, keyed by offer id. */
|
|
120
120
|
readonly accept: KeyedAsyncSlot<string, void, string>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Reactive state for the consentful-role-grants offer flow.
|
|
3
3
|
*
|
|
4
4
|
* Maintains one offer cache keyed by id, seeded by the RPC list/history
|
|
5
|
-
* actions and kept live by the
|
|
5
|
+
* actions and kept live by the role-grant-offer WebSocket notifications.
|
|
6
6
|
* `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
|
|
7
7
|
* are derived views; `history` is the full cache ordered newest-first for
|
|
8
8
|
* the grantor/admin history view.
|
|
@@ -33,7 +33,7 @@ import { AsyncSlot } from './async_slot.svelte.js';
|
|
|
33
33
|
import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
|
|
34
34
|
import { is_iso8601_seconds_live } from '../timestamp.js';
|
|
35
35
|
import { GRANT_SCOPE_PAIRED_MESSAGE, is_grant_scope_paired } from '../auth/role_grant_offer_action_specs.js';
|
|
36
|
-
import { ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD,
|
|
36
|
+
import { ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, ROLE_GRANT_REVOKED_NOTIFICATION_METHOD } from '../auth/role_grant_offer_notifications.js';
|
|
37
37
|
/**
|
|
38
38
|
* Svelte context for `RoleGrantOffersState`.
|
|
39
39
|
* Use `role_grant_offers_state_context.set(state)` in the provider and
|
|
@@ -203,8 +203,8 @@ export class RoleGrantOffersState {
|
|
|
203
203
|
this.#merge_offers([offer]);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
case
|
|
207
|
-
//
|
|
206
|
+
case ROLE_GRANT_REVOKED_NOTIFICATION_METHOD:
|
|
207
|
+
// role_grant_revoked is a role-grant-lifecycle event — the offer cache
|
|
208
208
|
// is unaffected. Consumers handle it in an auth/role_grants state.
|
|
209
209
|
return;
|
|
210
210
|
default:
|