Skip to content

Quiz: Environments, Deploys and Rollbacks

Test your understanding of environments, parity, the deploy steps, preview deployments, rollbacks, in-flight work and deploy checklists with these review questions.


1. What is a staging environment?

  1. The copy of the app on your own laptop
  2. A private copy that runs on the same kind of servers as the live app, used only for testing before a change reaches members
  3. The live copy of the app that members use
  4. A temporary copy built for one pull request and deleted after merge
Show Answer

The correct answer is B. Staging is the dress rehearsal: the real stage with nobody watching. It should match production in code, build and versions, and differ only in its data and keys, with made-up data, Stripe test keys and vendor keys with a low cap. Option A is the local environment. Option C is production. Option D is a preview deployment. The dating-safety app launched without staging.

Concept Tested: Staging Environment

See: Three Places Your App Runs


2. Why does a platform rollback stop harm faster than a git revert?

  1. A rollback also restores the database to its old state
  2. A rollback deletes the bad commit from GitHub
  3. A git revert can only undo one line at a time
  4. A rollback switches back to an earlier build the platform already has, with no new build or deploy needed
Show Answer

The correct answer is D. The platform keeps a list of recent deploys with the exact build each one ran, so switching back takes seconds. A git revert makes a new commit that then has to build and deploy, which takes minutes. You often want both: roll back to stop the harm, then revert so main matches what's running. A rollback restores code, not data (A), and it doesn't touch GitHub (B).

Concept Tested: Roll Back a Deploy

See: When a Deploy Goes Wrong: Rolling Back


3. In the dating-safety app, development plugins were shipped to members' browsers, and the app still worked. Why is that a problem?

  1. Tools meant for the builder can expose internals or debug features to every member, and nobody notices because nothing breaks
  2. Development plugins make the production build fail
  3. Development plugins delete the database on start-up
  4. Browsers refuse to load pages with development plugins
Show Answer

The correct answer is A. Dev-only code in production is easy to miss because the app keeps working. The cost is that members download extra code, and some tools show internal details or debugging features nobody meant to publish. The fix is to mark each development plugin to apply only while serving in development, and add a check that fails the build if dev-only code appears. It doesn't break the build (B) or the browser (D).

Concept Tested: Dev-Only Code in Production

See: When Dev-Only Code Reaches Members


4. A builder ticked Production, Preview and Development for the database address and the live Stripe key on Vercel. What should you tell your agent to fix?

  1. "Remove preview deployments entirely."
  2. "Move the keys into the code so every environment matches."
  3. "Give previews their own staging database, Stripe test keys and capped vendor keys, and never tick Preview on a live key."
  4. "Keep the settings, but only open previews on weekends."
Show Answer

The correct answer is C. A preview is an environment, and with the production database and live key, clicking through a pull request can write to members' data or charge a real card. Previews are useful, so removing them (A) loses a good tool. Putting keys in the code (B) puts secrets in the repository, which Chapter 6 rules out. Timing (D) doesn't change what the preview can reach. Ask the agent to list every variable shared between production and preview.

Concept Tested: Preview Deployment

See: Preview Deployments


5. The dating-safety app's start command, build command and health check lived only in the Railway dashboard. What should you ask the agent to do?

  1. Take a screenshot of the settings page each month
  2. Leave them alone, since dashboard settings never change
  3. Copy them into the project instruction file as a note
  4. List every setting on the service's page, write them into a railway.json in the repository, and confirm the next deploy reads it
Show Answer

The correct answer is D. Deploy config in git gives these settings the same history, review and undo as code. When something breaks, the git history shows what changed. Screenshots (A) and notes (C) drift from what the platform runs. Dashboard settings do change (B), often by a click nobody remembers. After the move, the dashboard should show the settings come from the file.

Concept Tested: Deploy Config in Git

See: A Worked Example: Moving Deploy Config Into Git


6. Fifteen minutes after a deploy, the error tracker shows scans failing. The deploy before it worked fine and changed no database tables. What should you do first?

  1. Debug in production until you find the cause
  2. Roll back to the previous deploy, then investigate and revert in git
  3. Wait an hour to see if the errors clear on their own
  4. Push a quick guess at a fix straight to main
Show Answer

The correct answer is B. When the last good deploy is minutes old and no database change is involved, rolling back is the fastest way to stop harm. It turns the deploy into a two-way door. Debugging in production (A) and pushing guesses (D) keep members on broken code longer and can add new bugs. Waiting (C) lets every scan in that hour fail. The deploy checklist says the same: roll back first, investigate after.

Concept Tested: Roll Back a Deploy

See: A Worked Example: Rolling Back a Bad Scoring Change


7. Scans run inside the Express server and take up to a minute. Every deploy kills the scans in progress. Which fix lets long scans survive a deploy?

  1. A job queue kept outside the server, so a new worker picks up any scan the old one didn't finish
  2. Graceful shutdown alone, with the default short wait
  3. Deploying only at night
  4. A feature flag around the scan code
Show Answer

The correct answer is A. A job queue keeps the list of tasks outside the server, usually in the database, so a task doesn't vanish when a server stops. Graceful shutdown (B) lets short work finish, but the platform only waits so long, and a minute-long scan can outlast it. The two work best together. Deploying at night (C) only lowers the odds. A flag (D) changes which code runs, not whether work survives a restart.

Concept Tested: Job Queue

See: Job Queues


8. A change works on the laptop and breaks in production. Laptop: Node 22, a tiny database, the dev server. Production: Node 20, a large database, the built files. Why is environment parity the issue?

  1. Production should always run an older Node version
  2. Laptops can't run real databases
  3. Each difference nobody chose is a place a bug can hide, and here three such differences stack up
  4. The dev server is always faster than the built files
Show Answer

The correct answer is C. A function new in Node 22, a query that is fast on ten rows and slow on a million, and code that only works under the dev server can each hide until production. Good enough parity means every difference is chosen and written down. Pin the Node version in the repository, list required variables, and run the production build in staging. Option A has no basis, and laptops run real databases fine (B).

Concept Tested: Environment Parity

See: A Worked Example: Five Ways Environments Drift


9. A deploy also ran a migration that drops a column the old code reads. Why does a rollback not make this deploy safe?

  1. Rollbacks don't work on Railway
  2. A rollback restores old code but not old data, so the old code now reads a column that is gone
  3. Rollbacks also re-run every migration
  4. The platform blocks rollbacks after any migration
Show Answer

The correct answer is B. Rollback turns a deploy into a two-way door only while the database still fits the old code. A destructive migration is a one-way door, and rolling back the code leaves it broken against the changed schema. That's why Chapter 11's expand-and-contract plan adds the new thing first and drops the old column in a later deploy, after nothing reads it. Rollbacks work on Railway (A) and don't re-run migrations (C).

Concept Tested: Roll Back a Deploy

See: When a Deploy Goes Wrong: Rolling Back


10. An agent suggests putting the no-locate rule behind a feature flag "so we can turn it off if a vendor needs testing." How should you judge this?

  1. Good idea, since flags make every change safer
  2. Fine, as long as the flag defaults to on
  3. Fine, as long as only admins can flip it
  4. Reject it: a must-be-right safety rule should never be behind a switch someone could turn off
Show Answer

The correct answer is D. Feature flags suit good-enough-for-now changes, such as trying a new results-page layout on a few members. A flag on a safety rule makes the rule one click from off, by mistake, by a confused agent, or by anyone with access. Defaulting to on (B) or limiting who can flip it (C) still leaves the switch. Test vendors with fixtures and staging, and keep the rule enforced in code.

Concept Tested: Feature Flag

See: Feature Flags: Shipping Code That Is Turned Off