@fuzdev/fuz_app 0.177.0 → 0.179.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 +117 -12
- package/dist/actions/connection_registry.d.ts +18 -0
- package/dist/actions/connection_registry.d.ts.map +1 -1
- package/dist/actions/connection_registry.js +23 -0
- package/dist/actions/room_action_specs.d.ts +733 -0
- package/dist/actions/room_action_specs.d.ts.map +1 -0
- package/dist/actions/room_action_specs.js +506 -0
- package/dist/actions/room_actions.d.ts +276 -0
- package/dist/actions/room_actions.d.ts.map +1 -0
- package/dist/actions/room_actions.js +394 -0
- package/dist/actions/room_client.svelte.d.ts +399 -0
- package/dist/actions/room_client.svelte.d.ts.map +1 -0
- package/dist/actions/room_client.svelte.js +942 -0
- package/dist/actions/room_registry.d.ts +454 -0
- package/dist/actions/room_registry.d.ts.map +1 -0
- package/dist/actions/room_registry.js +927 -0
- package/dist/actions/ws_socket_session.d.ts +2 -2
- package/dist/actions/ws_socket_session.js +3 -3
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_queries.d.ts +17 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +30 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts +102 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_mesh.svelte.js +232 -0
- package/dist/rtc/rtc_peer.svelte.d.ts +180 -0
- package/dist/rtc/rtc_peer.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_peer.svelte.js +397 -0
- package/dist/rtc/rtc_signal.d.ts +74 -0
- package/dist/rtc/rtc_signal.d.ts.map +1 -0
- package/dist/rtc/rtc_signal.js +87 -0
- package/dist/server/app_server.d.ts +16 -27
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +7 -9
- package/dist/testing/CLAUDE.md +72 -18
- package/dist/testing/cross_backend/action_manifest.d.ts +34 -2
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +33 -6
- package/dist/testing/cross_backend/capabilities.d.ts +23 -5
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +4 -1
- package/dist/testing/cross_backend/default_backend_configs.js +1 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +31 -6
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -13
- package/dist/testing/cross_backend/rooms_ws.d.ts +20 -0
- package/dist/testing/cross_backend/rooms_ws.d.ts.map +1 -0
- package/dist/testing/cross_backend/rooms_ws.js +534 -0
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +5 -2
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +24 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +2 -1
- package/dist/testing/cross_backend/test_room_authorize.d.ts +47 -0
- package/dist/testing/cross_backend/test_room_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_room_authorize.js +58 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +10 -4
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +85 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +57 -3
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts +23 -37
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -8
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +35 -46
- package/dist/testing/cross_backend/transport_composition.js +2 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +6 -3
- package/dist/testing/stubs.d.ts +1 -1
- package/dist/testing/stubs.js +1 -1
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/package.json +21 -26
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-process **rooms** suite — the WebSocket-only room verbs
|
|
4
|
+
* (`create_room_actions`) and the notifications their registry fans out, held
|
|
5
|
+
* to one wire on both spines.
|
|
6
|
+
*
|
|
7
|
+
* Runs against a backend mounting the room verbs on `ws_path` over an
|
|
8
|
+
* exclusive registry with the test room authorizer (`test_room_authorize`, the
|
|
9
|
+
* twin of the Rust stub's `TestRoomAuthorize`: the room id's prefix picks the
|
|
10
|
+
* rule) and the room limiter at its defaults — what `capabilities.rooms`
|
|
11
|
+
* declares. Each case names fresh rooms, so no case reads another's; the
|
|
12
|
+
* per-test `_testing_reset` drops every room besides.
|
|
13
|
+
*
|
|
14
|
+
* Pinned: join, leave, send, state, and watch round trips, with each event's
|
|
15
|
+
* shape and its room's `seq` in order; an event never reaches the seat that
|
|
16
|
+
* caused it; the refusals' codes and reasons (`room_not_found` for a denial
|
|
17
|
+
* and a missing room alike, the invalid room id as the input schema's
|
|
18
|
+
* reasonless refusal, `room_not_joined`, `room_member_not_found`, the payload
|
|
19
|
+
* and state bounds, `room_full`, `room_watch_limit`, and `method_not_found`
|
|
20
|
+
* over HTTP); exclusivity (one seat per actor, the newest admitted winning,
|
|
21
|
+
* the displaced seat told `room_seat_lost` with `moved_to`) and the rejoin
|
|
22
|
+
* tombstone (`room_seat_moved`); eviction through `_testing_room_evict`, which
|
|
23
|
+
* ends seats and watches alike; a closed socket's seat leaving as
|
|
24
|
+
* `disconnected`; the per-connection limiter's `rate_limited`, charged by
|
|
25
|
+
* escaped bytes, with a watch and a leave still answered past the byte budget. Error messages
|
|
26
|
+
* are not compared — codes and `data.reason` are the contract. The room verbs'
|
|
27
|
+
* action-manifest entries (`transport: 'ws'`) are the manifest parity gate's.
|
|
28
|
+
*
|
|
29
|
+
* Gated on `capabilities.ws` and `capabilities.rooms`. A backend declaring
|
|
30
|
+
* `rooms` declares `_testing_room_evict` too, which the eviction case drives
|
|
31
|
+
* and `describe_spine_cross_suites` requires. Cross-process only.
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
*/
|
|
35
|
+
import { assert, describe } from 'vitest';
|
|
36
|
+
import { DEFAULT_ROOM_MAX_PAYLOAD_BYTES, DEFAULT_ROOM_MAX_STATE_BYTES, DEFAULT_ROOM_MAX_WATCHES_PER_CONNECTION, ERROR_ROOM_FULL, ERROR_ROOM_MEMBER_NOT_FOUND, ERROR_ROOM_NOT_FOUND, ERROR_ROOM_NOT_JOINED, ERROR_ROOM_PAYLOAD_TOO_LARGE, ERROR_ROOM_SEAT_MOVED, ERROR_ROOM_STATE_TOO_LARGE, ERROR_ROOM_WATCH_LIMIT, all_room_action_specs } from '../../actions/room_action_specs.js';
|
|
37
|
+
import { ROLE_ADMIN } from '../../auth/role_schema.js';
|
|
38
|
+
import { JSONRPC_ERROR_CODES } from '../../http/jsonrpc_errors.js';
|
|
39
|
+
import { rpc_call, rpc_call_non_browser } from '../rpc_helpers.js';
|
|
40
|
+
import { is_notification_with, is_response_for } from '../transports/ws_client.js';
|
|
41
|
+
import { test_if } from './capabilities.js';
|
|
42
|
+
import { SPINE_RPC_PATH } from './spine_surface_constants.js';
|
|
43
|
+
import { open_session_ws } from './ws_endpoint.js';
|
|
44
|
+
/** Bound on every wait a broken case could otherwise turn into a hang. */
|
|
45
|
+
const WAIT_MS = 5000;
|
|
46
|
+
/**
|
|
47
|
+
* Register the rooms suite (module doc).
|
|
48
|
+
*
|
|
49
|
+
* @param options - the backend, its capabilities, and the fixture producer
|
|
50
|
+
*/
|
|
51
|
+
export const describe_rooms_ws_cross_tests = (options) => {
|
|
52
|
+
const { setup_test, capabilities, rpc_path = SPINE_RPC_PATH } = options;
|
|
53
|
+
const enabled = capabilities.ws && capabilities.rooms;
|
|
54
|
+
let next_id = 0;
|
|
55
|
+
let next_room = 0;
|
|
56
|
+
/** A fresh room id under `prefix` (`open:`, `scoped:<scope>:`, …), unique to the run. */
|
|
57
|
+
const room = (prefix) => `${prefix}${++next_room}-${Math.random().toString(36).slice(2, 10)}`;
|
|
58
|
+
const open = (account) => open_session_ws(options, account, { admitted: true, default_timeout_ms: WAIT_MS });
|
|
59
|
+
/** A request's result, failing on an error. */
|
|
60
|
+
const call = (ws, method, params) => ws.request(`room_${++next_id}`, method, params, WAIT_MS);
|
|
61
|
+
/** A request's error, failing on a result. */
|
|
62
|
+
const refused = async (ws, method, params) => {
|
|
63
|
+
const id = `room_${++next_id}`;
|
|
64
|
+
await ws.send({ jsonrpc: '2.0', id, method, params });
|
|
65
|
+
const frame = await ws.wait_for(is_response_for(id), WAIT_MS);
|
|
66
|
+
if (!frame.error)
|
|
67
|
+
assert.fail(`${method}: expected a refusal, got ${JSON.stringify(frame)}`);
|
|
68
|
+
return frame.error;
|
|
69
|
+
};
|
|
70
|
+
/** Assert a refusal's code and `data.reason` (`undefined` for none). */
|
|
71
|
+
const assert_refusal = (error, code, reason, label) => {
|
|
72
|
+
assert.strictEqual(error.code, code, `${label}: code (${JSON.stringify(error)})`);
|
|
73
|
+
assert.strictEqual(error.data?.reason, reason, `${label}: data.reason`);
|
|
74
|
+
};
|
|
75
|
+
/** The params of the first `method` notification matching `match`. */
|
|
76
|
+
const heard = async (ws, method, match = () => true) => (await ws.wait_for(is_notification_with(method, match), WAIT_MS)).params;
|
|
77
|
+
/** Every `method` notification received so far for `room_id`. */
|
|
78
|
+
const received = (ws, method, room_id) => ws.messages
|
|
79
|
+
.filter((m) => m.method === method)
|
|
80
|
+
.filter((m) => m.params.room_id === room_id)
|
|
81
|
+
.map((m) => m.params);
|
|
82
|
+
const join = (ws, params) => call(ws, 'room_join', params);
|
|
83
|
+
/** Daemon-token RPC, for the `_testing_*` seams. */
|
|
84
|
+
const backdoor = async (fixture, method, params) => {
|
|
85
|
+
const result = await rpc_call_non_browser({
|
|
86
|
+
app: fixture.fresh_transport({ origin: null }),
|
|
87
|
+
path: rpc_path,
|
|
88
|
+
method,
|
|
89
|
+
params,
|
|
90
|
+
headers: fixture.create_daemon_token_headers()
|
|
91
|
+
});
|
|
92
|
+
if (!result.ok)
|
|
93
|
+
assert.fail(`${method} failed: ${JSON.stringify(result)}`);
|
|
94
|
+
return result.result;
|
|
95
|
+
};
|
|
96
|
+
/** Close every client, whatever a case left open. */
|
|
97
|
+
const close_all = async (clients) => {
|
|
98
|
+
await Promise.all(clients.map((client) => client.close()));
|
|
99
|
+
};
|
|
100
|
+
describe('rooms over the socket (cross-process)', () => {
|
|
101
|
+
test_if(enabled, 'members join, relay, set state, and leave, in seq order', async () => {
|
|
102
|
+
const fixture = await setup_test();
|
|
103
|
+
const alice = await fixture.create_account();
|
|
104
|
+
const bob = await fixture.create_account();
|
|
105
|
+
const a = await open(alice);
|
|
106
|
+
const b = await open(bob);
|
|
107
|
+
try {
|
|
108
|
+
const room_id = room('open:');
|
|
109
|
+
const joined_a = await join(a, { room_id, state: 'muted' });
|
|
110
|
+
const member_a = joined_a.member_id;
|
|
111
|
+
assert.deepStrictEqual(joined_a, {
|
|
112
|
+
room_id,
|
|
113
|
+
member_id: member_a,
|
|
114
|
+
seq: 1,
|
|
115
|
+
members: [{ member_id: member_a, actor_id: alice.actor.id, state: 'muted' }],
|
|
116
|
+
topology: 'mesh',
|
|
117
|
+
extra: null
|
|
118
|
+
});
|
|
119
|
+
// the room's events reach the joiner ahead of its answer, so none
|
|
120
|
+
// waits unseen: its own join was never sent to it
|
|
121
|
+
assert.deepStrictEqual(received(a, 'room_member_joined', room_id), []);
|
|
122
|
+
const joined_b = await join(b, { room_id });
|
|
123
|
+
const member_b = joined_b.member_id;
|
|
124
|
+
assert.strictEqual(joined_b.seq, 2);
|
|
125
|
+
assert.deepStrictEqual(joined_b.members, [
|
|
126
|
+
{ member_id: member_a, actor_id: alice.actor.id, state: 'muted' },
|
|
127
|
+
{ member_id: member_b, actor_id: bob.actor.id, state: null }
|
|
128
|
+
]);
|
|
129
|
+
assert.deepStrictEqual(await heard(a, 'room_member_joined'), {
|
|
130
|
+
room_id,
|
|
131
|
+
seq: 2,
|
|
132
|
+
member: { member_id: member_b, actor_id: bob.actor.id, state: null }
|
|
133
|
+
});
|
|
134
|
+
// to one member, then to the room minus the sender
|
|
135
|
+
assert.strictEqual(await call(b, 'room_send', { room_id, to: member_a, payload: 'offer' }), null);
|
|
136
|
+
assert.deepStrictEqual(await heard(a, 'room_message', (p) => p.seq === 3), { room_id, seq: 3, from: member_b, to: member_a, payload: 'offer' });
|
|
137
|
+
assert.strictEqual(await call(b, 'room_send', { room_id, to: null, payload: 'hi' }), null);
|
|
138
|
+
assert.deepStrictEqual(await heard(a, 'room_message', (p) => p.seq === 4), { room_id, seq: 4, from: member_b, to: null, payload: 'hi' });
|
|
139
|
+
// the sender heard neither of its own messages
|
|
140
|
+
assert.deepStrictEqual(received(b, 'room_message', room_id), []);
|
|
141
|
+
assert.deepStrictEqual(await call(a, 'room_state_set', { room_id, state: 'live' }), {
|
|
142
|
+
seq: 5
|
|
143
|
+
});
|
|
144
|
+
assert.deepStrictEqual(await heard(b, 'room_member_state'), {
|
|
145
|
+
room_id,
|
|
146
|
+
seq: 5,
|
|
147
|
+
member_id: member_a,
|
|
148
|
+
state: 'live'
|
|
149
|
+
});
|
|
150
|
+
assert.deepStrictEqual(received(a, 'room_member_state', room_id), []);
|
|
151
|
+
assert.deepStrictEqual(await call(a, 'room_leave', { room_id }), { left: true });
|
|
152
|
+
assert.deepStrictEqual(await heard(b, 'room_member_left'), {
|
|
153
|
+
room_id,
|
|
154
|
+
seq: 6,
|
|
155
|
+
member_id: member_a,
|
|
156
|
+
reason: 'left'
|
|
157
|
+
});
|
|
158
|
+
assert.deepStrictEqual(await call(a, 'room_leave', { room_id }), { left: false });
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
await close_all([a, b]);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
test_if(enabled, 'a watch sees the members without a seat', async () => {
|
|
165
|
+
const fixture = await setup_test();
|
|
166
|
+
const watcher_account = await fixture.create_account();
|
|
167
|
+
const member_account = await fixture.create_account();
|
|
168
|
+
const watcher = await open(watcher_account);
|
|
169
|
+
const member = await open(member_account);
|
|
170
|
+
try {
|
|
171
|
+
const room_id = room('watch:');
|
|
172
|
+
// the `watch:` rule admits a watch and denies a join
|
|
173
|
+
assert.deepStrictEqual(await call(watcher, 'room_watch', { room_id }), {
|
|
174
|
+
room_id,
|
|
175
|
+
seq: 0,
|
|
176
|
+
members: []
|
|
177
|
+
});
|
|
178
|
+
assert_refusal(await refused(member, 'room_join', { room_id }), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_NOT_FOUND, 'join of a watch-only room');
|
|
179
|
+
const open_room = room('open:');
|
|
180
|
+
await call(watcher, 'room_watch', { room_id: open_room });
|
|
181
|
+
const joined = await join(member, { room_id: open_room, state: 's0' });
|
|
182
|
+
assert.deepStrictEqual(await heard(watcher, 'room_member_joined'), {
|
|
183
|
+
room_id: open_room,
|
|
184
|
+
seq: 1,
|
|
185
|
+
member: { member_id: joined.member_id, actor_id: member_account.actor.id, state: 's0' }
|
|
186
|
+
});
|
|
187
|
+
await call(member, 'room_state_set', { room_id: open_room, state: 's1' });
|
|
188
|
+
assert.deepStrictEqual(await heard(watcher, 'room_member_state'), {
|
|
189
|
+
room_id: open_room,
|
|
190
|
+
seq: 2,
|
|
191
|
+
member_id: joined.member_id,
|
|
192
|
+
state: 's1'
|
|
193
|
+
});
|
|
194
|
+
// watching again answers the occupancy again
|
|
195
|
+
assert.deepStrictEqual(await call(watcher, 'room_watch', { room_id: open_room }), {
|
|
196
|
+
room_id: open_room,
|
|
197
|
+
seq: 2,
|
|
198
|
+
members: [
|
|
199
|
+
{ member_id: joined.member_id, actor_id: member_account.actor.id, state: 's1' }
|
|
200
|
+
]
|
|
201
|
+
});
|
|
202
|
+
// a watcher gets no messages
|
|
203
|
+
await call(member, 'room_send', { room_id: open_room, to: null, payload: 'p' });
|
|
204
|
+
assert.deepStrictEqual(await call(watcher, 'room_unwatch', { room_id: open_room }), {
|
|
205
|
+
unwatched: true
|
|
206
|
+
});
|
|
207
|
+
assert.deepStrictEqual(received(watcher, 'room_message', open_room), []);
|
|
208
|
+
assert.deepStrictEqual(await call(watcher, 'room_unwatch', { room_id: open_room }), {
|
|
209
|
+
unwatched: false
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
await close_all([watcher, member]);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
test_if(enabled, 'refusals answer their codes and reasons', async () => {
|
|
217
|
+
const fixture = await setup_test();
|
|
218
|
+
const account = await fixture.create_account();
|
|
219
|
+
const ws = await open(account);
|
|
220
|
+
try {
|
|
221
|
+
// denied and missing read the same
|
|
222
|
+
for (const method of ['room_join', 'room_watch']) {
|
|
223
|
+
assert_refusal(await refused(ws, method, { room_id: 'closed:x' }), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_NOT_FOUND, `${method} of a denied room`);
|
|
224
|
+
assert_refusal(await refused(ws, method, { room_id: room('scoped::') }), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_NOT_FOUND, `${method} of a room with an empty scope`);
|
|
225
|
+
}
|
|
226
|
+
// a malformed room id is the input schema's reasonless refusal
|
|
227
|
+
for (const room_id of ['has space', '', 'x'.repeat(129), 'café']) {
|
|
228
|
+
assert_refusal(await refused(ws, 'room_join', { room_id }), JSONRPC_ERROR_CODES.invalid_params, undefined, `room id ${JSON.stringify(room_id)}`);
|
|
229
|
+
}
|
|
230
|
+
// unknown keys, and a `to` that is required
|
|
231
|
+
assert_refusal(await refused(ws, 'room_join', { room_id: room('open:'), extra: 1 }), JSONRPC_ERROR_CODES.invalid_params, undefined, 'an unknown key');
|
|
232
|
+
assert_refusal(await refused(ws, 'room_send', { room_id: room('open:'), payload: 'x' }), JSONRPC_ERROR_CODES.invalid_params, undefined, 'a send without `to`');
|
|
233
|
+
const room_id = room('open:');
|
|
234
|
+
assert_refusal(await refused(ws, 'room_send', { room_id, to: null, payload: 'x' }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_NOT_JOINED, 'a send before joining');
|
|
235
|
+
assert_refusal(await refused(ws, 'room_state_set', { room_id, state: 'x' }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_NOT_JOINED, 'a state set before joining');
|
|
236
|
+
// the bounds are UTF-8 bytes: one more than the bound, in two-byte characters
|
|
237
|
+
assert_refusal(await refused(ws, 'room_join', {
|
|
238
|
+
room_id,
|
|
239
|
+
state: 'é'.repeat(DEFAULT_ROOM_MAX_STATE_BYTES / 2) + 'x'
|
|
240
|
+
}), JSONRPC_ERROR_CODES.invalid_params, ERROR_ROOM_STATE_TOO_LARGE, 'a join state over the bound');
|
|
241
|
+
const { member_id } = await join(ws, {
|
|
242
|
+
room_id,
|
|
243
|
+
state: 'é'.repeat(DEFAULT_ROOM_MAX_STATE_BYTES / 2)
|
|
244
|
+
});
|
|
245
|
+
assert_refusal(await refused(ws, 'room_state_set', {
|
|
246
|
+
room_id,
|
|
247
|
+
state: 'x'.repeat(DEFAULT_ROOM_MAX_STATE_BYTES + 1)
|
|
248
|
+
}), JSONRPC_ERROR_CODES.invalid_params, ERROR_ROOM_STATE_TOO_LARGE, 'a state over the bound');
|
|
249
|
+
assert_refusal(await refused(ws, 'room_send', {
|
|
250
|
+
room_id,
|
|
251
|
+
to: null,
|
|
252
|
+
payload: 'x'.repeat(DEFAULT_ROOM_MAX_PAYLOAD_BYTES + 1)
|
|
253
|
+
}), JSONRPC_ERROR_CODES.invalid_params, ERROR_ROOM_PAYLOAD_TOO_LARGE, 'a payload over the bound');
|
|
254
|
+
assert_refusal(await refused(ws, 'room_send', {
|
|
255
|
+
room_id,
|
|
256
|
+
to: '0b4f5b0e-1c8a-4d63-9a51-1f0c2a3b4c5d',
|
|
257
|
+
payload: 'x'
|
|
258
|
+
}), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_MEMBER_NOT_FOUND, 'a send to no member');
|
|
259
|
+
// nor may a member address itself
|
|
260
|
+
assert_refusal(await refused(ws, 'room_send', { room_id, to: member_id, payload: 'x' }), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_MEMBER_NOT_FOUND, 'a send to the sender');
|
|
261
|
+
}
|
|
262
|
+
finally {
|
|
263
|
+
await ws.close();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
test_if(enabled, 'a room past its cap is full, and the admin rule reads the grant', async () => {
|
|
267
|
+
const fixture = await setup_test();
|
|
268
|
+
const accounts = [
|
|
269
|
+
await fixture.create_account(),
|
|
270
|
+
await fixture.create_account(),
|
|
271
|
+
await fixture.create_account()
|
|
272
|
+
];
|
|
273
|
+
const clients = [];
|
|
274
|
+
try {
|
|
275
|
+
for (const account of accounts)
|
|
276
|
+
clients.push(await open(account));
|
|
277
|
+
const [a, b, c] = clients;
|
|
278
|
+
const pair = room('pair:');
|
|
279
|
+
await join(a, { room_id: pair });
|
|
280
|
+
await join(b, { room_id: pair });
|
|
281
|
+
assert_refusal(await refused(c, 'room_join', { room_id: pair }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_FULL, 'a third member of a pair');
|
|
282
|
+
// a refused join displaced nothing
|
|
283
|
+
assert.deepStrictEqual(received(a, 'room_member_left', pair), []);
|
|
284
|
+
// a seat freed is a seat taken
|
|
285
|
+
await call(b, 'room_leave', { room_id: pair });
|
|
286
|
+
await join(c, { room_id: pair });
|
|
287
|
+
// a member without the global admin role is denied, the keeper admitted
|
|
288
|
+
const admin_room = room('admin:');
|
|
289
|
+
assert_refusal(await refused(a, 'room_join', { room_id: admin_room }), JSONRPC_ERROR_CODES.not_found, ERROR_ROOM_NOT_FOUND, 'a non-admin join of an admin room');
|
|
290
|
+
const keeper = await open(fixture);
|
|
291
|
+
clients.push(keeper);
|
|
292
|
+
const joined = await join(keeper, { room_id: admin_room });
|
|
293
|
+
assert.strictEqual(joined.members[0]?.actor_id, fixture.actor.id);
|
|
294
|
+
// and a fresh admin too, its grant read live
|
|
295
|
+
const admin = await open(await fixture.create_account({ roles: [ROLE_ADMIN] }));
|
|
296
|
+
clients.push(admin);
|
|
297
|
+
await call(admin, 'room_watch', { room_id: admin_room });
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
await close_all(clients);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
test_if(enabled, 'a connection watches at most its maximum of rooms', async () => {
|
|
304
|
+
const fixture = await setup_test();
|
|
305
|
+
const ws = await open(await fixture.create_account());
|
|
306
|
+
try {
|
|
307
|
+
const base = room('open:');
|
|
308
|
+
for (let i = 0; i < DEFAULT_ROOM_MAX_WATCHES_PER_CONNECTION; i++) {
|
|
309
|
+
await call(ws, 'room_watch', { room_id: `${base}-${i}` });
|
|
310
|
+
}
|
|
311
|
+
assert_refusal(await refused(ws, 'room_watch', { room_id: `${base}-past` }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_WATCH_LIMIT, 'a watch past the maximum');
|
|
312
|
+
// re-watching a watched room is no new watch
|
|
313
|
+
await call(ws, 'room_watch', { room_id: `${base}-0` });
|
|
314
|
+
// an unwatch frees a slot
|
|
315
|
+
await call(ws, 'room_unwatch', { room_id: `${base}-0` });
|
|
316
|
+
await call(ws, 'room_watch', { room_id: `${base}-past` });
|
|
317
|
+
}
|
|
318
|
+
finally {
|
|
319
|
+
await ws.close();
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
test_if(enabled, 'over HTTP the room verbs answer method_not_found', async () => {
|
|
323
|
+
const fixture = await setup_test();
|
|
324
|
+
for (const spec of all_room_action_specs) {
|
|
325
|
+
const result = await rpc_call({
|
|
326
|
+
app: fixture.transport,
|
|
327
|
+
path: rpc_path,
|
|
328
|
+
method: spec.method,
|
|
329
|
+
params: { room_id: room('open:') },
|
|
330
|
+
headers: fixture.create_session_headers()
|
|
331
|
+
});
|
|
332
|
+
assert.ok(!result.ok, `${spec.method} over HTTP succeeded`);
|
|
333
|
+
if (!result.ok) {
|
|
334
|
+
assert.strictEqual(result.error.code, JSONRPC_ERROR_CODES.method_not_found, `${spec.method} over HTTP`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
test_if(enabled, 'one seat per actor: the newest admitted join moves the other', async () => {
|
|
339
|
+
const fixture = await setup_test();
|
|
340
|
+
const account = await fixture.create_account();
|
|
341
|
+
const watcher_account = await fixture.create_account();
|
|
342
|
+
const s1 = await open(account);
|
|
343
|
+
const s2 = await open(account);
|
|
344
|
+
const watcher = await open(watcher_account);
|
|
345
|
+
try {
|
|
346
|
+
const first = room('open:');
|
|
347
|
+
const second = room('open:');
|
|
348
|
+
await call(watcher, 'room_watch', { room_id: first });
|
|
349
|
+
const m1 = (await join(s1, { room_id: first })).member_id;
|
|
350
|
+
const m2 = (await join(s2, { room_id: second })).member_id;
|
|
351
|
+
assert.deepStrictEqual(await heard(s1, 'room_seat_lost'), {
|
|
352
|
+
room_id: first,
|
|
353
|
+
member_id: m1,
|
|
354
|
+
reason: 'moved',
|
|
355
|
+
moved_to: second
|
|
356
|
+
});
|
|
357
|
+
assert.deepStrictEqual(await heard(watcher, 'room_member_left'), {
|
|
358
|
+
room_id: first,
|
|
359
|
+
seq: 2,
|
|
360
|
+
member_id: m1,
|
|
361
|
+
reason: 'moved'
|
|
362
|
+
});
|
|
363
|
+
// the moved seat is gone from its room
|
|
364
|
+
assert.deepStrictEqual(await call(watcher, 'room_watch', { room_id: first }), { room_id: first, seq: 2, members: [] });
|
|
365
|
+
// a rejoin naming the moved seat would take the newer seat back: refused
|
|
366
|
+
assert_refusal(await refused(s1, 'room_join', { room_id: first, rejoin_of: m1 }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_SEAT_MOVED, 'a rejoin of a moved seat');
|
|
367
|
+
// a fresh join moves it again
|
|
368
|
+
const m3 = (await join(s1, { room_id: first })).member_id;
|
|
369
|
+
assert.deepStrictEqual(await heard(s2, 'room_seat_lost'), {
|
|
370
|
+
room_id: second,
|
|
371
|
+
member_id: m2,
|
|
372
|
+
reason: 'moved',
|
|
373
|
+
moved_to: first
|
|
374
|
+
});
|
|
375
|
+
// joining again on one connection moves its own seat, to a fresh id
|
|
376
|
+
const m4 = (await join(s1, { room_id: first })).member_id;
|
|
377
|
+
assert.notStrictEqual(m4, m3);
|
|
378
|
+
assert.deepStrictEqual(await heard(s1, 'room_seat_lost', (p) => p.member_id === m3), { room_id: first, member_id: m3, reason: 'moved', moved_to: first });
|
|
379
|
+
// a seat released by its disconnect is rejoined, not refused
|
|
380
|
+
await s1.close();
|
|
381
|
+
await heard(watcher, 'room_member_left', (p) => p.member_id === m4);
|
|
382
|
+
const s3 = await open(account);
|
|
383
|
+
try {
|
|
384
|
+
const rejoined = await join(s3, { room_id: first, rejoin_of: m4 });
|
|
385
|
+
assert.notStrictEqual(rejoined.member_id, m4);
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
await s3.close();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
finally {
|
|
392
|
+
await close_all([s1, s2, watcher]);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
test_if(enabled, "a closed socket's seats leave as disconnected", async () => {
|
|
396
|
+
const fixture = await setup_test();
|
|
397
|
+
const stays = await open(await fixture.create_account());
|
|
398
|
+
const goes = await open(await fixture.create_account());
|
|
399
|
+
try {
|
|
400
|
+
const room_id = room('open:');
|
|
401
|
+
await join(stays, { room_id });
|
|
402
|
+
const { member_id } = await join(goes, { room_id });
|
|
403
|
+
await heard(stays, 'room_member_joined');
|
|
404
|
+
await goes.close();
|
|
405
|
+
assert.deepStrictEqual(await heard(stays, 'room_member_left'), {
|
|
406
|
+
room_id,
|
|
407
|
+
seq: 3,
|
|
408
|
+
member_id,
|
|
409
|
+
reason: 'disconnected'
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
finally {
|
|
413
|
+
await close_all([stays, goes]);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
test_if(enabled, 'an eviction ends seats and watches alike', async () => {
|
|
417
|
+
const fixture = await setup_test();
|
|
418
|
+
const evictee_account = await fixture.create_account();
|
|
419
|
+
const stayer_account = await fixture.create_account();
|
|
420
|
+
const evictee = await open(evictee_account);
|
|
421
|
+
const stayer = await open(stayer_account);
|
|
422
|
+
const watcher = await open(await fixture.create_account());
|
|
423
|
+
try {
|
|
424
|
+
// a scope target ends the scope's seats and watches
|
|
425
|
+
const scoped = room('scoped:g1:');
|
|
426
|
+
await call(watcher, 'room_watch', { room_id: scoped });
|
|
427
|
+
const { member_id } = await join(evictee, { room_id: scoped });
|
|
428
|
+
await heard(watcher, 'room_member_joined');
|
|
429
|
+
assert.deepStrictEqual(await backdoor(fixture, '_testing_room_evict', {
|
|
430
|
+
target: { kind: 'scope', scope: 'g1' },
|
|
431
|
+
reason: 'evicted'
|
|
432
|
+
}), { seats: 1, watches: 1, pending: 0 });
|
|
433
|
+
assert.deepStrictEqual(await heard(evictee, 'room_seat_lost'), {
|
|
434
|
+
room_id: scoped,
|
|
435
|
+
member_id,
|
|
436
|
+
reason: 'evicted',
|
|
437
|
+
moved_to: null
|
|
438
|
+
});
|
|
439
|
+
assert.deepStrictEqual(await heard(watcher, 'room_watch_ended'), {
|
|
440
|
+
room_id: scoped,
|
|
441
|
+
reason: 'evicted'
|
|
442
|
+
});
|
|
443
|
+
assert.deepStrictEqual(await call(watcher, 'room_unwatch', { room_id: scoped }), {
|
|
444
|
+
unwatched: false
|
|
445
|
+
});
|
|
446
|
+
// an actor within a scope: the others hear it leave as evicted
|
|
447
|
+
const shared = room('scoped:g2:');
|
|
448
|
+
await call(watcher, 'room_watch', { room_id: shared });
|
|
449
|
+
const evicted_member = (await join(evictee, { room_id: shared })).member_id;
|
|
450
|
+
const stayer_member = (await join(stayer, { room_id: shared })).member_id;
|
|
451
|
+
assert.deepStrictEqual(await backdoor(fixture, '_testing_room_evict', {
|
|
452
|
+
target: { kind: 'actor_in_scope', actor_id: evictee_account.actor.id, scope: 'g2' },
|
|
453
|
+
reason: 'evicted'
|
|
454
|
+
}), { seats: 1, watches: 0, pending: 0 });
|
|
455
|
+
for (const ws of [stayer, watcher]) {
|
|
456
|
+
assert.deepStrictEqual(await heard(ws, 'room_member_left', (p) => p.room_id === shared), { room_id: shared, seq: 3, member_id: evicted_member, reason: 'evicted' });
|
|
457
|
+
}
|
|
458
|
+
// the evicted seat sends nothing more
|
|
459
|
+
assert_refusal(await refused(evictee, 'room_send', { room_id: shared, to: null, payload: 'x' }), JSONRPC_ERROR_CODES.conflict, ERROR_ROOM_NOT_JOINED, 'a send from an evicted seat');
|
|
460
|
+
// a room target closes the room
|
|
461
|
+
assert.deepStrictEqual(await backdoor(fixture, '_testing_room_evict', {
|
|
462
|
+
target: { kind: 'room', room_id: shared },
|
|
463
|
+
reason: 'room_closed'
|
|
464
|
+
}), { seats: 1, watches: 1, pending: 0 });
|
|
465
|
+
assert.deepStrictEqual(await heard(stayer, 'room_seat_lost', (p) => p.room_id === shared), { room_id: shared, member_id: stayer_member, reason: 'room_closed', moved_to: null });
|
|
466
|
+
assert.deepStrictEqual(await heard(watcher, 'room_watch_ended', (p) => p.room_id === shared), { room_id: shared, reason: 'room_closed' });
|
|
467
|
+
// an actor target reaches every room; a target naming nothing removes nothing
|
|
468
|
+
const third = room('open:');
|
|
469
|
+
await join(stayer, { room_id: third });
|
|
470
|
+
assert.deepStrictEqual(await backdoor(fixture, '_testing_room_evict', {
|
|
471
|
+
target: { kind: 'actor', actor_id: stayer_account.actor.id },
|
|
472
|
+
reason: 'evicted'
|
|
473
|
+
}), { seats: 1, watches: 0, pending: 0 });
|
|
474
|
+
assert.deepStrictEqual(await backdoor(fixture, '_testing_room_evict', {
|
|
475
|
+
target: { kind: 'actor', actor_id: stayer_account.actor.id },
|
|
476
|
+
reason: 'evicted'
|
|
477
|
+
}), { seats: 0, watches: 0, pending: 0 });
|
|
478
|
+
}
|
|
479
|
+
finally {
|
|
480
|
+
await close_all([evictee, stayer, watcher]);
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
test_if(enabled, 'the room limiter charges escaped bytes per connection; a watch and a leave still answer past it', async () => {
|
|
484
|
+
const fixture = await setup_test();
|
|
485
|
+
const account = await fixture.create_account();
|
|
486
|
+
const ws = await open(account);
|
|
487
|
+
try {
|
|
488
|
+
const room_id = room('open:');
|
|
489
|
+
await join(ws, { room_id });
|
|
490
|
+
// a max-size payload whose every byte escapes to six: a few fill the
|
|
491
|
+
// default byte budget, far below its request count
|
|
492
|
+
const payload = '\u0001'.repeat(DEFAULT_ROOM_MAX_PAYLOAD_BYTES);
|
|
493
|
+
let sent = 0;
|
|
494
|
+
let limited = null;
|
|
495
|
+
while (sent < 10) {
|
|
496
|
+
const id = `room_${++next_id}`;
|
|
497
|
+
await ws.send({
|
|
498
|
+
jsonrpc: '2.0',
|
|
499
|
+
id,
|
|
500
|
+
method: 'room_send',
|
|
501
|
+
params: { room_id, to: null, payload }
|
|
502
|
+
});
|
|
503
|
+
const frame = await ws.wait_for(is_response_for(id), WAIT_MS);
|
|
504
|
+
if (frame.error) {
|
|
505
|
+
limited = frame.error;
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
sent++;
|
|
509
|
+
}
|
|
510
|
+
assert.ok(limited, 'the byte budget never refused');
|
|
511
|
+
assert.ok(sent >= 2, `refused after only ${sent} sends`);
|
|
512
|
+
assert_refusal(limited, JSONRPC_ERROR_CODES.rate_limited, undefined, 'past the budget');
|
|
513
|
+
const retry_after = limited.data?.retry_after;
|
|
514
|
+
assert.ok(typeof retry_after === 'number' && Number.isInteger(retry_after) && retry_after >= 1, `retry_after: ${JSON.stringify(retry_after)}`);
|
|
515
|
+
// what the limiter doesn't charge still runs
|
|
516
|
+
await call(ws, 'room_watch', { room_id: room('open:') });
|
|
517
|
+
assert.deepStrictEqual(await call(ws, 'room_leave', { room_id }), { left: true });
|
|
518
|
+
// and another connection of the same account has its own budget
|
|
519
|
+
const other = await open(account);
|
|
520
|
+
try {
|
|
521
|
+
const other_room = room('open:');
|
|
522
|
+
await join(other, { room_id: other_room });
|
|
523
|
+
assert.strictEqual(await call(other, 'room_send', { room_id: other_room, to: null, payload }), null);
|
|
524
|
+
}
|
|
525
|
+
finally {
|
|
526
|
+
await other.close();
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
finally {
|
|
530
|
+
await ws.close();
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6CAA6C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"rust_spine_stub_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/rust_spine_stub_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAezD,uGAAuG;AACvG,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,6CAA6C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,6CAA6C,CAAC;AAuCnG,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,8EAA8E;AAC9E,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD,0FAA0F;AAC1F,eAAO,MAAM,oCAAoC,sDACG,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC7C,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;OAOG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,UAAS,6BAAkC,KACzC,aAoDF,CAAC"}
|
|
@@ -66,7 +66,9 @@ export const RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH_ENV = 'FUZ_RUST_SPINE_STUB_EXP
|
|
|
66
66
|
* serves one action registry on `/api/rpc` and `/api/ws`), `cell_gated_create`
|
|
67
67
|
* (it mounts the `TestCellGatedCreateAuthorize` policy on its cell layer), and
|
|
68
68
|
* `ws_role_gated` (it mounts the role-gated WS endpoint at
|
|
69
|
-
* `SPINE_ROLE_GATED_WS_PATH`, sharing its connection registry), and
|
|
69
|
+
* `SPINE_ROLE_GATED_WS_PATH`, sharing its connection registry), and `rooms`
|
|
70
|
+
* (its registry carries the WS-only room verbs over an exclusive room
|
|
71
|
+
* registry and `TestRoomAuthorize`), and every
|
|
70
72
|
* `TESTING_BACKDOOR_METHODS` entry as `testing_backdoors` (it mounts them all,
|
|
71
73
|
* on one registry for both transports). Named
|
|
72
74
|
* (not inline) so every spine preset is greppable, mirroring
|
|
@@ -85,6 +87,7 @@ const rust_spine_stub_capabilities = Object.freeze({
|
|
|
85
87
|
ws_account_actions: true,
|
|
86
88
|
cell_gated_create: true,
|
|
87
89
|
ws_role_gated: true,
|
|
90
|
+
rooms: true,
|
|
88
91
|
testing_backdoors: TESTING_BACKDOOR_METHODS
|
|
89
92
|
});
|
|
90
93
|
/** Default listening port — slots beside zzz's 1175/1176; matches the binary's `DEFAULT_PORT`. */
|
|
@@ -27,6 +27,7 @@ import { type RoleGrantOfferLifecycleCrossTestOptions } from './role_grant_offer
|
|
|
27
27
|
import { type RoleGrantOfferNotificationWsTestOptions } from './role_grant_offer_notification_ws.js';
|
|
28
28
|
import { type RoleGrantParticipationCrossTestOptions } from './role_grant_participation.js';
|
|
29
29
|
import { type RoleGrantRoleGrammarCrossTestOptions } from './role_grant_role_grammar.js';
|
|
30
|
+
import { type RoomsWsCrossTestOptions } from './rooms_ws.js';
|
|
30
31
|
import { type RpcAdversarialCrossTestOptions } from './rpc_adversarial.js';
|
|
31
32
|
import { type SessionCapCrossTestOptions } from './session_cap.js';
|
|
32
33
|
import { type SessionCookieCodecCrossTestOptions } from './session_cookie_codec.js';
|
|
@@ -52,7 +53,7 @@ import { type CrossProcessWsTestOptions } from './ws_round_trip.js';
|
|
|
52
53
|
* guard test holds it, with `STANDALONE_CROSS_SUITES`, to every module that
|
|
53
54
|
* exports a `describe_*` suite, so a new suite fails until it is registered.
|
|
54
55
|
*/
|
|
55
|
-
export declare const SUITE_NAMES: readonly ["account_lifecycle", "actor_lookup", "app_settings", "body_size", "body_size_smuggling", "cell_crud", "cell_gated_create", "cell_grant_role", "cell_grant_steward", "cell_moderate", "cell_ref_admission", "cell_relations", "cookie_attributes", "credential_deadline", "credential_header_robustness", "fact_serving", "identity_parity", "origin", "origin_conformance", "origin_scope", "peer_ping_ws", "query_shape", "ready", "role_grant_offer_enumeration", "role_grant_offer_lifecycle", "role_grant_offer_notification_ws", "role_grant_participation", "role_grant_role_grammar", "rpc_adversarial", "session_cap", "session_cookie_codec", "simple_request", "sse_round_trip", "standard", "testing_backdoor", "token_lifetime", "token_scope_surface", "transport_composition", "ws_connection_cap", "ws_envelope", "ws_inbound_dispatch", "ws_outbound_overflow", "ws_role_gated", "ws_round_trip"];
|
|
56
|
+
export declare const SUITE_NAMES: readonly ["account_lifecycle", "actor_lookup", "app_settings", "body_size", "body_size_smuggling", "cell_crud", "cell_gated_create", "cell_grant_role", "cell_grant_steward", "cell_moderate", "cell_ref_admission", "cell_relations", "cookie_attributes", "credential_deadline", "credential_header_robustness", "fact_serving", "identity_parity", "origin", "origin_conformance", "origin_scope", "peer_ping_ws", "query_shape", "ready", "role_grant_offer_enumeration", "role_grant_offer_lifecycle", "role_grant_offer_notification_ws", "role_grant_participation", "role_grant_role_grammar", "rooms_ws", "rpc_adversarial", "session_cap", "session_cookie_codec", "simple_request", "sse_round_trip", "standard", "testing_backdoor", "token_lifetime", "token_scope_surface", "transport_composition", "ws_connection_cap", "ws_envelope", "ws_inbound_dispatch", "ws_outbound_overflow", "ws_role_gated", "ws_round_trip"];
|
|
56
57
|
/** A shipped single-backend cross suite, named by its module. */
|
|
57
58
|
export type SuiteName = (typeof SUITE_NAMES)[number];
|
|
58
59
|
/** A shipped suite module `describe_spine_cross_suites` leaves out. */
|
|
@@ -100,6 +101,7 @@ export interface SuiteOptionsMap {
|
|
|
100
101
|
role_grant_offer_notification_ws: RoleGrantOfferNotificationWsTestOptions;
|
|
101
102
|
role_grant_participation: RoleGrantParticipationCrossTestOptions;
|
|
102
103
|
role_grant_role_grammar: RoleGrantRoleGrammarCrossTestOptions;
|
|
104
|
+
rooms_ws: RoomsWsCrossTestOptions;
|
|
103
105
|
rpc_adversarial: RpcAdversarialCrossTestOptions;
|
|
104
106
|
session_cap: SessionCapCrossTestOptions;
|
|
105
107
|
session_cookie_codec: SessionCookieCodecCrossTestOptions;
|
|
@@ -309,7 +311,8 @@ export declare const register_spine_case_exclusions: (exclude_cases: SuiteCaseEx
|
|
|
309
311
|
* its cases, or an override changing its `capabilities.testing_backdoors`), an exclude,
|
|
310
312
|
* override or `exclude_cases` entry for a suite that skips itself or isn't
|
|
311
313
|
* run, a backend not declaring `SPINE_SUITES_REQUIRED_BACKDOORS` (or
|
|
312
|
-
* `_testing_put_fact` with `fact_serving
|
|
314
|
+
* `_testing_put_fact` with `fact_serving`, or `_testing_room_evict` with
|
|
315
|
+
* `rooms`), or a suite missing an input the
|
|
313
316
|
* handle doesn't carry
|
|
314
317
|
*/
|
|
315
318
|
export declare const describe_spine_cross_suites: (handle: ReconstructedBootstrappedBackendHandle, options: SpineCrossSuitesOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"spine_suites.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/spine_suites.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAyF9B,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAmC,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAEN,KAAK,gCAAgC,EACrC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,KAAK,2BAA2B,EAChC,MAAM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