Skip to main content

Integrations test harness — fake vs live (P4.0)

The integration/broker path is testable without live Nango or provider credentials. This is what lets agents iterate on integrations safely in CI: no secrets, no real provider state, deterministic runs.

The fake adapter

apps/api/src/integrations/testing/fake-nango.tsFakeNango is an in-memory double of the @nangohq/node backend SDK surface that NangoService actually calls (createConnectSession, listIntegrations, listConnections, deleteConnection, getScriptsConfig, triggerAction, listRecords). It is faithful to the shapes NangoService destructures and supports the failure classes the broker maps (404-on-delete, status-coded trigger/records errors, over-returning a page). Wire it into a real NangoService:
installFakeNango sets the lazily-built private client and ensures NANGO_SECRET_KEY is present so no real client is constructed.

What the LOCAL suite covers (no secrets, runs in CI)

Run it all locally / in CI:

What stays LIVE (separate, opt-in — P4.1)

The fake proves the contract; it cannot prove the real Nango/provider behaves the same. Live staging tests (P4.1) are gated behind env (EVAL_API_URL + credentials) and are never required for a local/CI run. They cover: a real connect→authorize→confirm round-trip, a real getScriptsConfig/triggerAction against a staging integration, and a real signed webhook delivery. Driftless keeps its own bounds/caps regardless of provider behavior — the fake encodes “provider misbehaves” (over-returns, errors, oversized output) so the caps are tested even though live providers usually behave.

Staging live gate (P4.1)

The repeatable evidence required before any broker flag reaches production. Run it against staging only (never prod), with the broker’s expected state stated explicitly. It is read-only and SKIP-safe: with no creds it skips and exits 0.
What the gate proves (scripts/harness/smoke.sh, section 6–7), keyed on SMOKE_BROKER_EXPECTED: The WRITE/invoke path is deliberately SKIPPED with an explicit reason — the gate never executes a live operation (it could mutate provider state). A known-safe read-invoke is run manually with an idempotency key when needed. Paste the === Smoke Test Summary === block (TOTAL/PASS/FAIL/SKIP) plus the retrieval-scale PASS (n/n) line into the release card as the gate evidence. RESULT: FAIL blocks the rollout; RESULT: SKIP means no live target was provided (not evidence).