@fuzdev/fuz_app 0.110.1 → 0.112.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 +15 -11
- package/dist/actions/action_rpc.d.ts +3 -3
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +4 -6
- package/dist/actions/peer_ping.d.ts +8 -0
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +8 -0
- package/dist/actions/peer_request.d.ts +1 -1
- package/dist/actions/peer_request.js +1 -1
- package/dist/actions/perform_action.d.ts +16 -9
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +30 -21
- package/dist/actions/register_action_ws.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +88 -21
- package/dist/auth/CLAUDE.md +59 -10
- package/dist/auth/account_action_specs.d.ts +0 -2
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +10 -1
- package/dist/auth/account_queries.d.ts +22 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +70 -16
- package/dist/auth/account_schema.d.ts +27 -9
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +23 -3
- package/dist/auth/actor_search_actions.d.ts +3 -3
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +10 -6
- package/dist/auth/admin_action_specs.d.ts +0 -2
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/api_token_queries.d.ts +9 -4
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +36 -8
- package/dist/auth/app_settings_queries.d.ts +8 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -1
- package/dist/auth/app_settings_queries.js +16 -3
- package/dist/auth/audit_log_queries.d.ts +21 -3
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +38 -7
- package/dist/auth/audit_log_schema.d.ts +0 -1
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/auth_ddl.d.ts +6 -0
- package/dist/auth/auth_ddl.d.ts.map +1 -1
- package/dist/auth/auth_ddl.js +9 -0
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +3 -8
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +1 -1
- package/dist/auth/cell_field_actions.js +1 -1
- package/dist/auth/cell_grant_actions.js +1 -1
- package/dist/auth/cell_item_actions.js +1 -1
- package/dist/auth/invite_queries.d.ts +10 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +28 -7
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +10 -0
- package/dist/auth/role_grant_offer_ddl.d.ts +34 -2
- package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_ddl.js +61 -2
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +48 -53
- package/dist/auth/role_grant_queries.d.ts +18 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +58 -18
- package/dist/auth/session_queries.d.ts +12 -3
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +26 -6
- package/dist/db/CLAUDE.md +34 -0
- package/dist/db/cell_audit_queries.d.ts.map +1 -1
- package/dist/db/cell_audit_queries.js +3 -1
- package/dist/db/cell_field_queries.d.ts +12 -3
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +25 -7
- package/dist/db/cell_grant_queries.d.ts +10 -2
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +29 -11
- package/dist/db/cell_item_queries.d.ts +13 -2
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +27 -7
- package/dist/db/cell_queries.d.ts +32 -3
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +57 -22
- package/dist/db/fact_queries.d.ts +7 -0
- package/dist/db/fact_queries.d.ts.map +1 -1
- package/dist/db/fact_queries.js +27 -4
- package/dist/db/schema_ready.d.ts +6 -1
- package/dist/db/schema_ready.d.ts.map +1 -1
- package/dist/db/schema_ready.js +6 -2
- package/dist/db/sql_columns.d.ts +144 -0
- package/dist/db/sql_columns.d.ts.map +1 -0
- package/dist/db/sql_columns.js +164 -0
- package/dist/db/sql_identifier.d.ts +6 -5
- package/dist/db/sql_identifier.d.ts.map +1 -1
- package/dist/db/sql_identifier.js +6 -5
- package/dist/http/CLAUDE.md +4 -2
- package/dist/http/jsonrpc_helpers.d.ts +13 -0
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +13 -0
- package/dist/http/route_spec.d.ts +2 -2
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +1 -2
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +7 -2
- package/dist/testing/CLAUDE.md +55 -28
- package/dist/testing/admin_integration.d.ts +0 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +0 -1
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +4 -1
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +5 -4
- package/dist/testing/app_server.d.ts +4 -3
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -5
- package/dist/testing/attack_surface.d.ts +16 -0
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +36 -13
- package/dist/testing/audit_completeness.d.ts +0 -3
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +0 -1
- package/dist/testing/auth_apps.d.ts +9 -2
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -2
- package/dist/testing/cross_backend/account_lifecycle.d.ts +5 -4
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +7 -0
- package/dist/testing/cross_backend/action_manifest.d.ts +19 -3
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +10 -4
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +9 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +6 -0
- package/dist/testing/cross_backend/actor_lookup.d.ts +3 -2
- package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.d.ts +4 -2
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +1 -1
- package/dist/testing/cross_backend/cell_crud.d.ts +2 -2
- package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_crud.js +10 -0
- package/dist/testing/cross_backend/cell_gated_create.d.ts +3 -3
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.d.ts +2 -2
- package/dist/testing/cross_backend/cell_grant_role.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.d.ts +2 -2
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/expected_schema.json +1 -1
- package/dist/testing/cross_backend/fact_serving.d.ts +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts +17 -2
- package/dist/testing/cross_backend/make_cross_backend_project.d.ts.map +1 -1
- package/dist/testing/cross_backend/make_cross_backend_project.js +23 -3
- package/dist/testing/cross_backend/origin.d.ts +4 -2
- package/dist/testing/cross_backend/origin.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin.js +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +11 -7
- package/dist/testing/cross_backend/query_shape.d.ts +6 -5
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/ready.d.ts +2 -2
- package/dist/testing/cross_backend/ready.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_enumeration.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_enumeration.js +7 -1
- package/dist/testing/cross_backend/setup.d.ts +26 -6
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.d.ts +5 -1
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +1 -5
- package/dist/testing/cross_backend/testing_backdoor.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +5 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +6 -0
- package/dist/testing/cross_backend/token_scope_surface.d.ts +2 -2
- package/dist/testing/cross_backend/token_scope_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/wire_shapes.d.ts +22 -0
- package/dist/testing/cross_backend/wire_shapes.d.ts.map +1 -0
- package/dist/testing/cross_backend/wire_shapes.js +41 -0
- package/dist/testing/data_exposure.d.ts +0 -3
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +0 -1
- package/dist/testing/db.d.ts +62 -7
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +86 -28
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +15 -2
- package/dist/testing/round_trip.d.ts +0 -3
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +0 -4
- package/dist/testing/rpc_attack_surface.js +2 -2
- package/dist/testing/rpc_round_trip.d.ts +0 -3
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +0 -1
- package/dist/testing/schema_generators.d.ts +15 -0
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +45 -11
- package/dist/testing/standard.d.ts +5 -1
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +2 -7
- package/dist/timestamp.d.ts +58 -0
- package/dist/timestamp.d.ts.map +1 -0
- package/dist/timestamp.js +57 -0
- package/dist/ui/AdminOverview.svelte +5 -10
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -1
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +6 -2
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SQL identifier validation for
|
|
2
|
+
* SQL identifier validation for the places an identifier must be
|
|
3
|
+
* interpolated rather than parameterized.
|
|
3
4
|
*
|
|
4
|
-
* PostgreSQL
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* PostgreSQL parameterizes values only — table and column names in DDL
|
|
6
|
+
* (DROP TABLE, TRUNCATE, ALTER) and the alias `qualify_columns` prefixes
|
|
7
|
+
* onto a projection (`db/sql_columns.ts`) have to be string-interpolated.
|
|
8
|
+
* This validator ensures such identifiers are safe to interpolate.
|
|
8
9
|
*
|
|
9
10
|
* @module
|
|
10
11
|
*/
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -71,7 +71,7 @@ interface RouteContext {
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
- **`route.db`** — handler's main DB work. Wrapped in a transaction when `transaction: true` (default for non-GET); routes that opt out (`transaction: false`, e.g. signup / bootstrap) get the pool here directly and may call `route.db.transaction(...)` for their own scope.
|
|
74
|
-
- **`route.pending_effects`** — direct push for eager fire-and-forget pool writes (audit,
|
|
74
|
+
- **`route.pending_effects`** — direct push for eager fire-and-forget pool writes (audit, api-token usage tracking).
|
|
75
75
|
- **`route.post_commit_effects`** — do not push directly; reach for `emit_after_commit` from `http/pending_effects.ts`. The helper pushes a thunk that the flush middleware invokes after the handler returns, closing the microtask-ordering window that an eager `Promise.resolve().then(fn)` leaves open inside the wrapping `db.transaction`.
|
|
76
76
|
|
|
77
77
|
Pool-level fire-and-forget writes (audit logs, etc.) run through the bound
|
|
@@ -107,7 +107,9 @@ wrapper). See `auth/signup_routes.ts`.
|
|
|
107
107
|
|
|
108
108
|
**Ordering: 401 → authz → 403 → 400 → handler.** Mirrors the RPC dispatcher
|
|
109
109
|
(`actions/action_rpc.ts`) so HTTP RPC and REST fail with the same priority, and
|
|
110
|
-
matches the Rust spine, which validates handler-side
|
|
110
|
+
matches the Rust spine, which validates handler-side — with the one difference
|
|
111
|
+
that the dispatcher carries a per-action rate-limit phase (429) between 403 and
|
|
112
|
+
400 that REST has no equivalent of. Body validation runs last
|
|
111
113
|
so a caller the authority gates refuse learns nothing about the route's input
|
|
112
114
|
shape — a 400 would confirm the route exists and describe how to call it.
|
|
113
115
|
Params and query still validate first: they are part of addressing the route,
|
|
@@ -43,6 +43,19 @@ export declare const is_jsonrpc_error_response: (message: unknown) => message is
|
|
|
43
43
|
* Returns `null` if no valid id can be extracted.
|
|
44
44
|
*/
|
|
45
45
|
export declare const to_jsonrpc_message_id: (message_or_id: unknown) => JsonrpcRequestId | null;
|
|
46
|
+
/**
|
|
47
|
+
* The id an error response to a rejected envelope can echo: the frame's
|
|
48
|
+
* `id` when the frame is an object carrying a valid one, else `null`.
|
|
49
|
+
*
|
|
50
|
+
* Unlike `to_jsonrpc_message_id`, a scalar frame (`5`, `"x"`) is never read
|
|
51
|
+
* as its own id — a non-object body has no id to echo, which is the Rust
|
|
52
|
+
* twin's `classify` answer too. Both transports use this for the
|
|
53
|
+
* `invalid_request` reply.
|
|
54
|
+
*
|
|
55
|
+
* @param frame - the parsed body, of any shape
|
|
56
|
+
* @returns the echoable id, or `null`
|
|
57
|
+
*/
|
|
58
|
+
export declare const to_jsonrpc_envelope_id: (frame: unknown) => JsonrpcRequestId | null;
|
|
46
59
|
/**
|
|
47
60
|
* Normalizes input to JSON-RPC params format.
|
|
48
61
|
* Returns `undefined` for null/undefined, wraps primitives in `{value}`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonrpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/jsonrpc_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,eAAe,EACf,MAAM,cAAc,CAAC;AAKtB,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,GAClC,QAAQ,aAAa,EACrB,QAAQ,oBAAoB,GAAG,SAAS,EACxC,IAAI,gBAAgB,KAClB,cAUF,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,aAAa,KACnB,eAID,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,2BAA2B,GACvC,QAAQ,aAAa,EACrB,QAAQ,yBAAyB,GAAG,SAAS,KAC3C,mBASF,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,6BAA6B,GACzC,IAAI,oBAAoB,CAAC,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,cAAc,GAAG,KAAK,CAAC,cAAc,CAGrB,CAAC;AAE/B,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,cACI,CAAC;AAEtE,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,mBACE,CAAC;AAEzE,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,eACG,CAAC;AAEtE,uEAAuE;AACvE,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,oBACJ,CAAC;AAIrE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,eAAe,OAAO,KAAG,gBAAgB,GAAG,IAOjF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,KAAG,gBAAgB,GAAG,IACX,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAQxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAQrE,CAAC"}
|
|
@@ -110,6 +110,19 @@ export const to_jsonrpc_message_id = (message_or_id) => {
|
|
|
110
110
|
const maybe_id = typeof message_or_id === 'object' ? message_or_id.id : message_or_id;
|
|
111
111
|
return is_jsonrpc_request_id(maybe_id) ? maybe_id : null;
|
|
112
112
|
};
|
|
113
|
+
/**
|
|
114
|
+
* The id an error response to a rejected envelope can echo: the frame's
|
|
115
|
+
* `id` when the frame is an object carrying a valid one, else `null`.
|
|
116
|
+
*
|
|
117
|
+
* Unlike `to_jsonrpc_message_id`, a scalar frame (`5`, `"x"`) is never read
|
|
118
|
+
* as its own id — a non-object body has no id to echo, which is the Rust
|
|
119
|
+
* twin's `classify` answer too. Both transports use this for the
|
|
120
|
+
* `invalid_request` reply.
|
|
121
|
+
*
|
|
122
|
+
* @param frame - the parsed body, of any shape
|
|
123
|
+
* @returns the echoable id, or `null`
|
|
124
|
+
*/
|
|
125
|
+
export const to_jsonrpc_envelope_id = (frame) => typeof frame === 'object' ? to_jsonrpc_message_id(frame) : null;
|
|
113
126
|
/**
|
|
114
127
|
* Normalizes input to JSON-RPC params format.
|
|
115
128
|
* Returns `undefined` for null/undefined, wraps primitives in `{value}`.
|
|
@@ -83,8 +83,8 @@ export interface RouteContext {
|
|
|
83
83
|
db: Db;
|
|
84
84
|
/**
|
|
85
85
|
* Eager fire-and-forget queue — push the in-flight `Promise<void>` for
|
|
86
|
-
* pool writes already running (audit emits,
|
|
87
|
-
*
|
|
86
|
+
* pool writes already running (audit emits, api-token usage
|
|
87
|
+
* tracking). The flush middleware drains via
|
|
88
88
|
* `flush_pending_effects` after the handler returns.
|
|
89
89
|
*/
|
|
90
90
|
pending_effects: Array<Promise<void>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEN,KAAK,cAAc,EAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKN,KAAK,WAAW,EAChB,MAAM,oBAAoB,CAAC;AAC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,CAAC"}
|
|
@@ -276,8 +276,7 @@ export const create_app_server = async (options) => {
|
|
|
276
276
|
// Hono app assembly
|
|
277
277
|
const app = new Hono();
|
|
278
278
|
// Two-queue side-effect flush. `pending_effects` collects eager
|
|
279
|
-
// fire-and-forget promises (audit emits,
|
|
280
|
-
// usage). `post_commit_effects` collects deferred thunks pushed via
|
|
279
|
+
// fire-and-forget promises (audit emits, api-token usage). `post_commit_effects` collects deferred thunks pushed via
|
|
281
280
|
// `emit_after_commit` (WS notifications, anything that must observe a
|
|
282
281
|
// committed transaction). Both queues drain here, after the handler
|
|
283
282
|
// (and any wrapping `db.transaction`) returns. In test mode both are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAetD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"serve_fact_route.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/serve_fact_route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAetD,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkEjD,MAAM,WAAW,+BAA+B;IAC/C;;;;;;OAMG;IACH,IAAI,EAAE,OAAO,CAAC;IACd,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACZ;AAgHD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,GAC7C,SAAS,+BAA+B,KACtC,SAgDF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,SA0CF,CAAC"}
|
|
@@ -150,11 +150,16 @@ const cell_fact_params_schema = z.strictObject({
|
|
|
150
150
|
cell_id: Uuid,
|
|
151
151
|
hash: FactHashSchema
|
|
152
152
|
});
|
|
153
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* Shared error-schema entry: tighten the auto-derived 400 to the literal
|
|
155
|
+
* emitted by params validation. `issues` is optional because the framework
|
|
156
|
+
* emits it through `dev_only` — a production body carries the `error`
|
|
157
|
+
* literal alone.
|
|
158
|
+
*/
|
|
154
159
|
const params_400_error = {
|
|
155
160
|
400: z.looseObject({
|
|
156
161
|
error: z.literal(ERROR_INVALID_ROUTE_PARAMS),
|
|
157
|
-
issues: z.array(z.unknown())
|
|
162
|
+
issues: z.array(z.unknown()).optional()
|
|
158
163
|
})
|
|
159
164
|
};
|
|
160
165
|
/**
|
package/dist/testing/CLAUDE.md
CHANGED
|
@@ -121,23 +121,24 @@ factories accept any migration namespace set.
|
|
|
121
121
|
- `IS_CI` — `process.env.CI === 'true'`.
|
|
122
122
|
- `DbFactory` — `{name, create, close, skip, skip_reason?}`.
|
|
123
123
|
- `reset_pglite(db)` — `DROP SCHEMA public CASCADE` + recreate. Reuses a live PGlite instance.
|
|
124
|
-
- `create_pglite_factory(init_schema)` — in-memory; no external deps; `skip: false`. See WASM caching below.
|
|
124
|
+
- `create_pglite_factory(init_schema, options?)` — in-memory; no external deps; `skip: false`. `options.substitutable: false` pins the call site to PGlite when a substitute is installed. See WASM caching below.
|
|
125
|
+
- `set_substitute_db_factory(create_factory | null)` — install a `DbFactoryBuilder` that stands in for `create_pglite_factory`, so a suite written against PGlite runs on another driver without being edited. Injected rather than selected here: the drivers a substitute wraps live in test-side code this shipped module can't import. fuz_app's own switch is `src/test/db_substitute.ts`.
|
|
125
126
|
- `create_pg_factory(init_schema, test_url?)` — PostgreSQL; `skip: true` when `test_url` missing. Drops `schema_version` before `init_schema` so migrations re-evaluate against actual tables (prevents stale tracker rows from skipping migrations when DDL changes between sessions). Pool reused + cleaned up across `create()` calls.
|
|
126
127
|
- `auth_truncate_tables` — `['invite', 'api_token', 'auth_session', 'role_grant', 'role_grant_offer', 'actor', 'account']` in FK-safe order. Excludes `audit_log` — unit DB tests don't need to truncate it.
|
|
127
128
|
- `auth_integration_truncate_tables` — `auth_truncate_tables + ['audit_log']` for integration suites that exercise the audit path.
|
|
128
129
|
- `drop_auth_schema(db)` — `DROP SCHEMA public CASCADE; CREATE SCHEMA public`; call at the top of `init_schema` on persistent pg databases that may hold stale DDL from previous fuz_app versions. Drift-proof full-schema reset (despite the name, not auth-scoped) — same mechanism as `reset_pglite`.
|
|
129
130
|
- `create_describe_db(factories, truncate_tables)` — returns `describe_db(name, fn)` running `fn(get_db)` once per factory inside a `describe` with shared `beforeAll(create)` + `beforeEach(TRUNCATE)` + `afterAll(close)`. Skipped factories use `describe.skip`.
|
|
130
131
|
- `log_db_factory_status(factories)` — console summary of enabled / skipped factories.
|
|
132
|
+
- `assert_columns_match_live(db, table, columns)` — the named-projection drift guard: asserts a `*_COLUMNS` const (`ACCOUNT_COLUMNS`, `CELL_COLUMNS`, a consumer's own) names exactly the live `public`-schema columns of `table`, via `query_public_columns(db, {table})`. Per module, or iterated from a table → const registry (fuz_app's own: `src/test/db/column_projections.db.test.ts`).
|
|
131
133
|
|
|
132
134
|
**PGlite WASM caching.** `create_pglite_factory` shares a single PGlite
|
|
133
|
-
instance in a module-level ref (`module_db`) across
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
cost again. Each vitest file runs in its own worker, so no cross-file
|
|
137
|
-
contamination — but inside a file, suites share state until the schema is
|
|
135
|
+
instance in a module-level ref (`module_db`) across the PGlite factories it builds.
|
|
136
|
+
Subsequent `create()` calls `DROP SCHEMA public CASCADE` instead of paying the
|
|
137
|
+
~500–700ms WASM cold-start cost again, so suites share state until the next
|
|
138
138
|
reset. The `db` vitest project (opted into by the `.db.test.ts` suffix) runs
|
|
139
139
|
with `isolate: false` + `fileParallelism: false` to amortize WASM boot across
|
|
140
|
-
every DB test file
|
|
140
|
+
every DB test file — which also makes that one instance the whole run's; a
|
|
141
|
+
project that isolates its files gets one per worker instead.
|
|
141
142
|
|
|
142
143
|
## Test app assembly
|
|
143
144
|
|
|
@@ -206,7 +207,7 @@ test-only by construction.
|
|
|
206
207
|
- `AuthTestApps` — `{public, authed, keeper, by_role: Map<string, Hono>}`.
|
|
207
208
|
- `create_auth_test_apps(specs, roles)` — builds one app per auth level. Keeper app uses `credential_type: 'daemon_token'` so `require_credential_types(['daemon_token'])` passes.
|
|
208
209
|
- `select_auth_app(apps, auth)` — map `RouteAuth` → matching Hono app. Throws for missing `role:*` entries.
|
|
209
|
-
- `
|
|
210
|
+
- `create_route_skip_filter(skip_routes)` — the `'METHOD /path'` skip predicate the three adversarial sub-suites apply from their `skip_routes` option.
|
|
210
211
|
|
|
211
212
|
## Cross-impl schema parity
|
|
212
213
|
|
|
@@ -236,8 +237,10 @@ per-method auth shape.
|
|
|
236
237
|
- `cross_backend/action_manifest.ts` — `ActionManifest` / `ActionManifestEntry`
|
|
237
238
|
Zod schema (the `_testing_action_manifest` wire validator) + `build_action_manifest(specs)`,
|
|
238
239
|
which normalizes each spec to `{method, side_effects, account, actor, roles,
|
|
239
|
-
credential_types}` (auth axes pass through; `roles` /
|
|
240
|
-
to sorted arrays
|
|
240
|
+
credential_types, rate_limit}` (auth axes pass through; `roles` /
|
|
241
|
+
`credential_types` flatten to sorted arrays; `rate_limit` is the declared
|
|
242
|
+
class or an explicit `null`, so a missing key reads as drift rather than a
|
|
243
|
+
default). Twin of `schema_introspect.ts`. Excludes the protocol actions
|
|
241
244
|
(`heartbeat` / `cancel` / `peer/ping`) — `create_testing_action_manifest_action`
|
|
242
245
|
filters them via the `protocol_action_specs` method set (Rust drops
|
|
243
246
|
`PROTOCOL_ACTION_SPECS`); the two impls organize them differently (`peer/ping`
|
|
@@ -246,6 +249,8 @@ credential_types}` (auth axes pass through; `roles` / `credential_types` flatten
|
|
|
246
249
|
- `cross_backend/action_manifest_parity.ts` — `diff_action_manifests` /
|
|
247
250
|
`format_action_manifest_diffs` / `assert_action_manifests_equal` (twin of
|
|
248
251
|
`schema_parity.ts`) — asserts exact method-set + per-method auth-shape parity.
|
|
252
|
+
`ActionManifestDiff` kinds: `method_only_in`, `side_effects_differ`,
|
|
253
|
+
`rate_limit_differs`, `auth_field_differs`, `auth_list_differs`.
|
|
249
254
|
- `cross_backend/setup.ts` `capture_action_manifest(handle)` — dumps a backend's
|
|
250
255
|
manifest over the daemon-token `_testing_action_manifest` channel (twin of
|
|
251
256
|
`capture_schema_snapshot`).
|
|
@@ -254,9 +259,9 @@ It runs under the same dual-spawn `cross_backend_parity` project (one TS-spine +
|
|
|
254
259
|
Rust-stub spawn serves both gates). It complements the in-repo
|
|
255
260
|
`spine_method_coverage` reconciliation gate (which proves _mounted ⟹ covered_);
|
|
256
261
|
this proves _TS-mount-set ≡ Rust-mount-set_. The gate asserts **exact** parity —
|
|
257
|
-
every mounted method and its full auth shape (side-effects
|
|
258
|
-
must match across the two impls, with no allowlisted
|
|
259
|
-
`action_manifest_parity.cross.test.ts`).
|
|
262
|
+
every mounted method and its full auth shape (side-effects, the four auth axes,
|
|
263
|
+
the rate-limit class) must match across the two impls, with no allowlisted
|
|
264
|
+
divergences (see `action_manifest_parity.cross.test.ts`).
|
|
260
265
|
|
|
261
266
|
**Cross-impl gate pattern** — a dual-impl consumer running two backends
|
|
262
267
|
(a TS Hono server and a Rust spine server) against a shared schema, plus
|
|
@@ -366,7 +371,7 @@ Walks Zod schemas to generate valid values for adversarial/round-trip tests.
|
|
|
366
371
|
|
|
367
372
|
- `detect_format(field_schema)` — reads `format` / `pattern` from the JSON Schema representation.
|
|
368
373
|
- `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → recurse, enums → first entry, etc.). For branded-string refinements, walks a fallback chain synthesized from the `pattern` string the JSON Schema representation exposes: fixed-length hex (`^[0-9a-f]{N}$` — blake3 / sha256 / md5 digests; `0`.repeat(N)), prefix-lengthed slug (`^<prefix>_[A-Za-z0-9_-]{N}$` — `ApiTokenId`-style ids; `<prefix>_` + `x`.repeat(N)), absolute path prefix, URL prefix. First candidate that `safeParse` accepts is used.
|
|
369
|
-
- `resolve_valid_path(path, params_schema?)` — swaps `:param` for
|
|
374
|
+
- `resolve_valid_path(path, params_schema?)` — swaps `:param` for a value the params schema accepts. Prefers `test_<name>` wherever the field schema admits it (the param name keeps failure messages readable); otherwise a UUID param takes the nil UUID and anything else is synthesized from the schema, percent-encoded. A synthesized value containing `/` is refused (it would route elsewhere) and falls back to `test_<name>`.
|
|
370
375
|
- `generate_valid_body(input_schema) => Record<string, unknown> | undefined` — builds a body satisfying the input schema. Throws with Zod `issues` if the generated body fails validation — surfaces broken generation logic with a descriptive error rather than a confusing 400 downstream.
|
|
371
376
|
|
|
372
377
|
### `integration_helpers.ts` — route lookup + body checks
|
|
@@ -397,7 +402,16 @@ case per route):
|
|
|
397
402
|
4. **adversarial input validation** — delegated to `describe_adversarial_input`.
|
|
398
403
|
5. **adversarial 404 response validation** — delegated to `describe_adversarial_404`.
|
|
399
404
|
|
|
400
|
-
Options: `{build: () => AppSurfaceSpec, snapshot_path, expected_public_routes, expected_api_middleware, roles, api_path_prefix?, security_policy?, error_schema_tightness?}`.
|
|
405
|
+
Options: `{build: () => AppSurfaceSpec, snapshot_path, expected_public_routes, expected_api_middleware, roles, api_path_prefix?, security_policy?, error_schema_tightness?, skip_routes?}`.
|
|
406
|
+
|
|
407
|
+
`skip_routes` is a list of `'METHOD /path'` surface keys the three
|
|
408
|
+
adversarial sub-suites drop, forwarded to each of them (it also sits on
|
|
409
|
+
`AdversarialTestOptions` for the standalone `describe_adversarial_auth` /
|
|
410
|
+
`describe_adversarial_input` / `describe_adversarial_404` calls). It is the
|
|
411
|
+
escape hatch for a route that cannot be driven generically at all — a
|
|
412
|
+
handler needing real seeded state, a path segment no schema describes. A
|
|
413
|
+
route whose params merely carry a format needs no entry: `resolve_valid_path`
|
|
414
|
+
synthesizes a segment the route accepts.
|
|
401
415
|
|
|
402
416
|
Also exported: `describe_adversarial_auth(options)` (group 3 on its own) and
|
|
403
417
|
`build_error_schema_lookup(specs, middleware_specs?)` (pre-built
|
|
@@ -479,7 +493,7 @@ For every route spec, fires a valid request with matching auth and validates
|
|
|
479
493
|
the response against declared schemas. DB-backed via `create_test_app`.
|
|
480
494
|
Per-route test (`test.each`) — one line per route in the vitest output.
|
|
481
495
|
|
|
482
|
-
Options: `{setup_test, surface_source,
|
|
496
|
+
Options: `{setup_test, surface_source, skip_routes?, input_overrides?, success_fixtures?}`.
|
|
483
497
|
`input_overrides` is a `Map<"METHOD /path", body>` — override generated
|
|
484
498
|
bodies for routes whose input schema can't round-trip cleanly (e.g. fields
|
|
485
499
|
that must reference DB state).
|
|
@@ -492,7 +506,7 @@ picks them up separately.
|
|
|
492
506
|
DB-backed round-trip for RPC: one POST test for all methods, one GET test
|
|
493
507
|
for `side_effects: false` methods. Successful responses validate against
|
|
494
508
|
`action.spec.output`; error responses validate as well-formed JSON-RPC error
|
|
495
|
-
envelopes. Options: `{setup_test, surface_source,
|
|
509
|
+
envelopes. Options: `{setup_test, surface_source, session_options, rpc_endpoints, skip_methods?, input_overrides?, success_fixtures?}`.
|
|
496
510
|
The admin RPC auth test picks a session-based identity (`authed` / `admin` /
|
|
497
511
|
bootstrapped keeper) based on `method.auth`; keeper uses the daemon token.
|
|
498
512
|
|
|
@@ -567,7 +581,7 @@ Support functions: `collect_json_schema_property_names(schema)` (walks
|
|
|
567
581
|
`assert_output_schemas_no_sensitive_fields(surface, fields?)`,
|
|
568
582
|
`assert_non_admin_schemas_no_admin_fields(surface, fields?)`.
|
|
569
583
|
|
|
570
|
-
Options: `{setup_test, surface_source,
|
|
584
|
+
Options: `{setup_test, surface_source, sensitive_fields?, admin_only_fields?, skip_routes?}`.
|
|
571
585
|
|
|
572
586
|
### `rate_limiting.ts` — `describe_rate_limiting_tests`
|
|
573
587
|
|
|
@@ -625,7 +639,7 @@ Override with
|
|
|
625
639
|
minimal route sets whose declared error codes outpace the suite's
|
|
626
640
|
denial-path drivers).
|
|
627
641
|
|
|
628
|
-
Options: `{setup_test, surface_source,
|
|
642
|
+
Options: `{setup_test, surface_source, session_options, rpc_endpoints, error_coverage_min?}`.
|
|
629
643
|
|
|
630
644
|
### `admin_integration.ts` — `describe_standard_admin_integration_tests`
|
|
631
645
|
|
|
@@ -645,7 +659,7 @@ header/account mismatch. Direct-grant fixtures (test focuses on revoke or
|
|
|
645
659
|
isolation, not the consent path) go through `create_test_role_grant_direct`
|
|
646
660
|
from `db_entities.ts`.
|
|
647
661
|
|
|
648
|
-
Required options: `{setup_test, surface_source,
|
|
662
|
+
Required options: `{setup_test, surface_source, session_options, rpc_endpoints: RpcEndpointsSuiteOption, roles: RoleSchemaResult, admin_prefix?}`.
|
|
649
663
|
|
|
650
664
|
`rpc_endpoints` is `Array<RpcEndpointSpec> | ((ctx: AppServerContext) => Array<RpcEndpointSpec>)` —
|
|
651
665
|
the same `RpcEndpointsSuiteOption` union every DB-backed suite accepts
|
|
@@ -827,7 +841,7 @@ Shared conventions (`.db.test.ts` suffix, `isolate: false` semantics,
|
|
|
827
841
|
`isolate: false`) live in Skill(fuz-stack) testing-patterns. fuz_app-specific
|
|
828
842
|
points:
|
|
829
843
|
|
|
830
|
-
- **`await_pending_effects: true`** is set by `create_test_app`. Fire-and-forget effects (audit logs,
|
|
844
|
+
- **`await_pending_effects: true`** is set by `create_test_app`. Fire-and-forget effects (audit logs, api-token usage tracking, WS fan-out via `emit_after_commit`) resolve before the response returns, so tests can assert on side effects inline without manual flushing.
|
|
831
845
|
- **Deep-path imports only.** Import from the canonical module (`testing/db.js`, `testing/rpc_helpers.js`, etc.); fuz_app's `dist/` ships no barrel.
|
|
832
846
|
- **DI via small `*Deps` interfaces.** Stub factories accept the same narrow `*Deps` contracts production code uses — never `Pick<GodType, ...>`. New helpers needing env/fs/logger take `EnvDeps` / `FsReadDeps` / `Logger` from `runtime/deps.ts` or `@fuzdev/fuz_util/log.ts`.
|
|
833
847
|
- **Keep the shared echo routes in sync with public surface.** When middleware or public API gains a new context variable, header, or field, update the echo in `middleware.ts` (`create_bearer_auth_test_app`, `create_test_middleware_stack_app`) alongside the assertions in `src/test/auth/*.test.ts`. Drift surfaces as a missed assertion, not a test failure.
|
|
@@ -1178,10 +1192,23 @@ never sees them). Both parse every success response against the verb's Zod
|
|
|
1178
1192
|
**output** schema, so a TS↔Rust envelope drift fails the suite — not just a
|
|
1179
1193
|
payload-field drift. Call-site primitives (`cross_rpc_call` / `error_reason` /
|
|
1180
1194
|
`expect_output`) live in `cross_backend/cell_cross_helpers.ts`; the shared
|
|
1181
|
-
options shape is `
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1195
|
+
options shape is `RpcPathCapabilityGatedCrossSuiteOptions` from
|
|
1196
|
+
`cross_backend/setup.ts`. `cross_backend/wire_shapes.ts` carries
|
|
1197
|
+
`assert_iso8601_seconds` / `assert_iso8601_seconds_nullable` — the byte-level
|
|
1198
|
+
gate on the canonical second-precision UTC timestamp shape, which a
|
|
1199
|
+
`z.string()` output schema can't catch (a millisecond stamp parses fine).
|
|
1200
|
+
The shared suites pin it on the account-status account + role grants, a
|
|
1201
|
+
session, a minted + listed API token, a cell's `created_at` / `updated_at`,
|
|
1202
|
+
an audit row, an admin account listing, and an offer's `created_at` /
|
|
1203
|
+
`expires_at`. `cross_backend/setup.ts` carries the four bases every
|
|
1204
|
+
imperative cross suite aliases: `CrossSuiteOptions` (`setup_test` alone),
|
|
1205
|
+
`CapabilityGatedCrossSuiteOptions` (+ `capabilities` — `ready`),
|
|
1206
|
+
`RpcPathCrossSuiteOptions` (+ `rpc_path?` — origin, body-size, actor
|
|
1207
|
+
lookup/search, app settings, testing backdoor), and the intersection
|
|
1208
|
+
`RpcPathCapabilityGatedCrossSuiteOptions` (every `cell_*` suite, query-shape,
|
|
1209
|
+
token-scope surface, fact-serving, account lifecycle). A suite takes the
|
|
1210
|
+
capability-carrying variant only when it actually gates cases on a flag, so
|
|
1211
|
+
the option type states whether the bundle is read.
|
|
1185
1212
|
|
|
1186
1213
|
- **`describe_cell_crud_cross_tests`** (gates on `capabilities.cell_crud`) —
|
|
1187
1214
|
the create → get → update → delete → list lifecycle threading the id, plus
|
|
@@ -1386,7 +1413,7 @@ censuses). Cross-process only; fuz_app's own wiring is
|
|
|
1386
1413
|
|
|
1387
1414
|
### Origin verification parity — `cross_backend/origin.ts`
|
|
1388
1415
|
|
|
1389
|
-
`describe_origin_cross_tests({setup_test,
|
|
1416
|
+
`describe_origin_cross_tests({setup_test, rpc_path?})` — the
|
|
1390
1417
|
imperative Origin-verification suite: disallowed `Origin` → 403 `forbidden_origin` (refused
|
|
1391
1418
|
before dispatch), absent `Origin` → request passes (non-browser direct access).
|
|
1392
1419
|
Imperative (not a conformance-table row) because origin rejection is
|
|
@@ -1460,7 +1487,7 @@ drift-guarded by `src/test/cross_backend/spine_expected_schema.db.test.ts`
|
|
|
1460
1487
|
|
|
1461
1488
|
### Testing-backdoor credential gate — `cross_backend/testing_backdoor.ts`
|
|
1462
1489
|
|
|
1463
|
-
`describe_testing_backdoor_cross_tests({setup_test,
|
|
1490
|
+
`describe_testing_backdoor_cross_tests({setup_test, rpc_path?})` —
|
|
1464
1491
|
the negative-credential parity suite for the `_testing_*` backdoor actions.
|
|
1465
1492
|
For each of `_testing_reset` / `_testing_mint_session` / `_testing_put_fact` /
|
|
1466
1493
|
`_testing_schema_snapshot` (the three privileged writes plus the schema-dump
|
|
@@ -1470,7 +1497,7 @@ proving the daemon-token gate that fences each backdoor action holds end-to-end
|
|
|
1470
1497
|
on the real dispatcher (the spec-derived `describe_rpc_attack_surface_tests`
|
|
1471
1498
|
never enumerates them because they're off the declared surface). Each method is
|
|
1472
1499
|
sent with **valid** params so each case varies only the credential (validation
|
|
1473
|
-
runs after the gates — order is 401 → authz → 403 → 400); the handler never
|
|
1500
|
+
runs after the gates — order is 401 → authz → 403 → 429 → 400); the handler never
|
|
1474
1501
|
runs. Cited property: `docs/security.md`
|
|
1475
1502
|
§Test Backdoor Actions. Cross-process only (the `_testing_*` actions are
|
|
1476
1503
|
mounted on the spawned binary, not the in-process app — like the ws/sse
|
|
@@ -3,7 +3,6 @@ import type { SessionOptions } from '../auth/session_cookie.js';
|
|
|
3
3
|
import { type RoleSchemaResult } from '../auth/role_schema.js';
|
|
4
4
|
import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
|
|
5
5
|
import type { AppSurfaceSpec } from '../http/surface.js';
|
|
6
|
-
import type { BackendCapabilities } from './cross_backend/capabilities.js';
|
|
7
6
|
import type { SetupTest } from './cross_backend/setup.js';
|
|
8
7
|
/**
|
|
9
8
|
* Configuration for `describe_standard_admin_integration_tests`.
|
|
@@ -21,8 +20,6 @@ export interface StandardAdminIntegrationTestOptions {
|
|
|
21
20
|
* shape for in-process and cross-process tests).
|
|
22
21
|
*/
|
|
23
22
|
surface_source: AppSurfaceSpec;
|
|
24
|
-
/** Backend capability declarations. */
|
|
25
|
-
capabilities: BackendCapabilities;
|
|
26
23
|
/** Session config — needed for cookie_name + factory-form rpc_endpoints resolution. */
|
|
27
24
|
session_options: SessionOptions<string>;
|
|
28
25
|
/** Role schema result from `create_role_schema()` — used to determine valid/invalid/web-grantable roles. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAgC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAW3E,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAmB1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"admin_integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/admin_integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAgC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAW3E,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAmB1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,0BAA0B,CAAC;AAYvE;;GAEG;AACH,MAAM,WAAW,mCAAmC;IACnD;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,uFAAuF;IACvF,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,4GAA4G;IAC5G,KAAK,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yCAAyC,GACrD,SAAS,mCAAmC,KAC1C,IAk5BF,CAAC"}
|
|
@@ -77,7 +77,6 @@ export const describe_standard_admin_integration_tests = (options) => {
|
|
|
77
77
|
// confusing test failure when `rpc_endpoints` is missing.
|
|
78
78
|
const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_options);
|
|
79
79
|
const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
|
|
80
|
-
void options.capabilities;
|
|
81
80
|
describe('standard_admin_integration', () => {
|
|
82
81
|
const { cookie_name } = options.session_options;
|
|
83
82
|
const { role_specs } = options.roles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAyBlE;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,
|
|
1
|
+
{"version":3,"file":"adversarial_404.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_404.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAoB7B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAyBlE;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,sBAAsB,KAAG,IA6E1E,CAAC"}
|
|
@@ -13,7 +13,7 @@ import './assert_dev_env.js';
|
|
|
13
13
|
import { test, assert, describe } from 'vitest';
|
|
14
14
|
import { z } from 'zod';
|
|
15
15
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
16
|
-
import { create_auth_test_apps, select_auth_app } from './auth_apps.js';
|
|
16
|
+
import { create_auth_test_apps, create_route_skip_filter, select_auth_app } from './auth_apps.js';
|
|
17
17
|
import { resolve_valid_path, generate_valid_body } from './schema_generators.js';
|
|
18
18
|
/**
|
|
19
19
|
* Extract the error code from a 404 Zod schema for use in the stub handler.
|
|
@@ -51,6 +51,7 @@ const extract_404_error_code = (schema) => {
|
|
|
51
51
|
export const describe_adversarial_404 = (options) => {
|
|
52
52
|
const { build, roles } = options;
|
|
53
53
|
const { surface, route_specs } = build();
|
|
54
|
+
const is_skipped = create_route_skip_filter(options.skip_routes);
|
|
54
55
|
// Build spec lookup for Zod schema access
|
|
55
56
|
const spec_lookup = new Map();
|
|
56
57
|
for (const spec of route_specs) {
|
|
@@ -63,6 +64,8 @@ export const describe_adversarial_404 = (options) => {
|
|
|
63
64
|
continue;
|
|
64
65
|
if (!route.error_schemas || !('404' in route.error_schemas))
|
|
65
66
|
continue;
|
|
67
|
+
if (is_skipped(route))
|
|
68
|
+
continue;
|
|
66
69
|
const key = `${route.method} ${route.path}`;
|
|
67
70
|
const spec = spec_lookup.get(key);
|
|
68
71
|
if (!spec?.params || !spec.errors?.[404])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adversarial_input.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,OAAO,EAEN,0BAA0B,EAC1B,uBAAuB,EAGvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA8ClE,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,UAAU,cAAc;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC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AC;CAC9B;AAID;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,KAAK,CAAC,aAAa,CAsMtF,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,cAAc,CA+B3F,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,aAAa,CA4CxF,CAAC;AAqBF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,sBAAsB,KAAG,IAmN5E,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { zod_unwrap_to_object, zod_extract_fields } from '@fuzdev/fuz_util/zod.t
|
|
|
18
18
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
19
19
|
import { filter_routes_with_input, filter_routes_with_params, filter_routes_with_query } from '../http/surface_query.js';
|
|
20
20
|
import { ValidationError, ERROR_INVALID_REQUEST_BODY, ERROR_INVALID_JSON_BODY, ERROR_INVALID_ROUTE_PARAMS, ERROR_INVALID_QUERY_PARAMS } from '../http/error_schemas.js';
|
|
21
|
-
import { create_auth_test_apps, select_auth_app } from './auth_apps.js';
|
|
21
|
+
import { create_auth_test_apps, create_route_skip_filter, select_auth_app } from './auth_apps.js';
|
|
22
22
|
import { detect_format, generate_valid_value, resolve_valid_path } from './schema_generators.js';
|
|
23
23
|
// --- Payload generation ---
|
|
24
24
|
/** One wrong-type value per base type — one representative is sufficient. */
|
|
@@ -374,9 +374,10 @@ const build_query_url = (path, query) => {
|
|
|
374
374
|
export const describe_adversarial_input = (options) => {
|
|
375
375
|
const { build, roles } = options;
|
|
376
376
|
const { surface, route_specs } = build();
|
|
377
|
-
const
|
|
378
|
-
const
|
|
379
|
-
const
|
|
377
|
+
const is_skipped = create_route_skip_filter(options.skip_routes);
|
|
378
|
+
const routes_with_input = filter_routes_with_input(surface).filter((r) => !is_skipped(r));
|
|
379
|
+
const routes_with_params = filter_routes_with_params(surface).filter((r) => !is_skipped(r));
|
|
380
|
+
const routes_with_query = filter_routes_with_query(surface).filter((r) => !is_skipped(r));
|
|
380
381
|
if (routes_with_input.length === 0 &&
|
|
381
382
|
routes_with_params.length === 0 &&
|
|
382
383
|
routes_with_query.length === 0)
|
|
@@ -3,8 +3,9 @@ import './assert_dev_env.js';
|
|
|
3
3
|
* Bootstrapped app server factory for integration tests.
|
|
4
4
|
*
|
|
5
5
|
* Creates a keeper account, API token, and signed session cookie on a
|
|
6
|
-
* database. By default uses a cached in-memory PGlite (shared WASM instance
|
|
7
|
-
* per
|
|
6
|
+
* database. By default uses a cached in-memory PGlite (one shared WASM instance
|
|
7
|
+
* per loaded copy of `testing/db.ts` — once per run under the `db` project's
|
|
8
|
+
* `isolate: false` + `fileParallelism: false`); pass `db` to use
|
|
8
9
|
* an existing database (any driver) instead.
|
|
9
10
|
*
|
|
10
11
|
* Also provides `create_test_app` — a combined helper that creates both
|
|
@@ -312,7 +313,7 @@ export interface TestApp {
|
|
|
312
313
|
*
|
|
313
314
|
* A fresh Hono app is created each call — middleware closures bind to the
|
|
314
315
|
* server's deps (db, keyring), so reuse across servers is unsafe.
|
|
315
|
-
* The expensive resource (PGlite WASM) is cached separately in `
|
|
316
|
+
* The expensive resource (PGlite WASM) is cached separately in `testing/db.ts`.
|
|
316
317
|
*
|
|
317
318
|
* @param options - test app configuration
|
|
318
319
|
* @returns a `TestApp` ready for HTTP testing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B
|
|
1
|
+
{"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;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C;IACjB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,aAAa,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,GAAG,EAAE,IAAI,CAAC;IACV,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,sBAAsB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,4EAA4E;IAC5E,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GACzC,SAAS,gCAAgC,KACvC,OAAO,CAAC,mBAAmB,CA0E7B,CAAC"}
|
|
@@ -31,8 +31,8 @@ export const stub_password_deps = {
|
|
|
31
31
|
/** 64-hex-char test cookie secret — deterministic, never used in production. */
|
|
32
32
|
export const TEST_COOKIE_SECRET = 'a'.repeat(64);
|
|
33
33
|
// Module-level PGlite factory for create_test_app_server when no db is provided.
|
|
34
|
-
// Shares the WASM instance cache from
|
|
35
|
-
// within
|
|
34
|
+
// Shares the WASM instance cache from `testing/db.ts`, avoiding redundant cold starts
|
|
35
|
+
// within one loaded copy of that module. Schema is reset on each create() call.
|
|
36
36
|
const fallback_pglite_factory = create_pglite_factory(async (db) => {
|
|
37
37
|
await run_migrations(db, [auth_migration_ns]);
|
|
38
38
|
});
|
|
@@ -205,10 +205,16 @@ const _build_test_backend = async (options) => {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
// In-memory PGlite via cached factory — reuses the WASM instance from
|
|
208
|
+
// In-memory PGlite via cached factory — reuses the WASM instance from `testing/db.ts`
|
|
209
209
|
// instead of creating a new PGlite each time. Schema is reset and migrations re-run
|
|
210
|
-
// on each call, but the expensive WASM cold start only happens once per
|
|
210
|
+
// on each call, but the expensive WASM cold start only happens once per loaded
|
|
211
|
+
// copy of `testing/db.ts` — under the `db` project's `isolate: false` +
|
|
212
|
+
// `fileParallelism: false` that is once for the whole run.
|
|
211
213
|
// `migration_namespaces` selects an auth+extras factory; auth-only is the default.
|
|
214
|
+
// `db_type` below names PGlite unconditionally: a run that installs a substitute
|
|
215
|
+
// factory (`set_substitute_db_factory`) before this module loads gets that driver
|
|
216
|
+
// here, and no caller reads this field to pick behavior — it is reported, not
|
|
217
|
+
// dispatched on.
|
|
212
218
|
const db = await resolve_fallback_factory(migration_namespaces).create();
|
|
213
219
|
const audit = audit_factory({ db, log: test_log });
|
|
214
220
|
backend = {
|
|
@@ -255,7 +261,7 @@ export const create_test_app_server = async (options) => {
|
|
|
255
261
|
*
|
|
256
262
|
* A fresh Hono app is created each call — middleware closures bind to the
|
|
257
263
|
* server's deps (db, keyring), so reuse across servers is unsafe.
|
|
258
|
-
* The expensive resource (PGlite WASM) is cached separately in `
|
|
264
|
+
* The expensive resource (PGlite WASM) is cached separately in `testing/db.ts`.
|
|
259
265
|
*
|
|
260
266
|
* @param options - test app configuration
|
|
261
267
|
* @returns a `TestApp` ready for HTTP testing
|
|
@@ -7,6 +7,14 @@ export interface AdversarialTestOptions {
|
|
|
7
7
|
build: () => AppSurfaceSpec;
|
|
8
8
|
/** All roles in the app (e.g. `['admin', 'keeper']`). */
|
|
9
9
|
roles: Array<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Routes to skip, in `'METHOD /path'` form (the surface key) — the escape
|
|
12
|
+
* hatch every sibling suite carries. Reach for it only when a route
|
|
13
|
+
* cannot be driven generically at all (a handler needing real seeded
|
|
14
|
+
* state, a path segment no schema can describe); a route whose params
|
|
15
|
+
* merely have a format is handled by the synthesizer.
|
|
16
|
+
*/
|
|
17
|
+
skip_routes?: Array<string>;
|
|
10
18
|
}
|
|
11
19
|
/**
|
|
12
20
|
* Generate adversarial HTTP auth enforcement test suites.
|
|
@@ -63,6 +71,14 @@ export interface StandardAttackSurfaceOptions {
|
|
|
63
71
|
* to skip the assertion and keep the audit log informational-only.
|
|
64
72
|
*/
|
|
65
73
|
error_schema_tightness?: ErrorSchemaTightnessOptions | null;
|
|
74
|
+
/**
|
|
75
|
+
* Routes the three adversarial sub-suites skip, in `'METHOD /path'` form
|
|
76
|
+
* — the escape hatch every sibling suite carries (`round_trip`,
|
|
77
|
+
* `data_exposure`). Reach for it only when a route cannot be driven
|
|
78
|
+
* generically at all; a route whose path params merely carry a format is
|
|
79
|
+
* handled by the params-schema-aware synthesizer.
|
|
80
|
+
*/
|
|
81
|
+
skip_routes?: Array<string>;
|
|
66
82
|
}
|
|
67
83
|
/**
|
|
68
84
|
* Run the standard attack surface test suite.
|