Previews
A preview is an ephemeral environment Verify builds on demand and runs scenarios against. It's how Verify makes behavioral claims real — every "the endpoint returns X" criterion needs the code to actually run somewhere, and the preview is that somewhere.
A preview is short-lived: built for the branch's current commit, used by the scenario runner (and optionally a human reviewer), and torn down when the branch moves to a new commit. A re-run on the same commit reuses the running preview — including its state. See Lifecycle for the exact contract.
Aviator can build the environment itself — the sandbox method, described through most of this page — or use one your own CI deploys, the endpoint method. See Externally hosted previews.
Optional, not required
Previews are optional. Verify works on day one with code-scan alone — without a preview, every criterion is routed to code-scan (static analysis of the diff) and you get verdicts on structural criteria from the first PR.
A preview unlocks runtime verification: behavioral criteria like "the endpoint returns 429" or "the modal closes on submit" need the code to actually run, and that requires a preview. Most teams get going with code-scan and add a preview when their criterion list starts asking about behavior the diff alone can't answer.
Lifecycle
Define
The preview is configured in the Verify settings in the Aviator dashboard (Verify → Settings → Verify, with the repo selected).
Build
Aviator boots a container from the cached image and prepares the environment.
Boot
The setup script runs. The declared port becomes reachable.
Use
Scenarios execute against the preview. Reviewers can also open it from the UI.
Teardown
When the branch moves to a new commit (or the preview is stopped), the optional teardown script runs and the container is destroyed.
Whether a run starts fresh depends on whether the branch has moved. When a verification run starts, Aviator compares the branch's current head SHA to the SHA the existing preview was built from:
New commit since the last run — the old container is torn down and a fresh one is built and booted. The setup script runs. The run starts from a clean slate.
Same commit (a re-run) — Aviator reconnects to the already-running container and skips the setup script entirely. Everything from the previous run persists: database rows, files, logged-in sessions.
The practical consequence: if your scenarios mutate data, a re-run on the same commit sees the previous run's leftovers. Push a new commit (or stop the preview) to force a clean boot.
Composition
A preview is composed of inputs from three places: a preview image, your secret store, and your repo.
Image — a preview image registered with Aviator for your account. Aviator caches the image locally and boots containers from it. Register images through Settings → Sandbox in the Aviator UI.
Secrets — runtime secrets (DB passwords, API keys) referenced by name from the account secret store and injected as environment variables when the container boots.
Setup script — optional. Runs after the container starts and before the port is marked ready. Used for migrations, seeding, warm-up.
Teardown script — optional. Runs before destruction to release external resources.
Port — the port the runner connects to. The container is considered ready when this port accepts connections.
Aviator stitches these together into a single ephemeral container. Your Verify settings are the contract — see Preview YAML reference for every field.
Externally hosted previews
Many teams already deploy an ephemeral environment for every pull request from their own CI. Rather than have Aviator build a second one, a preview can be declared as externally hosted — method: endpoint in the config. The environment stays yours; Aviator only borrows it.
The split of responsibility:
Builds and deploys the environment for the pull request
Correlates the registration to the verification session for that PR or branch
Registers its URL (and the commit it's running) with Aviator
Waits for a registration when a run needs one
Destroys the environment on its own schedule
Drives the app at the registered URL and records the evidence
Optionally deregisters early when it tears the environment down
Stops using the registration at its expiry
Aviator never builds or tears down an externally hosted preview, and never holds infrastructure credentials for it — the environment is already running by the time Aviator sees it.
Registered on every push, or built on request. The table above is the simplest arrangement: CI deploys and registers on every push, and Aviator finds a registration waiting. When a deploy is expensive, or environments come from a small pool, an endpoint preview can instead carry a provision block: Aviator sends your system a preview_provision event when a verification run needs a preview of a commit and nothing is registered for it, and a preview_done event when nothing will drive that preview any more. Your system builds on the first, registers as usual, and reclaims on the second. The event reaches you as a GitHub Actions workflow_dispatch or as a signed webhook. The environment is still yours; only the trigger moves. See Provisioning a preview on request.
Waiting, then degrading. Verification and the deploy pipeline run on their own clocks, so a run that needs the preview waits for one to be registered, up to a configured timeout. If the registration arrives in time, scenarios run against it. If it doesn't, verification still completes on code analysis alone — a degraded result rather than a failure — and a registration that lands afterwards starts a follow-up verification automatically. A registration also has to match the commit being verified: one built from a stale commit never drives the run.
Choosing between the two methods:
You don't already build per-PR environments and don't want to
You already run per-PR ephemeral environments in CI
The service boots from an image plus a setup script
The environment needs infrastructure Aviator can't host — managed data stores, private networks, a multi-service topology
You want previews with no CI work at all
You want verification to run against the same environment your team already reviews
Within endpoint, register on every push when deploys are cheap and already happen per PR; add provision when they aren't — a shared staging slot, a VM pool, a managed database that can't be cloned per push — so an environment is built only for a verification that needs one.
See Registering an external preview for the registration call and its semantics, and Provisioning a preview on request for the event round trip.
Multiple previews per repo
A repo can have more than one preview configured. Common patterns:
default only
Single API or service. One image, one set of secrets.
default + mirror
The mirror preview points at a more production-like configuration — bigger seed data, real third-party sandboxes. Used by scenarios that need higher fidelity.
api + worker + db
Multi-service apps. Each scenario picks the preview that matches the code it touches.
light + heavy
Light boots fast and is used by most scenarios. Heavy boots slow but covers integration tests that need full setup.
Scenarios target a preview by name. If no name is set, scenarios run against default.
When previews are used
Previews only spin up when the verification run has at least one runtime criterion — a criterion the classifier decides needs to be checked against the running code (see How verification works). If every criterion can be verified by code-scan alone, no preview is built and the run finishes faster.
This matters for cost: previews are the expensive part of verification. The classifier minimizes their use by routing structural assertions away from the runtime path when possible.
Reviewer access
The review document exposes a per-run "Open preview" link. Clicking it gives the reviewer access to the same ephemeral container the scenarios ran against — same data, same configuration, same code under test.
The link expires when the sandbox times out and the preview is torn down. The window is controlled by Sandbox Timeout (minutes) under Verify → Settings → Sandbox (default 60, up to 240). If reviewers routinely need longer sessions, raise that setting; a preview that has already been torn down can be launched again from the review document.
Previews vs. CI environments
Previews look like CI environments but they're not the same thing:
Triggered by
Verify run
Push, PR open, schedule
Lifespan
Until the branch moves to a new commit
Per job (minutes to hours)
Configured in
Verify settings in the Aviator dashboard
CI provider config (GH Actions, etc.)
Used by
Scenario runner + reviewer
Test runners, build pipeline
Purpose
Make behavioral verification real
Run the test suite, ship artifacts
See also
Preview YAML reference — the schema
Creating a preview — walkthrough
Managing previews — bake vs. setup, refresh, cleanup
Seed data for previews — fixtures and deterministic state
Registering an external preview — using an environment your CI deploys
Provisioning a preview on request — having Aviator ask for one when a run needs it
Last updated
Was this helpful?
