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
- —
- CLI
napalm branches create,napalm schema push,napalm endpoint,napalm people reach,napalm branches remove- 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.
Full-data branch clone
Data branches clone production rows and accounts without copying webhooks, actions or schedules.
Rehearsed migration
Schema pushes test every migration step and query check across cloned rows.
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.
Before you start#
You need a production project, the release’s schema and query files checked out locally (dbschema/default.gel and dbschema/queries) and the napalm CLI signed in with napalm login. Creating and removing branches requires manage scope.
Cloning main’s rows requires shard volume headroom. Branches can occupy up to 80% of a shard’s volume, and napalm branches ls notes reports current branch usage. If the cap would be exceeded, napalm branches create fails with 409 volume_full.
Copy main’s rows to a branch#
# Clone main's schema, settings and rows onto an isolated preview branchnapalm branches create notes rehearsal --data --preview # Wait for the background copy operation printed above to finishnapalm operations show <operation-id> --waitCopy duration scales with main’s row count, and napalm branches ls notes reports the branch as copying until the snapshot finishes. Subsequent writes to main stay isolated on main.
- Schema and settings
- Copies
main’s schema, sign-in settings and endpoint settings. Changing a setting on the branch leavesmainuntouched. - People
- Copies
main’s user accounts. The branch signs sessions with a separate key, so sessions issued onmainare rejected on the branch. - Files
- Copies file records pointing at
main’s stored bytes. Deleting a file record on the branch leavesmain’s stored object intact. - Left on main
- Omits service keys, webhooks, actions and schedules so rehearsal runs never trigger
main’s receivers or handlers.
Branches covers branch URLs and moving branches across shards.
Push the release to the branch#
# Preview the migration plan and query checks against the cloned branchnapalm schema push notes --branch rehearsal --plan # Apply the migration across the copied rowsnapalm schema push notes --branch rehearsal --yesOn 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 and leaves main untouched so you can iterate until the migration applies cleanly.
Point the app at the branch#
# Allow the staging origin and statement passthrough from sessions as well as keysnapalm endpoint notes --branch rehearsal --enable --passthrough all --allow-origin https://staging.example.com # Generate a client typechecked against the branch's updated schemanapalm generate notes --lang ts --branch rehearsal # Point the release build at the branch URL (/branches/<name>)VITE_NAPALM_URL=https://<project-address>/branches/rehearsal npm run buildThe branch inherits main’s endpoint settings. A project locked down for launch sets passthrough to keys, which rejects ad-hoc statements from user sessions. Passing --passthrough all on the branch allows session statements during rehearsal while main keeps keys.
Because named deployed queries belong to main, generate the rehearsal client without --deployed so requests send statement text alongside variables, and pass --branch rehearsal to typecheck every query against the branch’s updated schema. Develop against a personal branch uses the same client setup.
Try the release as people and services#
Exercise the release build with test sessions and branch-scoped service keys.
# Issue a branch-scoped service key for rehearsal services (shown once)napalm keys create notes --label rehearsal --branch rehearsal --days 7 # Compare one user's reach on main and on the rehearsal branchnapalm people reach notes ada@example.comnapalm people reach notes ada@example.com --branch rehearsal- People
- Each branch authenticates users independently.
napalm people ls notes --branch rehearsallists the cloned accounts, and testers sign in separately on the branch. - Sign-in mail
- The branch inherits
main’s SMTP configuration while cloned accounts retain real email addresses. Register dedicated test accounts on the branch so rehearsal flows never email real users. - Keys
- Service keys belong to a single branch, and the rehearsal branch rejects keys issued for
main. Issue a dedicated key per rehearsal service with--branch. Service keys covers expiration, read-only mode and reach audits. - Access
napalm people reachcounts the rows of each type a user can read, update and delete. Compare counts betweenmainand--branch rehearsalto verify policy changes against real user data.
Push the release to main#
Once the rehearsal passes, deploy the release through your standard production workflow: Deploy the schema with the app covers merge-driven and CI pushes, and Live schema changes covers multi-step expand-and-contract rollouts. Preview main’s migration plan first.
# Preview the migration plan against main without applying changesnapalm schema push notes --plan # After pushing to main, generate the production client for deployed queriesnapalm generate notes --deployed --lang tsVerify that main’s plan lists the exact DDL statements rehearsed on the branch, since any additional statement was not tested against cloned rows. Pushing to main also deploys dbschema/queries and blocks changes that break an active deployed query, after which your production build uses the client generated with --deployed.
Remove the branch#
napalm branches remove notes rehearsalRemoving the branch drops its copied rows and revokes every service key issued for the branch. A branch cannot be removed while its initial row copy is still in progress.
On clusters with change-log storage enabled, a deleted branch’s log remains readable and billed until its retention window expires. Adjust retention with napalm branches keep or purge the retained log immediately with napalm branches forget notes rehearsal.
Check the rehearsal#
Push the release to the branch again
Confirm the second push reports zero pending DDL changes because the branch already matches your schema.
Call the branch with a key from main
Confirm the branch rejects
main’s service key while succeeding with the rehearsal key.Read main’s plan
Confirm
napalm schema push notes --planlists only DDL statements already rehearsed on the branch.Remove the branch
Confirm
napalm branches ls notesno longer listsrehearsalandnapalm keys ls notesmarks the rehearsal key asrevoked.