Real vault compatibility suite
The harness that runs the app's vault code and the built app against the repository's real vault server and web UI.

The real vault suite proves that the mobile app's remote vault implementation interoperates with the actual vault server in the same repository (vault/) and with its web UI, rather than with a mock written by the same hands. It uses temporary databases and throwaway identities and never touches a real vault.

Why it lives in .tests

The harness sits in frontend/apps/mobile-exact/.tests/real-vault/, a top level dot directory, "so Exact builds the app without compiling the Playwright browser driver and its dependencies" (README). playwright-core 1.62.1 is the app's only dev dependency. bun run test does not match this directory.

Files

File

Role

server.ts

startRealVault(): spawns the real vault server and a stub daemon

web.ts

WebVault: drives the real web vault UI in Chromium

real-vault.test.ts

Nine Bun tests where the "phone" is the app's VaultStore with real fetch

drive.ts

The built app (iOS or web) plus real browser approval

race.ts

The built iOS app on real platform time, with injected failure or latency

README.md

Usage and the 2026-11-12 incident note

How the server is started

startRealVault (server.ts L70-L196):

    Creates a temp directory with a fresh vault.sqlite, and picks free ports.

    Starts a stub daemon that stores and serves /ipfs/<cid> blobs and answers 501 to everything else, "which the vault treats as non-fatal".

    Spawns bun src/main.ts in vault/ with --server-hostname 127.0.0.1 --server-port <port> --rp-id localhost --rp-origin http://localhost:<port> --db-path <tmp> --backend-http-base-url http://localhost:<daemon>, and SEED_VAULT_DEFAULT_NOTIFY_SERVER empty.

    Uses the Bun binary named by VAULT_BUN (or opts.bun), else mise exec -- bun, because the vault pins its own Bun version.

    Email delivery is the console sender. The harness scrapes stdout and stderr for Verification code for <email>: <digits> and hands codes out through code(email), waiting up to 15 s.

    Waits up to 30 s for GET /vault/api/config to answer.

    With beforeRequest, puts a proxy on the public port so a test can intercept or delay requests.

    stop() kills the process group (SIGTERM, then SIGKILL after 5 s), stops the stub and proxy, and deletes the temp directory.

Driving the web vault

WebVault (web.ts) gives each person their own browser context and acts as a user would: signUp(name) (email, emailed code, "Use a password", recovery words, first profile), signIn(), addAccount(name), deleteAccount(principal), principals(), approveConnect(url) (opens the link the app showed and clicks the button titled "Join" followed by the site name), and signOut() (clears cookies). reach() gets past the email and password forms whenever a navigation dropped the session.

The nine tests

Enabled only with REAL_VAULT=1 (describe.skipIf), default timeout 180 s (real-vault.test.ts L109-L328):

    Identities made in the web vault decrypt on the phone and sign with their principals; no private key appears in the view status.

    Phone add, rename and remove reach the server and the web vault; a second phone sees the vault name.

    Web additions and deletions sync to the phone.

    A real 409 when the web vault writes during the phone's upload keeps both edits (POST statuses [409, 200]).

    An idle sync sends knownVersion, gets unchanged and uploads nothing.

    A wrong or revoked credential fails closed and keeps every identity.

    Connect tokens: unknown, expired, cancelled, and one time use of the mailbox.

    Logout clears only this phone; the old credential still authenticates until deleted, then answers 401.

    Typed URL forms normalise to what the web vault expects.

The drives

drive.ts <ios|web> signs up in the browser, signs out, opens the built app at /me/vault, types the real vault URL, reads the connect link from the screen, approves in Chromium while the app is hidden, and asserts Connected then Remote. Evidence goes to .exact/real-vault/<host>/ (pending.png, returned.png, connected.png, and failure logs).

race.ts runs iOS with timing: 'platform', so timers run at real speed: two empty mailbox polls, background, browser approval, foreground, then an HTTP 503 on the first authenticated snapshot read. It asserts the snapshot was retried and that the consumed approval mailbox was not read again, that all identities arrive, and that they survive an app relaunch. This guards the 2026-11-12 fix recorded in the README. With seven remote identities it also runs connect and merge at a realistic vault size on the Hermes runtime, where the turn budget applies (inferred purpose of RACE_ACCOUNTS).

Environment variables

Variable

Used by

Meaning

REAL_VAULT=1

real-vault.test.ts

Enables the suite

VAULT_BUN

server.ts

Bun executable for the vault server

REAL_VAULT_HEADED=1

web.ts

Show the Chromium window

PLAYWRIGHT_BROWSERS_PATH

web.ts

Browser cache; defaults to ~/Library/Caches/ms-playwright when unset

EXACT

drive.ts, race.ts

Exact checkout, for scripts/agent.mjs. Required

EXACT_SIM

Exact

Simulator for the iOS drives

RACE_ACCOUNTS

race.ts

Extra remote identities to create, default 6 (seven with the first)

RACE_LATENCY_MS

race.ts

Delay every vault request. When above 0 the 503 is not injected and the test asserts no retry warning appeared

RACE_SKIP_LOCAL=1

race.ts

Skip importing a local identity before connecting

In CI

GitHub Actions installs Bun 1.3.10 for the vault, copies it to $RUNNER_TEMP/vault-bun, exports VAULT_BUN, installs Chromium with bunx playwright-core install --with-deps chromium, and runs REAL_VAULT=1 bun test ./.tests/real-vault/real-vault.test.ts. Pushes that touch vault/** trigger the workflow for this reason. The drives are not run in CI.

Known stale references

The test file's header mentions bun run test:real-vault, but package.json defines no such script. .gitignore still lists tools/real-vault/.scratch/, an older location.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime