testing/cross_backend/rust_spine_stub_backend_config.ts

Cross-process BackendConfig preset for the non-domain spine consumer, testing_spine_stub — a Rust binary that mounts only the spine surface (auth / account / admin / audit / role-grant offers) with no domain layer. fuz_app drives it from src/test/cross_backend/*.cross.test.ts to verify its TS spec against the Rust spine end-to-end with no domain implementation in the loop — drift becomes a fuz_app failure rather than a downstream consumer's failure with mixed signals.

Binary discovery — env-supplied, never hardcoded. The binary lives in a sibling Rust workspace, not in fuz_app, so the preset never bakes a path in. FUZ_TESTING_RUST_SPINE_STUB_BIN (or the binary_path option) must point at a prebuilt binary; the preset throws a clear error when neither is set rather than guessing. Build once with cargo build -p testing_spine_stub --release and point the env var at the resulting target/release/testing_spine_stub; operators / CI cache the binary across runs for fast spawns.

Operator setup — the target Postgres database must exist before the harness runs (the harness never issues CREATE DATABASE, to avoid forcing a CREATEDB grant on the test role):

createdb fuz_app_test_rust_spine_stub 2>/dev/null || true

The binary self-wipes the auth-namespace schema on every boot (FUZ_TESTING_RESET_DB_ON_STARTUP=true, set by the Rust-family builder), so no manual DROP TABLE between sessions is needed; per-test reset is the orthogonal _testing_reset RPC action default_cross_process_setup fires.

view source

Declarations
#

6 declarations

rust_spine_stub_backend_config
#

testing/cross_backend/rust_spine_stub_backend_config.ts view source

(options?: SpineStubBackendConfigOptions): BackendConfig import {rust_spine_stub_backend_config} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_stub_backend_config.js';

Build the BackendConfig for testing_spine_stub. Resolves the binary from options.binary_path or FUZ_TESTING_RUST_SPINE_STUB_BIN; throws when neither is set so a missing build surfaces as a clear error rather than a confusing spawn failure. Reconciles the binary's env contract: port via --port (and FUZ_RUST_SPINE_STUB_PORT), daemon-token dir via FUZ_RUST_SPINE_STUB_DIR (anchored to paths.root so the written {dir}/run/daemon_token matches the path spawn_backend reads).

options

default {}

returns

BackendConfig

throws

  • Error - when no binary path is available.

RUST_SPINE_STUB_BIN_ENV
#

RUST_SPINE_STUB_DEFAULT_DATABASE_URL
#

testing/cross_backend/rust_spine_stub_backend_config.ts view source

"postgres://localhost/fuz_app_test_rust_spine_stub" import {RUST_SPINE_STUB_DEFAULT_DATABASE_URL} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_stub_backend_config.js';

Default Postgres database — real PG (PGlite isn't reachable from tokio-postgres).

RUST_SPINE_STUB_DEFAULT_PORT
#

RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH_ENV
#

testing/cross_backend/rust_spine_stub_backend_config.ts view source

"FUZ_RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH" import {RUST_SPINE_STUB_EXPECTED_SCHEMA_PATH_ENV} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_stub_backend_config.js';

Env var the stub reads for the absolute path of the committed expected_schema.json its /ready gate introspects against. Pointed at the same fixture the TS spine reads () — column-presence is engine-portable, so one file is the cross-impl contract.

SpineStubBackendConfigOptions
#

testing/cross_backend/rust_spine_stub_backend_config.ts view source

SpineStubBackendConfigOptions import type {SpineStubBackendConfigOptions} from '@fuzdev/fuz_app/testing/cross_backend/rust_spine_stub_backend_config.js';

port?

Listening port. Default RUST_SPINE_STUB_DEFAULT_PORT.

type number

readonly

database_url?

Postgres connection URL. Default RUST_SPINE_STUB_DEFAULT_DATABASE_URL.

type string

readonly

binary_path?

Prebuilt binary path. Overrides the FUZ_TESTING_RUST_SPINE_STUB_BIN env var. When neither is set the preset throws.

type string

readonly

enable_login_rate_limit?

Enable the per-IP + per-account login rate limiters on the stub (FUZ_LOGIN_RATE_LIMIT_ENABLED=true). Off by default — the standard cross suites fire many loopback logins a live limiter would 429. Set true only for the dedicated login-security cross project (global_setup_login_security.ts). Pair with trusted_proxies so the limiter keys on the resolved X-Forwarded-For client IP. Mirrors TsSpineBackendConfigOptions.enable_login_rate_limit.

type boolean

readonly

trusted_proxies?

Comma-separated trusted-proxy allowlist passed as FUZ_TRUSTED_PROXIES (e.g. '127.0.0.1,::1'). Unset by default (the stub leaves XFF parsing off, keying on the raw TCP peer). The login-security project sets the loopback set so the limiter keys on the X-Forwarded-For client IP — the TS spine binary wires the equivalent set unconditionally.

type string

readonly

Depends on
#