Why it exists
Full session setup costs ~1.8 seconds cold or ~2 seconds warm. For a test suite with 50 integration scenarios, that’s 90+ seconds of pure provisioning overhead per run — before a single line of your code executes.mirra reset skips provisioning entirely. It opens the existing SQLite file per mirror, truncates the state tables, reloads the seed, and returns. Target: sub-100ms per mirror.
Common invocations
Usage inside tests
The Vitest plugin exposesresetMirraMirrors(), which is what it invokes under the hood:
beforeEach gives every test case a pristine mirror state without the cost of a fresh session.
Flags
Session to reset. Defaults to the most recent session on this machine. Accepts session ID (
ses_a7k2) or name (staging-acme).Comma-separated list of mirrors to reset. Default is all mirrors in the session. Example:
--mirrors=stripe,twilio.Override the seed to apply during reset. Default is the seed the session was created with. Example:
--seed=stripe:dunning-active. Useful when you want to reset to a different starting state mid-session.Custom JSON seed file. Takes precedence over
--seed.Emit a JSON result line instead of human-readable output.
What gets reset
- All mirror state. SQLite tables truncated and re-seeded.
- Webhook subscriptions. Subscriptions you registered during the session are cleared; the mirror’s default subscriptions (if any, per seed) are re-installed.
- Rate-limit counters. Fresh quota.
- Idempotency keys. The mirror forgets keys it saw.
What does not get reset
- The session itself. Session ID, URLs, credentials, and network routing are untouched.
- Dashboard traces. History of prior activity stays in PostgreSQL; the reset is logged as an event (
state.reset) so you can correlate before/after. - Cached mirror images. The mirror process keeps running; only its state store is wiped.
What takes longer than 100ms
- Large custom seed files. A 10MB seed JSON re-loads slower than a 100-row built-in fixture. Load time scales with seed size, not mirror count.
- Concurrent sessions on the same host. Reset takes a per-session SQLite lock. If the session is being written to concurrently, reset waits briefly.
Where to go next
Vitest plugin
Drop-in integration where resetMirraMirrors() is already wired in.
Sessions
Full session lifecycle reference.