@fuzdev/fuz_app 0.169.0 → 0.171.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.
Files changed (171) hide show
  1. package/dist/actions/CLAUDE.md +19 -21
  2. package/dist/actions/action_codegen.d.ts +27 -18
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +90 -90
  5. package/dist/actions/action_event.d.ts +0 -8
  6. package/dist/actions/action_event.d.ts.map +1 -1
  7. package/dist/actions/action_event.js +7 -6
  8. package/dist/actions/action_event_data.d.ts +4 -4
  9. package/dist/actions/action_rpc.d.ts +1 -1
  10. package/dist/actions/action_rpc.d.ts.map +1 -1
  11. package/dist/actions/action_rpc.js +6 -7
  12. package/dist/actions/action_spec.d.ts +8 -10
  13. package/dist/actions/action_spec.d.ts.map +1 -1
  14. package/dist/actions/action_spec.js +1 -1
  15. package/dist/actions/action_types.d.ts +4 -4
  16. package/dist/actions/action_types.d.ts.map +1 -1
  17. package/dist/actions/action_types.js +2 -2
  18. package/dist/actions/broadcast_api.d.ts +2 -2
  19. package/dist/actions/broadcast_api.js +4 -4
  20. package/dist/actions/compile_action_registry.d.ts +6 -7
  21. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  22. package/dist/actions/compile_action_registry.js +8 -9
  23. package/dist/actions/peer_ping.d.ts.map +1 -1
  24. package/dist/actions/peer_ping.js +3 -2
  25. package/dist/actions/perform_action.d.ts +6 -6
  26. package/dist/actions/perform_action.d.ts.map +1 -1
  27. package/dist/actions/perform_action.js +11 -10
  28. package/dist/actions/socket.svelte.d.ts +1 -1
  29. package/dist/actions/socket.svelte.js +2 -2
  30. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  31. package/dist/actions/ws_socket_session.js +2 -1
  32. package/dist/auth/CLAUDE.md +11 -11
  33. package/dist/auth/admin_action_specs.d.ts +24 -24
  34. package/dist/auth/audit_emitter.d.ts +6 -7
  35. package/dist/auth/audit_emitter.d.ts.map +1 -1
  36. package/dist/auth/audit_emitter.js +11 -22
  37. package/dist/auth/audit_log_ddl.d.ts +1 -1
  38. package/dist/auth/audit_log_ddl.js +1 -1
  39. package/dist/auth/audit_log_queries.d.ts +0 -13
  40. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  41. package/dist/auth/audit_log_queries.js +3 -3
  42. package/dist/auth/audit_log_schema.d.ts +14 -15
  43. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  44. package/dist/auth/audit_log_schema.js +1 -1
  45. package/dist/auth/auth_ddl.d.ts +1 -1
  46. package/dist/auth/auth_ddl.js +1 -1
  47. package/dist/auth/cell_action_specs.d.ts +54 -54
  48. package/dist/auth/cell_actions.d.ts +2 -2
  49. package/dist/auth/cell_actions.js +5 -5
  50. package/dist/auth/middleware.d.ts +6 -2
  51. package/dist/auth/middleware.d.ts.map +1 -1
  52. package/dist/auth/middleware.js +14 -2
  53. package/dist/auth/request_context.d.ts.map +1 -1
  54. package/dist/auth/request_context.js +7 -9
  55. package/dist/auth/role_grant_offer_action_specs.d.ts +6 -6
  56. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  57. package/dist/auth/role_grant_offer_ddl.js +1 -1
  58. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  59. package/dist/auth/role_grant_offer_notifications.js +2 -3
  60. package/dist/auth/self_service_role_actions.d.ts +1 -1
  61. package/dist/auth/self_service_role_actions.js +1 -1
  62. package/dist/env/env_schemas.d.ts +1 -2
  63. package/dist/env/env_schemas.d.ts.map +1 -1
  64. package/dist/env/env_schemas.js +3 -4
  65. package/dist/http/CLAUDE.md +30 -31
  66. package/dist/http/auth_shape.d.ts +14 -32
  67. package/dist/http/auth_shape.d.ts.map +1 -1
  68. package/dist/http/auth_shape.js +14 -49
  69. package/dist/http/error_schemas.d.ts +18 -18
  70. package/dist/http/json_text.d.ts +53 -0
  71. package/dist/http/json_text.d.ts.map +1 -0
  72. package/dist/http/json_text.js +152 -0
  73. package/dist/http/jsonrpc_helpers.js +1 -1
  74. package/dist/http/route_error_check.d.ts +2 -2
  75. package/dist/http/route_error_check.d.ts.map +1 -1
  76. package/dist/http/route_error_check.js +2 -3
  77. package/dist/http/route_errors.d.ts +4 -4
  78. package/dist/http/route_errors.d.ts.map +1 -1
  79. package/dist/http/route_errors.js +0 -13
  80. package/dist/http/route_result.d.ts +2 -1
  81. package/dist/http/route_result.d.ts.map +1 -1
  82. package/dist/http/route_spec.d.ts +34 -37
  83. package/dist/http/route_spec.d.ts.map +1 -1
  84. package/dist/http/route_spec.js +31 -31
  85. package/dist/http/schema_helpers.d.ts +77 -68
  86. package/dist/http/schema_helpers.d.ts.map +1 -1
  87. package/dist/http/schema_helpers.js +54 -77
  88. package/dist/http/surface.d.ts.map +1 -1
  89. package/dist/http/surface.js +6 -8
  90. package/dist/primitive_schemas.d.ts +9 -17
  91. package/dist/primitive_schemas.d.ts.map +1 -1
  92. package/dist/primitive_schemas.js +9 -17
  93. package/dist/realtime/sse.d.ts +3 -3
  94. package/dist/realtime/sse.d.ts.map +1 -1
  95. package/dist/realtime/sse.js +2 -2
  96. package/dist/schema_issues.d.ts +39 -147
  97. package/dist/schema_issues.d.ts.map +1 -1
  98. package/dist/schema_issues.js +39 -352
  99. package/dist/schema_meta.d.ts +63 -136
  100. package/dist/schema_meta.d.ts.map +1 -1
  101. package/dist/schema_meta.js +37 -184
  102. package/dist/sensitivity.d.ts +3 -5
  103. package/dist/sensitivity.d.ts.map +1 -1
  104. package/dist/sensitivity.js +3 -5
  105. package/dist/testing/CLAUDE.md +20 -22
  106. package/dist/testing/adversarial_headers.js +2 -2
  107. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  108. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  109. package/dist/testing/adversarial_input_cases.js +31 -46
  110. package/dist/testing/assertions.d.ts +2 -2
  111. package/dist/testing/assertions.d.ts.map +1 -1
  112. package/dist/testing/assertions.js +3 -3
  113. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  114. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  115. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  116. package/dist/testing/cross_backend/action_manifest.js +4 -3
  117. package/dist/testing/cross_backend/cell_crud.js +1 -1
  118. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  119. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  121. package/dist/testing/cross_backend/conformance_table.js +3 -3
  122. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  123. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  125. package/dist/testing/cross_backend/differential.js +2 -2
  126. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/identity_parity.js +16 -11
  128. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  129. package/dist/testing/cross_backend/query_shape.js +1 -1
  130. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  131. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  132. package/dist/testing/cross_backend/setup.d.ts +25 -3
  133. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/setup.js +4 -4
  135. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  136. package/dist/testing/cross_backend/testing_origin_check.d.ts +4 -4
  137. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  138. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  139. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
  140. package/dist/testing/cross_backend/ws_envelope.js +8 -0
  141. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  142. package/dist/testing/data_exposure.d.ts.map +1 -1
  143. package/dist/testing/data_exposure.js +1 -1
  144. package/dist/testing/integration.js +2 -2
  145. package/dist/testing/integration_helpers.d.ts.map +1 -1
  146. package/dist/testing/integration_helpers.js +2 -2
  147. package/dist/testing/middleware.d.ts.map +1 -1
  148. package/dist/testing/middleware.js +2 -2
  149. package/dist/testing/rpc_attack_surface.js +1 -1
  150. package/dist/testing/rpc_envelope_cases.d.ts +10 -3
  151. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  152. package/dist/testing/rpc_envelope_cases.js +22 -1
  153. package/dist/testing/rpc_helpers.d.ts +12 -14
  154. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  155. package/dist/testing/rpc_helpers.js +9 -10
  156. package/dist/testing/schema_generators.d.ts +67 -60
  157. package/dist/testing/schema_generators.d.ts.map +1 -1
  158. package/dist/testing/schema_generators.js +154 -159
  159. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  160. package/dist/testing/sse_round_trip.js +2 -2
  161. package/dist/testing/surface_invariants.d.ts +1 -1
  162. package/dist/testing/surface_invariants.js +1 -1
  163. package/dist/ui/form_state.svelte.d.ts +1 -1
  164. package/dist/ui/form_state.svelte.js +1 -1
  165. package/package.json +5 -7
  166. package/dist/zod.d.ts +0 -116
  167. package/dist/zod.d.ts.map +0 -1
  168. package/dist/zod.js +0 -218
  169. package/dist/zod_schemas.d.ts +0 -100
  170. package/dist/zod_schemas.d.ts.map +0 -1
  171. package/dist/zod_schemas.js +0 -157
@@ -278,8 +278,8 @@ per-method auth shape.
278
278
  - `cross_backend/action_manifest.ts` — `ActionManifest` / `ActionManifestEntry`
279
279
  fuz_schema schema (the `_testing_action_manifest` wire validator) + `build_action_manifest(specs)`,
280
280
  which normalizes each spec to `{method, input, side_effects, account, actor, roles,
281
- credential_types, rate_limit}` (`input` is `'void'` for a `z.void()` or
282
- fuz_schema `s.void` input, by `is_void_schema`, else `'object'` — the Rust
281
+ credential_types, rate_limit}` (`input` is `'void'` for an `s.void` input, by
282
+ `is_void_schema`, else `'object'` — the Rust
283
283
  `InputShape`; auth axes pass through; `roles` /
284
284
  `credential_types` flatten to sorted arrays; `rate_limit` is the declared
285
285
  class or an explicit `null`, so a missing key reads as drift rather than a
@@ -419,7 +419,7 @@ or Postgres and runs in the `cross-ts` CI job.
419
419
  - `assert_only_expected_public_routes(surface, list)` — bidirectional: no unexpected public routes, no missing expected ones. Format: `['GET /health', 'POST /api/account/login']`.
420
420
  - `assert_full_middleware_stack(surface, prefix, mws)` — every route under `prefix` has exactly `mws` as its middleware chain, less each layer that carves it out (a layer whose `path` and one of whose `carve_outs` apply to the route, `middleware_carves_out`, with no other layer of its name running there) — the rule `applicable_middleware` and the route error map read. A route missing a layer no carve-out explains fails, and so does a carved-out route still listing it.
421
421
  - `get_route_error_schema(lookup, route, status)` — reads the route's error map (`lookup` is `AppSurfaceSpec.route_error_maps`) at a status, a fuz_schema schema.
422
- - `assert_error_schema_valid(lookup, route, status, body)` — assert the route declares the status, and the body parses against the status's schema (`parse_any`), a union of its definitions' `literal(code)` bodies, so a code the route doesn't declare at the status fails the parse; a mismatch throws an `Error` carrying the issues. Every adversarial refusal runs through it.
422
+ - `assert_error_schema_valid(lookup, route, status, body)` — assert the route declares the status, and the body parses against the status's schema (`parse`), a union of its definitions' `literal(code)` bodies, so a code the route doesn't declare at the status fails the parse; a mismatch throws an `Error` carrying the issues. Every adversarial refusal runs through it.
423
423
  - `assert_error_response_declared(errors, jsonrpc, response, label)` — a JSON error response (400 and up) is one the route's map declares, by `check_route_error` (the DEV error check's rule: 500 `internal_error` / 503 `service_unavailable` always accepted, a JSON-RPC envelope on a `jsonrpc` route skipped, a success or non-JSON response passing); what the attack-surface suite's `correct auth passes guard` holds each answer to.
424
424
 
425
425
  ### `surface_invariants.ts` — structural + policy invariants
@@ -499,20 +499,18 @@ Support functions:
499
499
 
500
500
  ### `schema_generators.ts` — valid-value generation
501
501
 
502
- Walks Zod and `@fuzdev/fuz_schema` schemas to generate valid values for
503
- adversarial/round-trip tests. Every helper takes either library's schema
504
- (`ValidationSchema`) and parses with `parse_any`; a schema of neither throws,
505
- naming it.
502
+ Walks `@fuzdev/fuz_schema` schemas to generate valid values for
503
+ adversarial/round-trip tests. A value that is no schema throws, naming it.
506
504
 
507
- - `to_object_schema_view(schema, label)` → `ObjectSchemaView` — the fields (`SchemaFieldInfo[]`, from `zod.ts`) of an object schema of either library through its wrappers, in Zod's type vocabulary (`zod_extract_fields` for Zod; a fuz_schema object of any strictness reads `'object'`, `literal(null)` `'null'`, `literal(undefined)` `'void'`, `one_of` `'enum'`, `variant` `'union'`), and each field's schema, throwing on a schema that is no object schema. `to_body_input(input_schema, label)` is the body generators' gate: `null` for a void or null input, else the object view, and a throw for any other input — no body is never silently what an unbuildable input yields.
505
+ - `to_object_schema_view(schema, label)` → `ObjectSchemaView` — the fields (`SchemaFieldInfo[]`, from `http/schema_helpers.ts`) of an object schema through its wrappers, each `base_type` its innermost fuz_schema kind (`SchemaFieldBaseType`: an object of any strictness reads `'object'`, `literal(null)` `'null'`, `literal(undefined)` `'void'`), and each field's schema, throwing on a schema that is no object schema. `to_body_input(input_schema, label)` is the body generators' gate: `null` for a void or null input, else the object view, and a throw for any other input — no body is never silently what an unbuildable input yields.
508
506
 
509
- - `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a `.transform()` or pipe field (`Username`) yields its input-side bounds and pattern instead of throwing; a `.nullable()` / `.nullish()` field's one non-null `anyOf` branch (or one non-null `type` of a `type` array) is returned. Both libraries render with `unrepresentable: 'any'`, so it is never `null`: a part JSON Schema can't say (a `z.date()`, a `z.custom()`, a fuz_schema `check`) is left out or `{}` and the bounds around it still read; it throws on a schema an emitter refuses even then. A pipe yields its input stage only, and a `.refine()` never appears (a code-point length bound generates nothing). Every JSON Schema read in the generators goes through it.
507
+ - `to_field_json_schema(field_schema)` — the field's JSON Schema rendered with `io: 'input'`, so a field piped through a `transform` (`Username`) yields its input-side bounds and pattern instead of throwing; a `nullable` field's one non-null `anyOf` branch (or one non-null `type` of a `type` array) is returned. It renders with `unrepresentable: 'any'`, so it is never `null`: a part JSON Schema can't say (a `check`) is left out or `{}` and the bounds around it still read; it throws on a schema the emitter refuses even then. A pipe yields its input stage only, and a `check` never appears (a code-point length bound generates nothing). Every JSON Schema read in the generators goes through it.
510
508
  - `detect_format(field_schema)` — `detect_json_schema_format` over `to_field_json_schema`: the `format`, `'pattern'` for a regex, or `null`.
511
509
  - `generate_valid_value(field, field_schema)` — base-type switch producing a valid sample (UUIDs → nil UUID, strings → `'xxxxxxxxxx'`, numbers → `1`, objects → `generate_valid_object` against the field schema, so a nested refinement is satisfied too, enums → first entry, records → `{}`, a void field → `undefined`, 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, two `/`-joined segments (an `owner/name` slug). First candidate the field accepts is used.
512
- - `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string (a preprocessed integer whose minimum is above one) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
510
+ - `generate_valid_string_param(field, field_schema)` — a string a URL-sourced field (route param, query value) accepts: the nil UUID for a UUID field, else the first of `test_value`, the generated valid value as a string, `1`, `0`, `true`, `false`, the field's JSON Schema `default` or lower bound as a string, each `min_value` / `max_value` bound anywhere in the schema as an integer (a string parsed into an integer whose range excludes the small candidates, as `db_routes`' `query_int` — bounds past a `transform`, which JSON Schema can't say) and a synthesized string the field accepts; `null` when none does. The params and query case generators build their base from it.
513
511
  - `resolve_valid_path(path, params_schema?, param_values?)` — swaps each whole param segment (`:name`, `:name{re}`, optional or not, read as Hono reads a template: `split_route_template` / `parse_route_param`) for a value the params schema accepts; a `:` inside a literal segment (`files:upload`) stays. 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>`. A value in `param_values` (the route's entry of `RouteParamValues`, `'METHOD /path'` → param name → value, the option the path-resolving suites take) comes first, percent-encoded like the rest. A `:name{re}` param's value, supplied or generated, must match its pattern grouped and anchored, `^(?:re)$` (`compile_route_param_pattern`, over the value as Hono decodes it, `decode_route_path`) — Hono's RegExpRouter reading, the stricter of its routers', as TrieRouter leaves a top-level alternation ungrouped — else it throws naming the route and the param and pointing at `param_values`: no value is guessed from the pattern, and no route is skipped silently. A `param_values` entry naming no param of the path throws too, and so does a supplied `''`, `.` or `..` (the URL normalizes it away) or a lone surrogate. Supplied values are always encoded, so a `{re}` needing a literal `/` can't be met by one.
514
512
  - `to_route_content_type(route)` — the `Content-Type` a well-formed request to the route sends: `application/json`, or `application/octet-stream` for a `raw_body` route. Every `POST` route refuses anything else with 415 before its other gates, so every probe in the harnesses (auth, params and query fuzz, 404, data exposure, round trip) sends it, body or not.
515
- - `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a `.refine()` over optional fields (at least one of, exactly one of, both of) at any depth, and, where one optional field suffices, keeps the others (an `acting` declared first) out. Returns the last `parse_any` result (`GeneratedObject`) and leaves the throw to the caller, which renders its issues with `format_issues` (`schema_issues.ts`).
513
+ - `generate_valid_object(object_schema, schema) => {value, result}` — required and defaulted fields; when `schema` (refinements included) refuses those, each optional field alone in declaration order, the first that parses; failing that, the optional fields added cumulatively until it parses. Covers a `check` over optional fields (at least one of, exactly one of, both of) at any depth, and, where one optional field suffices, keeps the others (an `acting` declared first) out. Returns the last `parse` result (`GeneratedObject`) and leaves the throw to the caller, which renders its issues with `format_issues` (`schema_issues.ts`).
516
514
  - `generate_valid_object_with_field(object_schema, schema, base, field)` — a valid object carrying `field`, built from the valid `base`: `base` itself when it carries the field; else the field joins `base`, with the optional fields `base` omits filled as `generate_valid_object` fills them (a pair rule: `scope_kind` needs `scope_id`); failing that, the field replaces `base`'s optional fields, refilled around it (exactly one of: adding `slug` drops `id`). `null` when no object the generator builds carries the field. The body a single-fault case on a field the base omits changes.
517
515
  - `generate_valid_body(input_schema) => Record<string, unknown> | undefined` — builds a body satisfying the input schema (`generate_valid_object`); `undefined` for a void or null input. Throws for an input that is no object, void or null schema (`to_body_input`), and with the parse's issues if the generated body fails validation — surfaces broken generation logic with a descriptive error rather than a confusing 400 downstream.
518
516
 
@@ -570,7 +568,7 @@ accepts (`assert_error_schema_valid`).
570
568
  The generators live in the hono-free `adversarial_input_cases.ts`, so the
571
569
  cross-process suites reuse them:
572
570
 
573
- - `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural (non-object, extra key when the input refuses unknown keys — a `z.strictObject` or a fuz_schema `object`), missing required fields, one wrong-type per field, null for required non-nullable, one format violation per constrained field, and boundary cases read from the field's input-side JSON Schema (`to_field_json_schema` — through a transform or pipe, and under a nullable's `anyOf`): the empty string, one under `minLength` (above one; a prefix of the valid value) and one over `maxLength`; below `minimum`, above `maximum`, at an exclusive bound, zero and negative for a positive-only field, a non-integer for an integer field and a value off a `multipleOf` grid (each half a step from the valid value, inside the range); the empty array, one under `minItems` (above one; the valid value's own items) and one over `maxItems`. A per-field case is emitted only when the field refuses its value (a `z.coerce` field given a wrong type, a pattern admitting the violation string, a preprocess that repairs the value: dropped), so no generated case is accidentally valid. Each per-field case is single-fault — valid but for the field it breaks: it changes one field of a valid base (`generate_valid_object`'s, or `options.base` (`InputTestCaseOptions`) for an input whose valid shape the generator can't reach), or, for a field that base omits, of the body `generate_valid_object_with_field` builds around it, so a case can't also break an object-level rule. A field no valid body carries keeps its wrong-type and null cases on the base and gets no format or boundary cases. Either base failing the schema throws, naming `options.label` (the method or route) when given. A per-field case names the field it breaks (`InputTestCase.field`; absent on the whole-body cases). A void or null input gets no cases; any other input that is no object schema throws (`to_body_input`).
571
+ - `generate_input_test_cases(input_schema, options?)` → `InputTestCase[]` — whole-body structural (non-object, extra key when the input refuses unknown keys — a fuz_schema `object`), missing required fields, one wrong-type per field, null for required non-nullable, one format violation per constrained field, and boundary cases read from the field's input-side JSON Schema (`to_field_json_schema` — through a transform or pipe, and under a nullable's `anyOf`): the empty string, one under `minLength` (above one; a prefix of the valid value) and one over `maxLength`; below `minimum`, above `maximum`, zero and negative for a positive-only field, and a non-integer for an integer field (half a step from the valid value, inside the range); the empty array, one under `minItems` (above one; the valid value's own items) and one over `maxItems`. A per-field case is emitted only when the field refuses its value (a field whose transform accepts the wrong type, a pattern admitting the violation string, a preprocess that repairs the value: dropped), so no generated case is accidentally valid. Each per-field case is single-fault — valid but for the field it breaks: it changes one field of a valid base (`generate_valid_object`'s, or `options.base` (`InputTestCaseOptions`) for an input whose valid shape the generator can't reach), or, for a field that base omits, of the body `generate_valid_object_with_field` builds around it, so a case can't also break an object-level rule. A field no valid body carries keeps its wrong-type and null cases on the base and gets no format or boundary cases. Either base failing the schema throws, naming `options.label` (the method or route) when given. A per-field case names the field it breaks (`InputTestCase.field`; absent on the whole-body cases). A void or null input gets no cases; any other input that is no object schema throws (`to_body_input`).
574
572
  - `expected_invalid_reason(input_schema, test_case)` → `string | undefined` — the `data.reason` an RPC refusal of the case owes: the broken field's `invalid_reason` (`schema_meta.ts`), resolved by the same `resolve_invalid_reason` the dispatcher resolves through, or none for an undeclared field or a whole-body case.
575
573
  - `generate_params_test_cases(params_schema)` → `ParamsTestCase[]` — format violations only (unconstrained string params accept anything), each one the field refuses.
576
574
  - `generate_query_test_cases(query_schema)` → `QueryTestCase[]` — missing required fields the field refuses to go without (a preprocessed field with a default accepts its absence) + format violations the field refuses.
@@ -783,7 +781,7 @@ waiter on timeout so the `waiters` array doesn't grow.
783
781
  Six tests in two top-level groups:
784
782
 
785
783
  1. **schema-level** (3 tests, no DB) — walks JSON Schema representations:
786
- - `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `z.void()`, and the request of a `request_response` with `initiator` `'backend'` or `'both'`)
784
+ - `no sensitive fields in any output schema` — `sensitive_field_blocklist`, over every route, RPC method and WS method output, and the params the server pushes over WS (a `remote_notification`'s payload, whose `output` is `s.void`, and the request of a `request_response` with `initiator` `'backend'` or `'both'`)
787
785
  - `no admin-only fields in non-admin output schemas` — `admin_only_field_blocklist`, over the route outputs a non-admin reaches; routes only, since the blocklist matches by name and domain RPC/WS outputs carry `created_by`/`updated_by` legitimately. Admin-gated means every role in an any-of `roles` (or a WS endpoint's `required_roles`) is `admin` or `keeper`, or the daemon token is required
788
786
  - `no sensitive fields in any error schema`
789
787
  2. **runtime** (3 tests, DB-backed via `create_test_app`):
@@ -794,7 +792,7 @@ Six tests in two top-level groups:
794
792
  Support functions: `collect_json_schema_property_names(schema)` (walks
795
793
  `properties`/`patternProperties`/`additionalProperties`/`items`/`prefixItems`/`contains`,
796
794
  `allOf`/`anyOf`/`oneOf`/`not`/`if`/`then`/`else`, and `$defs`/`definitions`
797
- values, where a lazy or `.meta({id})` schema's body sits behind a `$ref`),
795
+ values, where a schema's body may sit behind a `$ref`),
798
796
  `assert_output_schemas_no_sensitive_fields(surface_source, fields?, skip_routes?)`,
799
797
  `assert_non_admin_schemas_no_admin_fields(surface_source, fields?, skip_routes?)`.
800
798
  Both read each output from its spec on both sides (`schema_to_surface`): the
@@ -1005,7 +1003,7 @@ Request builders:
1005
1003
  Response assertions:
1006
1004
 
1007
1005
  - `assert_jsonrpc_error_response(body, expected_code?)` — validates `JsonrpcErrorResponse`; optional code check.
1008
- - `assert_jsonrpc_success_response(body, output_schema?)` — validates `JsonrpcResponse`; optional `output_schema` check on `result`, Zod or fuz_schema (`parse_any`).
1006
+ - `assert_jsonrpc_success_response(body, output_schema?)` — validates `JsonrpcResponse`; optional `output_schema` check on `result` (`parse`).
1009
1007
 
1010
1008
  One-shot transport:
1011
1009
 
@@ -1016,7 +1014,7 @@ One-shot transport:
1016
1014
  - `RpcCallArgs` — `{app, path, method, params?, params_json?, headers?, id?, verb?}`. `verb` defaults to `'POST'`; use `'GET'` for `side_effects: false` methods. `params_json` sends raw JSON text in place of `params` (exclusive with it) on either verb.
1017
1015
  - `rpc_call_raw(args)` — the same request as `rpc_call`, the response unparsed: `RpcCallRawResult` `{status, headers, body}` with the whole envelope. `parse_rpc_call_result(raw, method)` turns it into an `RpcCallResult`; `rpc_call` is the two composed.
1018
1016
  - `rpc_call(args)` — merges `RPC_CALL_DEFAULT_HEADERS` (`host: 'localhost'`, `origin: TEST_ORIGIN`, `Content-Type: 'application/json'`) under caller headers. Envelope-shape violations throw; JSON-RPC errors return `{ok: false, error}` so callers assert on `error.code` / `error.data.reason`.
1019
- - `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema, Zod or fuz_schema (`parse_any`); throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
1017
+ - `rpc_call_typed<T>(args, output_schema)` — parses the success `result` through the schema (`parse`); throws on envelope failure, error response, or schema mismatch. Use `rpc_call` when the test needs to assert on error shapes.
1020
1018
  - `rpc_call_for_spec<TSpec>(args)` — spec-bound variant: takes `{..., spec, params}` in place of `{..., method, params}`. `params` is typed from `spec.input` and the success `result` is typed from `spec.output` (runtime-validated, same contract as `rpc_call_typed`). Error branch stays untyped (JSON-RPC `error.data` shapes vary per call site). Use at happy-path + denial-path call sites; fall back to `rpc_call` for adversarial tests that send deliberately-malformed params.
1021
1019
 
1022
1020
  Registry lookups:
@@ -1947,11 +1945,11 @@ token, no `Origin`).
1947
1945
 
1948
1946
  The cell-layer parity coverage is split across two sibling suites. Cells
1949
1947
  can't ride the generic `describe_rpc_round_trip_tests` (stateful verbs need a
1950
- real id threaded across calls; `cell_get` has a top-level `.refine()`), so —
1948
+ real id threaded across calls; `cell_get` has a top-level `check`), so —
1951
1949
  like ws/sse — the full cell surface **live-mounts** on the spine RPC path but
1952
1950
  stays **off** `create_spine_surface_spec`, and these dedicated suites are the
1953
1951
  cell validators (`describe_standard_cross_process_tests`' generic round-trip
1954
- never sees them). Both parse every success response against the verb's Zod
1952
+ never sees them). Both parse every success response against the verb's
1955
1953
  **output** schema, so a TS↔Rust envelope drift fails the suite — not just a
1956
1954
  payload-field drift. Call-site primitives (`cross_rpc_call` / `error_reason` /
1957
1955
  `expect_output`) live in `cross_backend/cross_rpc.ts`, shared by every
@@ -1973,7 +1971,7 @@ options shape is `RpcPathCapabilityGatedCrossSuiteOptions` from
1973
1971
  `cross_backend/setup.ts`. `cross_backend/wire_shapes.ts` carries
1974
1972
  `assert_iso8601_seconds` / `assert_iso8601_seconds_nullable` — the byte-level
1975
1973
  gate on the canonical second-precision UTC timestamp shape, which a
1976
- `z.string()` output schema can't catch (a millisecond stamp parses fine).
1974
+ `string` output schema can't catch (a millisecond stamp parses fine).
1977
1975
  The shared suites pin it on the account-status account + role grants, a
1978
1976
  session, a minted + listed API token, a cell's `created_at` / `updated_at`,
1979
1977
  an audit row, an admin account listing, and an offer's `created_at` /
@@ -2777,15 +2775,15 @@ round-trip / conformance suites never vary:
2777
2775
  USERNAME_LENGTH_MAX]` = `[3, 39]` boundary edges (just-outside → 400,
2778
2776
  just-inside → 403 no-matching-invite) and the creation regex shape (leading
2779
2777
  non-letter / trailing punctuation / embedded disallowed char → 400; mid-string
2780
- `_`/`-` accepted), catching an off-by-one or position bug in the TS Zod
2781
- `.min/.max/.regex` vs the Rust byte-scan `is_valid_username_for_creation`.
2778
+ `_`/`-` accepted), catching an off-by-one or position bug in the TS
2779
+ `Username` bounds and regex vs the Rust byte-scan `is_valid_username_for_creation`.
2782
2780
  - **Email format (creation)** — the optional signup `email` validated to the
2783
2781
  loose `local@domain.tld` shape (TS `Email`, `EMAIL_REGEX` + 254-byte
2784
2782
  bound, Rust `is_valid_email`): malformed (no `@` / no domain dot / empty
2785
2783
  side / dot at a domain edge, beside another dot inside it too / whitespace /
2786
2784
  over-length) → 400, well-formed → 403 no-invite. Accepted siblings include
2787
2785
  the single-char-TLD `a@b.c` and the consecutive dots inside a domain that
2788
- Zod's `z.email()` rejects — the deliberately-looser shared rule. **Closed a
2786
+ a stricter email grammar rejects — the deliberately-looser shared rule. **Closed a
2789
2787
  real divergence**: the Rust spine previously length-checked the email only,
2790
2788
  accepting any non-empty string TS rejected.
2791
2789
  - **Malformed JSON body** — an unparseable (`{`) or non-object (`[]`) body typed
@@ -16,7 +16,7 @@ import './assert_dev_env.js';
16
16
  * @module
17
17
  */
18
18
  import { test, assert, describe } from 'vitest';
19
- import { parse_any } from '../schema_issues.js';
19
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
20
20
  import { REST_FORBIDDEN_ORIGIN } from '../http/error_schemas.js';
21
21
  import { create_test_middleware_stack_app, TEST_MIDDLEWARE_PATH } from './middleware.js';
22
22
  import { create_test_raw_api_token } from './entities.js';
@@ -132,7 +132,7 @@ export const describe_standard_adversarial_headers = (suite_name, options, allow
132
132
  if (tc.expected_error) {
133
133
  assert.strictEqual(body.error, tc.expected_error.code);
134
134
  assert.strictEqual(res.status, tc.expected_error.status);
135
- const parsed = parse_any(tc.expected_error.schema, body);
135
+ const parsed = parse(tc.expected_error.schema, body);
136
136
  assert.ok(parsed.ok, `error body fails its schema: ${JSON.stringify(body)}`);
137
137
  }
138
138
  if (tc.expected_status === 200) {
@@ -1,6 +1,6 @@
1
1
  import './assert_dev_env.js';
2
2
  import { ERROR_INVALID_REQUEST_BODY, ERROR_INVALID_JSON_BODY } from '../http/error_schemas.js';
3
- import { type ValidationSchema } from '../schema_issues.js';
3
+ import { type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
4
4
  /** One adversarial body for an input schema, and the error code it owes. */
5
5
  export interface InputTestCase {
6
6
  label: string;
@@ -46,13 +46,13 @@ export interface InputTestCaseOptions {
46
46
  * - Null for required non-nullable fields
47
47
  * - One format violation per constrained field
48
48
  * - String length (empty, one under `minLength`, one over `maxLength`), numeric
49
- * (out of range, non-integer, off a `multipleOf` grid) and array-length
49
+ * (out of range, non-integer) and array-length
50
50
  * (empty, one under `minItems`, one over `maxItems`) boundaries
51
51
  *
52
52
  * Format and boundaries come from the field's input-side JSON Schema
53
- * (`to_field_json_schema`), so a field carrying a `.transform()` or pipe and a
54
- * `.nullable()` / `.nullish()` field get them too. A bound only a `.refine()`
55
- * enforces generates nothing — JSON Schema can't express it.
53
+ * (`to_field_json_schema`), so a field carrying a `transform` in a pipe and a
54
+ * `nullable` field get them too. A bound only a `check` enforces generates
55
+ * nothing — JSON Schema can't express it.
56
56
  *
57
57
  * Each per-field case is single-fault: valid except for the field it breaks.
58
58
  * It changes one field of a valid base body — `options.base` when given, else
@@ -65,29 +65,30 @@ export interface InputTestCaseOptions {
65
65
  * emitted only when the field refuses its value, so no case is accidentally
66
66
  * valid.
67
67
  *
68
- * A void or null input takes no body and gets no cases; an input of neither
69
- * library, or one that is no object schema, throws rather than yielding none.
68
+ * A void or null input takes no body and gets no cases; a value that is no
69
+ * schema, or an input that is no object schema, throws rather than yielding
70
+ * none.
70
71
  *
71
- * @param input_schema - the input schema to attack, Zod or `@fuzdev/fuz_schema`
72
+ * @param input_schema - the input schema to attack
72
73
  * @param options - a base body to seed the cases, and a label for errors
73
- * @throws Error if the input is of neither library or is neither void, null,
74
+ * @throws Error if the input is no schema or is neither void, null,
74
75
  * nor an object schema, or if the base body fails `input_schema` — a seeded
75
76
  * base the schema refuses, or a generated one that surfaces broken
76
77
  * generation logic — naming the issues rather than producing nonsense
77
78
  * adversarial cases.
78
79
  */
79
- export declare const generate_input_test_cases: (input_schema: ValidationSchema, options?: InputTestCaseOptions) => Array<InputTestCase>;
80
+ export declare const generate_input_test_cases: (input_schema: AnySchema, options?: InputTestCaseOptions) => Array<InputTestCase>;
80
81
  /**
81
82
  * The `error.data.reason` an RPC refusal of `test_case` owes: the declared
82
83
  * `invalid_reason` of the field it breaks, resolved as the dispatcher resolves
83
84
  * a failure on that field (`resolve_invalid_reason`), or `undefined` — no
84
85
  * reason — for an undeclared field or a whole-body case.
85
86
  *
86
- * @param input_schema - the input schema the case was generated from, Zod or `@fuzdev/fuz_schema`
87
+ * @param input_schema - the input schema the case was generated from
87
88
  * @param test_case - a case `generate_input_test_cases` produced from it
88
89
  * @returns the owed reason, or `undefined` when the refusal carries none
89
90
  */
90
- export declare const expected_invalid_reason: (input_schema: ValidationSchema, test_case: InputTestCase) => string | undefined;
91
+ export declare const expected_invalid_reason: (input_schema: AnySchema, test_case: InputTestCase) => string | undefined;
91
92
  /**
92
93
  * Generate adversarial test cases for a route's params schema.
93
94
  *
@@ -96,11 +97,11 @@ export declare const expected_invalid_reason: (input_schema: ValidationSchema, t
96
97
  * params accept any string value, and only a violation the field refuses.
97
98
  * Each case breaks one field of a valid params record.
98
99
  *
99
- * @param params_schema - the params schema, a Zod or `@fuzdev/fuz_schema` object schema
100
+ * @param params_schema - the params schema, an object schema
100
101
  * @throws Error if no valid params record can be generated, or `params_schema`
101
- * is no object schema or of neither library
102
+ * is no object schema or no schema
102
103
  */
103
- export declare const generate_params_test_cases: (params_schema: ValidationSchema) => Array<ParamsTestCase>;
104
+ export declare const generate_params_test_cases: (params_schema: AnySchema) => Array<ParamsTestCase>;
104
105
  /**
105
106
  * Generate adversarial test cases for a route's query schema.
106
107
  *
@@ -111,9 +112,9 @@ export declare const generate_params_test_cases: (params_schema: ValidationSchem
111
112
  *
112
113
  * Each case breaks one field of a valid query record.
113
114
  *
114
- * @param query_schema - the query schema, a Zod or `@fuzdev/fuz_schema` object schema
115
+ * @param query_schema - the query schema, an object schema
115
116
  * @throws Error if no valid query record can be generated, or `query_schema`
116
- * is no object schema or of neither library
117
+ * is no object schema or no schema
117
118
  */
118
- export declare const generate_query_test_cases: (query_schema: ValidationSchema) => Array<QueryTestCase>;
119
+ export declare const generate_query_test_cases: (query_schema: AnySchema) => Array<QueryTestCase>;
119
120
  //# sourceMappingURL=adversarial_input_cases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adversarial_input_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAwEtF,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAID,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,yBAAyB,GACrC,cAAc,gBAAgB,EAC9B,UAAU,oBAAoB,KAC5B,KAAK,CAAC,aAAa,CAiOrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,gBAAgB,EAC9B,WAAW,aAAa,KACtB,MAAM,GAAG,SAG+C,CAAC;AAmC5D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GACtC,eAAe,gBAAgB,KAC7B,KAAK,CAAC,cAAc,CAoBtB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,gBAAgB,KAAG,KAAK,CAAC,aAAa,CAkC7F,CAAC"}
1
+ {"version":3,"file":"adversarial_input_cases.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/adversarial_input_cases.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAuErE,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,0BAA0B,GAAG,OAAO,uBAAuB,CAAC;CACnF;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAID,+CAA+C;AAC/C,MAAM,WAAW,oBAAoB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,yBAAyB,GACrC,cAAc,SAAS,EACvB,UAAU,oBAAoB,KAC5B,KAAK,CAAC,aAAa,CAyMrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,SAAS,EACvB,WAAW,aAAa,KACtB,MAAM,GAAG,SAG+C,CAAC;AAmC5D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GAAI,eAAe,SAAS,KAAG,KAAK,CAAC,cAAc,CAoBzF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GAAI,cAAc,SAAS,KAAG,KAAK,CAAC,aAAa,CAkCtF,CAAC"}
@@ -14,20 +14,18 @@ import './assert_dev_env.js';
14
14
  */
15
15
  import { resolve_invalid_reason } from '../schema_meta.js';
16
16
  import { ERROR_INVALID_REQUEST_BODY, ERROR_INVALID_JSON_BODY } from '../http/error_schemas.js';
17
- import { format_issues, parse_any } from '../schema_issues.js';
17
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
18
+ import { format_issues } from '../schema_issues.js';
18
19
  import { detect_format, detect_json_schema_format, generate_valid_object, generate_valid_object_with_field, generate_valid_string_param, to_body_input, to_field_json_schema, to_object_schema_view } from './schema_generators.js';
19
- /** Whether `schema` accepts `value`, a parse of either library (`parse_any`). */
20
- const accepts = (schema, value) => parse_any(schema, value).ok;
20
+ /** Whether `schema` accepts `value`. */
21
+ const accepts = (schema, value) => parse(schema, value).ok;
21
22
  // --- Payload generation ---
22
23
  /** One wrong-type value per base type — one representative is sufficient. */
23
24
  const wrong_type_for = (base_type) => {
24
25
  switch (base_type) {
25
26
  case 'string':
26
- case 'uuid':
27
- case 'email':
28
27
  return { label: 'number instead of string', value: 42 };
29
28
  case 'number':
30
- case 'int':
31
29
  return { label: 'string instead of number', value: 'not_a_number' };
32
30
  case 'boolean':
33
31
  return { label: 'number instead of boolean', value: 42 };
@@ -35,7 +33,7 @@ const wrong_type_for = (base_type) => {
35
33
  return { label: 'string instead of array', value: 'not_an_array' };
36
34
  case 'object':
37
35
  return { label: 'string instead of object', value: 'not_an_object' };
38
- case 'enum':
36
+ case 'one_of':
39
37
  return { label: 'number instead of enum', value: 42 };
40
38
  default:
41
39
  return null;
@@ -58,14 +56,12 @@ const format_violation = (format) => {
58
56
  };
59
57
  /**
60
58
  * `value` moved by `step`, up when that stays inside the field's numeric range
61
- * and down otherwise — a number off the integer or `multipleOf` grid that
62
- * still meets the range, so the grid check is the one a refusal names.
59
+ * and down otherwise — a number off the integer grid that still meets the
60
+ * range, so the integer check is the one a refusal names.
63
61
  */
64
62
  const off_grid_in_range = (json, value, step) => {
65
63
  const up = value + step;
66
- const over = (typeof json.maximum === 'number' && up > json.maximum) ||
67
- (typeof json.exclusiveMaximum === 'number' && up >= json.exclusiveMaximum);
68
- return over ? value - step : up;
64
+ return typeof json.maximum === 'number' && up > json.maximum ? value - step : up;
69
65
  };
70
66
  /**
71
67
  * Generate adversarial test cases for a route's input schema.
@@ -77,13 +73,13 @@ const off_grid_in_range = (json, value, step) => {
77
73
  * - Null for required non-nullable fields
78
74
  * - One format violation per constrained field
79
75
  * - String length (empty, one under `minLength`, one over `maxLength`), numeric
80
- * (out of range, non-integer, off a `multipleOf` grid) and array-length
76
+ * (out of range, non-integer) and array-length
81
77
  * (empty, one under `minItems`, one over `maxItems`) boundaries
82
78
  *
83
79
  * Format and boundaries come from the field's input-side JSON Schema
84
- * (`to_field_json_schema`), so a field carrying a `.transform()` or pipe and a
85
- * `.nullable()` / `.nullish()` field get them too. A bound only a `.refine()`
86
- * enforces generates nothing — JSON Schema can't express it.
80
+ * (`to_field_json_schema`), so a field carrying a `transform` in a pipe and a
81
+ * `nullable` field get them too. A bound only a `check` enforces generates
82
+ * nothing — JSON Schema can't express it.
87
83
  *
88
84
  * Each per-field case is single-fault: valid except for the field it breaks.
89
85
  * It changes one field of a valid base body — `options.base` when given, else
@@ -96,12 +92,13 @@ const off_grid_in_range = (json, value, step) => {
96
92
  * emitted only when the field refuses its value, so no case is accidentally
97
93
  * valid.
98
94
  *
99
- * A void or null input takes no body and gets no cases; an input of neither
100
- * library, or one that is no object schema, throws rather than yielding none.
95
+ * A void or null input takes no body and gets no cases; a value that is no
96
+ * schema, or an input that is no object schema, throws rather than yielding
97
+ * none.
101
98
  *
102
- * @param input_schema - the input schema to attack, Zod or `@fuzdev/fuz_schema`
99
+ * @param input_schema - the input schema to attack
103
100
  * @param options - a base body to seed the cases, and a label for errors
104
- * @throws Error if the input is of neither library or is neither void, null,
101
+ * @throws Error if the input is no schema or is neither void, null,
105
102
  * nor an object schema, or if the base body fails `input_schema` — a seeded
106
103
  * base the schema refuses, or a generated one that surfaces broken
107
104
  * generation logic — naming the issues rather than producing nonsense
@@ -118,7 +115,7 @@ export const generate_input_test_cases = (input_schema, options) => {
118
115
  let base;
119
116
  if (options?.base) {
120
117
  base = { ...options.base };
121
- const base_result = parse_any(input_schema, base);
118
+ const base_result = parse(input_schema, base);
122
119
  if (!base_result.ok) {
123
120
  throw new Error(`adversarial_input: the seeded base${for_label} fails validation — ` +
124
121
  `fix the base for: ${format_issues(base_result.issues)}`);
@@ -138,8 +135,8 @@ export const generate_input_test_cases = (input_schema, options) => {
138
135
  body: [1, 2, 3],
139
136
  expected_error: ERROR_INVALID_JSON_BODY
140
137
  });
141
- // whole-body structural: extra unknown key (enforces strictObject)
142
- // only emit if the schema rejects unknown keys (a `z.strictObject`, a fuz_schema `object`)
138
+ // whole-body structural: extra unknown key (enforces a strict `object`)
139
+ // only emit if the schema rejects unknown keys
143
140
  if (!accepts(input_schema, { ...base, __adversarial_extra: 'rejected' })) {
144
141
  cases.push({
145
142
  label: 'extra unknown key',
@@ -154,8 +151,8 @@ export const generate_input_test_cases = (input_schema, options) => {
154
151
  // can't also break an object-level rule (exactly one of, both or neither)
155
152
  const field_base = generate_valid_object_with_field(input_schema, input_schema, base, field);
156
153
  // every per-field case breaks the field, so the field itself must refuse
157
- // its value — a candidate it accepts (a `z.coerce` field given a wrong
158
- // type, a pattern that admits the violation string) is no invalid case.
154
+ // its value — a candidate it accepts (a field that coerces a wrong type,
155
+ // a pattern that admits the violation string) is no invalid case.
159
156
  // A type case (wrong type, null) on a field no valid body carries falls
160
157
  // back to the base; a value case — a format or a bound — is built only on
161
158
  // a body that is valid but for the field, or it tests no bound at all
@@ -211,7 +208,7 @@ export const generate_input_test_cases = (input_schema, options) => {
211
208
  }
212
209
  // string length boundaries — `x`s are one UTF-16 unit and one code point
213
210
  // each, so the over-`maxLength` string is over in either count
214
- if (field.base_type === 'string' || field.base_type === 'uuid' || field.base_type === 'email') {
211
+ if (field.base_type === 'string') {
215
212
  if (typeof json.minLength === 'number' && json.minLength > 0) {
216
213
  push_field_case(`empty string: ${field.name}`, '', 'value');
217
214
  }
@@ -228,37 +225,25 @@ export const generate_input_test_cases = (input_schema, options) => {
228
225
  }
229
226
  }
230
227
  // numeric boundaries
231
- if (field.base_type === 'number' || field.base_type === 'int') {
228
+ if (field.base_type === 'number') {
232
229
  if (typeof json.minimum === 'number') {
233
230
  push_field_case(`below minimum: ${field.name} (${json.minimum - 1})`, json.minimum - 1, 'value');
234
231
  }
235
232
  if (typeof json.maximum === 'number') {
236
233
  push_field_case(`above maximum: ${field.name} (${json.maximum + 1})`, json.maximum + 1, 'value');
237
234
  }
238
- if (typeof json.exclusiveMinimum === 'number') {
239
- push_field_case(`at exclusive minimum: ${field.name} (${json.exclusiveMinimum})`, json.exclusiveMinimum, 'value');
240
- }
241
- if (typeof json.exclusiveMaximum === 'number') {
242
- push_field_case(`at exclusive maximum: ${field.name} (${json.exclusiveMaximum})`, json.exclusiveMaximum, 'value');
243
- }
244
235
  // 0 and negative for positive-only fields
245
236
  if (typeof json.minimum === 'number' && json.minimum > 0) {
246
237
  push_field_case(`zero for positive-only: ${field.name}`, 0, 'value');
247
238
  push_field_case(`negative for positive-only: ${field.name}`, -1, 'value');
248
239
  }
249
240
  // off the grid by half a step from the valid value, inside the range,
250
- // so the integer or `multipleOf` check is the one that refuses
241
+ // so the integer check is the one that refuses
251
242
  const valid_number = typeof valid_value === 'number' ? valid_value : 1;
252
243
  if (json.type === 'integer') {
253
244
  const value = off_grid_in_range(json, valid_number, 0.5);
254
245
  push_field_case(`non-integer: ${field.name} (${value})`, value, 'value');
255
246
  }
256
- if (typeof json.multipleOf === 'number' && json.multipleOf > 0) {
257
- // a whole step for an integer field, so the integer check still holds
258
- const step = json.type === 'integer' && json.multipleOf > 1 ? 1 : json.multipleOf / 2;
259
- const value = off_grid_in_range(json, valid_number, step);
260
- push_field_case(`not multipleOf: ${field.name} (${value}, multipleOf ${json.multipleOf})`, value, 'value');
261
- }
262
247
  }
263
248
  // array length boundaries
264
249
  if (field.base_type === 'array') {
@@ -287,7 +272,7 @@ export const generate_input_test_cases = (input_schema, options) => {
287
272
  * a failure on that field (`resolve_invalid_reason`), or `undefined` — no
288
273
  * reason — for an undeclared field or a whole-body case.
289
274
  *
290
- * @param input_schema - the input schema the case was generated from, Zod or `@fuzdev/fuz_schema`
275
+ * @param input_schema - the input schema the case was generated from
291
276
  * @param test_case - a case `generate_input_test_cases` produced from it
292
277
  * @returns the owed reason, or `undefined` when the refusal carries none
293
278
  */
@@ -312,7 +297,7 @@ const generate_string_record_base = (schema, view, kind) => {
312
297
  }
313
298
  base[field.name] = value;
314
299
  }
315
- const result = parse_any(schema, base);
300
+ const result = parse(schema, base);
316
301
  if (!result.ok) {
317
302
  throw new Error(`adversarial_input: generated ${kind} base fails validation — ` +
318
303
  `fix generate_valid_string_param for: ${format_issues(result.issues)}`);
@@ -327,9 +312,9 @@ const generate_string_record_base = (schema, view, kind) => {
327
312
  * params accept any string value, and only a violation the field refuses.
328
313
  * Each case breaks one field of a valid params record.
329
314
  *
330
- * @param params_schema - the params schema, a Zod or `@fuzdev/fuz_schema` object schema
315
+ * @param params_schema - the params schema, an object schema
331
316
  * @throws Error if no valid params record can be generated, or `params_schema`
332
- * is no object schema or of neither library
317
+ * is no object schema or no schema
333
318
  */
334
319
  export const generate_params_test_cases = (params_schema) => {
335
320
  const view = to_object_schema_view(params_schema, 'adversarial_input: the params schema');
@@ -360,9 +345,9 @@ export const generate_params_test_cases = (params_schema) => {
360
345
  *
361
346
  * Each case breaks one field of a valid query record.
362
347
  *
363
- * @param query_schema - the query schema, a Zod or `@fuzdev/fuz_schema` object schema
348
+ * @param query_schema - the query schema, an object schema
364
349
  * @throws Error if no valid query record can be generated, or `query_schema`
365
- * is no object schema or of neither library
350
+ * is no object schema or no schema
366
351
  */
367
352
  export const generate_query_test_cases = (query_schema) => {
368
353
  const view = to_object_schema_view(query_schema, 'adversarial_input: the query schema');
@@ -1,5 +1,5 @@
1
1
  import './assert_dev_env.js';
2
- import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
2
+ import { type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
3
3
  import type { AppSurface, AppSurfaceRoute } from '../http/surface.js';
4
4
  import type { RouteErrorMap } from '../http/route_errors.js';
5
5
  /**
@@ -64,7 +64,7 @@ export declare const get_route_error_schema: (lookup: ReadonlyMap<string, RouteE
64
64
  * @throws AssertionError if no schema is declared for the route+status pair.
65
65
  * @throws Error if the body does not satisfy the declared schema, a code the
66
66
  * route doesn't declare at the status included, its message carrying the
67
- * failed parse's issues (`parse_any`).
67
+ * failed parse's issues (`parse`).
68
68
  */
69
69
  export declare const assert_error_schema_valid: (lookup: ReadonlyMap<string, RouteErrorMap>, route: AppSurfaceRoute, status: number, body: unknown) => void;
70
70
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"assertions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAgB7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,EAAE,iBAAiB,MAAM,KAAG,MACtB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAC3C,SAAS,UAAU,EACnB,eAAe,MAAM,KACnB,IAOF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,eAAe,MAAM,UAAU,KAAG,IAE9E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAC9C,SAAS,UAAU,EACnB,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,IAWF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,KACZ,SAAS,GAAG,SAEd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,MAAM,OAAO,KACX,IAUF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAC1C,QAAQ,aAAa,EACrB,SAAS,OAAO,EAChB,UAAU,QAAQ,EAClB,OAAO,MAAM,KACX,OAAO,CAAC,IAAI,CAiBd,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,UAAU,EACnB,aAAa,MAAM,EACnB,qBAAqB,KAAK,CAAC,MAAM,CAAC,KAChC,IAsBF,CAAC"}
1
+ {"version":3,"file":"assertions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAe7B,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAe7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,EAAE,iBAAiB,MAAM,KAAG,MACtB,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAC3C,SAAS,UAAU,EACnB,eAAe,MAAM,KACnB,IAOF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,eAAe,MAAM,UAAU,KAAG,IAE9E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAC9C,SAAS,UAAU,EACnB,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,IAWF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAClC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,KACZ,SAAS,GAAG,SAEd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,GACrC,QAAQ,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EAC1C,OAAO,eAAe,EACtB,QAAQ,MAAM,EACd,MAAM,OAAO,KACX,IAUF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAC1C,QAAQ,aAAa,EACrB,SAAS,OAAO,EAChB,UAAU,QAAQ,EAClB,OAAO,MAAM,KACX,OAAO,CAAC,IAAI,CAiBd,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,UAAU,EACnB,aAAa,MAAM,EACnB,qBAAqB,KAAK,CAAC,MAAM,CAAC,KAChC,IAsBF,CAAC"}
@@ -11,9 +11,9 @@ import { readFileSync } from 'node:fs';
11
11
  import { resolve, dirname } from 'node:path';
12
12
  import { fileURLToPath } from 'node:url';
13
13
  import { assert } from 'vitest';
14
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
14
15
  import { format_route_key } from '../http/surface_query.js';
15
16
  import { is_public_auth } from '../http/auth_shape.js';
16
- import { parse_any } from '../schema_issues.js';
17
17
  import { check_route_error, format_route_error_check, is_error_status, is_json_response } from '../http/route_error_check.js';
18
18
  import { middleware_applies, middleware_carves_out, middleware_spec_applies } from '../http/schema_helpers.js';
19
19
  /**
@@ -94,13 +94,13 @@ export const get_route_error_schema = (lookup, route, status) => {
94
94
  * @throws AssertionError if no schema is declared for the route+status pair.
95
95
  * @throws Error if the body does not satisfy the declared schema, a code the
96
96
  * route doesn't declare at the status included, its message carrying the
97
- * failed parse's issues (`parse_any`).
97
+ * failed parse's issues (`parse`).
98
98
  */
99
99
  export const assert_error_schema_valid = (lookup, route, status, body) => {
100
100
  const key = format_route_key(route);
101
101
  const schema = get_route_error_schema(lookup, route, status);
102
102
  assert.ok(schema, `missing error schema for ${status} on ${key}`);
103
- const result = parse_any(schema, body);
103
+ const result = parse(schema, body);
104
104
  if (!result.ok) {
105
105
  throw new Error(`error schema mismatch for ${status} on ${key} (error ${JSON.stringify(body?.error)}): ${JSON.stringify(result.issues)}`);
106
106
  }
@@ -11,7 +11,7 @@ import '../assert_dev_env.js';
11
11
  * generic round-trip would tombstone the bootstrapped keeper). They
12
12
  * live-mount on every spine's RPC path but stay off the declared surface,
13
13
  * so this dedicated suite is their cross-impl validator. Every success
14
- * `result` is parsed against the verb's declared Zod **output** schema, so
14
+ * `result` is parsed against the verb's declared **output** schema, so
15
15
  * a TS↔Rust envelope drift fails the assertion.
16
16
  *
17
17
  * @module
@@ -141,7 +141,7 @@ export const describe_account_lifecycle_cross_tests = (options) => {
141
141
  const failure = events.find((e) => e.outcome === 'failure' &&
142
142
  e.metadata?.reason === ERROR_CANNOT_DELETE_KEEPER);
143
143
  assert.ok(failure, 'keeper-removal guard must emit an account_delete outcome=failure audit row with reason cannot_delete_keeper');
144
- // Byte-shape gate on the audit row's timestamp — `z.string()` in
144
+ // Byte-shape gate on the audit row's timestamp — the `Timestamp` in
145
145
  // `AuditLogEventWithUsernamesJson` accepts a millisecond stamp too.
146
146
  assert_iso8601_seconds(failure.created_at, 'audit_log_list.created_at');
147
147
  });
@@ -30,10 +30,9 @@ import '../assert_dev_env.js';
30
30
  *
31
31
  * @module
32
32
  */
33
- import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
33
+ import { type Infer, type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
34
34
  import { type RouteAuth } from '../../http/auth_shape.js';
35
35
  import { RateLimitKey } from '../../rate_limiter.js';
36
- import type { ValidationSchema } from '../../schema_issues.js';
37
36
  import type { RequestResponseActionSpec } from '../../actions/action_spec.js';
38
37
  /**
39
38
  * One method's normalized RPC metadata — the cross-impl-comparable unit.
@@ -66,9 +65,10 @@ export declare const ActionManifestEntry: import("@fuzdev/fuz_schema/schema.ts")
66
65
  /** RPC method name (`spec.method`). */
67
66
  method: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
68
67
  /**
69
- * `'void'` when the input is a void schema (`is_void_schema`: `z.void()`
70
- * or fuz_schema `s.void`, a parameterless method), else `'object'` — the
71
- * Rust spine's declared `InputShape`, which its dispatcher enforces. A `z.strictObject({})` input is `'object'`.
68
+ * `'void'` when the input is a void schema (`is_void_schema`: `s.void`, a
69
+ * parameterless method), else `'object'` — the Rust spine's declared
70
+ * `InputShape`, which its dispatcher enforces. An `object({})` input is
71
+ * `'object'`.
72
72
  */
73
73
  input: import("@fuzdev/fuz_schema/schema.ts").Schema<"object" | "void", "object" | "void", "one_of", readonly ["void", "object"]>;
74
74
  /** `true` when the action declares `side_effects` (mutation; POST-only on the RPC transport). */
@@ -149,9 +149,10 @@ export declare const ActionManifest: import("@fuzdev/fuz_schema/schema.ts").Sche
149
149
  /** RPC method name (`spec.method`). */
150
150
  method: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
151
151
  /**
152
- * `'void'` when the input is a void schema (`is_void_schema`: `z.void()`
153
- * or fuz_schema `s.void`, a parameterless method), else `'object'` — the
154
- * Rust spine's declared `InputShape`, which its dispatcher enforces. A `z.strictObject({})` input is `'object'`.
152
+ * `'void'` when the input is a void schema (`is_void_schema`: `s.void`, a
153
+ * parameterless method), else `'object'` — the Rust spine's declared
154
+ * `InputShape`, which its dispatcher enforces. An `object({})` input is
155
+ * `'object'`.
155
156
  */
156
157
  input: import("@fuzdev/fuz_schema/schema.ts").Schema<"object" | "void", "object" | "void", "one_of", readonly ["void", "object"]>;
157
158
  /** `true` when the action declares `side_effects` (mutation; POST-only on the RPC transport). */
@@ -177,7 +178,7 @@ export type ActionManifest = Infer<typeof ActionManifest>;
177
178
  */
178
179
  export declare const action_manifest_entry: (spec: {
179
180
  readonly method: string;
180
- readonly input: ValidationSchema;
181
+ readonly input: AnySchema;
181
182
  readonly auth: RouteAuth;
182
183
  readonly side_effects: boolean;
183
184
  readonly rate_limit?: RateLimitKey;