Skip to the page

Testing

Release rehearsals

Clone main’s rows onto an isolated branch, push your migration and test queries as users and service keys before updating main.

API
—
In the schema
—

What you’ll build#

This page rehearses a release on a full copy of production before the release reaches main. You clone main’s rows onto an isolated branch, push the release schema and run the release build against the cloned branch. Once the migration and access rules pass on the clone, you push the release to main and remove the branch.

Where a pull request’s branch tests a single change against empty or seeded tables, a rehearsal exercises the entire release across every stored row and validates updated access policies against real user accounts.

Full-data rehearsal clone

napalm branches create --data --preview clones main’s schema, rows, accounts and file pointers onto an isolated branch while leaving production webhooks, actions and schedules behind.

Migration plan & row-level apply

napalm schema push --plan prints the DDL statements and the query checks. The push then applies the migration across every copied production row ahead of main.

Before you start#

You need a project in production, the release’s schema and queries in your checkout (dbschema/default.gel and dbschema/queries) and the napalm CLI signed in with napalm login. Creating and removing a branch needs the manage scope.

A copy of main’s rows needs room. Branches may fill four fifths of the cluster’s volume, and copied rows count toward the limit. napalm branches ls notes shows the space branches take on the volume. Without room, napalm branches create fails with 409 volume_full.

Copy main’s rows to a branch#

Terminal
# A branch with main's schema, settings and rows. An operation copies the rows.# On a cluster with a preview shard, --preview runs the branch on that shard, away from main.napalm branches create notes rehearsal --data --preview # Wait for the copy. The create command prints the operation's id.napalm operations show <operation-id> --wait

The copy takes longer as main grows. Until the copy finishes, napalm branches ls notes lists the branch’s rows as copying. The branch holds main’s rows as of the copy, and later writes to main stay on main.

Schema and settings
main’s schema, sign-in settings and endpoint settings. A setting changed on the branch leaves main alone.
People
main’s accounts. The branch signs sessions with a separate key, so a session from main does not work on the branch.
Files
File records copy with the rows and point at main’s stored bytes. Deleting a file on the branch leaves main’s file in place.
Left on main
Keys, webhooks, actions and schedules. The rehearsal calls none of main’s webhook receivers or handlers.

Branches covers each branch’s address and moving a branch between shards.

Push the release to the branch#

Terminal
# The plan against the copy, with the query checks. Nothing is applied.napalm schema push notes --branch rehearsal --plan # The migration, applied to the copy of main's rowsnapalm schema push notes --branch rehearsal --yes

On a branch, napalm schema push typechecks every file in dbschema/queries against the new schema without deploying named queries, then executes the DDL migration across every copied row and reports total elapsed duration. Any constraint or rewrite violation against production data aborts on the branch while leaving main untouched, letting you iterate until the migration applies cleanly.

Point the app at the branch#

Terminal
# The staging site's origin, and statements from sessions as well as keysnapalm endpoint notes --branch rehearsal --enable --passthrough all --allow-origin https://staging.example.com # A client that sends each statement, with every query checked against the branch's new schemanapalm generate notes --lang ts --branch rehearsal # The release build at the branch's address: the project's address, then /branches/<name>VITE_NAPALM_URL=https://<project-address>/branches/rehearsal npm run build

The branch starts with main’s endpoint settings. A project locked down for launch has passthrough keys, which refuses a statement sent with a session. --passthrough all lets the release build’s sessions send statements on the branch, and main keeps keys.

Deployed queries belong to main, so the release build sends each statement with the call. A client generated without --deployed works this way, and --branch rehearsal checks every query against the branch’s schema during generation. Develop against a personal branch sets up a branch the same way for daily work.

Try the release as people and services#

Use the release build as people would, and run your services against the branch.

Terminal
# A key for a service in the rehearsal, good on the branch only. It's shown once.napalm keys create notes --label rehearsal --branch rehearsal --days 7 # One person's reach today, then after the releasenapalm people reach notes ada@example.comnapalm people reach notes ada@example.com --branch rehearsal
People
A branch signs people in separately. napalm people ls notes --branch rehearsal lists the copied accounts, and every tester signs in again on the branch.
Sign-in mail
The branch keeps main’s mail server, and the copied accounts hold real addresses. Sign up test accounts on the branch, so no sign-in mail from the rehearsal reaches a real person.
Keys
Keys belong to one branch, and the branch refuses a key made for main. Give each service in the rehearsal a key made with --branch. Service keys covers expiry, read-only keys and a key’s reach.
Access
napalm people reach counts the objects of each type one person can read, change and delete. Run the count on main and on the branch. A difference comes from a rule the release changes or from rows written after the copy.

Push the release to main#

Once the rehearsal passes, release the schema the usual way. Deploy the schema with the app covers a merge, a push from CI and two habits for a safe deploy. Live schema changes splits a change into steps the open app survives. Inspect main’s migration plan first.

Terminal
# Main's plan. Nothing is applied.napalm schema push notes --plan # After the push: the production client, calling each deployed query by namenapalm generate notes --deployed --lang ts

Check the plan against the statements the branch ran. A statement the branch never ran is untested on main’s rows. On main, the push also deploys the queries in dbschema/queries and refuses a change that breaks a deployed query. The production build then calls each deployed query by name through a client generated with --deployed.

Remove the branch#

Terminal
napalm branches remove notes rehearsal

The command drops the copy and revokes every key made for the branch. A branch still copying main’s rows cannot be removed until the copy ends.

On a cluster that keeps a change log, the removed branch’s log stays readable until the retention window ends, and the retained log bytes are billed until then. napalm branches keep sets the window, and napalm branches forget notes rehearsal deletes the log at once.

Check the rehearsal#

  1. Push the release to the branch again

    The second push applies nothing and reports that the branch already has the schema.

  2. Call the branch with a key from main

    The branch refuses the key. The same statement sent with the rehearsal key gets an answer.

  3. Read main’s plan

    napalm schema push notes --plan lists only statements the branch ran.

  4. Remove the branch

    napalm branches ls notes no longer lists rehearsal, and napalm keys ls notes shows the rehearsal key as revoked.

Type a word or two to search every docs page.