testing/cross_backend/query_shape.ts

Cross-backend query-string shape parity suite.

The TS pipeline reads queries through Hono's c.req.query() — a duplicated key resolves to its first occurrence — and only routes that declare a z.strictObject query schema 400 unknown keys, in the pipeline's params → query → 401 → authz → 403 phase order. A derived-serde axum extractor diverges on every axis (a plain-text pre-handler "duplicate field" 400 observable anonymously, silently ignored unknown keys, query rejection ahead of the 401), so each spine surface that reads a query is pinned here on both backends:

  • GET /api/account/status — NO query schema: a duplicated acting reads first-wins (the persona resolves), unknown keys are ignored, and an anonymous caller with junk query hears 401, never a query 400.
  • the JSON-RPC GET endpointmethod / id / params read first-wins; a duplicated method must dispatch the first one on every backend (a last-wins reader dispatches a different method per backend on the same request).
  • GET /api/facts/:hash (gated on capabilities.fact_serving) — strict query schema: unknown keys and a malformed acting are 400 invalid_query_params even for an anonymous caller (query precedes the 401 guard), while a duplicated acting takes the first occurrence.

The per-surface in-process TS pins live beside each module's own tests (account_status.test.ts, action_rpc.test.ts, serve_fact_route.db.test.ts); this suite is the cross-impl gate, so it is cross-process only — like login_security.ts and testing_backdoor.ts.

$lib-free by contract (relative specifiers only), like the sibling cross-backend suites.

view source

Declarations
#

2 declarations

describe_query_shape_cross_tests
#

QueryShapeCrossTestOptions
#

testing/cross_backend/query_shape.ts view source

RpcPathCapabilityGatedCrossSuiteOptions import type {QueryShapeCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/query_shape.js';

Options for the query-shape parity suite. The standard capability-gating RPC-dispatched cross-suite shape (setup_test / capabilities / rpc_path); aliases the shared RpcPathCapabilityGatedCrossSuiteOptions rather than minting a duplicate.

rpc_path?

RPC endpoint path the methods are mounted on. Default /api/rpc.

type string

readonly

setup_test

Per-test fixture-producing function (fresh keeper + db per call).

type (): Promise<TestFixtureBase>

readonly
returns Promise<TestFixtureBase>

capabilities

Backend capability declarations — each suite gates on its own flag.

type BackendCapabilities

readonly

Depends on
#