chore(bridge): add sandbox e2e test suite#388
Conversation
|
hello @islandbitcoin this branch is presenting some conflicts, can you take a look on them? |
96ded7e to
518ba8d
Compare
I made some updates, and now I'm able to run the test suite successfully with baseline settings. I made a script that should help you set up the webhook locally using ngrok, check the updated |
ENG-274. Covers KYC, virtual account, external account, deposit, withdrawal, post-cutover state, ETH-USDT LN parity, and ERPNext audit-row verification. Guarded by RUN_BRIDGE_SANDBOX_E2E=true. Includes preflight check for Level 1 service guard and documentation drift cleanup (Level 2->Level 1, Tron->ETH-USDT).
32d7a65 to
d5cb53e
Compare
|
Rebased this PR onto the latest New head: MacMax verification: TEST="test/flash/unit/dev/setup-bridge-webhooks.spec.ts test/flash/unit/services/frappe/models/BridgeTransferRequest.spec.ts --runInBand --forceExit" yarn test:unit
IBEX_ENVIRONMENT=sandbox yarn test:bridge-sandbox-e2e:ci
./node_modules/.bin/eslint --resolve-plugins-relative-to ./node_modules --no-ignore $(git diff --name-only origin/tmp/bridge-rebase-pr-ready...HEAD | rg '\.(ts|js)$')
git diff --check origin/tmp/bridge-rebase-pr-ready...HEADResults:
|
There was a problem hiding this comment.
Pull request overview
Adds an opt-in Bridge sandbox end-to-end Jest suite (ENG-274) that exercises Bridge GraphQL mutations and webhook handlers against a real sandbox environment, plus local developer tooling to (re)configure Bridge sandbox webhooks via ngrok. Also aligns the Bridge service-level account-level guard to match the GraphQL resolver gate, and updates integration docs to remove Level-2/Tron drift.
Changes:
- Introduces
test/flash/bridge-sandbox-e2e/Jest harness + specs (KYC, virtual account, external account, deposit webhook/idempotency, withdrawal error paths, optional cutover + LN parity smokes) guarded by env flags. - Adds a Node-based
dev/setup-bridge-webhooks.jshelper (with unit tests) and wiresdev/setup.sh --webhook|--devto recreate Bridge sandbox webhooks and write local overrides. - Updates Bridge service guard (
level < 2→level < 1), plus Frappe audit datetime serialization and Bridge docs drift cleanup.
Reviewed changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/flash/unit/services/frappe/models/BridgeTransferRequest.spec.ts | Adds coverage for Frappe datetime serialization format. |
| test/flash/unit/dev/setup-bridge-webhooks.spec.ts | Unit tests for webhook setup helper (definitions, ngrok URL parsing, YAML merge, reconcile behavior). |
| test/flash/bridge-sandbox-e2e/README.md | Runbook for the opt-in sandbox E2E suite and required env/config. |
| test/flash/bridge-sandbox-e2e/preflight.ts | Source-based preflight to validate service-level account guard configuration. |
| test/flash/bridge-sandbox-e2e/ln-parity.spec.ts | Optional LN parity smoke spec (guarded by LN_PARITY_TESTS=true). |
| test/flash/bridge-sandbox-e2e/kyc-virtual-account.spec.ts | KYC initiation + injected webhook + optional virtual account creation flow. |
| test/flash/bridge-sandbox-e2e/jest.setup.ts | Suite gating (RUN_BRIDGE_SANDBOX_E2E, IBEX_ENVIRONMENT=sandbox), Mongo/Redis lifecycle, preflight call. |
| test/flash/bridge-sandbox-e2e/jest.config.js | Jest config scoped to sandbox E2E suite. |
| test/flash/bridge-sandbox-e2e/helpers/http-utils.ts | Minimal mock req/res for Express handler injection. |
| test/flash/bridge-sandbox-e2e/helpers.ts | Shared helpers: schema-executed GraphQL operations, user creation, webhook injection, ERPNext/Mongo lookups. |
| test/flash/bridge-sandbox-e2e/external-account.spec.ts | External account Plaid link URL (optional) + injected webhook/idempotency assertions. |
| test/flash/bridge-sandbox-e2e/deposit-withdrawal.spec.ts | Deposit webhook injection + persistence/idempotency + withdrawal error-path assertions. |
| test/flash/bridge-sandbox-e2e/cutover-state.spec.ts | Optional cutover state query smoke (guarded by CUTOVER_TESTS=true). |
| test/flash/bridge-sandbox-e2e/config-overrides.yaml | Sandbox-only config overrides used by the suite. |
| src/services/frappe/models/BridgeTransferRequest.ts | Formats first_seen_at / last_seen_at into Frappe-accepted datetime strings. |
| src/services/bridge/index.ts | Lowers service-level account gate to Level 1+ and adds warn logging; minor formatting cleanups. |
| package.json | Adds test:bridge-sandbox-e2e and test:bridge-sandbox-e2e:ci scripts. |
| docs/plans/2026-06-08-bridge-webhook-setup.md | Plan doc for webhook setup helper + dev/setup.sh wiring. |
| docs/plans/2026-06-04-eng-274-bridge-sandbox-e2e.md | Detailed ENG-274 implementation plan and suite design/verification notes. |
| docs/bridge-integration/WEBHOOKS.md | Updates deposit narrative away from Tron-specific wording. |
| docs/bridge-integration/FLOWS.md | Updates flow diagram/steps away from Tron and Level-2 assumptions. |
| docs/bridge-integration/ARCHITECTURE.md | Updates architecture description (Ethereum USDT, Level 1+). |
| docs/bridge-integration/API.md | Updates account-level requirement and error table text. |
| dev/setup.sh | Adds --dev / --webhook options to run webhook setup path. |
| dev/setup-bridge-webhooks.js | Implements ngrok + Bridge Webhook API orchestration and dev-overrides YAML merge. |
| dev/erpnext/backup.sh | Hardens backup script (pipefail, docker compose exec/cp, paths). |
| .gitignore | Ignores planning scratch markdown files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Updated the branch with the backup/doc cleanup requested:
Verification on MacMax:
|
Summary
ENG-274. Adds an opt-in sandbox end-to-end test suite for the Bridge integration.
What's Included
Test Suite (
test/flash/bridge-sandbox-e2e/)bridgeInitiateKyc, webhook injection,bridgeCreateVirtualAccountCUTOVER_TESTS=true)LN_PARITY_TESTS=true)Infrastructure
test:bridge-sandbox-e2eandtest:bridge-sandbox-e2e:ciRUN_BRIDGE_SANDBOX_E2E=true+IBEX_ENVIRONMENT=sandboxService-Level Fix
src/services/bridge/index.ts—checkAccountLevel()changed fromlevel < 2tolevel < 1to match the GraphQL resolver gate (PR fix(bridge): lower account level requirement from level 2 to level > 0 #385)Documentation Drift Cleanup
docs/bridge-integration/: Level 2→Level 1, Tron→ETH-USDT referencestest/flash/bridge-sandbox-e2e/README.mdHow to Verify
See
test/flash/bridge-sandbox-e2e/README.mdfor setup instructions.Related
ENG-274