@fuzdev/fuz_app 0.181.0 → 0.182.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 +24 -6
- package/dist/actions/action_rpc.d.ts +11 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +3 -2
- package/dist/actions/action_types.d.ts +16 -1
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +1 -1
- package/dist/actions/notification_sender.d.ts +83 -0
- package/dist/actions/notification_sender.d.ts.map +1 -0
- package/dist/actions/notification_sender.js +85 -0
- package/dist/actions/perform_action.d.ts +9 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +22 -13
- package/dist/actions/register_action_ws.d.ts +14 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +3 -2
- package/dist/actions/ws_socket_session.d.ts +3 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/CLAUDE.md +60 -41
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +13 -3
- package/dist/auth/account_queries.d.ts +158 -16
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +189 -18
- package/dist/auth/account_routes.d.ts +1 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +27 -26
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +71 -28
- package/dist/auth/api_token_queries.d.ts +13 -5
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +24 -9
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +3 -2
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +12 -1
- package/dist/auth/deps.d.ts +10 -0
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/request_context.d.ts +73 -73
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +78 -96
- package/dist/auth/resolved_auth.d.ts +10 -5
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +2 -2
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +2 -1
- package/dist/auth/role_grant_offer_actions.d.ts +7 -11
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +61 -93
- package/dist/auth/role_grant_offer_notifications.d.ts +87 -38
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +75 -22
- package/dist/auth/role_grant_offer_queries.d.ts +96 -15
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +185 -70
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/role_grant_queries.d.ts +52 -12
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +75 -24
- package/dist/auth/role_grant_sql.d.ts +21 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -1
- package/dist/auth/role_grant_sql.js +21 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +9 -2
- package/dist/auth/session_queries.d.ts +34 -13
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +48 -18
- package/dist/auth/standard_rpc_actions.d.ts +6 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +5 -6
- package/dist/auth/token_scope.d.ts +1 -1
- package/dist/auth/token_scope.js +1 -1
- package/dist/http/CLAUDE.md +7 -6
- package/dist/http/auth_shape.d.ts +1 -1
- package/dist/http/error_schemas.d.ts +9 -21
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +14 -24
- package/dist/http/route_spec.d.ts +2 -2
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +3 -1
- package/dist/server/app_server.d.ts +26 -16
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +17 -7
- package/dist/server/serve_fact_route.d.ts +3 -3
- package/dist/server/serve_fact_route.js +12 -12
- package/dist/testing/CLAUDE.md +5 -5
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +3 -1
- package/dist/testing/auth_apps.js +1 -1
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +43 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -26
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -6
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -10
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +4 -4
- package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +5 -4
- 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 +183 -30
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +26 -5
- package/dist/testing/middleware.d.ts +1 -1
- package/dist/testing/middleware.js +5 -5
- package/dist/testing/resolved_auth.d.ts +3 -1
- package/dist/testing/resolved_auth.d.ts.map +1 -1
- package/dist/testing/resolved_auth.js +4 -4
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +5 -2
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +8 -4
- package/package.json +1 -1
|
@@ -12,14 +12,19 @@ import '../assert_dev_env.js';
|
|
|
12
12
|
* - `role_grant_revoked` (flat, omits `revoked_by`) → revokee (active grant
|
|
13
13
|
* revoked by the `role_grant_revoke` action), for a global grant and a
|
|
14
14
|
* scoped one unless `scope_kind` is `null`
|
|
15
|
-
* - `role_grant_offer_supersede` → each
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* - `role_grant_offer_supersede` → each live party of an offer a cascade ended:
|
|
16
|
+
* an accept's siblings' grantors (`reason: 'sibling_accepted'`, the
|
|
17
|
+
* recipient being the caller), both parties of every offer a revoke ends
|
|
18
|
+
* (`reason: 'role_grant_revoked'` — the revokee's incoming siblings and its
|
|
19
|
+
* own outgoing offers), and the other party of every offer an account
|
|
20
|
+
* removal ends (`reason: 'account_deleted'`, delete and purge — gated on
|
|
21
|
+
* `capabilities.account_lifecycle` too; the removed account's socket closes
|
|
22
|
+
* and hears none of it)
|
|
18
23
|
*
|
|
19
24
|
* These exercise only spine primitives (accounts, role-grants, offers, WS
|
|
20
25
|
* notifications) — zero consumer domain — so the suite lives here and runs
|
|
21
|
-
* against any backend that
|
|
22
|
-
*
|
|
26
|
+
* against any backend that mounts the standard RPC actions and a WS endpoint
|
|
27
|
+
* their notifications reach: fuz_app's own spine self-tests
|
|
23
28
|
* (`testing_spine_server` + the Rust `testing_spine_stub`) and downstream
|
|
24
29
|
* twin-impl consumers (the fuz_forge Deno/Hono + Rust `fuz_forge_server`
|
|
25
30
|
* backends) alike.
|
|
@@ -35,7 +40,10 @@ import '../assert_dev_env.js';
|
|
|
35
40
|
* but the answers to its own requests, behind a `heartbeat` barrier on its
|
|
36
41
|
* socket (`assert_bystander_heard_nothing` says why the barrier makes the
|
|
37
42
|
* silence meaningful). A fan-out that reached past its target account fails
|
|
38
|
-
* there.
|
|
43
|
+
* there. The target is held the same way, behind a barrier of its own: its
|
|
44
|
+
* socket heard exactly the notifications the case addressed to it, each once,
|
|
45
|
+
* in order — so a backend delivering one twice (a registry reached through
|
|
46
|
+
* two paths) fails, which the frame's own `wait_for` can't see.
|
|
39
47
|
*
|
|
40
48
|
* Sends are queued on the post-commit drain (handler-emit, not audit-derived),
|
|
41
49
|
* so a frame may land a beat after the RPC resolves — `WsClient.wait_for` polls
|
|
@@ -47,11 +55,12 @@ import '../assert_dev_env.js';
|
|
|
47
55
|
* guard), and accept stays idempotent on the role_grant while still superseding
|
|
48
56
|
* pending siblings. Gated on `capabilities.ws`.
|
|
49
57
|
*
|
|
50
|
-
* The revoke
|
|
58
|
+
* The revoke cases revoke the revokee's only `ROLE_ADMIN` grant. On an endpoint
|
|
51
59
|
* gated on that role (`ws_required_roles`) the revokee's socket loses its
|
|
52
60
|
* access by the same revoke: it is closed with `WS_CLOSE_PERMISSION_REVOKED`,
|
|
53
|
-
* and
|
|
54
|
-
* so the
|
|
61
|
+
* and its notifications may or may not reach it first (nothing orders the
|
|
62
|
+
* two), so the cases assert the close there — and at most the start of what it
|
|
63
|
+
* would have heard, in order — and the frames on an ungated endpoint.
|
|
55
64
|
*
|
|
56
65
|
* Cross-process only: `create_admitted_ws_transport` needs a real bound socket, so wire
|
|
57
66
|
* it from a `*.cross.test.ts` file, never an in-process setup. Authed cookies
|
|
@@ -64,23 +73,38 @@ import { assert, describe } from 'vitest';
|
|
|
64
73
|
import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
|
|
65
74
|
import { rpc_call } from '../rpc_helpers.js';
|
|
66
75
|
import { WS_ADMISSION_PROBE_ID } from '../transports/ws_transport.js';
|
|
67
|
-
import { is_notification_with, is_response_for } from '../transports/ws_client.js';
|
|
76
|
+
import { is_notification, is_notification_with, is_response_for } from '../transports/ws_client.js';
|
|
68
77
|
import { ROLE_ADMIN, is_builtin_role } from '../../auth/role_schema.js';
|
|
69
78
|
import { WS_CLOSE_PERMISSION_REVOKED, WS_CLOSE_PERMISSION_REVOKED_REASON } from '../../actions/transports.js';
|
|
70
79
|
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';
|
|
71
80
|
import { test_if } from './capabilities.js';
|
|
72
81
|
import { create_active_role_grant, create_pending_role_grant_offer } from './role_grant_cross_helpers.js';
|
|
82
|
+
import { cross_account_purge } from './revocation_drivers.js';
|
|
73
83
|
import { SPINE_PARTICIPANT_ROLE, SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
74
84
|
import { open_session_ws } from './ws_endpoint.js';
|
|
75
85
|
/** The request id the bystander's barrier `heartbeat` goes out under. */
|
|
76
86
|
const BYSTANDER_BARRIER_ID = 'bystander_barrier';
|
|
87
|
+
/** The request id the target's barrier `heartbeat` goes out under. */
|
|
88
|
+
const TARGET_BARRIER_ID = 'target_barrier';
|
|
89
|
+
/**
|
|
90
|
+
* Name each frame a socket received but the answers to its admission probe and
|
|
91
|
+
* its barrier: a notification by its method, anything else as its JSON, so an
|
|
92
|
+
* unexpected response shows in the assertion's diff.
|
|
93
|
+
*/
|
|
94
|
+
const to_heard_frames = (ws) => ws.messages
|
|
95
|
+
.filter((msg) => !is_response_for(WS_ADMISSION_PROBE_ID)(msg) && !is_response_for(TARGET_BARRIER_ID)(msg))
|
|
96
|
+
.map((msg) => {
|
|
97
|
+
const method = msg?.method;
|
|
98
|
+
return typeof method === 'string' ? method : JSON.stringify(msg);
|
|
99
|
+
});
|
|
77
100
|
/**
|
|
78
101
|
* Register the role-grant-offer WS notification suite — cases over a real
|
|
79
102
|
* upgrade, one per server-initiated notification (received / accepted /
|
|
80
|
-
* declined / retracted / revoke, global and scoped, + supersede on
|
|
81
|
-
*
|
|
82
|
-
* lifecycle RPC, and strict-parses the delivered
|
|
83
|
-
* params schema. Gated on `capabilities.ws
|
|
103
|
+
* declined / retracted / revoke, global and scoped, + supersede on the accept,
|
|
104
|
+
* revoke, delete and purge cascades). Each opens every party's socket, drives
|
|
105
|
+
* the lifecycle RPC, and strict-parses the delivered frames against their
|
|
106
|
+
* canonical params schema. Gated on `capabilities.ws`, the removals on
|
|
107
|
+
* `capabilities.account_lifecycle` too.
|
|
84
108
|
*/
|
|
85
109
|
export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
86
110
|
const { setup_test, capabilities, ws_required_roles = [] } = options;
|
|
@@ -131,7 +155,8 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
131
155
|
* frame can be written while the pass is still pushing — a window the
|
|
132
156
|
* barrier's round trip outlasts in practice. Either way the check covers
|
|
133
157
|
* every pass of the drain, not just the one that reached the target: TS
|
|
134
|
-
*
|
|
158
|
+
* calls every queued send in one synchronous loop
|
|
159
|
+
* (`flush_post_commit_effects`), and `PostCommitEffects::drain_all` joins
|
|
135
160
|
* effects whose notify futures push synchronously, so every pass
|
|
136
161
|
* completes in the drain's first poll.
|
|
137
162
|
*/
|
|
@@ -140,6 +165,34 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
140
165
|
const strays = bystander_ws.messages.filter((msg) => !is_response_for(WS_ADMISSION_PROBE_ID)(msg) && !is_response_for(BYSTANDER_BARRIER_ID)(msg));
|
|
141
166
|
assert.deepStrictEqual(strays, [], 'a bystander socket received frames addressed to others');
|
|
142
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Assert the targeted socket heard exactly `expected` — the notifications
|
|
170
|
+
* the case addressed to it, in order, each once — and nothing else but the
|
|
171
|
+
* answers to its own requests. Called once the targeted frame has landed,
|
|
172
|
+
* behind a `heartbeat` barrier on the target's own socket, which makes the
|
|
173
|
+
* absence of a second copy a finding for the reason
|
|
174
|
+
* `assert_bystander_heard_nothing` gives: a fan-out queues every copy it
|
|
175
|
+
* sends in the pass that sent the first, ahead of the barrier's response.
|
|
176
|
+
*/
|
|
177
|
+
const assert_target_heard_exactly = async (target_ws, expected) => {
|
|
178
|
+
await target_ws.request(TARGET_BARRIER_ID, 'heartbeat', {}, 5000);
|
|
179
|
+
assert.deepStrictEqual(to_heard_frames(target_ws), expected, 'the target socket did not hear exactly the notifications addressed to it, each once');
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Wait for the `role_grant_offer_supersede` frame of `offer_id` on `ws` and
|
|
183
|
+
* strict-parse its params against the canonical wire schema.
|
|
184
|
+
*/
|
|
185
|
+
const wait_for_supersede = async (ws, offer_id) => {
|
|
186
|
+
const frame = await ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, (p) => p.offer.id === offer_id), 5000);
|
|
187
|
+
const params = parse_or_throw(RoleGrantOfferSupersedeParams, frame.params);
|
|
188
|
+
assert.strictEqual(params.offer.id, offer_id);
|
|
189
|
+
assert.isNotNull(params.offer.superseded_at);
|
|
190
|
+
return params;
|
|
191
|
+
};
|
|
192
|
+
/** The offer ids of the supersede frames `ws` heard, in order. */
|
|
193
|
+
const supersede_offer_ids = (ws) => ws.messages
|
|
194
|
+
.filter(is_notification(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD))
|
|
195
|
+
.map((msg) => msg.params.offer.id);
|
|
143
196
|
/** Drive a JSON-RPC call over the fixture's HTTP transport. */
|
|
144
197
|
const rpc = (fixture, method, params, headers) => rpc_call({ app: fixture.transport, path: SPINE_RPC_PATH, method, params, headers });
|
|
145
198
|
/** A fresh pending `ROLE_ADMIN` offer, from the keeper unless a grantor is given. */
|
|
@@ -171,6 +224,9 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
171
224
|
const params = parse_or_throw(RoleGrantOfferReceivedParams, frame.params);
|
|
172
225
|
assert.strictEqual(params.offer.to_account_id, recipient.account.id);
|
|
173
226
|
assert.strictEqual(params.offer.role, ROLE_ADMIN);
|
|
227
|
+
await assert_target_heard_exactly(recipient_ws, [
|
|
228
|
+
ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD
|
|
229
|
+
]);
|
|
174
230
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
175
231
|
}
|
|
176
232
|
finally {
|
|
@@ -196,6 +252,9 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
196
252
|
const params = parse_or_throw(RoleGrantOfferAcceptedParams, frame.params);
|
|
197
253
|
assert.strictEqual(params.offer.id, offer.id);
|
|
198
254
|
assert.isNotNull(params.offer.accepted_at);
|
|
255
|
+
await assert_target_heard_exactly(grantor, [
|
|
256
|
+
ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD
|
|
257
|
+
]);
|
|
199
258
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
200
259
|
}
|
|
201
260
|
finally {
|
|
@@ -221,6 +280,9 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
221
280
|
assert.strictEqual(params.offer.id, offer.id);
|
|
222
281
|
// Decline reason rides inside the offer row, not a sibling field.
|
|
223
282
|
assert.strictEqual(params.offer.decline_reason, 'no thanks');
|
|
283
|
+
await assert_target_heard_exactly(grantor, [
|
|
284
|
+
ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD
|
|
285
|
+
]);
|
|
224
286
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
225
287
|
}
|
|
226
288
|
finally {
|
|
@@ -247,6 +309,11 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
247
309
|
assert.strictEqual(params.offer.id, offer.id);
|
|
248
310
|
assert.strictEqual(params.offer.to_account_id, recipient.account.id);
|
|
249
311
|
assert.isNotNull(params.offer.retracted_at);
|
|
312
|
+
// the offer's create, made with the socket open, notified it first
|
|
313
|
+
await assert_target_heard_exactly(recipient_ws, [
|
|
314
|
+
ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD,
|
|
315
|
+
ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD
|
|
316
|
+
]);
|
|
250
317
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
251
318
|
}
|
|
252
319
|
finally {
|
|
@@ -294,10 +361,14 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
294
361
|
const early = revokee_ws.messages.find(is_revoke_frame);
|
|
295
362
|
if (early)
|
|
296
363
|
assert_flat_revoke(early);
|
|
364
|
+
// a closed socket takes no barrier: what reached it ahead of the
|
|
365
|
+
// close is the notification once, or nothing
|
|
366
|
+
assert.deepStrictEqual(to_heard_frames(revokee_ws), early ? [ROLE_GRANT_REVOKED_NOTIFICATION_METHOD] : [], 'the gated socket heard more than the one notification before its close');
|
|
297
367
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
298
368
|
return;
|
|
299
369
|
}
|
|
300
370
|
assert_flat_revoke(await revokee_ws.wait_for(is_revoke_frame, 5000));
|
|
371
|
+
await assert_target_heard_exactly(revokee_ws, [ROLE_GRANT_REVOKED_NOTIFICATION_METHOD]);
|
|
301
372
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
302
373
|
}
|
|
303
374
|
finally {
|
|
@@ -329,6 +400,7 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
329
400
|
assert.strictEqual(params.scope_kind, scope_kind);
|
|
330
401
|
assert.strictEqual(params.scope_id, scope_id);
|
|
331
402
|
assert.strictEqual(params.reason, null);
|
|
403
|
+
await assert_target_heard_exactly(revokee_ws, [ROLE_GRANT_REVOKED_NOTIFICATION_METHOD]);
|
|
332
404
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
333
405
|
}
|
|
334
406
|
finally {
|
|
@@ -364,6 +436,9 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
364
436
|
// cause_id points at the accepted sibling (grantor 2's offer).
|
|
365
437
|
assert.strictEqual(params.cause_id, grantor2_offer.id);
|
|
366
438
|
assert.isNotNull(params.offer.superseded_at);
|
|
439
|
+
await assert_target_heard_exactly(grantor1_ws, [
|
|
440
|
+
ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD
|
|
441
|
+
]);
|
|
367
442
|
await assert_bystander_heard_nothing(bystander_ws);
|
|
368
443
|
}
|
|
369
444
|
finally {
|
|
@@ -374,39 +449,117 @@ export const describe_role_grant_offer_notification_ws_tests = (options) => {
|
|
|
374
449
|
await bystander_ws.close();
|
|
375
450
|
}
|
|
376
451
|
});
|
|
377
|
-
test_if(capabilities.ws,
|
|
452
|
+
test_if(capabilities.ws, "revoke supersedes the revokee's pending offers both ways and notifies both parties of each", async () => {
|
|
378
453
|
const fixture = await setup_test();
|
|
379
454
|
const grantor = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
380
455
|
const revokee = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
456
|
+
const recipient = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
381
457
|
const role_grant_id = await create_active_role_grant(fixture, revokee, {
|
|
382
458
|
rpc_path: SPINE_RPC_PATH
|
|
383
459
|
});
|
|
384
|
-
// A
|
|
385
|
-
// the revoke
|
|
460
|
+
// A pending sibling for the revoked grant's (account, role), and an
|
|
461
|
+
// offer the revokee made — the revoke's two cascades, in that order.
|
|
386
462
|
const sibling_offer = await create_pending_offer(fixture, revokee.account.id, grantor.create_session_headers());
|
|
387
|
-
|
|
463
|
+
const outgoing_offer = await create_pending_offer(fixture, recipient.account.id, revokee.create_session_headers());
|
|
388
464
|
const bystander_ws = await open_bystander(fixture);
|
|
465
|
+
const grantor_ws = await open_ws(grantor);
|
|
466
|
+
const revokee_ws = await open_ws(revokee);
|
|
467
|
+
const recipient_ws = await open_ws(recipient);
|
|
389
468
|
try {
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const frame = await grantor_ws.wait_for(is_notification_with(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, (p) => p.offer.id === sibling_offer.id), 5000);
|
|
395
|
-
const params = parse_or_throw(RoleGrantOfferSupersedeParams, frame.params);
|
|
396
|
-
assert.strictEqual(params.offer.id, sibling_offer.id);
|
|
469
|
+
const revoked = await rpc(fixture, 'role_grant_revoke', { actor_id: revokee.actor.id, role_grant_id }, fixture.create_session_headers());
|
|
470
|
+
assert.isTrue(revoked.ok, `revoke failed: ${JSON.stringify(revoked)}`);
|
|
471
|
+
const assert_supersede = async (ws, offer_id) => {
|
|
472
|
+
const params = await wait_for_supersede(ws, offer_id);
|
|
397
473
|
assert.strictEqual(params.reason, 'role_grant_revoked');
|
|
398
474
|
// cause_id points at the revoked role_grant.
|
|
399
475
|
assert.strictEqual(params.cause_id, role_grant_id);
|
|
400
|
-
|
|
401
|
-
|
|
476
|
+
};
|
|
477
|
+
// the sibling's grantor and the outgoing offer's recipient
|
|
478
|
+
await assert_supersede(grantor_ws, sibling_offer.id);
|
|
479
|
+
await assert_target_heard_exactly(grantor_ws, [
|
|
480
|
+
ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD
|
|
481
|
+
]);
|
|
482
|
+
await assert_supersede(recipient_ws, outgoing_offer.id);
|
|
483
|
+
await assert_target_heard_exactly(recipient_ws, [
|
|
484
|
+
ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD
|
|
485
|
+
]);
|
|
486
|
+
// the revokee is the sibling's recipient and the outgoing offer's
|
|
487
|
+
// grantor: the revoke, then the two offers in the cascade's order
|
|
488
|
+
const revokee_heard = [
|
|
489
|
+
ROLE_GRANT_REVOKED_NOTIFICATION_METHOD,
|
|
490
|
+
ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD,
|
|
491
|
+
ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD
|
|
492
|
+
];
|
|
493
|
+
if (revoke_closes_the_socket) {
|
|
494
|
+
// the gated socket closes with the revoke, hearing at most the
|
|
495
|
+
// start of what it would have heard, in order
|
|
496
|
+
const closed = await revokee_ws.wait_for_close(5000);
|
|
497
|
+
assert.ok(closed, 'the gated socket did not close after the revoke');
|
|
498
|
+
assert.strictEqual(revokee_ws.close_code, WS_CLOSE_PERMISSION_REVOKED);
|
|
499
|
+
const heard = to_heard_frames(revokee_ws);
|
|
500
|
+
assert.deepStrictEqual(heard, revokee_heard.slice(0, heard.length));
|
|
402
501
|
}
|
|
403
|
-
|
|
404
|
-
await
|
|
502
|
+
else {
|
|
503
|
+
await assert_supersede(revokee_ws, outgoing_offer.id);
|
|
504
|
+
await assert_target_heard_exactly(revokee_ws, revokee_heard);
|
|
505
|
+
assert.deepStrictEqual(supersede_offer_ids(revokee_ws), [sibling_offer.id, outgoing_offer.id], "the revokee hears the sibling's supersede, then its own offer's");
|
|
405
506
|
}
|
|
507
|
+
await assert_bystander_heard_nothing(bystander_ws);
|
|
406
508
|
}
|
|
407
509
|
finally {
|
|
510
|
+
await Promise.all([recipient_ws.close(), revokee_ws.close(), grantor_ws.close()]);
|
|
408
511
|
await bystander_ws.close();
|
|
409
512
|
}
|
|
410
513
|
});
|
|
514
|
+
/**
|
|
515
|
+
* The account removals: `remove` ends `removed`'s account, whose pending
|
|
516
|
+
* offers both ways are superseded with `reason: 'account_deleted'`, the
|
|
517
|
+
* account as the grantor's cause and its actor as the recipient's. Each
|
|
518
|
+
* offer's other party hears it once; the removed account's socket closes
|
|
519
|
+
* and hears none of it.
|
|
520
|
+
*/
|
|
521
|
+
const removal_case = async (remove) => {
|
|
522
|
+
const fixture = await setup_test();
|
|
523
|
+
const removed = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
524
|
+
const recipient = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
525
|
+
const grantor = await fixture.create_account({ roles: [ROLE_ADMIN] });
|
|
526
|
+
const outgoing_offer = await create_pending_offer(fixture, recipient.account.id, removed.create_session_headers());
|
|
527
|
+
const incoming_offer = await create_pending_offer(fixture, removed.account.id, grantor.create_session_headers());
|
|
528
|
+
const bystander_ws = await open_bystander(fixture);
|
|
529
|
+
const removed_ws = await open_ws(removed);
|
|
530
|
+
const recipient_ws = await open_ws(recipient);
|
|
531
|
+
const grantor_ws = await open_ws(grantor);
|
|
532
|
+
try {
|
|
533
|
+
await remove(fixture, removed);
|
|
534
|
+
// the recipient is sent the grantor's actor, an id it already holds —
|
|
535
|
+
// never the removed account's id; the grantor is sent the removed
|
|
536
|
+
// account, its offer's `to_account_id`
|
|
537
|
+
for (const [ws, offer_id, cause_id] of [
|
|
538
|
+
[recipient_ws, outgoing_offer.id, removed.actor.id],
|
|
539
|
+
[grantor_ws, incoming_offer.id, removed.account.id]
|
|
540
|
+
]) {
|
|
541
|
+
const params = await wait_for_supersede(ws, offer_id);
|
|
542
|
+
assert.strictEqual(params.reason, 'account_deleted');
|
|
543
|
+
assert.strictEqual(params.cause_id, cause_id);
|
|
544
|
+
await assert_target_heard_exactly(ws, [ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD]);
|
|
545
|
+
}
|
|
546
|
+
const closed = await removed_ws.wait_for_close(5000);
|
|
547
|
+
assert.ok(closed, "the removed account's socket did not close");
|
|
548
|
+
// binds only on a spine that delivers a frame queued ahead of the close;
|
|
549
|
+
// one whose close drops it passes either way, so the spine's own fan-out
|
|
550
|
+
// tests are what hold a send to the removed account out
|
|
551
|
+
assert.deepStrictEqual(to_heard_frames(removed_ws), [], "the removed account's socket heard a notification before its close");
|
|
552
|
+
await assert_bystander_heard_nothing(bystander_ws);
|
|
553
|
+
}
|
|
554
|
+
finally {
|
|
555
|
+
await Promise.all([grantor_ws.close(), recipient_ws.close(), removed_ws.close()]);
|
|
556
|
+
await bystander_ws.close();
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
test_if(capabilities.ws && capabilities.account_lifecycle, "delete supersedes the account's pending offers both ways and notifies each other party", () => removal_case(async (fixture, removed) => {
|
|
560
|
+
const deleted = await rpc(fixture, 'account_delete', { account_id: removed.account.id }, fixture.create_session_headers());
|
|
561
|
+
assert.isTrue(deleted.ok, `delete failed: ${JSON.stringify(deleted)}`);
|
|
562
|
+
}));
|
|
563
|
+
test_if(capabilities.ws && capabilities.account_lifecycle, "purge supersedes the account's pending offers both ways and notifies each other party", () => removal_case((fixture, removed) => cross_account_purge(fixture, SPINE_RPC_PATH, removed.account.id)));
|
|
411
564
|
});
|
|
412
565
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session_cap.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/session_cap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"session_cap.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/session_cap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA+E9B,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAOzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,gCAAgC,GAAI,SAAS,0BAA0B,KAAG,IA8QtF,CAAC"}
|
|
@@ -31,6 +31,14 @@ import '../assert_dev_env.js';
|
|
|
31
31
|
* committed, and leave a socket on a session it kept open and dispatching. A
|
|
32
32
|
* spine that only deletes the row leaves the socket running on a dead
|
|
33
33
|
* session; one that closes the account's sockets drops the kept one.
|
|
34
|
+
* - **concurrent logins at the cap all succeed** and leave the account at
|
|
35
|
+
* exactly the cap. The logins of one account take turns on its row lock, so
|
|
36
|
+
* each evicts against a count holding the ones before it; without that, two
|
|
37
|
+
* logins each count without the other's row and both commit above the cap,
|
|
38
|
+
* or deadlock in their evictions and answer 500. The burst can only show the
|
|
39
|
+
* race when it happens: the exact pin — a login waiting on another's
|
|
40
|
+
* uncommitted mint — is each spine's own real-Postgres test (and a backend
|
|
41
|
+
* on a one-connection engine serializes the burst whatever it locks).
|
|
34
42
|
*
|
|
35
43
|
* **Why `max_sessions + 1` logins and not `max_sessions`.** The starting session
|
|
36
44
|
* count isn't zero and isn't guaranteed equal across impls — `create_account`
|
|
@@ -50,11 +58,6 @@ import '../assert_dev_env.js';
|
|
|
50
58
|
* fourth `Set-Cookie` parser — reading the raw header is `cookie_attributes.ts`'s
|
|
51
59
|
* job, and this case only needs "does this login still authenticate".
|
|
52
60
|
*
|
|
53
|
-
* What it does **not** pin: concurrent creators. Two simultaneous logins can
|
|
54
|
-
* each evict against a stale count under Read Committed and both commit above
|
|
55
|
-
* the cap — see `query_session_enforce_limit`'s race note. That needs a
|
|
56
|
-
* barrier-based test against one backend, not a parity case.
|
|
57
|
-
*
|
|
58
61
|
* @module
|
|
59
62
|
*/
|
|
60
63
|
import { describe, test, assert } from 'vitest';
|
|
@@ -118,6 +121,24 @@ export const describe_session_cap_cross_tests = (options) => {
|
|
|
118
121
|
const { sessions: listed } = expect_output(await cross_rpc_call(newest[newest.length - 1], rpc_path, 'account_session_list', undefined, {}), SessionListOutput);
|
|
119
122
|
assert.strictEqual(listed.length, max_sessions, `the account must hold exactly ${max_sessions} sessions after the cap evicts`);
|
|
120
123
|
});
|
|
124
|
+
test(`${max_sessions * 3} concurrent logins all succeed and leave exactly ${max_sessions} sessions`, async () => {
|
|
125
|
+
const fixture = await setup_test();
|
|
126
|
+
await fixture.create_account({ username, password_value: DEFAULT_TEST_PASSWORD });
|
|
127
|
+
const burst = max_sessions * 3;
|
|
128
|
+
// each asserts its own 200 — a login lost to an eviction deadlock is a 500
|
|
129
|
+
const sessions = await Promise.all(Array.from({ length: burst }, (_, i) => login(fixture, `concurrent login ${i + 1}/${burst}`)));
|
|
130
|
+
let listed = null;
|
|
131
|
+
for (const transport of sessions) {
|
|
132
|
+
const result = await cross_rpc_call(transport, rpc_path, 'account_session_list', undefined, {});
|
|
133
|
+
// an evicted login's transport is the anonymous caller
|
|
134
|
+
if (!result.ok)
|
|
135
|
+
continue;
|
|
136
|
+
listed = expect_output(result, SessionListOutput).sessions.length;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
assert.strictEqual(listed, max_sessions, `the account must hold exactly ${max_sessions} sessions after a concurrent burst — ` +
|
|
140
|
+
'each login evicting against the sessions committed before it');
|
|
141
|
+
});
|
|
121
142
|
test("the session list marks the caller's own session current, and none for a bearer or daemon token", async () => {
|
|
122
143
|
const fixture = await setup_test();
|
|
123
144
|
const account = await fixture.create_account({
|
|
@@ -48,7 +48,7 @@ export interface BearerAuthTestCase extends BearerAuthTestOptions {
|
|
|
48
48
|
* `ResolvedAuth` — its fields and no others.
|
|
49
49
|
*/
|
|
50
50
|
assert_account_set?: boolean;
|
|
51
|
-
/** Expected `ResolvedAuth.
|
|
51
|
+
/** Expected `ResolvedAuth.account.id` when `assert_account_set` is true. */
|
|
52
52
|
expected_account_id?: string;
|
|
53
53
|
/** If set, assert the resolved `api_token_id` after a successful bearer auth. */
|
|
54
54
|
expected_api_token_id?: string;
|
|
@@ -119,7 +119,7 @@ export const create_bearer_auth_test_app = (tc) => {
|
|
|
119
119
|
app.use('*', async (c, next) => {
|
|
120
120
|
c.set(RESOLVED_AUTH_KEY, create_test_resolved_auth({
|
|
121
121
|
credential_type: 'session',
|
|
122
|
-
|
|
122
|
+
account: pre_context.account
|
|
123
123
|
}));
|
|
124
124
|
c.set(REQUEST_CONTEXT_KEY, pre_context);
|
|
125
125
|
c.set(TEST_CONTEXT_PRESET_KEY, TEST_CONTEXT_PRESET);
|
|
@@ -194,10 +194,10 @@ export const describe_bearer_auth_cases = (suite_name, cases) => {
|
|
|
194
194
|
const resolved = body.resolved_auth;
|
|
195
195
|
if (tc.assert_account_set) {
|
|
196
196
|
assert.ok(resolved, 'the request should resolve to a credential');
|
|
197
|
-
assert.deepStrictEqual(Object.keys(resolved).sort(), ['
|
|
197
|
+
assert.deepStrictEqual(Object.keys(resolved).sort(), ['account', 'api_token_id', 'credential_deadline', 'credential_type', 'scope'], 'the resolved credential should be the api_token arm, with no other fields');
|
|
198
198
|
assert.strictEqual(resolved.credential_type, 'api_token');
|
|
199
199
|
if (tc.expected_account_id !== undefined) {
|
|
200
|
-
assert.strictEqual(resolved.
|
|
200
|
+
assert.strictEqual(resolved.account?.id, tc.expected_account_id, 'account_id should match the validated api_token.account_id');
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
if (tc.expected_api_token_id !== undefined) {
|
|
@@ -276,13 +276,13 @@ export const create_test_middleware_stack_app = (options) => {
|
|
|
276
276
|
app.use(ORIGIN_MIDDLEWARE_PATH, origin_mw);
|
|
277
277
|
app.use(AUTH_MIDDLEWARE_PATH, bearer_mw);
|
|
278
278
|
// echo route for assertions — exposes the account-grain identity bearer
|
|
279
|
-
// auth writes (`ResolvedAuth.
|
|
279
|
+
// auth writes (`ResolvedAuth.account`); the full request context is the
|
|
280
280
|
// dispatcher's authorization phase concern, not middleware.
|
|
281
281
|
app.get(TEST_MIDDLEWARE_PATH, (c) => {
|
|
282
282
|
return c.json({
|
|
283
283
|
ok: true,
|
|
284
284
|
client_ip: get_client_ip(c),
|
|
285
|
-
account_id: get_resolved_auth(c)?.
|
|
285
|
+
account_id: get_resolved_auth(c)?.account.id ?? null
|
|
286
286
|
});
|
|
287
287
|
});
|
|
288
288
|
return {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
+
import type { Account } from '../auth/account_schema.js';
|
|
2
3
|
import type { BuiltinCredentialType } from '../auth/credential_type_schema.js';
|
|
3
4
|
import type { ResolvedAuth } from '../auth/resolved_auth.js';
|
|
4
5
|
import { type TokenScope } from '../auth/token_scope.js';
|
|
5
6
|
/** Options for `create_test_resolved_auth`. */
|
|
6
7
|
export interface TestResolvedAuthOptions {
|
|
7
8
|
credential_type: BuiltinCredentialType;
|
|
8
|
-
|
|
9
|
+
/** The account the credential resolved — the row the authorization phase builds on. */
|
|
10
|
+
account: Account;
|
|
9
11
|
/**
|
|
10
12
|
* The raw session token a `session` credential carries, hashed into its
|
|
11
13
|
* `session_hash` the way the session leg hashes the cookie's. Default a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolved_auth.d.ts","sourceRoot":"","sources":["../../src/lib/testing/resolved_auth.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACvC,eAAe,EAAE,qBAAqB,CAAC;IACvC,
|
|
1
|
+
{"version":3,"file":"resolved_auth.d.ts","sourceRoot":"","sources":["../../src/lib/testing/resolved_auth.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACvC,eAAe,EAAE,qBAAqB,CAAC;IACvC,uFAAuF;IACvF,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uGAAuG;IACvG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,iFAAiF;IACjF,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,uBAAuB,KAAG,YAsB5E,CAAC"}
|
|
@@ -17,25 +17,25 @@ import { token_scope_full } from '../auth/token_scope.js';
|
|
|
17
17
|
* @returns the resolved credential
|
|
18
18
|
*/
|
|
19
19
|
export const create_test_resolved_auth = (options) => {
|
|
20
|
-
const { credential_type,
|
|
20
|
+
const { credential_type, account } = options;
|
|
21
21
|
const credential_deadline = options.credential_deadline ?? null;
|
|
22
22
|
switch (credential_type) {
|
|
23
23
|
case 'session':
|
|
24
24
|
return {
|
|
25
25
|
credential_type,
|
|
26
|
-
|
|
26
|
+
account,
|
|
27
27
|
session_hash: hash_session_token(options.session_id ?? create_uuid()),
|
|
28
28
|
credential_deadline
|
|
29
29
|
};
|
|
30
30
|
case 'api_token':
|
|
31
31
|
return {
|
|
32
32
|
credential_type,
|
|
33
|
-
|
|
33
|
+
account,
|
|
34
34
|
api_token_id: options.api_token_id ?? create_uuid(),
|
|
35
35
|
scope: options.scope ?? token_scope_full(),
|
|
36
36
|
credential_deadline
|
|
37
37
|
};
|
|
38
38
|
case 'daemon_token':
|
|
39
|
-
return { credential_type,
|
|
39
|
+
return { credential_type, account, credential_deadline: null };
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAGN,KAAK,UAAU,EACf,KAAK,SAAS,EACd,MAAM,uBA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G;IACH,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/E;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,cAmHF,CAAC"}
|
package/dist/testing/stubs.js
CHANGED
|
@@ -12,6 +12,7 @@ import { REST_FORBIDDEN_ORIGIN } from '../http/error_schemas.js';
|
|
|
12
12
|
import { body_limit_middleware_shape } from '../http/body_limit_schema.js';
|
|
13
13
|
import { host_gate_middleware_shape } from '../http/host.js';
|
|
14
14
|
import { create_realtime_closer } from '../actions/connection_closer.js';
|
|
15
|
+
import { create_realtime_notification_sender } from '../actions/notification_sender.js';
|
|
15
16
|
import { Db } from '../db/db.js';
|
|
16
17
|
import { attach_route_handler, prefix_route_specs } from '../http/route_spec.js';
|
|
17
18
|
import { route_raw } from '../http/route_result.js';
|
|
@@ -170,7 +171,8 @@ export const create_stub_app_deps = () => ({
|
|
|
170
171
|
db: stub_db,
|
|
171
172
|
log: new Logger('test', { level: 'off' }),
|
|
172
173
|
audit: create_test_audit_emitter(),
|
|
173
|
-
connection_closer: create_realtime_closer()
|
|
174
|
+
connection_closer: create_realtime_closer(),
|
|
175
|
+
notification_sender: create_realtime_notification_sender()
|
|
174
176
|
});
|
|
175
177
|
/**
|
|
176
178
|
* Create a stub `AppBackend` with no database behind it — no migration
|
|
@@ -319,7 +321,8 @@ export const create_test_app_surface_spec = (options) => {
|
|
|
319
321
|
actions: endpoint.actions,
|
|
320
322
|
log: ctx.deps.log,
|
|
321
323
|
action_ip_rate_limiter: ctx.action_ip_rate_limiter,
|
|
322
|
-
action_account_rate_limiter: ctx.action_account_rate_limiter
|
|
324
|
+
action_account_rate_limiter: ctx.action_account_rate_limiter,
|
|
325
|
+
notification_sender: ctx.deps.notification_sender
|
|
323
326
|
});
|
|
324
327
|
}) ?? [];
|
|
325
328
|
// Resolve ws endpoints (mirrors create_app_server). Surface-only —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_round_trip.d.ts","sourceRoot":"","sources":["../../src/lib/testing/ws_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,MAAM,CAAC;AAC1C,OAAO,EACN,SAAS,EAET,KAAK,gBAAgB,EAErB,KAAK,QAAQ,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAEpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOtF,OAAO,KAAK,EAAE,qBA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;IACxE,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,yFAAyF;IACzF,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0GAA0G;IAC1G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,4CAA4C;AAC5C,MAAM,WAAW,0BAA0B;IAC1C;;;;;OAKG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAC7D,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,cAAc,CAAC,EAAE,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IAC3D,yDAAyD;IACzD,eAAe,CAAC,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAC7D;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAChC;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B;;;;;;;;OAQG;IACH,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7D;AAiED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,0BAA0B,KAAG,aA0O5E,CAAC"}
|
|
@@ -66,7 +66,7 @@ export const create_fake_hono_context = (opts) => {
|
|
|
66
66
|
[REQUEST_CONTEXT_KEY]: request_context,
|
|
67
67
|
[RESOLVED_AUTH_KEY]: create_test_resolved_auth({
|
|
68
68
|
credential_type: opts.credential_type,
|
|
69
|
-
|
|
69
|
+
account: request_context.account,
|
|
70
70
|
session_id: auth_session_id ?? undefined,
|
|
71
71
|
api_token_id: opts.api_token_id
|
|
72
72
|
}),
|
|
@@ -241,7 +241,10 @@ export const create_ws_test_harness = (options) => {
|
|
|
241
241
|
// the harness drives per-message dispatch, not throttling — the
|
|
242
242
|
// assembled-app tests cover the limiters `create_app_server` threads
|
|
243
243
|
action_ip_rate_limiter: null,
|
|
244
|
-
action_account_rate_limiter: null
|
|
244
|
+
action_account_rate_limiter: null,
|
|
245
|
+
// the harness's one registry is every socket a handler's notification
|
|
246
|
+
// can reach
|
|
247
|
+
notification_sender: registry
|
|
245
248
|
});
|
|
246
249
|
const events_factory = stub.get_create_events();
|
|
247
250
|
const connect = async (identity = {}) => {
|
|
@@ -249,13 +252,14 @@ export const create_ws_test_harness = (options) => {
|
|
|
249
252
|
const credential_type = identity.credential_type ?? 'session';
|
|
250
253
|
const session_id = identity.session_id ?? create_uuid();
|
|
251
254
|
const roles = identity.roles ?? [];
|
|
255
|
+
const request_context = build_multi_role_request_context(account_id, roles);
|
|
252
256
|
const ctx_store = new Map([
|
|
253
|
-
[REQUEST_CONTEXT_KEY,
|
|
257
|
+
[REQUEST_CONTEXT_KEY, request_context],
|
|
254
258
|
[
|
|
255
259
|
RESOLVED_AUTH_KEY,
|
|
256
260
|
create_test_resolved_auth({
|
|
257
261
|
credential_type,
|
|
258
|
-
|
|
262
|
+
account: request_context.account,
|
|
259
263
|
session_id,
|
|
260
264
|
api_token_id: identity.api_token_id
|
|
261
265
|
})
|