Skip to main content
mirra reset [flags]
Wipes every mirror in a session back to the seed the session started with. Much faster than tearing down and re-provisioning — typically under 100ms per mirror. Use it between test cases when you want a clean slate but don’t want to pay provisioning cost every time.

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

mirra reset

Usage inside tests

The Vitest plugin exposes resetMirraMirrors(), which is what it invokes under the hood:
import { beforeEach } from 'vitest';
import { resetMirraMirrors } from '@mirrahq/vitest';

beforeEach(async () => {
  await resetMirraMirrors();
});
Doing this in beforeEach gives every test case a pristine mirror state without the cost of a fresh session.

Flags

--session
string
Session to reset. Defaults to the most recent session on this machine. Accepts session ID (ses_a7k2) or name (staging-acme).
--mirrors
list
Comma-separated list of mirrors to reset. Default is all mirrors in the session. Example: --mirrors=stripe,twilio.
--seed
string
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.
--seed-file
path
Custom JSON seed file. Takes precedence over --seed.
--json
boolean
default:"false"
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.