@fuzdev/fuz_app 0.185.0 β 0.186.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +14 -2
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +36 -5
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +3 -1
- package/dist/auth/CLAUDE.md +11 -5
- package/dist/auth/account_queries.d.ts +53 -40
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +57 -50
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +59 -25
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +26 -9
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_queries.d.ts +11 -3
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -4
- package/dist/auth/audit_log_schema.js +1 -1
- package/dist/auth/auth_ddl.d.ts.map +1 -1
- package/dist/auth/auth_ddl.js +4 -0
- package/dist/auth/cleanup.js +1 -1
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +35 -0
- package/dist/auth/role_grant_offer_queries.d.ts +13 -13
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +12 -13
- package/dist/auth/role_grant_queries.d.ts +16 -9
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +16 -9
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +15 -0
- package/dist/auth/session_queries.d.ts +24 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +28 -0
- package/dist/db/CLAUDE.md +3 -3
- package/dist/db/cell_ddl.d.ts +8 -3
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +10 -5
- package/dist/http/body_limit.d.ts +4 -4
- package/dist/http/body_limit.js +4 -4
- package/dist/testing/CLAUDE.md +126 -27
- package/dist/testing/app_server.d.ts +5 -7
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +5 -7
- package/dist/testing/auth_apps.d.ts +3 -1
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +22 -5
- package/dist/testing/cross_backend/backend_config.d.ts +8 -0
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/backend_log.d.ts +71 -0
- package/dist/testing/cross_backend/backend_log.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_log.js +134 -0
- package/dist/testing/cross_backend/backend_swap.d.ts +41 -0
- package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_swap.js +431 -0
- package/dist/testing/cross_backend/body_size_smuggling.js +3 -3
- package/dist/testing/cross_backend/bootstrap_backend.js +4 -4
- package/dist/testing/cross_backend/conformance_case.d.ts +11 -6
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +4 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts +2 -2
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_principal.js +27 -10
- package/dist/testing/cross_backend/default_backend_configs.d.ts +38 -5
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +50 -15
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +52 -30
- package/dist/testing/cross_backend/revocation_drivers.d.ts +14 -2
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +36 -8
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +7 -0
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -2
- package/dist/testing/cross_backend/setup.d.ts +44 -43
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +64 -62
- package/dist/testing/cross_backend/spawn_backend.d.ts +7 -3
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +86 -7
- package/dist/testing/cross_backend/spine_suites.d.ts +1 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +4 -2
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -2
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +7 -6
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +10 -8
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +7 -31
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +4 -3
- package/dist/testing/data_exposure.d.ts +4 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +93 -25
- package/dist/testing/db_invariants.d.ts +5 -5
- package/dist/testing/db_invariants.js +5 -5
- package/dist/testing/logged_errors.d.ts +61 -0
- package/dist/testing/logged_errors.d.ts.map +1 -0
- package/dist/testing/logged_errors.js +285 -0
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
- package/dist/testing/middleware_gate_probes.js +15 -8
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +41 -16
- package/dist/testing/stubs.d.ts +5 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +6 -3
- package/dist/testing/test_app.d.ts +40 -11
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +66 -9
- package/dist/testing/transports/fetch_transport.d.ts +10 -0
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +13 -0
- package/package.json +4 -3
|
@@ -43,6 +43,8 @@ import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
|
43
43
|
import { builtin_role_specs, is_builtin_role, list_roles_with_grant_path, RoleName } from './role_schema.js';
|
|
44
44
|
import { GRANT_PATH_SELF_SERVICE } from './grant_path_schema.js';
|
|
45
45
|
import { query_create_role_grant } from './role_grant_queries.js';
|
|
46
|
+
import { query_account_lock_live } from './account_queries.js';
|
|
47
|
+
import { ERROR_AUTHENTICATION_REQUIRED } from '../http/error_schemas.js';
|
|
46
48
|
import { query_revoke_role_grant } from './role_grant_offer_queries.js';
|
|
47
49
|
import { emit_supersede_audits } from './role_grant_offer_actions.js';
|
|
48
50
|
import { is_role_grant_active } from './account_schema.js';
|
|
@@ -106,6 +108,19 @@ export const create_self_service_role_actions = (deps, options = {}) => {
|
|
|
106
108
|
const handler = async (input, ctx) => {
|
|
107
109
|
const auth = ctx.auth;
|
|
108
110
|
reject_if_ineligible(input.role);
|
|
111
|
+
// The credential was resolved before the transaction, so a delete or a
|
|
112
|
+
// purge of the account can commit in between: a toggle after it would
|
|
113
|
+
// write a grant (or revoke one) on the tombstone, back on an undelete,
|
|
114
|
+
// or meet a purged actor's foreign key. The account row first β the
|
|
115
|
+
// class order's first row, which a delete's tombstone and a purge's
|
|
116
|
+
// `DELETE` write β refuses it as the dead credential it now is, or
|
|
117
|
+
// makes a removal still to commit wait for the toggle. Both branches,
|
|
118
|
+
// before the no-op answers: a removed account is told it is removed.
|
|
119
|
+
if (!(await query_account_lock_live(ctx, auth.account.id))) {
|
|
120
|
+
throw jsonrpc_errors.unauthenticated('unauthenticated', {
|
|
121
|
+
reason: ERROR_AUTHENTICATION_REQUIRED
|
|
122
|
+
});
|
|
123
|
+
}
|
|
109
124
|
if (input.enabled) {
|
|
110
125
|
// Pre-check for idempotent re-grant. `query_create_role_grant` is itself
|
|
111
126
|
// idempotent (returns the existing role_grant instead of inserting), but
|
|
@@ -101,6 +101,30 @@ export declare const query_session_get_valid: (deps: QueryDeps, token_hash: stri
|
|
|
101
101
|
* @returns `true` when the session exists, belongs to the account, and has not expired
|
|
102
102
|
*/
|
|
103
103
|
export declare const query_session_is_live: (deps: QueryDeps, id: string, account_id: string) => Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* The password hash of the account a live session belongs to β the hash a
|
|
106
|
+
* password change verifies `current_password` against.
|
|
107
|
+
*
|
|
108
|
+
* The change's credential was resolved before this read, and its account row
|
|
109
|
+
* with it in a separate statement, so a change, a delete or a purge can commit
|
|
110
|
+
* between the two reads or after them. Each revokes the account's sessions in
|
|
111
|
+
* the transaction of its write, so while the session lives, the stored hash is
|
|
112
|
+
* the one the session was resolved under; once it is gone, the credential died
|
|
113
|
+
* mid-request and there is no hash to verify. Bound to the session in one
|
|
114
|
+
* statement, the read answers one or the other, never a later change's hash
|
|
115
|
+
* beside a dead session. The read is no lock: a session that dies after it is
|
|
116
|
+
* caught by the change's transaction, which takes the account row and then
|
|
117
|
+
* reads the session again (`query_session_is_live`). No tombstone filter: a
|
|
118
|
+
* delete revokes the sessions, and the change's transaction refuses a
|
|
119
|
+
* tombstone itself. Twin of the Rust
|
|
120
|
+
* `fuz_auth::query_session_live_password_hash`.
|
|
121
|
+
*
|
|
122
|
+
* @param deps - query dependencies
|
|
123
|
+
* @param id - the session's id, its token hash
|
|
124
|
+
* @param account_id - the account the session must belong to
|
|
125
|
+
* @returns the account's password hash, or `undefined` when the session is no longer live
|
|
126
|
+
*/
|
|
127
|
+
export declare const query_session_live_password_hash: (deps: QueryDeps, id: string, account_id: string) => Promise<string | undefined>;
|
|
104
128
|
/**
|
|
105
129
|
* Revoke (delete) a session by its token hash, with no account scoping.
|
|
106
130
|
*
|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,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC7B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GACjC,SAAS,0BAA0B,KACjC,OAAO,CAAC,aAAa,CAUvB,CAAC"}
|
|
@@ -123,6 +123,34 @@ export const query_session_is_live = async (deps, id, account_id) => {
|
|
|
123
123
|
const row = await deps.db.query_one(`SELECT id FROM auth_session WHERE id = $1 AND account_id = $2 AND expires_at > NOW()`, [id, account_id]);
|
|
124
124
|
return row !== undefined;
|
|
125
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* The password hash of the account a live session belongs to β the hash a
|
|
128
|
+
* password change verifies `current_password` against.
|
|
129
|
+
*
|
|
130
|
+
* The change's credential was resolved before this read, and its account row
|
|
131
|
+
* with it in a separate statement, so a change, a delete or a purge can commit
|
|
132
|
+
* between the two reads or after them. Each revokes the account's sessions in
|
|
133
|
+
* the transaction of its write, so while the session lives, the stored hash is
|
|
134
|
+
* the one the session was resolved under; once it is gone, the credential died
|
|
135
|
+
* mid-request and there is no hash to verify. Bound to the session in one
|
|
136
|
+
* statement, the read answers one or the other, never a later change's hash
|
|
137
|
+
* beside a dead session. The read is no lock: a session that dies after it is
|
|
138
|
+
* caught by the change's transaction, which takes the account row and then
|
|
139
|
+
* reads the session again (`query_session_is_live`). No tombstone filter: a
|
|
140
|
+
* delete revokes the sessions, and the change's transaction refuses a
|
|
141
|
+
* tombstone itself. Twin of the Rust
|
|
142
|
+
* `fuz_auth::query_session_live_password_hash`.
|
|
143
|
+
*
|
|
144
|
+
* @param deps - query dependencies
|
|
145
|
+
* @param id - the session's id, its token hash
|
|
146
|
+
* @param account_id - the account the session must belong to
|
|
147
|
+
* @returns the account's password hash, or `undefined` when the session is no longer live
|
|
148
|
+
*/
|
|
149
|
+
export const query_session_live_password_hash = async (deps, id, account_id) => {
|
|
150
|
+
const row = await deps.db.query_one(`SELECT a.password_hash FROM auth_session s JOIN account a ON a.id = s.account_id
|
|
151
|
+
WHERE s.id = $1 AND s.account_id = $2 AND s.expires_at > NOW()`, [id, account_id]);
|
|
152
|
+
return row?.password_hash;
|
|
153
|
+
};
|
|
126
154
|
/**
|
|
127
155
|
* Revoke (delete) a session by its token hash, with no account scoping.
|
|
128
156
|
*
|
package/dist/db/CLAUDE.md
CHANGED
|
@@ -120,9 +120,9 @@ The wire schemas + RPC handlers + authz predicates for this layer live in
|
|
|
120
120
|
authorizer's verdict + the `cell_moderate` verb, never in `data`.
|
|
121
121
|
`cell.policy jsonb` (nullable) is a root's contribution policy, opaque to the
|
|
122
122
|
spine β a table CHECK holds it to roots and to JSON objects (`policy @> '{}'`,
|
|
123
|
-
the object test pglet runs too). Nullable
|
|
124
|
-
|
|
125
|
-
/ `refs`; global partial-unique on `path`.
|
|
123
|
+
the object test pglet runs too). Nullable `created_by` FK to `actor` (NULL =
|
|
124
|
+
system origin); `updated_by` and `cell_grant.granted_by` are provenance stamps
|
|
125
|
+
with no FK. GIN on `data` / `refs`; global partial-unique on `path`.
|
|
126
126
|
- **`cell_queries.ts`** β `query_cell_create / get / get_by_path / update /
|
|
127
127
|
delete / set_moderation`, `_list_by_kind / _list_by_creator`, the
|
|
128
128
|
generic `query_cell_list` (filter + SQL-side visibility predicate mirroring
|
package/dist/db/cell_ddl.d.ts
CHANGED
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
* doesn't block reuse of its path. Path writes are admin-only at the
|
|
20
20
|
* action layer; user-namespaced paths are a future extension.
|
|
21
21
|
*
|
|
22
|
-
* **Ownership columns
|
|
23
|
-
* `
|
|
22
|
+
* **Ownership columns**: `created_by` is a nullable FK to `actor`
|
|
23
|
+
* (`ON DELETE SET NULL`): NULL = system origin (well-known cells,
|
|
24
|
+
* daemon/agent cells), and the owner the edit and manage predicates read.
|
|
24
25
|
* The non-admin authz path treats NULL `created_by` as admin-only via an
|
|
25
|
-
* explicit equality check (`auth/cell_authorize.ts`).
|
|
26
|
+
* explicit equality check (`auth/cell_authorize.ts`). `updated_by` and
|
|
27
|
+
* `cell_grant.granted_by` are provenance stamps with no FK, as `fuz_auth`'s
|
|
28
|
+
* are (`drop_provenance_stamp_foreign_keys`): nothing authorizes on them, so
|
|
29
|
+
* they keep the id they were written with after a purge, and neither a
|
|
30
|
+
* purge's cascade nor a stamp write waits on the other.
|
|
26
31
|
*
|
|
27
32
|
* **Timestamp naming** (`created_at`, `updated_at`) aligns with fuz_app's
|
|
28
33
|
* `_at`-everywhere convention used by `account`, `actor`, `audit_log`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_ddl.d.ts","sourceRoot":"","sources":["../../src/lib/db/cell_ddl.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cell_ddl.d.ts","sourceRoot":"","sources":["../../src/lib/db/cell_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,cAAc,CAAC;AAuOtB,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,4DAA6D,CAAC;AA+B3F;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,kBAG/B,CAAC"}
|
package/dist/db/cell_ddl.js
CHANGED
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
* doesn't block reuse of its path. Path writes are admin-only at the
|
|
20
20
|
* action layer; user-namespaced paths are a future extension.
|
|
21
21
|
*
|
|
22
|
-
* **Ownership columns
|
|
23
|
-
* `
|
|
22
|
+
* **Ownership columns**: `created_by` is a nullable FK to `actor`
|
|
23
|
+
* (`ON DELETE SET NULL`): NULL = system origin (well-known cells,
|
|
24
|
+
* daemon/agent cells), and the owner the edit and manage predicates read.
|
|
24
25
|
* The non-admin authz path treats NULL `created_by` as admin-only via an
|
|
25
|
-
* explicit equality check (`auth/cell_authorize.ts`).
|
|
26
|
+
* explicit equality check (`auth/cell_authorize.ts`). `updated_by` and
|
|
27
|
+
* `cell_grant.granted_by` are provenance stamps with no FK, as `fuz_auth`'s
|
|
28
|
+
* are (`drop_provenance_stamp_foreign_keys`): nothing authorizes on them, so
|
|
29
|
+
* they keep the id they were written with after a purge, and neither a
|
|
30
|
+
* purge's cascade nor a stamp write waits on the other.
|
|
26
31
|
*
|
|
27
32
|
* **Timestamp naming** (`created_at`, `updated_at`) aligns with fuz_app's
|
|
28
33
|
* `_at`-everywhere convention used by `account`, `actor`, `audit_log`,
|
|
@@ -107,7 +112,7 @@ CREATE TABLE IF NOT EXISTS cell (
|
|
|
107
112
|
updated_at TIMESTAMPTZ,
|
|
108
113
|
deleted_at TIMESTAMPTZ,
|
|
109
114
|
created_by UUID REFERENCES actor(id) ON DELETE SET NULL,
|
|
110
|
-
updated_by UUID
|
|
115
|
+
updated_by UUID,
|
|
111
116
|
CHECK (policy IS NULL OR (parent_id IS NULL AND policy @> '{}'::jsonb))
|
|
112
117
|
)`;
|
|
113
118
|
/**
|
|
@@ -166,7 +171,7 @@ CREATE TABLE IF NOT EXISTS cell_grant (
|
|
|
166
171
|
actor_id UUID REFERENCES actor(id) ON DELETE CASCADE,
|
|
167
172
|
role TEXT,
|
|
168
173
|
scope_id UUID,
|
|
169
|
-
granted_by UUID
|
|
174
|
+
granted_by UUID,
|
|
170
175
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
171
176
|
CHECK (
|
|
172
177
|
(actor_id IS NOT NULL AND role IS NULL AND scope_id IS NULL) OR
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
* holds the connection for a drain window and then closes or, the body
|
|
51
51
|
* untouched and arriving within the window, reads it off and serves the
|
|
52
52
|
* next request.
|
|
53
|
-
* - **Bun** closes at once, the body unread, honouring the header. Bun 1.4.
|
|
54
|
-
* is the tested floor
|
|
55
|
-
*
|
|
56
|
-
* later.
|
|
53
|
+
* - **Bun** closes at once, the body unread, honouring the header. Bun 1.4.4
|
|
54
|
+
* is the tested floor (CI's pin); the close needs 1.4.3 β an older Bun kept
|
|
55
|
+
* the connection after the `413` and served the next request (correctly
|
|
56
|
+
* framed) β so run Bun at the floor or later.
|
|
57
57
|
*
|
|
58
58
|
* @module
|
|
59
59
|
*/
|
package/dist/http/body_limit.js
CHANGED
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
* holds the connection for a drain window and then closes or, the body
|
|
51
51
|
* untouched and arriving within the window, reads it off and serves the
|
|
52
52
|
* next request.
|
|
53
|
-
* - **Bun** closes at once, the body unread, honouring the header. Bun 1.4.
|
|
54
|
-
* is the tested floor
|
|
55
|
-
*
|
|
56
|
-
* later.
|
|
53
|
+
* - **Bun** closes at once, the body unread, honouring the header. Bun 1.4.4
|
|
54
|
+
* is the tested floor (CI's pin); the close needs 1.4.3 β an older Bun kept
|
|
55
|
+
* the connection after the `413` and served the next request (correctly
|
|
56
|
+
* framed) β so run Bun at the floor or later.
|
|
57
57
|
*
|
|
58
58
|
* @module
|
|
59
59
|
*/
|
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -33,7 +33,7 @@ time (never runtime), where a throwing guard would break `vite build`.
|
|
|
33
33
|
- `stub_handler()` β a `route_raw` text answer (`stub`), a handler that fits any route (`attach_route_handler(shape, stub_handler)`).
|
|
34
34
|
- `stub_route_spec(shape)` β a spec for a surface that is described and never served: `shape` with a handler that throws when run (the spine routes of `create_rust_spine_consumer_surface_spec`).
|
|
35
35
|
- `stub_mw` β pass-through middleware (`async (_c, next) => next()`).
|
|
36
|
-
- `create_stub_app_deps()` β factory: fresh `AppDeps` with a stub keyring (`sign` answers `<value>.stub_signature`, so a session cookie signed on stub deps is a line; nothing else of it does anything), no-op password, a `
|
|
36
|
+
- `create_stub_app_deps()` β factory: fresh `AppDeps` with a stub keyring (`sign` answers `<value>.stub_signature`, so a session cookie signed on stub deps is a line; nothing else of it does anything), no-op password, a fresh `create_stub_db()` (transactions run their callbacks), silent `Logger`, no-op `audit`, an empty `connection_closer` and `notification_sender`.
|
|
37
37
|
- `create_test_audit_emitter()` β no-op `AuditEmitter`; `emit` / `emit_role_grant_target` / `emit_pool` resolve immediately, `notify` no-op, `add_listener` throws (use `create_recording_audit_emitter` for a listener-accepting emitter), `listener_count` returns 0, `drain_inflight` resolves immediately, `inflight_count` returns 0.
|
|
38
38
|
- `create_stub_audit_sse()` β no-op `AuditLogSse` for surface-test wiring without booting real SSE. `on_audit_event` no-op (nothing is broadcast); `required_role` is `admin`; `registry` is a fresh `SseRegistry` (live `.count` / `.close_*` for registry-state tests, isolated per call). For real SSE plumbing build via `create_audit_log_sse` against `create_test_app`.
|
|
39
39
|
- `create_stub_api_middleware({include_daemon_token?, origin_carve_outs?})` β stub `MiddlewareSpec[]` with `create_auth_middleware_specs`'s names, paths, order and declared `errors` (pinned against it by `auth/middleware.mounted.test.ts`), each layer its own pass-through handler so `assert_middleware_stack_mounted` tells them apart. A stub declaring more errors than the real layer would widen every route's error map under its path. The real stack: `auth/CLAUDE.md` Β§Middleware.
|
|
@@ -132,6 +132,37 @@ mismatch.
|
|
|
132
132
|
- `create_recording_audit_emitter(calls_ref?)` β no-op `AuditEmitter` pushing every `emit` and `emit_pool` call into `calls`. Pass `calls_ref` to write into a caller-owned array; omit to let the helper allocate. Returns `{emitter, calls}` β destructure `emitter` as the `audit` dep and read `calls` to assert. `add_listener` records (never fires) and returns a remover with the production semantics, so `listener_count` tracks what a server registered and released.
|
|
133
133
|
- `RecordingAuditEmitter` β `{emitter: AuditEmitter; calls: Array<AuditLogInput>}`.
|
|
134
134
|
|
|
135
|
+
### `logged_errors.ts` β fail a test on an error it logs
|
|
136
|
+
|
|
137
|
+
`install_logged_error_gate(options?)` β call at the top level of a vitest
|
|
138
|
+
`setupFiles` module (fuz_app's: `src/test/logged_error_gate.ts`, on the `unit`
|
|
139
|
+
and `db` projects). Wraps `Logger.prototype.error` and `console.error` once per
|
|
140
|
+
process (state on `globalThis`, since an isolated project re-evaluates the
|
|
141
|
+
module per file), buffers what each test logs, and fails the test in its last
|
|
142
|
+
`onTestFinished` hook β after its `afterEach` hooks and a `create_test_app`
|
|
143
|
+
close β on any error not declared; a test that already failed is skipped. A
|
|
144
|
+
call counts whatever the logger's level. Errors logged outside a test fail the
|
|
145
|
+
file in its last `afterAll`. Errors only.
|
|
146
|
+
|
|
147
|
+
- `expect_logged_error(pattern)` β inside a test: the test must log a match,
|
|
148
|
+
and every match is allowed. Throws outside a test, in a concurrent test, or
|
|
149
|
+
without the gate.
|
|
150
|
+
- `allow_logged_error(pattern, reason)` β reason required; in a test for that
|
|
151
|
+
test, at collection for the enclosing `describe` (the file at top level) and
|
|
152
|
+
for what the file logs outside its tests or in its concurrent tests; throws
|
|
153
|
+
in a concurrent test; a no-op without the gate.
|
|
154
|
+
- `LOGGED_ERROR_BANNERS` β the designed test-mode banners
|
|
155
|
+
(`RATE_LIMITERS_DISABLED_BANNER`, the two fail-floor banners), allowed
|
|
156
|
+
everywhere; `options.allow` adds a consumer's own.
|
|
157
|
+
- `LoggedErrorPattern` (substring or `RegExp`), `LoggedErrorAllowance`,
|
|
158
|
+
`InstallLoggedErrorGateOptions`.
|
|
159
|
+
|
|
160
|
+
Late errors (an effect nothing awaited) land on the next test. A concurrent
|
|
161
|
+
test's errors go to the file's bucket β no buffer can say whose they are β so
|
|
162
|
+
both `expect_logged_error` and `allow_logged_error` throw in one; allow them
|
|
163
|
+
on its `describe`, at collection. The gate's own tests are `test.fails` cases
|
|
164
|
+
(`src/test/testing/logged_errors.test.ts`).
|
|
165
|
+
|
|
135
166
|
### `token_scope_fixtures.ts` β scope documents built to a size
|
|
136
167
|
|
|
137
168
|
`token_scope_methods_at_bytes(bytes, filler)` β method names whose `methods`
|
|
@@ -197,11 +228,12 @@ which the Rust `fuz_testing` embeds byte for byte
|
|
|
197
228
|
rows a backend answered), `register_db_invariants_check`,
|
|
198
229
|
`check_db_invariants_after_all`, `check_db_invariants_after_suite`.
|
|
199
230
|
|
|
200
|
-
`create_test_app`
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
231
|
+
`create_test_app` runs its `assert_db_invariants` when the test that built it
|
|
232
|
+
finishes (only inside a running test β its body or a `beforeEach`; skipped
|
|
233
|
+
when the test already failed), so a direct caller is checked too, and then
|
|
234
|
+
closes the app (Β§`app_server.ts` and `test_app.ts`);
|
|
235
|
+
`default_in_process_setup` uses the test app's check, and the cross-process
|
|
236
|
+
setup registers its fixture's. In-process it queries the app's
|
|
205
237
|
own database;
|
|
206
238
|
cross-process it calls the backend's `_testing_db_invariants` on the keeper's
|
|
207
239
|
daemon-token channel (unrecorded by a transcript), so `memory://` spawns are
|
|
@@ -265,16 +297,32 @@ rate limiter `null` β a limiter passed through `app_options` wins over the
|
|
|
265
297
|
mode, so a rate-limit test enables just the one it pins; the mode's stderr
|
|
266
298
|
banner prints once per module instance β once per test file in an isolated
|
|
267
299
|
vitest project, once per run under `isolate: false`, ../../../docs/usage.md Β§Rate limiters), static daemon token state (no rotation, keeper already set),
|
|
268
|
-
`await_pending_effects: true` (Β§Cross-cutting conventions),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
300
|
+
`await_pending_effects: true` (Β§Cross-cutting conventions), the shutdown
|
|
301
|
+
drain bound `TEST_SHUTDOWN_DRAIN_TIMEOUT_MS` (under vitest's
|
|
302
|
+
per-test timeout, so a give-up fails as one rather than as a timeout), and a
|
|
303
|
+
silent logger. Override via `app_options`. `cleanup()` runs the assembled
|
|
304
|
+
server's idempotent `close` β it also closes the server's live connections,
|
|
305
|
+
disposes the limiters it built, and removes the audit listeners and closer
|
|
306
|
+
members it added β and resolves `void`, throwing with the
|
|
307
|
+
`ShutdownDrainGivenUp` report when the drain gave up on work still in flight.
|
|
308
|
+
A test that gives up on purpose calls `server.close()`, which resolves the
|
|
309
|
+
report.
|
|
310
|
+
|
|
311
|
+
An app built inside a test (its body or a `beforeEach`) is closed when the
|
|
312
|
+
test finishes, after its invariant check, in one `onTestFinished` hook. That
|
|
313
|
+
close fails the test on a give-up, unless the test failed or closed the app
|
|
314
|
+
itself (`cleanup` or `server.close()`; `TestApp.server` is the assembled
|
|
315
|
+
server with its `close` marking that). An app built in `beforeAll` registers
|
|
316
|
+
nothing and is its suite's to close, so a fixture shared across tests is
|
|
317
|
+
built there β `describe_middleware_gate_tests`' in-process fixture is built
|
|
318
|
+
in `beforeAll` and checked once after its probes (a `TestFixture` has no
|
|
319
|
+
close). Inside a concurrent test `create_test_app` throws: vitest names
|
|
320
|
+
whichever concurrent test started last as current, so the close would land
|
|
321
|
+
on a sibling's app β build the app in `beforeAll` and close it in `afterAll`.
|
|
273
322
|
|
|
274
323
|
`auth_cleanup` is `'off'` here: a background pass would delete rows and
|
|
275
324
|
write audit rows mid-test. A suite that opts in through `app_options` has the
|
|
276
|
-
schedule stopped by `cleanup()
|
|
277
|
-
resolves its `ShutdownDrainGivenUp` report.
|
|
325
|
+
schedule stopped by `cleanup()`.
|
|
278
326
|
|
|
279
327
|
A fresh Hono app is created on every call because middleware closures bind
|
|
280
328
|
to the server's deps (db, keyring). Hono assembly is cheap;
|
|
@@ -393,6 +441,31 @@ fuz_app's wiring (TS vs Rust under `cross_backend_parity`, Node vs Bun under
|
|
|
393
441
|
`describe_spine_differential_suites`): ../../test/CLAUDE.md Β§Cross-backend
|
|
394
442
|
self-tests.
|
|
395
443
|
|
|
444
|
+
## Backend swap
|
|
445
|
+
|
|
446
|
+
`cross_backend/backend_swap.ts` β `describe_backend_swap_tests({orders,
|
|
447
|
+
database_url, empty_database, declined_role?})`: two backends over one
|
|
448
|
+
Postgres database, one at a time. Per order the first mints through its real
|
|
449
|
+
routes (bootstrap, a second keeper session and a keeper API token, invite,
|
|
450
|
+
signup, login, a member API token, two pending offers); the second boots over
|
|
451
|
+
that database β its migrations and every table's content digest unchanged β
|
|
452
|
+
honors each credential, the password hash and the offers, accepting one and
|
|
453
|
+
declining the other, logs the second keeper session out, revokes the keeper
|
|
454
|
+
token and changes the member's password; and the first boots again and
|
|
455
|
+
honors what it wrote: the keeper session and token refused (nothing else
|
|
456
|
+
ended them) beside the keeper's first cookie, the member's sessions and token
|
|
457
|
+
ended by the password change. Each phase spawns, drains and tears down its
|
|
458
|
+
own backend, and an `afterEach` tears down one a timed-out phase left
|
|
459
|
+
running. The configs must share the database (`DATABASE_URL`, compared as
|
|
460
|
+
exact strings), the cookie name and a set `SECRET_FUZ_COOKIE_KEYS`, keep a
|
|
461
|
+
startup reset off (`FUZ_TESTING_RESET_DB_ON_STARTUP` unset or a false
|
|
462
|
+
stringbool, as the Rust spine parses it; `reset_db_on_startup: false` on the
|
|
463
|
+
Rust family builder) and declare `_testing_drain_effects` and
|
|
464
|
+
`_testing_db_invariants`, and `declined_role` must not be `admin` β all
|
|
465
|
+
checked before the first spawn. A standalone suite
|
|
466
|
+
(`STANDALONE_CROSS_SUITES`). fuz_app's wiring is the `cross_backend_swap`
|
|
467
|
+
project (../../test/CLAUDE.md Β§Cross-backend self-tests).
|
|
468
|
+
|
|
396
469
|
## Assertions, coverage, helpers
|
|
397
470
|
|
|
398
471
|
### `assertions.ts` β surface + error-schema assertions
|
|
@@ -508,7 +581,7 @@ adversarial/round-trip tests. A value that is no schema throws, naming it.
|
|
|
508
581
|
- `admin_only_field_blocklist` β `['updated_by', 'created_by']`; never in non-admin response bodies.
|
|
509
582
|
- `collect_json_keys_recursive(value)` β deep walk; returns `Set<string>` of every key at every nesting depth.
|
|
510
583
|
- `assert_no_sensitive_fields_in_json(body, blocklist, context)` β rejects any key in the blocklist at any depth.
|
|
511
|
-
- `to_principal_transport(principal, fixture)` β the transport a principal's request goes through, so it carries that principal's credential and nothing else: cookie-free with no `Origin` for the daemon token, cookie-free for a public call, the fixture's own for a session principal (whose `Cookie` header replaces the jar's).
|
|
584
|
+
- `to_principal_transport(principal, fixture)` β the transport a principal's request goes through, so it carries that principal's credential and nothing else: cookie-free with no `Origin` for the daemon token, cookie-free for a public call, the fixture's own for a session principal (whose `Cookie` header replaces the jar's). An anonymous probe over the fixture's transport authenticates as the keeper, whose cookie its jar carries, and a bearer one throws (`fetch_transport.ts`) β send those through `fixture.fresh_transport()`.
|
|
512
585
|
- `pick_auth_headers(spec, test_app, authed_account, admin_account)` β `RouteAuth` β appropriate test credentials; role `admin` uses `admin_account`, other roles use bootstrapped keeper, `keeper` uses daemon token.
|
|
513
586
|
|
|
514
587
|
## Attack surface suites
|
|
@@ -761,7 +834,7 @@ The groups:
|
|
|
761
834
|
2. **runtime** (DB-backed via `create_test_app`):
|
|
762
835
|
- `unauthenticated error responses contain no sensitive fields`
|
|
763
836
|
- `admin routes return 403 for non-admin user` β cross-privilege check
|
|
764
|
-
- `all 2xx responses pass field blocklists` β GETs sorted before POSTs so data-returning routes fire before destructive ones (logout, revoke-all) invalidate sessions
|
|
837
|
+
- `all 2xx responses pass field blocklists` β GETs sorted before POSTs so data-returning routes fire before destructive ones (logout, revoke-all) invalidate sessions; a mutation sent as the authed account runs on a fresh one (`round_trip_uses_fresh_account`); a public route is sent anonymously and again as an authenticated account (a fresh one for a mutation), since it may answer a caller with more; fails when a route that requires a credential refuses the one sent as unauthenticated (`is_unauthenticated_refusal`), naming the route β a public route's 401 is its own answer β and when no 2xx JSON response carried a key besides `ok` at any depth, so a sweep that checked nothing never passes
|
|
765
838
|
|
|
766
839
|
Support functions: `collect_json_schema_property_names(schema)` (walks
|
|
767
840
|
`properties`/`patternProperties`/`additionalProperties`/`items`/`prefixItems`/`contains`,
|
|
@@ -871,8 +944,9 @@ in-process only, an unreadable `Content-Length` β 400 `invalid_content_length`
|
|
|
871
944
|
(over a socket Node's parser and hyper answer that one themselves with a
|
|
872
945
|
bodiless 400, and `fetch` can't send it). Each probe is a request head with no
|
|
873
946
|
body and no credential, refused before auth, rate limiting and body parsing;
|
|
874
|
-
in-process the probes share one fixture
|
|
875
|
-
|
|
947
|
+
in-process the probes share one fixture, built in `beforeAll` and checked
|
|
948
|
+
against the database invariants once they are done. A route whose path has a
|
|
949
|
+
param or wildcard segment throws rather than be probed at its literal template.
|
|
876
950
|
`send_middleware_gate_probe(probe, base_url, transport)` writes it to the socket
|
|
877
951
|
with `raw_http_send_head` (`fetch` replaces a caller's `Host` and
|
|
878
952
|
`Content-Length`), or in-process through the transport, whose `Request` keeps
|
|
@@ -1006,7 +1080,7 @@ The groups:
|
|
|
1006
1080
|
- wrong role β `forbidden` (-32002)
|
|
1007
1081
|
- authenticated without role β `forbidden`
|
|
1008
1082
|
- **keeper rejects non-daemon credentials** β session and api_token credentials are rejected even when the account has the keeper role (only `daemon_token` passes). The credential-type gate fires before the role gate (see `auth/CLAUDE.md` Β§Keeper auth shape).
|
|
1009
|
-
- correct auth passes β valid params (`input_overrides` or generated) reach the method's handler, a recording stub, at 200
|
|
1083
|
+
- correct auth passes β valid params (`input_overrides` or generated) reach the method's handler, a recording stub answering a generated schema-valid output, at 200
|
|
1010
1084
|
- GET unauthenticated for `side_effects: false` reads
|
|
1011
1085
|
2. **RPC adversarial envelopes** β the fixed cases of `create_rpc_envelope_cases(endpoint, {skip_methods?})` (hono-free `rpc_envelope_cases.ts`, shared with the cross-process `describe_rpc_adversarial_cross_tests`): malformed and response-shaped envelopes, batches, unknown methods, the GET read restriction and its query parsing, and anonymous ordering cases (an anonymous GET mutation or batch is `invalid_request`, never 401; params validation runs after authorization). Each is sent by an app its method admits and pinned β status, code, echoed `id`, `data.reason` β by `assert_rpc_envelope_refusal`. The case list is the module's TSDoc.
|
|
1012
1086
|
3. **RPC adversarial params** β `generate_rpc_params_test_cases(input, options?)` (`rpc_envelope_cases.ts`): `generate_input_test_cases` minus its structural cases (a non-object `params` is refused at the envelope, not at params validation), taking the same `{base?, label?}`. Every case expects 400 `invalid_params` with `data.reason` the broken field's declared `invalid_reason` (`expected_invalid_reason`), absent for an undeclared field. Shared with the cross-process suite. `input_overrides` (method name β valid params) seeds a method's cases from that base; an override its schema refuses throws at collection, naming the method.
|
|
@@ -1051,7 +1125,7 @@ have files of their own.
|
|
|
1051
1125
|
|
|
1052
1126
|
### Fixture protocol + capabilities
|
|
1053
1127
|
|
|
1054
|
-
- `testing/cross_backend/setup.ts` β the fixture protocol: `SetupTest` / `TestFixture` / `CreateTestAccountOptions`, and `default_cross_process_setup(handle, options?)` over a `BootstrappedBackendHandle`; the in-process `default_in_process_setup` (over `create_test_app`; `migration_namespaces` for tables beyond auth) and `default_in_process_suite_options` (the `{setup_test, surface_source, capabilities}` triple plus pass-through options) are `in_process_setup.ts`. Every test starts from a freshly bootstrapped keeper: cross-process by `_testing_reset` over the daemon-token channel (every auth row wiped, the keeper and any `extra_accounts` seeded, the answered seeds matched by `match_testing_reset_seeds`), in-process by a fresh `create_test_app`. `fixture.create_account({roles?, email?})` goes through the production surface β invite, signup, login, `account_token_create`, an offer and accept per role β so a role whose `grant_paths` lacks `'admin'` is seeded through `extra_accounts` instead; an `email` must be per-test unique. The fixture also carries `fresh_transport({origin?})` (no cookie jar; `{origin: null}` for bearer-only paths) and the dead-credential mints the conformance principals use, each proving its credential live before killing it (in-process they need `account_verify` on the setup's `rpc_endpoints`; cross-process `mint_expired_token`
|
|
1128
|
+
- `testing/cross_backend/setup.ts` β the fixture protocol: `SetupTest` / `TestFixture` / `CreateTestAccountOptions`, and `default_cross_process_setup(handle, options?)` over a `BootstrappedBackendHandle`; the in-process `default_in_process_setup` (over `create_test_app`; `migration_namespaces` for tables beyond auth) and `default_in_process_suite_options` (the `{setup_test, surface_source, capabilities}` triple plus pass-through options) are `in_process_setup.ts`. Every test starts from a freshly bootstrapped keeper: cross-process by `_testing_reset` over the daemon-token channel (every auth row wiped, the keeper and any `extra_accounts` seeded, the answered seeds matched by `match_testing_reset_seeds`), in-process by a fresh `create_test_app`. `fixture.create_account({roles?, email?})` goes through the production surface β invite, signup, login, `account_token_create`, an offer and accept per role β so a role whose `grant_paths` lacks `'admin'` is seeded through `extra_accounts` instead; an `email` must be per-test unique. The fixture also carries `fresh_transport({origin?})` (no cookie jar; `{origin: null}` for bearer-only paths) and the dead-credential mints the conformance principals use, each proving its credential live before killing it (in-process they need `account_verify` on the setup's `rpc_endpoints`; cross-process `mint_expired_token` and `mint_expired_session` need `_testing_shorten_credential_expiry` mounted).
|
|
1055
1129
|
|
|
1056
1130
|
**Keeper β admin.** `fixture.account` holds `[ROLE_KEEPER, ROLE_ADMIN]` as two
|
|
1057
1131
|
grants, as a production bootstrap does (in-process,
|
|
@@ -1079,7 +1153,7 @@ have files of their own.
|
|
|
1079
1153
|
host gate off, `host_gate: false`.
|
|
1080
1154
|
|
|
1081
1155
|
No flag covers the body-size smuggling probe (`body_size_smuggling.ts`): every
|
|
1082
|
-
backend closes the connection after an oversized-body 413. Bun 1.4.
|
|
1156
|
+
backend closes the connection after an oversized-body 413. Bun 1.4.4 is the
|
|
1083
1157
|
tested floor.
|
|
1084
1158
|
|
|
1085
1159
|
### `cross_backend/standard_bundle.ts` β `describe_standard_cross_process_tests`
|
|
@@ -1365,7 +1439,7 @@ without.
|
|
|
1365
1439
|
| `actor_lookup` | the keeper resolves its own actor in the leak-safe wire shape (the refusals are table rows) | β |
|
|
1366
1440
|
| `app_settings` | an anonymous signup reads `open_signup` fresh after `app_settings_update` | β |
|
|
1367
1441
|
| `body_size` | the 1 MiB body cap: cap+1 β 413 `payload_too_large`, exactly the cap not size-rejected, an over-cap chunked body β 413, no upload racing the close | β |
|
|
1368
|
-
| `body_size_smuggling` | raw socket: an oversized `POST` + a pipelined `GET` β at most one response; `Content-Length` beside `Transfer-Encoding` β close (Bun 1.4.
|
|
1442
|
+
| `body_size_smuggling` | raw socket: an oversized `POST` + a pipelined `GET` β at most one response; `Content-Length` beside `Transfer-Encoding` β close (Bun 1.4.4 is the tested floor) | β |
|
|
1369
1443
|
| `capability_mounts` | each mount flag a request observes (`ws`, `sse`, `cell_crud`, `cell_relations`, `fact_serving`, `fact_serving_admin_hash`, `ready`, `account_status`, `ws_account_actions`, `ws_role_gated`) probed once and held to its declaration both ways β `true` answers as mounted, `false` as unmounted; each flag's probe again as an unmounted control (its surface moved under `CAPABILITY_MOUNTS_ABSENT`) read as unmounted on every backend; every other flag a skipped test naming why (`UNPROBED_CAPABILITIES`); can't be excluded or overridden; probes the paths the gated suites send to; cross-process only | every probed flag (the declaration) |
|
|
1370
1444
|
| `cell_crud` | the CRUD lifecycle + authz matrix, each response parsed against its output schema, `cell_list` paging past hidden rows, mistyped `data` | `cell_crud` (clone cases also `cell_relations`) |
|
|
1371
1445
|
| `cell_gated_create` | the parent-aware `CellCreateAuthorize`: admin-only `space` root, contributions gated by the root's `policy[kind]`, 404 on a hidden parent vs 403 on a visible one, `cell_policy_set` | `cell_gated_create` |
|
|
@@ -1440,7 +1514,8 @@ What the suites share:
|
|
|
1440
1514
|
β `AccountRevocation` rows, the account-wide revocations the WS and SSE
|
|
1441
1515
|
suites each close a live connection on, so a row added there is covered on
|
|
1442
1516
|
both. The drivers stand alone too (`cross_post_as`,
|
|
1443
|
-
`cross_admin_token_revoke_all`, `cross_account_purge
|
|
1517
|
+
`cross_admin_token_revoke_all`, `cross_account_purge`,
|
|
1518
|
+
`cross_session_revoke_current`).
|
|
1444
1519
|
- **`cross_backend/ws_endpoint.ts`** β `WsEndpointTarget` and
|
|
1445
1520
|
`open_session_ws` (see Β§Cross-process plumbing), and
|
|
1446
1521
|
`assert_ws_upgrade_refused(open, status)`, which holds a refused upgrade to
|
|
@@ -1531,7 +1606,12 @@ Conventions that hold across them:
|
|
|
1531
1606
|
family builders a consumer config composes: the env baseline (`HOST` bound
|
|
1532
1607
|
to `DEFAULT_TEST_BACKEND_HOST`, `127.0.0.1`; the port under
|
|
1533
1608
|
`port_env_var`; cookie keys; allowed origins; the bootstrap token path; the
|
|
1534
|
-
|
|
1609
|
+
TS family's `PUBLIC_LOG_LEVEL`, `TS_BACKEND_LOG_LEVEL` β the spawned binary
|
|
1610
|
+
inherits `VITEST`, which turns every fuz_util `Logger` off; the Rust startup
|
|
1611
|
+
self-wipe, off with `reset_db_on_startup: false`), the default paths, the
|
|
1612
|
+
`log` (`backend.log` under the temp root,
|
|
1613
|
+
`SPINE_CROSS_SUITE_BACKEND_ERRORS` plus `log_allow_errors` allowed;
|
|
1614
|
+
`log_path: null` for none), and the required `capabilities`.
|
|
1535
1615
|
`daemon_token_dir_env` names the env var the binary reads its daemon-token
|
|
1536
1616
|
directory from, set to the `{dir}` whose `{dir}/run/daemon_token` is the
|
|
1537
1617
|
bootstrap's `daemon_token_path` (`to_daemon_token_dir`, which throws for a
|
|
@@ -1597,13 +1677,32 @@ Conventions that hold across them:
|
|
|
1597
1677
|
exit during the run, or a group teardown gave up on β naming the backend,
|
|
1598
1678
|
the exit and the stderr tail, so every global setup that awaits it fails
|
|
1599
1679
|
the run on an unclean shutdown; the dual-spawn setup tears both down before
|
|
1600
|
-
it throws.
|
|
1680
|
+
it throws. With `config.log` it tees stdout and stderr, whole lines per
|
|
1681
|
+
stream, into `log.path`, and teardown also rejects on each error-level line
|
|
1682
|
+
there no `log.allow_errors` entry names (`backend_log.ts`).
|
|
1683
|
+
- `testing/cross_backend/backend_log.ts` β `BackendLogConfig` (`{path,
|
|
1684
|
+
allow_errors}`), `BackendLogAllowance` (`{pattern, reason}`, a substring:
|
|
1685
|
+
configs cross to the workers through `provide`), `is_backend_error_line`
|
|
1686
|
+
(a `Logger` `π©errorπ©` line, a `tracing` `ERROR` event, or a Rust panic's
|
|
1687
|
+
first line, ANSI stripped; a
|
|
1688
|
+
bare `console.error` has no marker and is not seen),
|
|
1689
|
+
`find_unexpected_backend_errors`, `format_unexpected_backend_errors`,
|
|
1690
|
+
`with_backend_log_allowances(config, allow)`, and
|
|
1691
|
+
`SPINE_CROSS_SUITE_BACKEND_ERRORS` β what the shipped suites provoke on
|
|
1692
|
+
purpose (`fact_serving`'s masked 404 on both spines), which both family
|
|
1693
|
+
builders allow. `create_log_line_splitter` is how each stream is written
|
|
1694
|
+
whole lines at a time, decoding across chunks. A failed log write fails
|
|
1695
|
+
teardown. A line is not attributed to its test; a per-test check would need
|
|
1696
|
+
a log backdoor on both spines.
|
|
1601
1697
|
- `testing/transports/fetch_transport.ts` β cookie-threading HTTP transport
|
|
1602
1698
|
satisfying `RpcTestTransport`. Carries a name-keyed cookie jar that
|
|
1603
1699
|
updates on every response's `Set-Cookie` and re-sends on every request;
|
|
1604
1700
|
`Origin` defaults to `base_url` (`origin: null` disables for bearer-only
|
|
1605
1701
|
paths). A cookie cleared with `Max-Age` of zero or less leaves the jar, as
|
|
1606
|
-
it leaves a browser's.
|
|
1702
|
+
it leaves a browser's. A request naming `Authorization` or `X-Daemon-Token`
|
|
1703
|
+
and no `Cookie` throws while the jar is non-empty, since the jar's cookie
|
|
1704
|
+
would authenticate beside a dead token; send it over a cookie-free
|
|
1705
|
+
transport, or pass `Cookie` to send both on purpose. Exposes `cookies()` so `ws_transport` can thread the session
|
|
1607
1706
|
cookie onto the WS upgrade.
|
|
1608
1707
|
- `testing/transports/bootstrap.ts` β stateless `bootstrap({transport, config})`
|
|
1609
1708
|
POSTs `/api/account/bootstrap` against the running binary, parses the
|
|
@@ -1718,7 +1817,7 @@ Conventions that hold across them:
|
|
|
1718
1817
|
| `_testing_reset` | yes | the consumer's `reset_state(db)` first, on the same transaction (domain rows depend on auth rows); then every auth row wiped, `app_settings` and `bootstrap_lock` reset, a fresh keeper and any `extra_accounts` seeded through the in-process primitives |
|
|
1719
1818
|
| `_testing_drain_effects` | yes | answers `{ok: true}` once no request's effect flush (`deps.request_tracker`) and no audit pool write is in flight, those started while it waits included β never a handler still running, its own among them; the barrier before an audit or effect read (WS replies before its effects flush) |
|
|
1720
1819
|
| `_testing_db_invariants` | yes | every row breaking a `DB_INVARIANTS` check, read after each test |
|
|
1721
|
-
| `_testing_mint_session` | yes | a backdated session row behind a valid cookie (
|
|
1820
|
+
| `_testing_mint_session` | yes | a backdated session row behind a valid cookie, on any account (a dead session no wire path leaves) |
|
|
1722
1821
|
| `_testing_put_fact` | yes | seeds a fact, with an optional holder or external URL |
|
|
1723
1822
|
| `_testing_flood_notifications` | yes | queues notifications onto the caller's socket past its outbound budget (`invalid_params` past its caps, `no_connection` over HTTP) |
|
|
1724
1823
|
| `_testing_schema_snapshot`, `_testing_migration_tracker` | yes | the parity gates' reads |
|
|
@@ -1797,7 +1896,7 @@ re-roll the serve / daemon-info / drain boilerplate:
|
|
|
1797
1896
|
- `testing/cross_backend/full_spine_mount.ts` β `build_full_spine_rpc_actions(deps, options)` β the **full** live RPC mount: the declared bundle **plus** the off-declared-surface families the binary live-mounts (`_testing_*` backdoors, the cell verb set, the opt-in `actor_lookup` / `actor_search` resolvers). `build_full_spine_mount(deps, options)` builds it once for both of the binary's endpoints, returning `FullSpineMount` (`{rpc_actions, ws_actions}`): the WS list is `protocol_actions` plus every RPC action not already among them, then the WS-only room verbs and `room_notification_actions`, twinning the Rust `testing_spine_stub`, which serves one registry on RPC and WS (the one difference is `cancel` β a registered protocol action on TS, owned by the read loop on Rust β and the stub's RPC dispatcher refuses its `ws_only` room verbs). `options.room_registry` is the registry the room verbs, `_testing_room_evict`, and `_testing_reset` (which clears it) share β the binary builds it with `create_spine_room_registry(connections)` (exclusive, the default bounds; the twin of the stub's `stub_room_registry`) over its WS endpoints' connection registry; omitted, one over a fresh connection registry serves enumeration. Single-sources the mount so the binary and the `spine_method_coverage` reconciliation test build the same list. `create_spine_live_rpc_endpoints()` wraps the list, built on stub deps, as one endpoint at `SPINE_RPC_PATH` β the `live_rpc_endpoints` value the conformance table, the differential and the auth-row generator resolve off-surface methods from (no handler built there runs).
|
|
1798
1897
|
- `testing/cross_backend/ts_spine_backend_config.ts` β `ts_spine_node_backend_config()` / `ts_spine_bun_backend_config()` presets (in-memory pglet, no external infra), the TS analog of `rust_spine_stub_backend_config()`.
|
|
1799
1898
|
|
|
1800
|
-
fuz_app's own binary (`src/test/cross_backend/testing_spine_server{,_node,_bun}.ts`) is the worked example: one runtime-agnostic `build_spine_app` over `create_app_backend` + `create_app_server`, `build_full_spine_mount`'s lists on one RPC endpoint and two WS endpoints (`/api/ws` and `SPINE_ROLE_GATED_WS_PATH`) sharing one registry, so each socket hears a notification once; `_node` and `_bun` differ only in their adapter. It leaves `auth_cleanup` off, as the Rust stub does β a background pass would delete rows under a running suite; a consumer's binary may schedule it only when nothing its suites seed is already expired (the `expired_session`
|
|
1899
|
+
fuz_app's own binary (`src/test/cross_backend/testing_spine_server{,_node,_bun}.ts`) is the worked example: one runtime-agnostic `build_spine_app` over `create_app_backend` + `create_app_server`, `build_full_spine_mount`'s lists on one RPC endpoint and two WS endpoints (`/api/ws` and `SPINE_ROLE_GATED_WS_PATH`) sharing one registry, so each socket hears a notification once; `_node` and `_bun` differ only in their adapter. It leaves `auth_cleanup` off, as the Rust stub does β a background pass would delete rows under a running suite; a consumer's binary may schedule it only when nothing its suites seed is already expired (the `expired_session` and `expired_token` principals leave expired credential rows).
|
|
1801
1900
|
|
|
1802
1901
|
`capabilities.sse` is a mount flag, so each config states it; a consumer
|
|
1803
1902
|
binary that doesn't wire `audit_log_sse` states `false`. The real-HTTP
|
|
@@ -87,13 +87,11 @@ export interface MintTestSessionOptions {
|
|
|
87
87
|
/**
|
|
88
88
|
* Mint a real `auth_session` row for an existing account and return a
|
|
89
89
|
* validly-signed session cookie value referencing it, with the row's id (the
|
|
90
|
-
* token's hash) for a caller that revokes it. Test-only
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* in-process `fixture.mint_expired_session()` seam call this so the write
|
|
96
|
-
* semantics match across transports.
|
|
90
|
+
* token's hash) for a caller that revokes it. Test-only: pass a negative
|
|
91
|
+
* `expires_in_seconds` to produce an *expired server-side session* whose
|
|
92
|
+
* signed cookie envelope is still well-formed β what the TS
|
|
93
|
+
* `_testing_mint_session` action writes through, so its rows match the Rust
|
|
94
|
+
* twin's.
|
|
97
95
|
*
|
|
98
96
|
* @mutates `options.db` β inserts one `auth_session` row.
|
|
99
97
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAW5D,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3E,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAOhE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAIhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,MAAM,CAA6B,CAAC;AAE1F,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,QAAiB,CAAC;AA2CjD;;;;;GAKG;AACH,MAAM,WAAW,uCAAuC;IACvD,EAAE,EAAE,EAAE,CAAC;IACP,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,2DAA2D;AAC3D,MAAM,MAAM,0BAA0B,GAAG,uCAAuC,CAAC;AAEjF;;;;;;;;;;;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oBAAoB,KAC3B,OAAO,CAAC,aAAa,CAyBvB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,QAAO,IAAI,CACzD,gBAAgB,EAChB,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAa1C,CAAC"}
|
|
@@ -143,13 +143,11 @@ export const create_test_account_with_credentials = async (options) => {
|
|
|
143
143
|
/**
|
|
144
144
|
* Mint a real `auth_session` row for an existing account and return a
|
|
145
145
|
* validly-signed session cookie value referencing it, with the row's id (the
|
|
146
|
-
* token's hash) for a caller that revokes it. Test-only
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* in-process `fixture.mint_expired_session()` seam call this so the write
|
|
152
|
-
* semantics match across transports.
|
|
146
|
+
* token's hash) for a caller that revokes it. Test-only: pass a negative
|
|
147
|
+
* `expires_in_seconds` to produce an *expired server-side session* whose
|
|
148
|
+
* signed cookie envelope is still well-formed β what the TS
|
|
149
|
+
* `_testing_mint_session` action writes through, so its rows match the Rust
|
|
150
|
+
* twin's.
|
|
153
151
|
*
|
|
154
152
|
* @mutates `options.db` β inserts one `auth_session` row.
|
|
155
153
|
*/
|
|
@@ -17,7 +17,9 @@ import { type RequestContext } from '../auth/request_context.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const create_test_request_context: (role?: string) => RequestContext;
|
|
19
19
|
/**
|
|
20
|
-
* Create a Hono test app from route specs with optional auth context.
|
|
20
|
+
* Create a Hono test app from route specs with optional auth context. Each
|
|
21
|
+
* request's pending and post-commit effects are flushed before its response
|
|
22
|
+
* returns, as `create_test_app` awaits them.
|
|
21
23
|
*
|
|
22
24
|
* @param route_specs - the route specs to register
|
|
23
25
|
* @param auth_ctx - optional request context to inject via middleware
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_apps.d.ts","sourceRoot":"","sources":["../../src/lib/testing/auth_apps.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,C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