@fuzdev/fuz_app 0.182.0 → 0.184.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/README.md +2 -0
- package/dist/actions/CLAUDE.md +535 -1223
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +3 -2
- package/dist/actions/connection_closer.d.ts +11 -9
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +11 -9
- package/dist/actions/frontend_rpc_client.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts +14 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +2 -1
- package/dist/actions/ws_socket_session.d.ts +9 -1
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +43 -19
- package/dist/auth/CLAUDE.md +430 -1024
- package/dist/auth/account_queries.d.ts +1 -1
- package/dist/auth/account_queries.js +1 -1
- package/dist/auth/account_routes.d.ts +9 -8
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +78 -75
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +32 -28
- package/dist/auth/api_token.d.ts +20 -3
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +28 -9
- package/dist/auth/api_token_queries.d.ts +2 -2
- package/dist/auth/api_token_queries.js +2 -2
- package/dist/auth/audit_emitter.d.ts +75 -84
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +83 -71
- package/dist/auth/audit_log_schema.d.ts +25 -14
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +23 -8
- package/dist/auth/auth_guard_resolver.d.ts +1 -1
- package/dist/auth/auth_guard_resolver.js +1 -1
- package/dist/auth/bearer_auth.d.ts +2 -5
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +4 -13
- package/dist/auth/bootstrap_account.d.ts +42 -26
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +36 -19
- package/dist/auth/bootstrap_routes.d.ts +20 -21
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +26 -31
- package/dist/auth/bootstrap_token_store.d.ts +3 -4
- package/dist/auth/bootstrap_token_store.d.ts.map +1 -1
- package/dist/auth/bootstrap_token_store.js +1 -1
- package/dist/auth/daemon_token.d.ts +5 -1
- package/dist/auth/daemon_token.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.d.ts +12 -8
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +15 -21
- package/dist/auth/deps.d.ts +19 -5
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/deps.js +3 -2
- package/dist/auth/invite_queries.d.ts +51 -3
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +81 -6
- package/dist/auth/invite_schema.d.ts +2 -1
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/middleware.d.ts +2 -3
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +3 -3
- package/dist/auth/request_context.d.ts +3 -3
- package/dist/auth/request_context.js +3 -3
- package/dist/auth/resolved_auth.d.ts +7 -7
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts +27 -3
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +42 -35
- package/dist/auth/role_grant_offer_queries.d.ts +60 -4
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +79 -5
- package/dist/auth/role_grant_queries.d.ts +3 -52
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +5 -80
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +11 -22
- package/dist/auth/session_cookie.d.ts +82 -174
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +80 -130
- package/dist/auth/session_middleware.d.ts +8 -17
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +14 -23
- package/dist/auth/session_queries.d.ts +15 -17
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +28 -20
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +93 -43
- package/dist/db/CLAUDE.md +5 -3
- package/dist/db/sql_columns.d.ts +1 -1
- package/dist/db/sql_columns.js +1 -1
- package/dist/dev/setup.d.ts +3 -1
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +3 -1
- package/dist/http/CLAUDE.md +315 -763
- package/dist/http/db_routes.d.ts +8 -23
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +73 -73
- package/dist/http/origin.d.ts +7 -8
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -8
- package/dist/http/pending_effects.d.ts +118 -6
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +114 -6
- package/dist/http/route_result.d.ts +1 -1
- package/dist/http/route_spec.d.ts +14 -11
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/sse.d.ts +4 -23
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +4 -25
- package/dist/server/app_backend.d.ts +4 -5
- 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 +80 -16
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +113 -31
- package/dist/server/app_server_context.d.ts +1 -2
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.js +2 -2
- package/dist/testing/CLAUDE.md +265 -796
- package/dist/testing/admin_integration.d.ts +2 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +3 -3
- package/dist/testing/adversarial_404.d.ts +6 -1
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +38 -17
- package/dist/testing/app_server.d.ts +23 -148
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +53 -131
- package/dist/testing/attack_surface.d.ts +1 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/audit_completeness.d.ts +2 -3
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/audit_drift_guard.d.ts +11 -6
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +15 -8
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts +12 -9
- package/dist/testing/cross_backend/audit_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/audit_cross_helpers.js +13 -14
- package/dist/testing/cross_backend/capabilities.d.ts +9 -6
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +11 -7
- package/dist/testing/cross_backend/capability_mounts.d.ts +103 -0
- package/dist/testing/cross_backend/capability_mounts.d.ts.map +1 -0
- package/dist/testing/cross_backend/capability_mounts.js +428 -0
- package/dist/testing/cross_backend/cell_moderate.js +2 -2
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +12 -11
- package/dist/testing/cross_backend/conformance_principal.d.ts +54 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -0
- package/dist/testing/cross_backend/conformance_principal.js +283 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +7 -56
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +6 -274
- package/dist/testing/cross_backend/cookie_attributes.js +1 -1
- package/dist/testing/cross_backend/credential_deadline.d.ts.map +1 -1
- package/dist/testing/cross_backend/credential_deadline.js +2 -0
- package/dist/testing/cross_backend/credential_wire.d.ts +1 -1
- package/dist/testing/cross_backend/credential_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/db_state_diff.d.ts +72 -0
- package/dist/testing/cross_backend/db_state_diff.d.ts.map +1 -0
- package/dist/testing/cross_backend/db_state_diff.js +444 -0
- package/dist/testing/cross_backend/declared_skips.d.ts +68 -0
- package/dist/testing/cross_backend/declared_skips.d.ts.map +1 -0
- package/dist/testing/cross_backend/declared_skips.js +132 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts +3 -3
- package/dist/testing/cross_backend/default_spine_surface.d.ts +0 -6
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +4 -9
- package/dist/testing/cross_backend/differential.d.ts +13 -5
- package/dist/testing/cross_backend/differential.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential.js +35 -11
- package/dist/testing/cross_backend/differential_normalize.d.ts +12 -0
- package/dist/testing/cross_backend/differential_normalize.d.ts.map +1 -1
- package/dist/testing/cross_backend/differential_normalize.js +16 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +1 -42
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -4
- package/dist/testing/cross_backend/in_process_setup.d.ts +28 -19
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +156 -142
- package/dist/testing/cross_backend/login_security.d.ts +12 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +21 -4
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts +0 -2
- package/dist/testing/cross_backend/request_target_conformance_wire.d.ts.map +1 -1
- package/dist/testing/cross_backend/request_target_conformance_wire.js +3 -1
- package/dist/testing/cross_backend/revocation_drivers.d.ts +18 -5
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +18 -10
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts +1 -1
- package/dist/testing/cross_backend/role_grant_cross_helpers.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +33 -1
- package/dist/testing/cross_backend/role_grant_participation.js +4 -4
- package/dist/testing/cross_backend/rpc_adversarial.js +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -4
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -2
- package/dist/testing/cross_backend/session_cap.d.ts +2 -2
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +22 -11
- package/dist/testing/cross_backend/setup.d.ts +32 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +32 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +125 -15
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +459 -62
- 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 +1 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +9 -1
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +123 -27
- package/dist/testing/cross_backend/standard.d.ts +2 -3
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +3 -3
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -2
- package/dist/testing/cross_backend/testing_credential_read.d.ts +10 -11
- package/dist/testing/cross_backend/testing_credential_read.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_credential_read.js +12 -12
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +84 -47
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +95 -63
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +2 -3
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +7 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts +5 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +54 -8
- package/dist/testing/daemon_token_rotation.d.ts.map +1 -1
- package/dist/testing/daemon_token_rotation.js +2 -3
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -0
- package/dist/testing/db.d.ts +0 -32
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -86
- package/dist/testing/db_entities.d.ts +14 -0
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +17 -0
- package/dist/testing/db_invariant_queries.d.ts +259 -0
- package/dist/testing/db_invariant_queries.d.ts.map +1 -0
- package/dist/testing/db_invariant_queries.js +400 -0
- package/dist/testing/db_invariants.d.ts +106 -0
- package/dist/testing/db_invariants.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.d.ts +11 -0
- package/dist/testing/db_invariants.gen.sql.d.ts.map +1 -0
- package/dist/testing/db_invariants.gen.sql.js +13 -0
- package/dist/testing/db_invariants.js +141 -0
- package/dist/testing/db_invariants.sql +152 -0
- package/dist/testing/describe_db.d.ts +36 -0
- package/dist/testing/describe_db.d.ts.map +1 -0
- package/dist/testing/describe_db.js +71 -0
- package/dist/testing/integration.d.ts +8 -12
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +13 -17
- package/dist/testing/integration_helpers.d.ts +1 -1
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/rate_limiting.d.ts +3 -4
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +6 -5
- package/dist/testing/role_grant_helpers.d.ts +1 -1
- package/dist/testing/role_grant_helpers.d.ts.map +1 -1
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +3 -0
- package/dist/testing/rpc_attack_surface.d.ts +8 -6
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +69 -6
- package/dist/testing/rpc_helpers.d.ts +1 -2
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -3
- package/dist/testing/rpc_round_trip.d.ts +3 -4
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +4 -1
- package/dist/testing/sse_round_trip.d.ts +3 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +15 -6
- package/dist/testing/stubs.d.ts +9 -8
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +20 -13
- package/dist/testing/test_app.d.ts +168 -0
- package/dist/testing/test_app.d.ts.map +1 -0
- package/dist/testing/test_app.js +123 -0
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +3 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +1 -2
- package/package.json +1 -1
|
@@ -33,7 +33,8 @@ import '../assert_dev_env.js';
|
|
|
33
33
|
* out-of-range or mistyped `limit` (`0`, `-1`, `1.5`, past the max, `null`,
|
|
34
34
|
* a string) is `invalid_params` in every direction, and the reverse lists
|
|
35
35
|
* read oldest edge first.
|
|
36
|
-
* - **items** — `cell_item_insert` at fractional-index positions
|
|
36
|
+
* - **items** — `cell_item_insert` at fractional-index positions (generated
|
|
37
|
+
* without jitter, so every run and both backends send one key sequence), forward
|
|
37
38
|
* (lex-ordered) + reverse `cell_item_list`, `cell_item_move`, idempotent
|
|
38
39
|
* `cell_item_delete`; an insert or a move onto a taken position →
|
|
39
40
|
* `invalid_params` `cell_item_position_taken`, leaving the rows as they were.
|
|
@@ -90,8 +91,8 @@ const create_cell = async (t, rpc_path, h, params) => expect_output(await cross_
|
|
|
90
91
|
* `auth/cell_relation_visibility.db.test.ts`.
|
|
91
92
|
*/
|
|
92
93
|
const wire_children = async (t, rpc_path, owner_h, parent, pub_child, priv_child) => {
|
|
93
|
-
const pos_a = fractional_index_between(null, null);
|
|
94
|
-
const pos_b = fractional_index_between(pos_a, null);
|
|
94
|
+
const pos_a = fractional_index_between(null, null, { jitter: false });
|
|
95
|
+
const pos_b = fractional_index_between(pos_a, null, { jitter: false });
|
|
95
96
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: parent, child_id: pub_child, position: pos_a }, owner_h), CellItemInsertOutput);
|
|
96
97
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: parent, child_id: priv_child, position: pos_b }, owner_h), CellItemInsertOutput);
|
|
97
98
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_field_set', { source_id: parent, name: 'pub_link', target_id: pub_child }, owner_h), CellFieldSetOutput);
|
|
@@ -249,7 +250,7 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
249
250
|
const hub = await make();
|
|
250
251
|
const parent = await make();
|
|
251
252
|
const source = await make();
|
|
252
|
-
const positions = fractional_indices_between(null, null, inbound);
|
|
253
|
+
const positions = fractional_indices_between(null, null, inbound, { jitter: false });
|
|
253
254
|
for (let i = 0; i < inbound; i++) {
|
|
254
255
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: parent, child_id: hub, position: positions[i] }, h), CellItemInsertOutput);
|
|
255
256
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_field_set', { source_id: source, name: `link_${i}`, target_id: hub }, h), CellFieldSetOutput);
|
|
@@ -284,7 +285,7 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
284
285
|
const source = await make('public');
|
|
285
286
|
const parent = await make('public');
|
|
286
287
|
const padding = CELL_RELATION_LIST_LIMIT_DEFAULT + 1;
|
|
287
|
-
const positions = fractional_indices_between(null, null, padding + 1);
|
|
288
|
+
const positions = fractional_indices_between(null, null, padding + 1, { jitter: false });
|
|
288
289
|
for (let i = 0; i <= padding; i++) {
|
|
289
290
|
const end = await make(i < padding ? 'private' : 'public');
|
|
290
291
|
const name = `link_${String(i).padStart(3, '0')}`;
|
|
@@ -362,10 +363,10 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
362
363
|
const parent = await make();
|
|
363
364
|
const child_a = await make();
|
|
364
365
|
const child_b = await make();
|
|
365
|
-
const pos_a = fractional_index_between(null, null);
|
|
366
|
+
const pos_a = fractional_index_between(null, null, { jitter: false });
|
|
366
367
|
const ins_a = expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: parent, child_id: child_a, position: pos_a }, h), CellItemInsertOutput);
|
|
367
368
|
assert.strictEqual(ins_a.item.child_id, child_a);
|
|
368
|
-
const pos_b = fractional_index_between(pos_a, null);
|
|
369
|
+
const pos_b = fractional_index_between(pos_a, null, { jitter: false });
|
|
369
370
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: parent, child_id: child_b, position: pos_b }, h), CellItemInsertOutput);
|
|
370
371
|
// Forward list is lex-ordered by position; child_a (pos_a < pos_b) first.
|
|
371
372
|
const forward = expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_list', { parent_id: parent }, h), CellItemListOutput);
|
|
@@ -376,7 +377,7 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
376
377
|
const reverse = expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_list', { child_id: child_a }, h), CellItemListOutput);
|
|
377
378
|
assert.ok(reverse.items.some((i) => i.parent_id === parent), 'reverse item_list missing the parent');
|
|
378
379
|
// Move child_b ahead of child_a.
|
|
379
|
-
const new_pos = fractional_index_between(null, pos_a);
|
|
380
|
+
const new_pos = fractional_index_between(null, pos_a, { jitter: false });
|
|
380
381
|
const moved = expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_move', { parent_id: parent, position: pos_b, new_position: new_pos }, h), CellItemMoveOutput);
|
|
381
382
|
assert.strictEqual(moved.item.position, new_pos);
|
|
382
383
|
assert.strictEqual(moved.item.child_id, child_b);
|
|
@@ -396,8 +397,8 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
396
397
|
const child_a = await make();
|
|
397
398
|
const child_b = await make();
|
|
398
399
|
const child_c = await make();
|
|
399
|
-
const pos_a = fractional_index_between(null, null);
|
|
400
|
-
const pos_b = fractional_index_between(pos_a, null);
|
|
400
|
+
const pos_a = fractional_index_between(null, null, { jitter: false });
|
|
401
|
+
const pos_b = fractional_index_between(pos_a, null, { jitter: false });
|
|
401
402
|
for (const [child_id, position] of [
|
|
402
403
|
[child_a, pos_a],
|
|
403
404
|
[child_b, pos_b]
|
|
@@ -429,7 +430,7 @@ export const describe_cell_relations_cross_tests = (options) => {
|
|
|
429
430
|
const source = await make('orig');
|
|
430
431
|
const child = await make('child');
|
|
431
432
|
const field_target = await make('target');
|
|
432
|
-
const child_pos = fractional_index_between(null, null);
|
|
433
|
+
const child_pos = fractional_index_between(null, null, { jitter: false });
|
|
433
434
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_item_insert', { parent_id: source, child_id: child, position: child_pos }, h), CellItemInsertOutput);
|
|
434
435
|
expect_output(await cross_rpc_call(t, rpc_path, 'cell_field_set', { source_id: source, name: 'link', target_id: field_target }, h), CellFieldSetOutput);
|
|
435
436
|
// Shallow clone: new owned cell, path nulled, item edge shares the
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { type resolve_rpc_endpoints_for_setup } from '../rpc_helpers.js';
|
|
3
|
+
import type { FetchTransport } from '../transports/fetch_transport.js';
|
|
4
|
+
import { type ConformancePrincipal } from './conformance_case.js';
|
|
5
|
+
import type { TestFixture } from './setup.js';
|
|
6
|
+
/**
|
|
7
|
+
* Names a seeded `extra_accounts` username for the `role_holder` /
|
|
8
|
+
* `wrong_role` principals — the only two that aren't backed by an
|
|
9
|
+
* always-available fixture accessor. Suites exercising those principals
|
|
10
|
+
* declare the matching `extra_accounts` at setup and name them here.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConformancePrincipalConfig {
|
|
13
|
+
/** `extra_accounts` username for the `role_holder` principal. */
|
|
14
|
+
readonly role_holder?: string;
|
|
15
|
+
/** `extra_accounts` username for the `wrong_role` principal. */
|
|
16
|
+
readonly wrong_role?: string;
|
|
17
|
+
}
|
|
18
|
+
/** A resolved principal: the transport + headers a case fires through. */
|
|
19
|
+
export interface ResolvedConformancePrincipal {
|
|
20
|
+
readonly transport: FetchTransport;
|
|
21
|
+
readonly headers: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Suppress the default `Origin` header on the request. Required for
|
|
24
|
+
* non-browser credential probes (bearer / daemon) — `bearer_auth`
|
|
25
|
+
* discards the token when `Origin` / `Referer` is present.
|
|
26
|
+
*/
|
|
27
|
+
readonly suppress_default_origin?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The actor of the account the credential names — what the `principal`
|
|
30
|
+
* acting binding writes. Absent for principals that present no account.
|
|
31
|
+
*/
|
|
32
|
+
readonly actor_id?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Map a `ConformancePrincipal` onto the transport + headers it
|
|
36
|
+
* authenticates with, reading exclusively from the per-test `TestFixture`.
|
|
37
|
+
*
|
|
38
|
+
* The always-available principals resolve from fixture accessors (the dead
|
|
39
|
+
* credentials that need a server-side state — a revoked session or token, an
|
|
40
|
+
* expired token — from the fixture's `mint_*` seams); `role_holder` /
|
|
41
|
+
* `wrong_role` read a seeded `extra_accounts` entry named via
|
|
42
|
+
* `options.principals` (throws a clear setup error when unconfigured);
|
|
43
|
+
* `scoped_token` mints its narrowed credential over the production path.
|
|
44
|
+
* Also used outside the table by suites that send a principal's requests
|
|
45
|
+
* themselves (`describe_rpc_adversarial_cross_tests`).
|
|
46
|
+
*
|
|
47
|
+
* @param fixture - the per-test fixture
|
|
48
|
+
* @param as - the principal
|
|
49
|
+
* @param principals - usernames for `role_holder` / `wrong_role`
|
|
50
|
+
* @param resolved_rpc_endpoints - the endpoints `scoped_token` mints through
|
|
51
|
+
* @returns the transport and headers the principal sends with
|
|
52
|
+
*/
|
|
53
|
+
export declare const resolve_conformance_principal: (fixture: TestFixture, as: ConformancePrincipal, principals?: ConformancePrincipalConfig, resolved_rpc_endpoints?: ReturnType<typeof resolve_rpc_endpoints_for_setup>) => Promise<ResolvedConformancePrincipal>;
|
|
54
|
+
//# sourceMappingURL=conformance_principal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance_principal.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/conformance_principal.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAiB9B,OAAO,EAAmB,KAAK,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IAC1C,iEAAiE;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,0EAA0E;AAC1E,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAwFD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GACzC,SAAS,WAAW,EACpB,IAAI,oBAAoB,EACxB,aAAa,0BAA0B,EACvC,yBAAwB,UAAU,CAAC,OAAO,+BAA+B,CAAM,KAC7E,OAAO,CAAC,4BAA4B,CA8KtC,CAAC"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The conformance principals' credentials: how each `ConformancePrincipal`
|
|
4
|
+
* resolves onto the transport and headers it sends with, read from the
|
|
5
|
+
* per-test `TestFixture` — the table (`describe_conformance_table_tests`)
|
|
6
|
+
* and the suites that send a principal's requests themselves
|
|
7
|
+
* (`describe_rpc_adversarial_cross_tests`). Its own module, apart from the
|
|
8
|
+
* table's WebSocket leg, so a suite resolving principals over HTTP reaches
|
|
9
|
+
* no socket transport.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { DAEMON_TOKEN_HEADER, is_daemon_token_shaped } from '../../auth/daemon_token.js';
|
|
14
|
+
import { API_TOKEN_PREFIX, is_api_token_shaped } from '../../auth/api_token.js';
|
|
15
|
+
import { account_token_create_action_spec } from '../../auth/account_action_specs.js';
|
|
16
|
+
import { find_rpc_action } from '../rpc_helpers.js';
|
|
17
|
+
import { SCOPED_TOKEN_ADMITTED_METHOD } from './conformance_case.js';
|
|
18
|
+
import { mint_narrowed_api_token } from './narrowed_api_token.js';
|
|
19
|
+
/**
|
|
20
|
+
* A deliberately malformed `X-Daemon-Token` value for the `invalid_daemon`
|
|
21
|
+
* principal. Fails the `DaemonToken` schema (not 43 base64url chars), so
|
|
22
|
+
* the daemon-token middleware soft-fail-discards it rather than authenticating
|
|
23
|
+
* — the request falls through with no identity, surfacing
|
|
24
|
+
* `credential_type_required` on a daemon-gated action (matching the Rust
|
|
25
|
+
* spine's `None`). Sent over a no-Origin transport so it lands on the
|
|
26
|
+
* invalid-token path, not the browser-context discard.
|
|
27
|
+
*/
|
|
28
|
+
const INVALID_DAEMON_TOKEN_VALUE = 'not-a-valid-daemon-token';
|
|
29
|
+
/**
|
|
30
|
+
* The `wrong_daemon` principal's token: well-shaped (43 base64url characters),
|
|
31
|
+
* so it passes the shape precheck and is refused by the compare — never the
|
|
32
|
+
* server's, whose tokens are random.
|
|
33
|
+
*/
|
|
34
|
+
const WRONG_DAEMON_TOKEN_VALUE = 'A'.repeat(43);
|
|
35
|
+
/**
|
|
36
|
+
* The `unknown_bearer` principal's token: well-shaped (the prefix and 43
|
|
37
|
+
* base64url characters), so it costs the lookup no row answers.
|
|
38
|
+
*/
|
|
39
|
+
const UNKNOWN_BEARER_TOKEN_VALUE = `${API_TOKEN_PREFIX}${'A'.repeat(43)}`;
|
|
40
|
+
if (!is_daemon_token_shaped(WRONG_DAEMON_TOKEN_VALUE)) {
|
|
41
|
+
throw new Error('conformance: WRONG_DAEMON_TOKEN_VALUE must be daemon-token-shaped');
|
|
42
|
+
}
|
|
43
|
+
if (!is_api_token_shaped(UNKNOWN_BEARER_TOKEN_VALUE)) {
|
|
44
|
+
throw new Error('conformance: UNKNOWN_BEARER_TOKEN_VALUE must be api-token-shaped');
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The keeper's session cookie with its MAC corrupted: the first character of
|
|
48
|
+
* the signature (after the last `.`) changed, so the signature keeps its
|
|
49
|
+
* shape and the keyring refuses it on the compare, not the shape check.
|
|
50
|
+
*/
|
|
51
|
+
const tamper_session_cookie = (cookie) => {
|
|
52
|
+
const dot = cookie.lastIndexOf('.');
|
|
53
|
+
const first = cookie[dot + 1];
|
|
54
|
+
if (dot === -1 || first === undefined) {
|
|
55
|
+
throw new Error(`conformance: principal 'tampered_cookie' found no signed session cookie`);
|
|
56
|
+
}
|
|
57
|
+
return `${cookie.slice(0, dot + 1)}${first === 'A' ? 'B' : 'A'}${cookie.slice(dot + 2)}`;
|
|
58
|
+
};
|
|
59
|
+
/** A dead bearer presented alone: no cookie, no `Origin`, so the token is looked up. */
|
|
60
|
+
const as_lone_bearer = (fixture, token) => ({
|
|
61
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
62
|
+
headers: { authorization: `Bearer ${token}` },
|
|
63
|
+
suppress_default_origin: true
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Mint the `scoped_token` principal's narrowed bearer token over the
|
|
67
|
+
* production `account_token_create` path.
|
|
68
|
+
*
|
|
69
|
+
* Minted rather than seeded, and minted *here* rather than in a case. The
|
|
70
|
+
* seed stays `full` because `_testing_reset`'s api token backs every other
|
|
71
|
+
* bearer principal, and a case that minted its own credential would be the
|
|
72
|
+
* setup-DSL trap the case schema exists to avoid.
|
|
73
|
+
*
|
|
74
|
+
* `account_token_create` is session-only, so this runs over the keeper's
|
|
75
|
+
* session — which also makes the mint itself a live assertion that a narrowed
|
|
76
|
+
* scope is *accepted* at the mint boundary, not merely stored.
|
|
77
|
+
*/
|
|
78
|
+
const mint_scoped_token = async (fixture, resolved_rpc_endpoints) => {
|
|
79
|
+
const found = find_rpc_action(resolved_rpc_endpoints, account_token_create_action_spec.method);
|
|
80
|
+
if (!found) {
|
|
81
|
+
throw new Error(`conformance: principal 'scoped_token' needs '${account_token_create_action_spec.method}' ` +
|
|
82
|
+
`on the surface to mint its narrowed token, but the method is not registered on ` +
|
|
83
|
+
`rpc_endpoints.`);
|
|
84
|
+
}
|
|
85
|
+
return mint_narrowed_api_token({
|
|
86
|
+
app: fixture.transport,
|
|
87
|
+
rpc_path: found.path,
|
|
88
|
+
session_headers: fixture.create_session_headers(),
|
|
89
|
+
methods: [SCOPED_TOKEN_ADMITTED_METHOD],
|
|
90
|
+
name: 'conformance scoped token'
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Map a `ConformancePrincipal` onto the transport + headers it
|
|
95
|
+
* authenticates with, reading exclusively from the per-test `TestFixture`.
|
|
96
|
+
*
|
|
97
|
+
* The always-available principals resolve from fixture accessors (the dead
|
|
98
|
+
* credentials that need a server-side state — a revoked session or token, an
|
|
99
|
+
* expired token — from the fixture's `mint_*` seams); `role_holder` /
|
|
100
|
+
* `wrong_role` read a seeded `extra_accounts` entry named via
|
|
101
|
+
* `options.principals` (throws a clear setup error when unconfigured);
|
|
102
|
+
* `scoped_token` mints its narrowed credential over the production path.
|
|
103
|
+
* Also used outside the table by suites that send a principal's requests
|
|
104
|
+
* themselves (`describe_rpc_adversarial_cross_tests`).
|
|
105
|
+
*
|
|
106
|
+
* @param fixture - the per-test fixture
|
|
107
|
+
* @param as - the principal
|
|
108
|
+
* @param principals - usernames for `role_holder` / `wrong_role`
|
|
109
|
+
* @param resolved_rpc_endpoints - the endpoints `scoped_token` mints through
|
|
110
|
+
* @returns the transport and headers the principal sends with
|
|
111
|
+
*/
|
|
112
|
+
export const resolve_conformance_principal = async (fixture, as, principals, resolved_rpc_endpoints = []) => {
|
|
113
|
+
switch (as) {
|
|
114
|
+
case 'keeper':
|
|
115
|
+
// Keeper carries its session cookie via `create_session_headers`
|
|
116
|
+
// (in-process the transport is stateless; cross-process the jar
|
|
117
|
+
// also holds it — the explicit header is the same value).
|
|
118
|
+
return {
|
|
119
|
+
transport: fixture.transport,
|
|
120
|
+
headers: fixture.create_session_headers(),
|
|
121
|
+
actor_id: fixture.actor.id
|
|
122
|
+
};
|
|
123
|
+
case 'daemon':
|
|
124
|
+
// Daemon-token is a non-browser credential — empty jar + no Origin.
|
|
125
|
+
return {
|
|
126
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
127
|
+
headers: fixture.create_daemon_token_headers(),
|
|
128
|
+
suppress_default_origin: true,
|
|
129
|
+
actor_id: fixture.actor.id
|
|
130
|
+
};
|
|
131
|
+
case 'invalid_daemon':
|
|
132
|
+
// A malformed `X-Daemon-Token` carried ALONGSIDE the keeper's session
|
|
133
|
+
// cookie, over a non-browser (no-Origin) transport. The invalid daemon
|
|
134
|
+
// token is soft-fail-discarded (matching the Rust spine's `None`), so
|
|
135
|
+
// auth falls through to the session leg: the request authenticates as
|
|
136
|
+
// the keeper-via-session (clearing `require_auth`), then the daemon-gated
|
|
137
|
+
// action's credential-type gate refuses the session credential →
|
|
138
|
+
// `403 credential_type_required`. No-Origin keeps the daemon token on
|
|
139
|
+
// the invalid-token path, NOT the browser-context discard. Without the
|
|
140
|
+
// base credential this would 401 (anonymous) — the session is what makes
|
|
141
|
+
// the *credential-type* gate, not the auth gate, the refusing layer.
|
|
142
|
+
return {
|
|
143
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
144
|
+
headers: fixture.create_session_headers({
|
|
145
|
+
[DAEMON_TOKEN_HEADER]: INVALID_DAEMON_TOKEN_VALUE
|
|
146
|
+
}),
|
|
147
|
+
suppress_default_origin: true,
|
|
148
|
+
actor_id: fixture.actor.id
|
|
149
|
+
};
|
|
150
|
+
case 'daemon_browser':
|
|
151
|
+
// A VALID `X-Daemon-Token` carried in a browser context (default Origin
|
|
152
|
+
// present) ALONGSIDE the keeper's session cookie. The daemon-token
|
|
153
|
+
// middleware discards a header-bearing daemon token as browser context
|
|
154
|
+
// (mirroring the bearer guard + the Rust spine's `is_browser_context`),
|
|
155
|
+
// so the valid token is dropped and auth falls through to the session
|
|
156
|
+
// leg → keeper-via-session → a daemon-gated action refuses the session
|
|
157
|
+
// credential with `credential_type_required`. Origin is NOT suppressed —
|
|
158
|
+
// its presence is the browser-context signal under test. Unlike the
|
|
159
|
+
// `daemon` principal (no Origin → token honored → reaches the 400 confirm
|
|
160
|
+
// guard), the 403 here proves the valid token was discarded, not honored.
|
|
161
|
+
return {
|
|
162
|
+
transport: fixture.transport,
|
|
163
|
+
headers: fixture.create_session_headers(fixture.create_daemon_token_headers()),
|
|
164
|
+
actor_id: fixture.actor.id
|
|
165
|
+
};
|
|
166
|
+
case 'token':
|
|
167
|
+
// Bearer is discarded in a browser context — empty jar + no Origin.
|
|
168
|
+
return {
|
|
169
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
170
|
+
headers: fixture.create_bearer_headers(),
|
|
171
|
+
suppress_default_origin: true,
|
|
172
|
+
actor_id: fixture.actor.id
|
|
173
|
+
};
|
|
174
|
+
case 'bearer_browser':
|
|
175
|
+
// A VALID bearer api-token in a browser context (default Origin
|
|
176
|
+
// present), fresh jar so no session rides alongside. The bearer
|
|
177
|
+
// middleware discards a header-bearing token as browser context
|
|
178
|
+
// (mirroring the daemon guard + the Rust spine's `is_browser_context`),
|
|
179
|
+
// so the request arrives anonymous → an authed action 401s. Origin is
|
|
180
|
+
// NOT suppressed (its presence is the browser-context signal) — the
|
|
181
|
+
// inverse of the `token` principal, which suppresses it so the same
|
|
182
|
+
// token is honored. The 401 proves the valid token was discarded, not
|
|
183
|
+
// honored (a non-discarding leg would authenticate → 200).
|
|
184
|
+
return {
|
|
185
|
+
transport: fixture.fresh_transport(),
|
|
186
|
+
headers: fixture.create_bearer_headers()
|
|
187
|
+
};
|
|
188
|
+
case 'malformed_bearer': {
|
|
189
|
+
// The keeper's valid token minus its last character — prefixed, one char
|
|
190
|
+
// short — over the same no-Origin, empty-jar transport as `token`, so the
|
|
191
|
+
// shape precheck (not the browser-context discard) is what refuses it.
|
|
192
|
+
const valid = fixture.create_bearer_headers().authorization;
|
|
193
|
+
if (!valid)
|
|
194
|
+
throw new Error(`conformance: principal 'malformed_bearer' found no bearer header`);
|
|
195
|
+
return {
|
|
196
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
197
|
+
headers: { authorization: valid.slice(0, -1) },
|
|
198
|
+
suppress_default_origin: true
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
case 'scoped_token': {
|
|
202
|
+
// A narrowed bearer, otherwise identical to `token` — empty jar + no
|
|
203
|
+
// Origin, so the credential is honored rather than browser-discarded
|
|
204
|
+
// and the scope gate is what any denial comes from.
|
|
205
|
+
const token = await mint_scoped_token(fixture, resolved_rpc_endpoints);
|
|
206
|
+
return {
|
|
207
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
208
|
+
headers: { authorization: `Bearer ${token}` },
|
|
209
|
+
suppress_default_origin: true,
|
|
210
|
+
actor_id: fixture.actor.id
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
case 'anonymous':
|
|
214
|
+
// Fresh jar so the keeper cookie (cross-process) can't leak in.
|
|
215
|
+
return { transport: fixture.fresh_transport(), headers: {} };
|
|
216
|
+
case 'fresh_non_admin': {
|
|
217
|
+
const account = await fixture.create_account();
|
|
218
|
+
return {
|
|
219
|
+
transport: fixture.fresh_transport(),
|
|
220
|
+
headers: account.create_session_headers(),
|
|
221
|
+
actor_id: account.actor.id
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
case 'expired_session': {
|
|
225
|
+
// The keeper presented via an expired server-side session — fresh
|
|
226
|
+
// jar so only the (expired) cookie this seam returns is sent. The
|
|
227
|
+
// minted cookie payload is valid; the backdated `auth_session` row
|
|
228
|
+
// is what the DB-row expiry gate refuses.
|
|
229
|
+
const cookie = await fixture.mint_expired_session();
|
|
230
|
+
return {
|
|
231
|
+
transport: fixture.fresh_transport(),
|
|
232
|
+
headers: { cookie },
|
|
233
|
+
actor_id: fixture.actor.id
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
case 'tampered_cookie': {
|
|
237
|
+
// fresh jar, so the tampered cookie is the only one sent
|
|
238
|
+
const { cookie } = fixture.create_session_headers();
|
|
239
|
+
if (!cookie)
|
|
240
|
+
throw new Error(`conformance: principal 'tampered_cookie' found no cookie`);
|
|
241
|
+
return {
|
|
242
|
+
transport: fixture.fresh_transport(),
|
|
243
|
+
headers: { cookie: tamper_session_cookie(cookie) }
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
case 'wrong_daemon':
|
|
247
|
+
// no Origin, so the token reaches the compare, not the browser-context discard
|
|
248
|
+
return {
|
|
249
|
+
transport: fixture.fresh_transport({ origin: null }),
|
|
250
|
+
headers: { [DAEMON_TOKEN_HEADER]: WRONG_DAEMON_TOKEN_VALUE },
|
|
251
|
+
suppress_default_origin: true
|
|
252
|
+
};
|
|
253
|
+
case 'unknown_bearer':
|
|
254
|
+
return as_lone_bearer(fixture, UNKNOWN_BEARER_TOKEN_VALUE);
|
|
255
|
+
case 'revoked_session':
|
|
256
|
+
return {
|
|
257
|
+
transport: fixture.fresh_transport(),
|
|
258
|
+
headers: { cookie: await fixture.mint_revoked_session() }
|
|
259
|
+
};
|
|
260
|
+
case 'revoked_token':
|
|
261
|
+
return as_lone_bearer(fixture, await fixture.mint_revoked_token());
|
|
262
|
+
case 'expired_token':
|
|
263
|
+
return as_lone_bearer(fixture, await fixture.mint_expired_token());
|
|
264
|
+
case 'role_holder':
|
|
265
|
+
case 'wrong_role': {
|
|
266
|
+
const username = principals?.[as];
|
|
267
|
+
if (!username) {
|
|
268
|
+
throw new Error(`conformance: principal '${as}' requires options.principals.${as} naming a seeded ` +
|
|
269
|
+
`extra_accounts username (declare the account at setup via extra_accounts).`);
|
|
270
|
+
}
|
|
271
|
+
const extra = fixture.extra_accounts[username];
|
|
272
|
+
if (!extra) {
|
|
273
|
+
throw new Error(`conformance: extra_accounts['${username}'] not seeded for principal '${as}' — ` +
|
|
274
|
+
`declare it in the suite's extra_accounts option.`);
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
transport: fixture.fresh_transport(),
|
|
278
|
+
headers: extra.create_session_headers(),
|
|
279
|
+
actor_id: extra.actor.id
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
@@ -2,25 +2,12 @@ import '../assert_dev_env.js';
|
|
|
2
2
|
import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
|
|
3
3
|
import type { RouteSpec } from '../../http/route_spec.js';
|
|
4
4
|
import type { RpcAction } from '../../actions/action_types.js';
|
|
5
|
-
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
6
5
|
import { resolve_rpc_endpoints_for_setup, type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
7
|
-
import type
|
|
8
|
-
import { type ConformanceCase, type ConformancePrincipal } from './conformance_case.js';
|
|
6
|
+
import { type ConformanceCase } from './conformance_case.js';
|
|
9
7
|
import type { BackendCapabilities } from './capabilities.js';
|
|
10
8
|
import type { SetupTest, TestFixture } from './setup.js';
|
|
11
9
|
import type { WsEndpointTarget } from './ws_endpoint.js';
|
|
12
|
-
|
|
13
|
-
* Names a seeded `extra_accounts` username for the `role_holder` /
|
|
14
|
-
* `wrong_role` principals — the only two that aren't backed by an
|
|
15
|
-
* always-available fixture accessor. Suites exercising those principals
|
|
16
|
-
* declare the matching `extra_accounts` at setup and name them here.
|
|
17
|
-
*/
|
|
18
|
-
export interface ConformancePrincipalConfig {
|
|
19
|
-
/** `extra_accounts` username for the `role_holder` principal. */
|
|
20
|
-
readonly role_holder?: string;
|
|
21
|
-
/** `extra_accounts` username for the `wrong_role` principal. */
|
|
22
|
-
readonly wrong_role?: string;
|
|
23
|
-
}
|
|
10
|
+
import { type ConformancePrincipalConfig } from './conformance_principal.js';
|
|
24
11
|
/** Options for `describe_conformance_table_tests`. */
|
|
25
12
|
export interface ConformanceTableOptions {
|
|
26
13
|
/** The conformance cases to run, in order. */
|
|
@@ -41,8 +28,8 @@ export interface ConformanceTableOptions {
|
|
|
41
28
|
* live mount is fine. Omitted, only declared methods resolve.
|
|
42
29
|
*/
|
|
43
30
|
readonly live_rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
44
|
-
/**
|
|
45
|
-
readonly
|
|
31
|
+
/** The session cookie's name — needed to resolve the `rpc_endpoints` factory form. */
|
|
32
|
+
readonly session_cookie_name: string;
|
|
46
33
|
/** Maps the `role_holder` / `wrong_role` principals to seeded usernames. */
|
|
47
34
|
readonly principals?: ConformancePrincipalConfig;
|
|
48
35
|
/**
|
|
@@ -61,8 +48,8 @@ export interface ConformanceRpcEndpointsOptions {
|
|
|
61
48
|
readonly rpc_endpoints: RpcEndpointsSuiteOption;
|
|
62
49
|
/** The live-mounted RPC endpoints, for methods off the declared surface. */
|
|
63
50
|
readonly live_rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
64
|
-
/**
|
|
65
|
-
readonly
|
|
51
|
+
/** The session cookie's name — needed to resolve the factory forms. */
|
|
52
|
+
readonly session_cookie_name: string;
|
|
66
53
|
}
|
|
67
54
|
/**
|
|
68
55
|
* Resolve the endpoints a conformance case's RPC method is looked up in: the
|
|
@@ -70,7 +57,7 @@ export interface ConformanceRpcEndpointsOptions {
|
|
|
70
57
|
* takes the first match, so a declared method resolves from the declared
|
|
71
58
|
* surface even when the live mount repeats it.
|
|
72
59
|
*
|
|
73
|
-
* @param options - the declared and live endpoints, and the session
|
|
60
|
+
* @param options - the declared and live endpoints, and the session cookie name
|
|
74
61
|
* @returns the endpoints in lookup order
|
|
75
62
|
*/
|
|
76
63
|
export declare const resolve_conformance_rpc_endpoints: (options: ConformanceRpcEndpointsOptions) => Array<RpcEndpointSpec>;
|
|
@@ -85,42 +72,6 @@ export declare const resolve_conformance_rpc_endpoints: (options: ConformanceRpc
|
|
|
85
72
|
* @returns whether the WS leg runs it
|
|
86
73
|
*/
|
|
87
74
|
export declare const is_ws_conformance_case: (c: ConformanceCase) => boolean;
|
|
88
|
-
/** A resolved principal: the transport + headers a case fires through. */
|
|
89
|
-
export interface ResolvedConformancePrincipal {
|
|
90
|
-
readonly transport: FetchTransport;
|
|
91
|
-
readonly headers: Record<string, string>;
|
|
92
|
-
/**
|
|
93
|
-
* Suppress the default `Origin` header on the request. Required for
|
|
94
|
-
* non-browser credential probes (bearer / daemon) — `bearer_auth`
|
|
95
|
-
* discards the token when `Origin` / `Referer` is present.
|
|
96
|
-
*/
|
|
97
|
-
readonly suppress_default_origin?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* The actor of the account the credential names — what the `principal`
|
|
100
|
-
* acting binding writes. Absent for principals that present no account.
|
|
101
|
-
*/
|
|
102
|
-
readonly actor_id?: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Map a `ConformancePrincipal` onto the transport + headers it
|
|
106
|
-
* authenticates with, reading exclusively from the per-test `TestFixture`.
|
|
107
|
-
*
|
|
108
|
-
* The always-available principals resolve from fixture accessors (the dead
|
|
109
|
-
* credentials that need a server-side state — a revoked session or token, an
|
|
110
|
-
* expired token — from the fixture's `mint_*` seams); `role_holder` /
|
|
111
|
-
* `wrong_role` read a seeded `extra_accounts` entry named via
|
|
112
|
-
* `options.principals` (throws a clear setup error when unconfigured);
|
|
113
|
-
* `scoped_token` mints its narrowed credential over the production path.
|
|
114
|
-
* Also used outside the table by suites that send a principal's requests
|
|
115
|
-
* themselves (`describe_rpc_adversarial_cross_tests`).
|
|
116
|
-
*
|
|
117
|
-
* @param fixture - the per-test fixture
|
|
118
|
-
* @param as - the principal
|
|
119
|
-
* @param principals - usernames for `role_holder` / `wrong_role`
|
|
120
|
-
* @param resolved_rpc_endpoints - the endpoints `scoped_token` mints through
|
|
121
|
-
* @returns the transport and headers the principal sends with
|
|
122
|
-
*/
|
|
123
|
-
export declare const resolve_conformance_principal: (fixture: TestFixture, as: ConformancePrincipal, principals?: ConformancePrincipalConfig, resolved_rpc_endpoints?: ReturnType<typeof resolve_rpc_endpoints_for_setup>) => Promise<ResolvedConformancePrincipal>;
|
|
124
75
|
/**
|
|
125
76
|
* Response headers that fingerprint the backend implementation or framework.
|
|
126
77
|
* Neither spine emits these; the runner asserts they stay absent on EVERY
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance_table.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/conformance_table.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwD9B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"conformance_table.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/conformance_table.ts"],"names":[],"mappings":"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"}
|