@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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The per-test database invariant check — the hooks `create_test_app` and the
|
|
4
|
+
* cross-process setup register, over the invariants and their statement in
|
|
5
|
+
* `db_invariant_queries.ts`. In-process the check queries the test app's own
|
|
6
|
+
* `Db` (`assert_db_invariants`); cross-process it reads the backend's
|
|
7
|
+
* `_testing_db_invariants` backdoor (`assert_db_invariant_rows`).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { afterAll, onTestFinished, TestRunner } from 'vitest';
|
|
12
|
+
import { format_db_invariant_violations, query_db_invariant_violations, to_db_invariant_violations, validate_db_invariant_exclusions } from './db_invariant_queries.js';
|
|
13
|
+
/** The exclusion sets already logged, by label and set — the log's dedupe. */
|
|
14
|
+
const announced_db_invariant_exclusions = new Set();
|
|
15
|
+
/**
|
|
16
|
+
* Validate a setup's exclusions and log them, one line naming each with its
|
|
17
|
+
* reason, so a run shows what it leaves unchecked. Validates on every call
|
|
18
|
+
* and logs a label's set once per module instance, since a direct
|
|
19
|
+
* `create_test_app` caller builds an app per test. Silent when there are none.
|
|
20
|
+
*
|
|
21
|
+
* @param exclude - the setup's exclusions
|
|
22
|
+
* @param label - names the setup
|
|
23
|
+
* @throws Error on an unknown invariant or an empty reason
|
|
24
|
+
*/
|
|
25
|
+
export const announce_db_invariant_exclusions = (exclude, label) => {
|
|
26
|
+
validate_db_invariant_exclusions(exclude, label);
|
|
27
|
+
const entries = Object.entries(exclude ?? {});
|
|
28
|
+
if (entries.length === 0)
|
|
29
|
+
return;
|
|
30
|
+
const key = JSON.stringify([label, entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))]);
|
|
31
|
+
if (announced_db_invariant_exclusions.has(key))
|
|
32
|
+
return;
|
|
33
|
+
announced_db_invariant_exclusions.add(key);
|
|
34
|
+
console.log(`[db invariants] ${label} excludes ${entries.map(([name, reason]) => `${name} (${reason})`).join('; ')}`);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Throw when any row not excluded breaks an invariant — the check over rows
|
|
38
|
+
* a backend's `_testing_db_invariants` answered.
|
|
39
|
+
*
|
|
40
|
+
* @param rows - every violating row
|
|
41
|
+
* @param label - names the database in the message
|
|
42
|
+
* @param exclude - invariants to skip, each with its reason
|
|
43
|
+
* @throws Error listing every broken invariant and its rows
|
|
44
|
+
*/
|
|
45
|
+
export const assert_db_invariant_rows = (rows, label, exclude) => {
|
|
46
|
+
const violations = to_db_invariant_violations(rows, exclude);
|
|
47
|
+
if (violations.length > 0)
|
|
48
|
+
throw new Error(format_db_invariant_violations(violations, label));
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Throw when any invariant not excluded is broken.
|
|
52
|
+
*
|
|
53
|
+
* @param deps - the database to read
|
|
54
|
+
* @param label - names the database in the message
|
|
55
|
+
* @param exclude - invariants to skip, each with its reason
|
|
56
|
+
* @throws Error listing every broken invariant and its rows
|
|
57
|
+
*/
|
|
58
|
+
export const assert_db_invariants = async (deps, label, exclude) => {
|
|
59
|
+
const violations = await query_db_invariant_violations(deps, exclude);
|
|
60
|
+
if (violations.length > 0)
|
|
61
|
+
throw new Error(format_db_invariant_violations(violations, label));
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Run `check` when the current test finishes — the per-test hook
|
|
65
|
+
* `create_test_app` registers when it builds an app (in-process, and so every
|
|
66
|
+
* `default_in_process_setup` fixture) and the cross-process setup registers
|
|
67
|
+
* from `setup_test()`, with `check` the app's or fixture's
|
|
68
|
+
* `assert_db_invariants`.
|
|
69
|
+
*
|
|
70
|
+
* Runs after the test body and its `afterEach` hooks, before the next test's
|
|
71
|
+
* setup resets the database. A test that already failed is left as it
|
|
72
|
+
* failed: its state proves nothing more. Outside a test — an app or fixture built in
|
|
73
|
+
* `beforeAll`, shared by a describe's tests — nothing is registered, and the
|
|
74
|
+
* suite checks the fixture once its tests are done
|
|
75
|
+
* (`check_db_invariants_after_all`).
|
|
76
|
+
*
|
|
77
|
+
* Under `describe.concurrent` the hook attaches to whichever test vitest
|
|
78
|
+
* names current, and two tests' rows share one database, so a violation can
|
|
79
|
+
* fail a sibling of the test that left it; the shipped concurrent suite
|
|
80
|
+
* builds its fixture in `beforeAll` and is checked once after all its tests.
|
|
81
|
+
*
|
|
82
|
+
* @param check - throws on a violation
|
|
83
|
+
* @returns whether a hook was registered — `false` outside a test
|
|
84
|
+
*/
|
|
85
|
+
export const register_db_invariants_check = (check) => {
|
|
86
|
+
if (!TestRunner.getCurrentTest())
|
|
87
|
+
return false;
|
|
88
|
+
onTestFinished(async ({ task }) => {
|
|
89
|
+
if (task.result?.state === 'fail')
|
|
90
|
+
return;
|
|
91
|
+
await check();
|
|
92
|
+
});
|
|
93
|
+
return true;
|
|
94
|
+
};
|
|
95
|
+
/** Whether `task` or any task under it failed. */
|
|
96
|
+
const task_failed = (task) => task.result?.state === 'fail' || (task.type === 'suite' && task.tasks.some(task_failed));
|
|
97
|
+
/**
|
|
98
|
+
* Check a describe-scoped fixture's database now, unless a test of `suite`
|
|
99
|
+
* failed or no fixture was built — the body of the suite-level check, for a
|
|
100
|
+
* describe's own `afterAll` that runs it ahead of its cleanup (a
|
|
101
|
+
* `create_test_app` app the describe closes, a database its factory closes):
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* afterAll(async ({}, suite) => {
|
|
105
|
+
* try {
|
|
106
|
+
* await check_db_invariants_after_suite(suite, test_app);
|
|
107
|
+
* } finally {
|
|
108
|
+
* await test_app.cleanup();
|
|
109
|
+
* }
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param suite - the describe's task, the `afterAll` hook's second argument
|
|
114
|
+
* @param fixture - the shared fixture or test app, `null` or `undefined` until built
|
|
115
|
+
* @throws Error listing every broken invariant and its rows
|
|
116
|
+
*/
|
|
117
|
+
export const check_db_invariants_after_suite = async (suite, fixture) => {
|
|
118
|
+
if (!fixture || task_failed(suite))
|
|
119
|
+
return;
|
|
120
|
+
await fixture.assert_db_invariants();
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Check a describe-scoped fixture's database once the describe's tests are
|
|
124
|
+
* done — the suite-level twin of the per-test hook, for a fixture built in
|
|
125
|
+
* `beforeAll` and shared by the describe (the per-describe round-trip and
|
|
126
|
+
* exposure suites), or a `create_test_app` app built there, which registers
|
|
127
|
+
* no per-test hook. Skipped when a test of the describe failed, or when no
|
|
128
|
+
* fixture was built. Call inside the `describe`, at collection. It registers
|
|
129
|
+
* an `afterAll` of its own, so it reads a fixture nothing closes in another
|
|
130
|
+
* `afterAll`; a describe that closes its app or database there calls
|
|
131
|
+
* `check_db_invariants_after_suite` in that hook, ahead of the close.
|
|
132
|
+
*
|
|
133
|
+
* @param get_fixture - the shared fixture, `null` or `undefined` until built
|
|
134
|
+
*/
|
|
135
|
+
export const check_db_invariants_after_all = (get_fixture) => {
|
|
136
|
+
// vitest requires the hook's context argument to be a destructuring pattern
|
|
137
|
+
// eslint-disable-next-line no-empty-pattern
|
|
138
|
+
afterAll(async ({}, suite) => {
|
|
139
|
+
await check_db_invariants_after_suite(suite, get_fixture());
|
|
140
|
+
});
|
|
141
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
-- generated by src/lib/testing/db_invariants.gen.sql.ts: the database invariants, $1 the keeper role and $2 the admin role
|
|
2
|
+
WITH
|
|
3
|
+
role_param AS (SELECT $1::text AS keeper, $2::text AS admin),
|
|
4
|
+
removal AS (
|
|
5
|
+
SELECT target_account_id AS account_id, event_type, seq, created_at
|
|
6
|
+
FROM audit_log
|
|
7
|
+
WHERE outcome = 'success'
|
|
8
|
+
AND event_type IN ('account_delete', 'account_purge')
|
|
9
|
+
AND target_account_id IS NOT NULL
|
|
10
|
+
),
|
|
11
|
+
offer_party AS (
|
|
12
|
+
SELECT o.id, o.from_actor_id, fa.account_id AS from_account_id, o.to_account_id,
|
|
13
|
+
o.to_actor_id, o.created_at,
|
|
14
|
+
(SELECT MIN(al.seq) FROM audit_log al
|
|
15
|
+
WHERE al.event_type = 'role_grant_offer_create' AND al.outcome = 'success'
|
|
16
|
+
AND al.metadata->>'offer_id' = o.id::text) AS create_seq
|
|
17
|
+
FROM role_grant_offer o
|
|
18
|
+
JOIN actor fa ON fa.id = o.from_actor_id
|
|
19
|
+
WHERE o.accepted_at IS NULL AND o.declined_at IS NULL AND o.retracted_at IS NULL AND o.superseded_at IS NULL
|
|
20
|
+
),
|
|
21
|
+
invite_issuer AS (
|
|
22
|
+
SELECT i.id, i.created_by, i.created_at, a.deleted_at IS NOT NULL AS actor_dead,
|
|
23
|
+
COALESCE(a.account_id, (SELECT al.account_id FROM audit_log al
|
|
24
|
+
WHERE al.event_type = 'invite_create' AND al.outcome = 'success'
|
|
25
|
+
AND al.metadata->>'invite_id' = i.id::text
|
|
26
|
+
ORDER BY al.seq LIMIT 1)) AS issuer_account_id,
|
|
27
|
+
(SELECT MIN(al.seq) FROM audit_log al
|
|
28
|
+
WHERE al.event_type = 'invite_create' AND al.outcome = 'success'
|
|
29
|
+
AND al.metadata->>'invite_id' = i.id::text) AS create_seq
|
|
30
|
+
FROM invite i
|
|
31
|
+
LEFT JOIN actor a ON a.id = i.created_by
|
|
32
|
+
WHERE i.claimed_at IS NULL
|
|
33
|
+
),
|
|
34
|
+
token_issued AS (
|
|
35
|
+
SELECT t.id, t.account_id, t.created_at,
|
|
36
|
+
(SELECT MIN(al.seq) FROM audit_log al
|
|
37
|
+
WHERE al.event_type = 'token_create' AND al.outcome = 'success'
|
|
38
|
+
AND al.metadata->>'token_id' = t.id) AS create_seq
|
|
39
|
+
FROM api_token t
|
|
40
|
+
)
|
|
41
|
+
SELECT 'credential_of_tombstoned_account' AS invariant, jsonb_build_object('kind', v.kind, 'id', v.id, 'account_id', v.account_id)::text AS row FROM (SELECT 'auth_session' AS kind, LEFT(s.id, 12) AS id, s.account_id
|
|
42
|
+
FROM auth_session s JOIN account ac ON ac.id = s.account_id
|
|
43
|
+
WHERE ac.deleted_at IS NOT NULL
|
|
44
|
+
UNION ALL
|
|
45
|
+
SELECT 'api_token' AS kind, t.id, t.account_id
|
|
46
|
+
FROM api_token t JOIN account ac ON ac.id = t.account_id
|
|
47
|
+
WHERE ac.deleted_at IS NOT NULL) v
|
|
48
|
+
UNION ALL
|
|
49
|
+
SELECT 'pending_offer_with_dead_party' AS invariant, jsonb_build_object('id', v.id, 'from_actor_id', v.from_actor_id, 'from_account_id', v.from_account_id, 'to_account_id', v.to_account_id, 'to_actor_id', v.to_actor_id, 'from_actor_dead', v.from_actor_dead, 'from_account_dead', v.from_account_dead, 'to_account_dead', v.to_account_dead, 'to_actor_dead', v.to_actor_dead)::text AS row FROM (SELECT op.id, op.from_actor_id, op.from_account_id, op.to_account_id, op.to_actor_id,
|
|
50
|
+
fa.deleted_at IS NOT NULL AS from_actor_dead,
|
|
51
|
+
fac.deleted_at IS NOT NULL AS from_account_dead,
|
|
52
|
+
ta.deleted_at IS NOT NULL AS to_account_dead,
|
|
53
|
+
COALESCE(tac.deleted_at IS NOT NULL, false) AS to_actor_dead
|
|
54
|
+
FROM offer_party op
|
|
55
|
+
JOIN actor fa ON fa.id = op.from_actor_id
|
|
56
|
+
JOIN account fac ON fac.id = op.from_account_id
|
|
57
|
+
JOIN account ta ON ta.id = op.to_account_id
|
|
58
|
+
LEFT JOIN actor tac ON tac.id = op.to_actor_id
|
|
59
|
+
WHERE fa.deleted_at IS NOT NULL OR fac.deleted_at IS NOT NULL
|
|
60
|
+
OR ta.deleted_at IS NOT NULL OR tac.deleted_at IS NOT NULL) v
|
|
61
|
+
UNION ALL
|
|
62
|
+
SELECT 'unclaimed_invite_of_dead_issuer' AS invariant, jsonb_build_object('id', v.id, 'created_by', v.created_by, 'issuer_account_id', v.issuer_account_id, 'actor_dead', v.actor_dead, 'issuer_purged', v.issuer_purged)::text AS row FROM (SELECT ii.id, ii.created_by, ii.issuer_account_id,
|
|
63
|
+
ii.actor_dead, ac.id IS NULL AS issuer_purged
|
|
64
|
+
FROM invite_issuer ii
|
|
65
|
+
LEFT JOIN account ac ON ac.id = ii.issuer_account_id
|
|
66
|
+
WHERE ii.issuer_account_id IS NOT NULL
|
|
67
|
+
AND (ii.actor_dead OR ac.id IS NULL OR ac.deleted_at IS NOT NULL)) v
|
|
68
|
+
UNION ALL
|
|
69
|
+
SELECT 'bootstrapped_without_live_keeper' AS invariant, jsonb_build_object('bootstrapped', v.bootstrapped)::text AS row FROM (SELECT true AS bootstrapped FROM bootstrap_lock
|
|
70
|
+
WHERE bootstrapped AND NOT EXISTS (
|
|
71
|
+
SELECT 1 FROM role_grant rg
|
|
72
|
+
JOIN actor a ON a.id = rg.actor_id
|
|
73
|
+
JOIN account ac ON ac.id = a.account_id
|
|
74
|
+
WHERE rg.role = (SELECT keeper FROM role_param)
|
|
75
|
+
AND rg.scope_id IS NULL
|
|
76
|
+
AND rg.revoked_at IS NULL AND (rg.expires_at IS NULL OR rg.expires_at > NOW())
|
|
77
|
+
AND a.deleted_at IS NULL
|
|
78
|
+
AND ac.deleted_at IS NULL
|
|
79
|
+
)) v
|
|
80
|
+
UNION ALL
|
|
81
|
+
SELECT 'bootstrapped_without_live_admin' AS invariant, jsonb_build_object('bootstrapped', v.bootstrapped)::text AS row FROM (SELECT true AS bootstrapped FROM bootstrap_lock
|
|
82
|
+
WHERE bootstrapped AND NOT EXISTS (
|
|
83
|
+
SELECT 1 FROM role_grant rg
|
|
84
|
+
JOIN actor a ON a.id = rg.actor_id
|
|
85
|
+
JOIN account ac ON ac.id = a.account_id
|
|
86
|
+
WHERE rg.role = (SELECT admin FROM role_param)
|
|
87
|
+
AND rg.scope_id IS NULL
|
|
88
|
+
AND rg.revoked_at IS NULL AND (rg.expires_at IS NULL OR rg.expires_at > NOW())
|
|
89
|
+
AND a.deleted_at IS NULL
|
|
90
|
+
AND ac.deleted_at IS NULL
|
|
91
|
+
)) v
|
|
92
|
+
UNION ALL
|
|
93
|
+
SELECT 'account_without_bootstrap' AS invariant, jsonb_build_object('account_id', v.account_id)::text AS row FROM (SELECT ac.id AS account_id FROM account ac
|
|
94
|
+
WHERE NOT EXISTS (SELECT 1 FROM bootstrap_lock WHERE bootstrapped)) v
|
|
95
|
+
UNION ALL
|
|
96
|
+
SELECT 'actor_tombstone_disagrees_with_account' AS invariant, jsonb_build_object('actor_id', v.actor_id, 'account_id', v.account_id, 'actor_dead', v.actor_dead, 'account_dead', v.account_dead)::text AS row FROM (SELECT a.id AS actor_id, a.account_id,
|
|
97
|
+
a.deleted_at IS NOT NULL AS actor_dead, ac.deleted_at IS NOT NULL AS account_dead
|
|
98
|
+
FROM actor a JOIN account ac ON ac.id = a.account_id
|
|
99
|
+
WHERE (a.deleted_at IS NULL) <> (ac.deleted_at IS NULL)) v
|
|
100
|
+
UNION ALL
|
|
101
|
+
SELECT 'offer_to_actor_outside_to_account' AS invariant, jsonb_build_object('id', v.id, 'to_account_id', v.to_account_id, 'to_actor_id', v.to_actor_id, 'to_actor_account_id', v.to_actor_account_id)::text AS row FROM (SELECT o.id, o.to_account_id, o.to_actor_id, a.account_id AS to_actor_account_id
|
|
102
|
+
FROM role_grant_offer o JOIN actor a ON a.id = o.to_actor_id
|
|
103
|
+
WHERE a.account_id <> o.to_account_id) v
|
|
104
|
+
UNION ALL
|
|
105
|
+
SELECT 'invite_claimed_by_without_claimed_at' AS invariant, jsonb_build_object('id', v.id, 'claimed_by', v.claimed_by)::text AS row FROM (SELECT i.id, i.claimed_by FROM invite i
|
|
106
|
+
WHERE i.claimed_by IS NOT NULL AND i.claimed_at IS NULL) v
|
|
107
|
+
UNION ALL
|
|
108
|
+
SELECT 'pending_offer_outlived_party_removal' AS invariant, jsonb_build_object('id', v.id, 'from_actor_id', v.from_actor_id, 'from_account_id', v.from_account_id, 'to_account_id', v.to_account_id)::text AS row FROM (SELECT op.id, op.from_actor_id, op.from_account_id, op.to_account_id
|
|
109
|
+
FROM offer_party op
|
|
110
|
+
WHERE EXISTS (
|
|
111
|
+
SELECT 1 FROM removal r
|
|
112
|
+
WHERE r.account_id = op.from_account_id
|
|
113
|
+
AND r.event_type IN ('account_delete')
|
|
114
|
+
AND CASE WHEN op.create_seq IS NULL THEN r.created_at >= op.created_at
|
|
115
|
+
ELSE r.seq > op.create_seq END
|
|
116
|
+
)
|
|
117
|
+
OR EXISTS (
|
|
118
|
+
SELECT 1 FROM removal r
|
|
119
|
+
WHERE r.account_id = op.to_account_id
|
|
120
|
+
AND r.event_type IN ('account_delete')
|
|
121
|
+
AND CASE WHEN op.create_seq IS NULL THEN r.created_at >= op.created_at
|
|
122
|
+
ELSE r.seq > op.create_seq END
|
|
123
|
+
)) v
|
|
124
|
+
UNION ALL
|
|
125
|
+
SELECT 'unclaimed_invite_outlived_issuer_removal' AS invariant, jsonb_build_object('id', v.id, 'created_by', v.created_by, 'issuer_account_id', v.issuer_account_id)::text AS row FROM (SELECT ii.id, ii.created_by, ii.issuer_account_id
|
|
126
|
+
FROM invite_issuer ii
|
|
127
|
+
WHERE EXISTS (
|
|
128
|
+
SELECT 1 FROM removal r
|
|
129
|
+
WHERE r.account_id = ii.issuer_account_id
|
|
130
|
+
AND r.event_type IN ('account_delete', 'account_purge')
|
|
131
|
+
AND CASE WHEN ii.create_seq IS NULL THEN r.created_at >= ii.created_at
|
|
132
|
+
ELSE r.seq > ii.create_seq END
|
|
133
|
+
)) v
|
|
134
|
+
UNION ALL
|
|
135
|
+
SELECT 'credential_outlived_account_removal' AS invariant, jsonb_build_object('kind', v.kind, 'id', v.id, 'account_id', v.account_id)::text AS row FROM (SELECT 'auth_session' AS kind, LEFT(s.id, 12) AS id, s.account_id
|
|
136
|
+
FROM auth_session s
|
|
137
|
+
WHERE EXISTS (
|
|
138
|
+
SELECT 1 FROM removal r
|
|
139
|
+
WHERE r.account_id = s.account_id
|
|
140
|
+
AND r.event_type IN ('account_delete')
|
|
141
|
+
AND r.created_at >= s.created_at
|
|
142
|
+
)
|
|
143
|
+
UNION ALL
|
|
144
|
+
SELECT 'api_token' AS kind, ti.id, ti.account_id
|
|
145
|
+
FROM token_issued ti
|
|
146
|
+
WHERE EXISTS (
|
|
147
|
+
SELECT 1 FROM removal r
|
|
148
|
+
WHERE r.account_id = ti.account_id
|
|
149
|
+
AND r.event_type IN ('account_delete')
|
|
150
|
+
AND CASE WHEN ti.create_seq IS NULL THEN r.created_at >= ti.created_at
|
|
151
|
+
ELSE r.seq > ti.create_seq END
|
|
152
|
+
)) v
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
import type { Db } from '../db/db.js';
|
|
3
|
+
import type { DbFactory } from './db.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create a `describe_db` function bound to specific factories and truncate tables.
|
|
6
|
+
*
|
|
7
|
+
* Returns a 2-arg `(name, fn)` function that runs the test suite against each
|
|
8
|
+
* factory. Each factory gets its own `describe` block with a shared database
|
|
9
|
+
* instance, automatic `beforeEach` truncation, and `afterAll` cleanup.
|
|
10
|
+
* Skipped factories use `describe.skip`.
|
|
11
|
+
*
|
|
12
|
+
* @param factories - one or more database factories to run suites against
|
|
13
|
+
* @param truncate_tables - tables to truncate between tests (children first for FK safety)
|
|
14
|
+
* @mutates the underlying database between tests — `beforeEach` issues
|
|
15
|
+
* `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
|
|
16
|
+
*/
|
|
17
|
+
export declare const create_describe_db: (factories: DbFactory | Array<DbFactory>, truncate_tables: Array<string>) => ((name: string, fn: (get_db: () => Db) => void) => void);
|
|
18
|
+
/**
|
|
19
|
+
* Assert a `*_COLUMNS` projection const names exactly the live columns of
|
|
20
|
+
* `table` — the drift guard for an exported const (`ACCOUNT_COLUMNS`,
|
|
21
|
+
* `CELL_COLUMNS`, a consumer's own).
|
|
22
|
+
*
|
|
23
|
+
* This is the reverse of the fail-loud read: a named projection makes a
|
|
24
|
+
* *dropped* column fail loud at query time, but a column *added* to the table
|
|
25
|
+
* and not to the projection would silently vanish from every row read. Both
|
|
26
|
+
* directions are covered by the equality here. It guards one const; it can't
|
|
27
|
+
* see a table that has *no* const — for that, keep a table → const registry
|
|
28
|
+
* and assert its key set against `query_public_columns` (fuz_app's own is
|
|
29
|
+
* `src/test/db/column_projections.db.test.ts`).
|
|
30
|
+
*
|
|
31
|
+
* @param db - a bootstrapped test database
|
|
32
|
+
* @param table - the `public`-schema table the const projects
|
|
33
|
+
* @param columns - the projection const's column names
|
|
34
|
+
*/
|
|
35
|
+
export declare const assert_columns_match_live: (db: Db, table: string, columns: ReadonlyArray<string>) => Promise<void>;
|
|
36
|
+
//# sourceMappingURL=describe_db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe_db.d.ts","sourceRoot":"","sources":["../../src/lib/testing/describe_db.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC9B,WAAW,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,EACvC,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,KAAK,IAAI,CAwBzD,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,yBAAyB,GACrC,IAAI,EAAE,EACN,OAAO,MAAM,EACb,SAAS,aAAa,CAAC,MAAM,CAAC,KAC5B,OAAO,CAAC,IAAI,CAId,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import './assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* The vitest-bound database test helpers: `create_describe_db`, which runs a
|
|
4
|
+
* suite once per `DbFactory` (`testing/db.ts`), and `assert_columns_match_live`,
|
|
5
|
+
* the named-projection drift guard. Apart from `testing/db.ts` so the
|
|
6
|
+
* factories stay vitest-free for the spawned spine binary.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { describe, beforeAll, beforeEach, afterAll, assert } from 'vitest';
|
|
11
|
+
import { assert_valid_sql_identifier } from '../db/sql_identifier.js';
|
|
12
|
+
import { query_public_columns } from '../db/schema_ready.js';
|
|
13
|
+
/**
|
|
14
|
+
* Create a `describe_db` function bound to specific factories and truncate tables.
|
|
15
|
+
*
|
|
16
|
+
* Returns a 2-arg `(name, fn)` function that runs the test suite against each
|
|
17
|
+
* factory. Each factory gets its own `describe` block with a shared database
|
|
18
|
+
* instance, automatic `beforeEach` truncation, and `afterAll` cleanup.
|
|
19
|
+
* Skipped factories use `describe.skip`.
|
|
20
|
+
*
|
|
21
|
+
* @param factories - one or more database factories to run suites against
|
|
22
|
+
* @param truncate_tables - tables to truncate between tests (children first for FK safety)
|
|
23
|
+
* @mutates the underlying database between tests — `beforeEach` issues
|
|
24
|
+
* `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
|
|
25
|
+
*/
|
|
26
|
+
export const create_describe_db = (factories, truncate_tables) => {
|
|
27
|
+
const factory_list = Array.isArray(factories) ? factories : [factories];
|
|
28
|
+
return (name, fn) => {
|
|
29
|
+
for (const factory of factory_list) {
|
|
30
|
+
const describe_fn = factory.skip ? describe.skip : describe;
|
|
31
|
+
describe_fn(`${name} (${factory.name})`, () => {
|
|
32
|
+
let db;
|
|
33
|
+
beforeAll(async () => {
|
|
34
|
+
db = await factory.create();
|
|
35
|
+
});
|
|
36
|
+
beforeEach(async () => {
|
|
37
|
+
if (db && truncate_tables.length > 0) {
|
|
38
|
+
await db.query(`TRUNCATE ${truncate_tables.map(assert_valid_sql_identifier).join(', ')} CASCADE`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
afterAll(async () => {
|
|
42
|
+
if (db)
|
|
43
|
+
await factory.close(db);
|
|
44
|
+
});
|
|
45
|
+
fn(() => db);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Assert a `*_COLUMNS` projection const names exactly the live columns of
|
|
52
|
+
* `table` — the drift guard for an exported const (`ACCOUNT_COLUMNS`,
|
|
53
|
+
* `CELL_COLUMNS`, a consumer's own).
|
|
54
|
+
*
|
|
55
|
+
* This is the reverse of the fail-loud read: a named projection makes a
|
|
56
|
+
* *dropped* column fail loud at query time, but a column *added* to the table
|
|
57
|
+
* and not to the projection would silently vanish from every row read. Both
|
|
58
|
+
* directions are covered by the equality here. It guards one const; it can't
|
|
59
|
+
* see a table that has *no* const — for that, keep a table → const registry
|
|
60
|
+
* and assert its key set against `query_public_columns` (fuz_app's own is
|
|
61
|
+
* `src/test/db/column_projections.db.test.ts`).
|
|
62
|
+
*
|
|
63
|
+
* @param db - a bootstrapped test database
|
|
64
|
+
* @param table - the `public`-schema table the const projects
|
|
65
|
+
* @param columns - the projection const's column names
|
|
66
|
+
*/
|
|
67
|
+
export const assert_columns_match_live = async (db, table, columns) => {
|
|
68
|
+
const live = await query_public_columns(db, { table });
|
|
69
|
+
assert.ok(live[table], `table "${table}" is not in the live public schema`);
|
|
70
|
+
assert.deepEqual([...columns].sort(), live[table]);
|
|
71
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
2
|
import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
4
3
|
import { type UncoveredEntry } from './error_coverage.js';
|
|
5
4
|
import type { AppSurfaceSpec } from '../http/surface.js';
|
|
@@ -29,11 +28,11 @@ export interface StandardIntegrationTestOptions {
|
|
|
29
28
|
/** Backend capability declarations for capability-gated cases. */
|
|
30
29
|
capabilities: BackendCapabilities;
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* The session cookie's name — needed to resolve factory-form `rpc_endpoints`
|
|
33
32
|
* against a stub `AppServerContext` at setup time and to read
|
|
34
33
|
* `cookie_name` for manual cookie composition in the session cases.
|
|
35
34
|
*/
|
|
36
|
-
|
|
35
|
+
session_cookie_name: string;
|
|
37
36
|
/**
|
|
38
37
|
* RPC endpoint specs — required. This suite dispatches
|
|
39
38
|
* `account_verify`, `account_session_*`, and `account_token_*` via
|
|
@@ -96,15 +95,12 @@ export interface StandardIntegrationTestOptions {
|
|
|
96
95
|
* message if the consumer's route specs are misconfigured.
|
|
97
96
|
*
|
|
98
97
|
* The two signup-invite-edge-case tests call `invite_create_action_spec`
|
|
99
|
-
* (admin-gated) over the fixture's session
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* `
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* keeper additional roles inline (cross-process via `_testing_reset`'s
|
|
106
|
-
* bootstrap-time seeding; in-process via `bootstrap_test_keeper`) — no
|
|
107
|
-
* per-role RPC cost, no offer/accept round-trip. The tests run against
|
|
98
|
+
* (admin-gated) over the fixture's session. In both modes the fixture's
|
|
99
|
+
* `fixture.account` is the fresh keeper, holding `ROLE_KEEPER` and
|
|
100
|
+
* `ROLE_ADMIN` as a production bootstrap grants them (cross-process via
|
|
101
|
+
* `_testing_reset`'s seeding; in-process via `bootstrap_test_keeper` with
|
|
102
|
+
* `DEFAULT_TEST_KEEPER_ROLES`), so the invite is admitted with no
|
|
103
|
+
* per-role RPC cost or offer/accept round-trip. The tests run against
|
|
108
104
|
* the production `open_signup: false` default — the cross-process
|
|
109
105
|
* per-test secondary mint via `fixture.create_account()` is
|
|
110
106
|
* invite-gated (keeper drives `invite_create` before signup) so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA4B7B,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAY1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA+/CF,CAAC"}
|
|
@@ -5,7 +5,7 @@ import './assert_dev_env.js';
|
|
|
5
5
|
* `describe_standard_integration_tests` creates a composable test suite that
|
|
6
6
|
* exercises the full middleware stack (origin, session, bearer_auth, request_context)
|
|
7
7
|
* against a real database. Consumers call it with their route factory and
|
|
8
|
-
* session
|
|
8
|
+
* session cookie name — all auth route tests come for free.
|
|
9
9
|
*
|
|
10
10
|
* Tests use `stub_password_deps` (deterministic hashing, no Argon2 overhead).
|
|
11
11
|
* Login handlers call `verify_password(submitted, stored_hash)` which works because
|
|
@@ -45,15 +45,12 @@ import { assert_middleware_gate_refusal, format_middleware_gate_probe, plan_midd
|
|
|
45
45
|
* message if the consumer's route specs are misconfigured.
|
|
46
46
|
*
|
|
47
47
|
* The two signup-invite-edge-case tests call `invite_create_action_spec`
|
|
48
|
-
* (admin-gated) over the fixture's session
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* `
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* keeper additional roles inline (cross-process via `_testing_reset`'s
|
|
55
|
-
* bootstrap-time seeding; in-process via `bootstrap_test_keeper`) — no
|
|
56
|
-
* per-role RPC cost, no offer/accept round-trip. The tests run against
|
|
48
|
+
* (admin-gated) over the fixture's session. In both modes the fixture's
|
|
49
|
+
* `fixture.account` is the fresh keeper, holding `ROLE_KEEPER` and
|
|
50
|
+
* `ROLE_ADMIN` as a production bootstrap grants them (cross-process via
|
|
51
|
+
* `_testing_reset`'s seeding; in-process via `bootstrap_test_keeper` with
|
|
52
|
+
* `DEFAULT_TEST_KEEPER_ROLES`), so the invite is admitted with no
|
|
53
|
+
* per-role RPC cost or offer/accept round-trip. The tests run against
|
|
57
54
|
* the production `open_signup: false` default — the cross-process
|
|
58
55
|
* per-test secondary mint via `fixture.create_account()` is
|
|
59
56
|
* invite-gated (keeper drives `invite_create` before signup) so the
|
|
@@ -71,10 +68,10 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
71
68
|
// confusing test failure when `rpc_endpoints` is missing. Factory-form
|
|
72
69
|
// callers are resolved with a stub ctx purely to extract the endpoint
|
|
73
70
|
// path; the running backend handles live dispatch.
|
|
74
|
-
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.
|
|
71
|
+
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_cookie_name);
|
|
75
72
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
76
73
|
describe('standard_integration', () => {
|
|
77
|
-
const
|
|
74
|
+
const cookie_name = options.session_cookie_name;
|
|
78
75
|
// Error coverage tracking across test groups
|
|
79
76
|
const error_collector = new ErrorCoverageCollector(options.surface_source.route_error_maps);
|
|
80
77
|
// the auth routes this suite drives: login / logout / password, signup
|
|
@@ -394,7 +391,7 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
394
391
|
// it exercises the authoritative server-side DB-row expiry gate over
|
|
395
392
|
// real auth resolution on every spine, not the cookie-payload gate a
|
|
396
393
|
// backdated-payload forge hit here. The payload gate stays covered by
|
|
397
|
-
// `
|
|
394
|
+
// `parse_session_from_cookies`'s own unit tests.
|
|
398
395
|
});
|
|
399
396
|
// --- 4. Session revocation ---
|
|
400
397
|
describe('session revocation', () => {
|
|
@@ -1156,10 +1153,9 @@ export const describe_standard_integration_tests = (options) => {
|
|
|
1156
1153
|
// Drive the admin-gated `invite_create` over the fixture's
|
|
1157
1154
|
// session. In both modes the fixture is the fresh keeper,
|
|
1158
1155
|
// holding `[ROLE_KEEPER, ROLE_ADMIN, ...extra_keeper_roles]`
|
|
1159
|
-
// from the bootstrap-equivalent seed step
|
|
1160
|
-
//
|
|
1161
|
-
//
|
|
1162
|
-
// a session with admin role.
|
|
1156
|
+
// from the bootstrap-equivalent seed step, so
|
|
1157
|
+
// `fixture.create_session_headers()` resolves to a session with
|
|
1158
|
+
// the admin role.
|
|
1163
1159
|
// `open_signup` stays at production default (`false`) across both
|
|
1164
1160
|
// in-process (per-test bootstrap default) and cross-process (the
|
|
1165
1161
|
// invite-gated `mint_account` flow doesn't need it flipped), so
|
|
@@ -2,7 +2,7 @@ import './assert_dev_env.js';
|
|
|
2
2
|
import type { RouteSpec, RouteMethod } from '../http/route_spec.js';
|
|
3
3
|
import { type RouteErrorMap } from '../http/route_errors.js';
|
|
4
4
|
import { type RouteAuth } from '../http/auth_shape.js';
|
|
5
|
-
import type { TestAccount } from './
|
|
5
|
+
import type { TestAccount } from './test_app.js';
|
|
6
6
|
import type { RpcTestTransport } from './rpc_helpers.js';
|
|
7
7
|
/**
|
|
8
8
|
* Find the route spec a request reaches: the first in list (mount) order
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AASvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
|
-
import type { SessionOptions } from '../auth/session_cookie.js';
|
|
3
2
|
import type { AppServerContext } from '../server/app_server_context.js';
|
|
4
3
|
import type { RouteSpec } from '../http/route_spec.js';
|
|
5
|
-
import { type SuiteAppOptions } from './
|
|
4
|
+
import { type SuiteAppOptions } from './test_app.js';
|
|
6
5
|
import { type DbFactory } from './db.js';
|
|
7
6
|
import type { RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
8
7
|
/**
|
|
9
8
|
* Configuration for `describe_rate_limiting_tests`.
|
|
10
9
|
*/
|
|
11
10
|
export interface RateLimitingTestOptions {
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
/** The session cookie's name. */
|
|
12
|
+
session_cookie_name: string;
|
|
14
13
|
/** Route spec factory — same one used in production. */
|
|
15
14
|
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
16
15
|
/** Optional overrides for `AppServerOptions`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA2B7B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA2B7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAGN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,iCAAiC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IA2J/E,CAAC"}
|
|
@@ -7,7 +7,7 @@ import './assert_dev_env.js';
|
|
|
7
7
|
* (2 attempts / 1 minute) and fire requests until 429 is returned.
|
|
8
8
|
*
|
|
9
9
|
* Consumers call `describe_rate_limiting_tests` with their route factory and
|
|
10
|
-
* session
|
|
10
|
+
* session cookie name — rate limit enforcement tests come for free.
|
|
11
11
|
*
|
|
12
12
|
* Each test body constructs its own `TestApp` with a per-test rate limiter
|
|
13
13
|
* override in `app_options`, so this suite reads its inputs directly from
|
|
@@ -25,9 +25,10 @@ import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
|
|
|
25
25
|
import { RateLimiter } from '../rate_limiter.js';
|
|
26
26
|
import { REST_RATE_LIMIT_EXCEEDED } from '../http/error_schemas.js';
|
|
27
27
|
import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
|
|
28
|
-
import { create_test_app } from './
|
|
28
|
+
import { create_test_app } from './test_app.js';
|
|
29
29
|
import { create_test_request_headers } from './test_origin.js';
|
|
30
|
-
import { create_default_db_factory,
|
|
30
|
+
import { create_default_db_factory, auth_integration_truncate_tables } from './db.js';
|
|
31
|
+
import { create_describe_db } from './describe_db.js';
|
|
31
32
|
import { find_auth_route, assert_rate_limit_retry_after_header } from './integration_helpers.js';
|
|
32
33
|
import { run_migrations } from '../db/migrate.js';
|
|
33
34
|
/**
|
|
@@ -62,7 +63,7 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
62
63
|
const login_ip_rate_limiter = create_test_rate_limiter();
|
|
63
64
|
try {
|
|
64
65
|
const test_app = await create_test_app({
|
|
65
|
-
|
|
66
|
+
session_cookie_name: options.session_cookie_name,
|
|
66
67
|
create_route_specs: options.create_route_specs,
|
|
67
68
|
db: get_db(),
|
|
68
69
|
rpc_endpoints: options.rpc_endpoints,
|
|
@@ -110,7 +111,7 @@ export const describe_rate_limiting_tests = (options) => {
|
|
|
110
111
|
const login_account_rate_limiter = create_test_rate_limiter();
|
|
111
112
|
try {
|
|
112
113
|
const test_app = await create_test_app({
|
|
113
|
-
|
|
114
|
+
session_cookie_name: options.session_cookie_name,
|
|
114
115
|
create_route_specs: options.create_route_specs,
|
|
115
116
|
db: get_db(),
|
|
116
117
|
rpc_endpoints: options.rpc_endpoints,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './assert_dev_env.js';
|
|
2
2
|
import type { Uuid } from '../primitive_schemas.js';
|
|
3
|
-
import type { TestAccount, TestApp } from './
|
|
3
|
+
import type { TestAccount, TestApp } from './test_app.js';
|
|
4
4
|
import type { TestFixture } from './cross_backend/setup.js';
|
|
5
5
|
import { type RpcCallArgs } from './rpc_helpers.js';
|
|
6
6
|
export interface RoleGrantOfferAndAcceptArgs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/testing/role_grant_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAMpD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"role_grant_helpers.d.ts","sourceRoot":"","sources":["../../src/lib/testing/role_grant_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAMpD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvE,MAAM,WAAW,2BAA2B;IAC3C,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;IAC7C,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,2BAA2B,KAC/B,OAAO,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,IAAI,CAAA;CAAE,CAyBjD,CAAC"}
|