Replay & verify

Verdicts & divergences

The rules are identical for every runtime, live in lib/src/core/verdict.dart, and are pinned by spec/fixtures/conformance/verdicts.json. They are deliberately strict: an attempt that didn't run as recorded is never evidence of a fix.

Attempts

Attempt statusWhen
reproducedThe original failure assertion fired (same signature).
cleanIt ran to the end as recorded: there is a failure assertion to check, every recorded input was dispatched, required restoration happened, no other failure fired, and nothing material diverged.
invalidAnything else: errors, timeouts, crashes without a report, incompatible capsules, no assertion, material divergences.

Batches (legacy verdict v1)

The table below describes the legacy rules. CLI 0.4.2 uses verdict v2 by default; use that section for current FIXED requirements.

bugcapsule runbugcapsule verifyRuleExit
REPRODUCED—Every requested attempt reproduced0
—FIXEDEvery requested attempt clean0
NOT REPRODUCED—Every requested attempt clean1
—STILL FAILINGReproduced, no clean attempt1
FLAKYFLAKYBoth reproduced and clean attempts2
INCONCLUSIVEINCONCLUSIVEAnything else3
INCOMPATIBLEINCOMPATIBLEWrong runtime, state schema changed, or (spec v2) a required adapter is missing or a connection can't be restored3

Attempts that never ran count against the requested number. One clean attempt plus one error is INCONCLUSIVE, never FIXED. The verdict is recorded on your project with the number of valid attempts; a capsule moves to fixed only when every requested attempt was valid.

In regress run: FIXED → pass; STILL FAILING → fail; FLAKY → the test is quarantined (skipped unless --include-quarantined); INCOMPATIBLE → stale (schema changed without a migration); anything else → inconclusive, counted as a failure.

Verdict v2

!

Default in CLI 0.4.2. Install the current SDK releases to capture the evidence verdict v2 needs. The dashboard shows v2 results. See What's new.

Two clean attempts are not proof. A race that reproduces half the time also misses twice in a row on unchanged code. Under verdict v2 a candidate is never FIXED merely because the original failure didn't fire. verify reports FIXED only when all of these hold:

  1. The baseline reproduced. The capsule's own commit, built clean in a temporary worktree, reproduced the failure in every one of at least 3 attempts (--baseline-runs, default 3). A baseline that reproduces only sometimes makes the result FLAKY. No baseline (no git SHA in the capsule, a commit missing from your repository, prebuilt artifacts) makes it INCONCLUSIVE. From CLI 0.4.2, a baseline whose attempts could not reach the replay server is reported unavailable (baseline.unavailable) and is never cached.
  2. Enough candidate attempts ran, all clean. The number depends on the baseline (the Wilson 95% lower bound of its reproduction rate, at least 5 and at most 30). The CLI raises --runs to it and says so.
  3. Each clean attempt has positive evidence that the failing path ran (below).
  4. The capsule is eligible and nothing material diverged.
BaselineClean candidate attempts needed
3/38
5/56
10/105
11/20— (baseline is FLAKY: no FIXED)

A baseline is cached under bugcapsule/.cache/baselines/ for 7 days, keyed by the capsule, the baseline revision and the harness (CLI version, runtime, strict network, settle timeout), so CI builds each old commit once.

Positive evidence

Each replay result from a v2 SDK carries evidence:

EvidenceWhenBest verdict
strongThe capsule's own BugCapsule.check(id, condition) ran during replay and held, or every postcondition you registered with BugCapsule.expect heldFIXED
weakOnly that every recorded input was dispatched and replay settled past the recorded failure pointFIXED (QUALIFIED)
noneNo evidence (reports from older SDKs), or a postcondition didn't hold or threwINCONCLUSIVE (STILL FAILING when a postcondition failed)

Postconditions say what must hold after the scenario replays without its failure. They are evaluated once, after a clean replay settles, and do nothing outside replay. Capsules from exceptions reach FIXED only with a postcondition, because "the exception didn't fire" is not evidence.

BugCapsule.check('cart_total_non_negative', total >= 0);
BugCapsule.expect('cart_total_positive', () => cart.total > 0);
BugCapsule.check("cart.total", cart.total >= 0)
BugCapsule.expect("cart.total_positive") { cart.total > 0 }
BugCapsule.check("cart_total_non_negative", total >= 0)
BugCapsule.expect("cart_total_positive") { cart.total > 0 }
BugCapsule.check('cart_total_non_negative', total >= 0);
BugCapsule.expect('cart.total_positive', () => cart.total > 0);

New verdicts and exit codes

VerdictWhenExit
FIXED (QUALIFIED)As FIXED, but the evidence is weak, or the capsule is partial or touched unsupported sources. The run lists its limitations. --accept-qualified exits 0 instead.4
UNSAFEReplay containment was broken: live traffic was allowed (--allow-live, or --lenient-network reaching a live dependency). Applies to run and verify, even when the failure reproduced.5

Neither counts as fixed: your project stores them as inconclusive, and the dashboard shows the precise verdict and the reason. run keeps its verdicts, adds UNSAFE, and REPRODUCED also needs evidence that the failure site was reached.

Per command

Two divergences also become material under v2: screen.size when the attempt dispatched coordinate taps (semantic actions keep it informational), and network.unused when the unused response was served before the failure point in the baseline.

Divergence catalogue

Types not marked expected are material: an attempt with one can't count as clean. Unknown divergence types are material too.

TypeMeansWhat to do
build.gitShaexpectedReplayed build is a different commit (normal for verify)Nothing
screen.sizeexpectedDifferent screen; pointer coordinates were scaledUse the capture device, or add semantic actions
network.unusedexpectedA recorded response was never requestedNothing
network.unrecordedmaterialThe app sent a request the recording never sawAdd an endpoint rule for volatile fields; if a fix changed the requests, capture a new capsule on the fixed path
network.reusedmaterialMore requests with one key than recorded; the last fixture was served againCheck for retries or duplicate calls in the replayed build
network.noBodymaterialA fixture without a body was servedKeep body capture on for that endpoint; raise maxBodyBytes
network.escapedmaterialWeb: a browser request bypassed the SDK to another origin. From the next web release, also any non-static request from the app's own origin (fetch/XHR the SDK didn't serve, beacons, EventSource, form posts, workers) and any real WebSocketInit before code grabs fetch; add static origins to web.allowOrigins; replay a production-style build without a live-reload socket
restore.disallowedmateriala storage key outside the capture's recorded storage policy (or the replayed build's allowlist) was not restoredAllow the key in both the capturing and the replayed build, then capture again
replay.unsafe_livematerialNext web release: a request matched --allow-live and reached the real network. The run is UNSAFEUse --allow-live only to debug the replay setup
action.unregisteredmaterialA recorded action id isn't registered in the replayed buildRegister it (renamed? registered late?)
text.untrackedmaterialA recorded text id isn't tracked in the replayed buildTrack it before the replay's input reaches it
text.redacted, storage.redacted, state.redacted, route.redactedmaterialA value was redacted on device and replayed as a placeholderFor QA builds, keep test-account tokens out of the deny list, or exclude that flow
pointer.mismatch, selector.ambiguous, selector.missingmaterialWeb: the element at the recorded point isn't the recorded targetAdd stable data-testid / data-bugcapsule-action attributes
pointer.unsupportedmaterialiOS: the capsule needs pointer replayWrap the taps in BugCapsule.action
lifecycle.unsupportedmaterialThe runtime can't drive a recorded lifecycle stateUsually unavoidable (iOS hidden)
restore.<integration>materialA restorer threwFix the restore callback / serializer
restore.missing, restore.missingIntegration, integration.missingmaterialCaptured data has no integration to restore itAdd the same integrations to the replayed build
restore.latematerialA restorer registered after the first input, or storage was read before restorationInit first; register state earlier
bloc.unrestored, riverpod.unrestored, notifier.unrestored, getx.unrestored, mobx.unrestoredmaterialFlutter: state couldn't be injected from a periodic checkpointRegister a serializer; avoid constructor-dispatched events
capability.unsupportedmaterialThe capsule needs a capability the replaying runtime lacksSee the feature matrix
dispatch.errormaterialDispatching a recorded input threwRead the attempt's details
failure.othermaterialA different failure firedIt may be a new bug; inspect it
runtime.mismatchincompatibleCapsule from another runtimeReplay in the right project (-p, --runtime)

Interaction divergences and reason codes

i

Available in the stable releases (Flutter 0.4.2, Android 0.4.1, iOS 0.4.2 and web 0.4.0), for spec v2 capsules that recorded WebSockets, platform channels or native SDKs.

Replay serves recorded interactions offline and never contacts the real socket, plugin or SDK. Each family (ws, platform, native) reports the same divergences:

TypeMeansWhat to do
*.unusedAfterFailureexpectedA recorded interaction after the failure time was never usedNothing
*.unrecordedmaterialThe app connected, sent, called or subscribed to something with no recorded match, also when the capsule has no recording for that adapter. The operation fails (connection error, bugcapsule.unrecorded)As with network.unrecorded: if a fix changed the traffic, capture a capsule on the fixed path
*.mismatchmaterialMatched by order, but the payload or arguments differ from the recordingMark volatile fields as ignored; check what the replayed build sends
*.unusedmaterialA recorded interaction at or before the failure was never matched or deliveredThe replayed build skipped a connection or call the recording made
*.undeliveredmaterialA due delivery waited too long (5 s) for its handlerListen to the stream or set the handler as the recording did
*.noPayloadmaterialA delivery needed a value that wasn't recorded in full (size only, truncated, omitted, redacted)Register a binary serializer, keep the payload under the limit, or allow redacted replay; capture again
*.unrestoredmaterialA connection or subscription open at a periodic checkpoint couldn't be restoredCapture from launch
dependency.livematerialA dependency was reached for real during replay (it escaped the adapter)Route every use through the integration; web: open sockets after init, not in workers
dependency.latematerialFlutter: the adapter was set up after the dependency (the binding existed before BugCapsule.init)Make BugCapsule.init the first line of main

Verdicts keep the same names. Runs add reason codes derived from these divergences; the CLI prints them under Why, and the dashboard explains them on the run:

Reason codeFrom
dependency.unsupportedPreflight: a required adapter is missing, doesn't support the recorded schema, or an open connection can't be restored (dependency.unsupported, dependency.schema, dependency.unrestorable). The attempt is INCOMPATIBLE and the app never starts.
interaction.missing*.unused, *.undelivered
interaction.unexpected*.unrecorded
interaction.mismatch*.mismatch
interaction.incomplete*.noPayload
interaction.livedependency.live, dependency.late
interaction.unrestored*.unrestored

Why such a verify is never FIXED: a missing, unexpected or mismatched interaction, a value replay couldn't hand over, a real dependency reached, or a connection that wasn't restored means the attempt didn't run as recorded, so the failure not firing proves nothing. Those attempts are invalid, and BugCapsule never marks a capsule fixed by a run with interaction divergences. Only *.unusedAfterFailure is expected: after a fix, the app may not reach what was recorded after the failure.

Reading a result

$ bugcapsule verify 35f3c4ba-… -n 3 -p examples/shop
  verify #1  PASS  9.6s  pointer, 6 inputs, 6 responses   (×3)
FIXED — failure gone in 3/3 valid runs
recorded: status fixed; runs: replay reproduced 3/3, verify not_reproduced 3/3 (validAttempts 3)
$ VITE_BUGCAPSULE_DEMO_FIX=discontinued bugcapsule verify 5200d4bc-… -n 2
  verify #1  INVALID  8.3s  … unexpected failure: …no recorded response for POST …/api/checkout
INCONCLUSIVE

The second one is correct: the fix makes the app send a request the recording never saw, so strict replay can't prove the bug is gone. Capture a capsule that covers the fixed path.

Login-gated flows

Tokens and OTPs are redacted on device, so replaying a flow behind a login often hits *.redacted and becomes inconclusive (a missing token can send the app down another path). For QA builds, use a test account whose token you deliberately leave out of the deny list, or start the failing flow after login so the token isn't part of it.