Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-api): add private recovery producer lane

Josuédc3851831146
diff --git a/docs/testing/pr1056-private-recovery-postgres.md b/docs/testing/pr1056-private-recovery-postgres.md
new file mode 100644
index 000000000..ddbd215b5
--- /dev/null
+++ b/docs/testing/pr1056-private-recovery-postgres.md
@@ -0,0 +1,38 @@
+# PR #1056 private password-recovery integration lane
+
+Public CI excludes the two cross-service recovery suites because they require the
+real Member Registration producer and isolated PostgreSQL databases. The public
+PostgreSQL job checks that both pinned suite files exist before excluding them;
+that check proves suite discoverability, not producer execution.
+
+Run the producer-backed lane from the Evenfire repository root:
+
+```sh
+scripts/ci/run-pr1056-private-recovery-postgres.sh local
+scripts/ci/run-pr1056-private-recovery-postgres.sh configured
+scripts/ci/run-pr1056-private-recovery-postgres.sh all
+```
+
+`local` runs `control-api/test/r4l1.resetPasswordPayload.externalRest.realPostgres.integration.test.ts`.
+It requires an isolated PostgreSQL 16 admin DSN in `CONTROL_API_REAL_PG_ADMIN_URL`,
+the Member Registration source checkout in `EVENFIRE_MEMBER_REGISTRATION_ROOT`,
+and that checkout's installed `tsx` dependencies. The suite creates temporary
+control and producer databases and launches the real local Member Registration
+service. Use a disposable local PostgreSQL instance only.
+
+`configured` runs `control-api/test/bug192.passwordRecovery.memberRegistration.realPostgres.integration.test.ts`.
+It requires `CONTROL_API_REAL_PG_ADMIN_URL`,
+`CONTROL_API_REAL_MEMBER_REGISTRATION_PG_URL`,
+`CONTROL_API_MEMBER_REGISTRATION_SERVICE_BASE_URL`, and
+`CONTROL_API_MEMBER_REGISTRATION_HMAC_SECRET`. The service URL and HMAC must refer
+to a real authorized Member Registration producer and its real PostgreSQL data.
+The test creates a temporary Control API database and observes the configured
+producer database; it does not start or replace that producer.
+
+`all` runs both modes sequentially and requires both sets of prerequisites. The
+runner verifies each exact suite file, requires at least one passing test, and
+fails if Vitest reports skipped tests. It does not print environment values.
+Do not substitute mocked producer responses for either suite. If a mode's
+producer, database, credentials, or service dependencies are unavailable, report
+that mode as **NOT VERIFIED** rather than treating the public CI exclusion check
+as execution evidence.
diff --git a/scripts/ci/run-pr1056-private-recovery-postgres.sh b/scripts/ci/run-pr1056-private-recovery-postgres.sh
new file mode 100755
index 000000000..2468edcb0
--- /dev/null
+++ b/scripts/ci/run-pr1056-private-recovery-postgres.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+CONTROL_API_DIR="$REPO_ROOT/control-api"
+MODE="${1:-all}"
+
+usage() {
+ cat <<'EOF'
+Usage: scripts/ci/run-pr1056-private-recovery-postgres.sh [local|configured|all]
+
+local Run the R4-L1 test, which starts the local Member Registration producer.
+configured Run the BUG-192 test against an already running Member Registration producer.
+all Run both producer-backed suites (default).
+EOF
+}
+
+require_environment() {
+ local name
+ for name in "$@"; do
+ if [[ -z "${!name:-}" ]]; then
+ printf 'Required environment variable is unset: %s\n' "$name" >&2
+ return 1
+ fi
+ done
+}
+
+run_suite() {
+ local suite="$1"
+ local output
+ if [[ ! -s "$CONTROL_API_DIR/$suite" ]]; then
+ printf 'Required producer-backed suite is missing or empty: %s\n' "$suite" >&2
+ return 1
+ fi
+ if ! output="$(cd "$CONTROL_API_DIR" && CONTROL_API_REAL_PG_REQUIRED=1 \
+ FORCE_COLOR=0 NO_COLOR=1 npm test -- --run "$suite" --reporter=default 2>&1)"; then
+ printf '%s\n' "$output"
+ return 1
+ fi
+ printf '%s\n' "$output"
+ if ! grep -Eq 'Test Files[[:space:]]+1 passed' <<<"$output" ||
+ ! grep -Eq 'Tests[[:space:]]+[1-9][0-9]* passed' <<<"$output" ||
+ grep -Eq '(Test Files|Tests).*([1-9][0-9]*) skipped' <<<"$output"; then
+ printf 'Producer-backed suite did not report passing, non-skipped tests: %s\n' "$suite" >&2
+ return 1
+ fi
+}
+
+run_local_producer_suite() {
+ require_environment CONTROL_API_REAL_PG_ADMIN_URL EVENFIRE_MEMBER_REGISTRATION_ROOT
+ local root="$(cd "$EVENFIRE_MEMBER_REGISTRATION_ROOT" && pwd)"
+ if [[ ! -x "$root/node_modules/.bin/tsx" ]]; then
+ printf 'Member Registration dependencies are missing under EVENFIRE_MEMBER_REGISTRATION_ROOT\n' >&2
+ return 1
+ fi
+ run_suite test/r4l1.resetPasswordPayload.externalRest.realPostgres.integration.test.ts
+}
+
+run_configured_producer_suite() {
+ require_environment \
+ CONTROL_API_REAL_PG_ADMIN_URL \
+ CONTROL_API_REAL_MEMBER_REGISTRATION_PG_URL \
+ CONTROL_API_MEMBER_REGISTRATION_SERVICE_BASE_URL \
+ CONTROL_API_MEMBER_REGISTRATION_HMAC_SECRET
+ run_suite test/bug192.passwordRecovery.memberRegistration.realPostgres.integration.test.ts
+}
+
+case "$MODE" in
+ local)
+ run_local_producer_suite
+ ;;
+ configured)
+ run_configured_producer_suite
+ ;;
+ all)
+ run_local_producer_suite
+ run_configured_producer_suite
+ ;;
+ -h|--help|help)
+ usage
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+esac