30.6 One change, three environments
- Approved by
- Panaversity ·
In everyday life. A restaurant chain adds a new dish. The chef cooks it first in the test kitchen. Then one branch serves it for a week, and the staff write down every plate sent back. Only then does the head office put it on every menu, and the old recipe card stays in the drawer. At each step a different person signs: the chef, the branch manager, the head office. In this section, the test kitchen is development, the branch is staging, and every menu is production. The signatures are the gates, and the old card in the drawer is the way back.
What you will learn. You practice this in Lab 30, Task 4.
- What changed in each environment, and who approved it?
- What does the full table look like for one change?
- How do you go back?
Why it matters. This is row 6: how a change arrives. A change that passed every test on the laptop can still reach production through a cell nobody filled. Following one change across the three columns shows where each gate sits, and what each one proves.
At work. On Tuesday, May 18, 2027, the check passed after the 10:40 fix. Now you follow the change to production, one column at a time.
What changed in each environment, and who approved it?
In each column a different file changed, a different person or check approved it, and a different record proves it. The change starts as a branch and passes the pull request's required checks. It merges to staging and runs on real questions for a week. Then a person applies it to production.
| Development: the laptop | Staging: CI and the staging workspace | Production: the portal | |
|---|---|---|---|
| Which files changed | A branch: the ingestion script, data/file-ids.json with staging's ids, and the new prompt file | The same files, merged, and config/prompts.yaml#staging. The merge applies them to staging | config/prompts.yaml#production, production's own file uploads, and the run log's new field |
| Who approved it | You, the builder | The required checks (30.7), then the pull request's reviewer. Ana reads the prompt's words where they state an AP rule (25.1) | A person, after a week of real questions in staging |
| What proves it | The suite on your laptop, [n of N] | The suite's report names the prompt version and the model. check:environments passed | The run log names the prompt version of every answer |
A week of real questions in staging is the step this book uses in place of a word you may meet, canary. A canary means that a new version runs on real work in one place first, and is watched before it goes everywhere. The run log names the prompt version beside every answer, so a wrong answer points straight to the words that made it. Whether to move to a new version at all is a release decision, and Chapter 29 teaches it in 29.5.
What does the full table look like for one change?
Six rows and three columns, every cell with a value and its proof. This is docs/environments.md at the end of Lab 30, Task 4, with the production apply written as a plan.
| Row | Development: the laptop | Staging: CI and the staging workspace | Production: the portal |
|---|---|---|---|
| 1 Who sends, and what it adds | The worker's code, through the SDK, with the staging key. It adds nothing. By a person: the request in the local log | CI's suite on replay sends nothing. Its live job runs only when the prompt, the model or the golden set changes. The portal's morning job calls the Messages API, which adds nothing. The hosted agent adds agents/ap-worker.md. Proof: claude-lock.staging.json, the agent's version | Same, in the production workspace. Waiting: claude-lock.production.json, made by the production apply |
| 2 What leaves, and what is kept | Requests and responses, logged for testing (21.13). Proof: .gitignore covers the log folder | Recorded answers and traces in CI. Sessions kept until deleted (23.3). Files kept until deleted or expired. During the week of real questions, the same rule as production: nothing of their content is logged, and their sessions are deleted after the week. By a person | Real questions leave. Nothing of their content is logged. Each file is uploaded with an expiry, and deleted when its invoice closes. Proof: config/prompts.yaml#production.fileExpirySeconds |
| 3 Which workspace the file ids belong to | Staging, through the key in .secrets/anthropic.env. Proof: data/file-ids.json[*].workspace | Same. CI's live job: [its credential] | Production, through the portal's production key. It uploads its own files. Proof: config/prompts.yaml#production.workspace, which the ingestion matches |
| 4 Which models may answer | The pin, and no fallback. Proof: the pin in src/loop/config.json | The pin. A fallback list, used only after the SDK's retries, on overload, a server error or a timeout. Empty since Tuesday, until the suite runs a fallback model. Proof: each model in config/prompts.yaml#staging.fallbacks is named in the suite's report | Same |
| 5 Which configuration the run reads | The worker's: config/prompts.yaml, the prompt version in its staging entry, and the SDK run's settingSources: []. Proof: src/sdk/claude-agent.ts#settingSources | The extraction and the hosted worker: the worker's configuration only. Proof: for the extraction, the prompt file that config/prompts.yaml#staging.prompt names exists and the suite's report names that version. For the hosted worker, claude-lock.staging.json. CI's review job, not the worker: the coding agent's, with --model in claude_args. Proof: that line in its workflow file | Same. Proof: for the extraction, the prompt file that config/prompts.yaml#production.prompt names exists. For the hosted worker, waiting: claude-lock.production.json, made by the production apply. By a person: the run log names the prompt version |
| 6 How a change arrives | A branch, then a pull request. By a person | The pull request's required checks: the suite and check:environments. A merge applies to staging with workload identity (23.13). A week of real questions. Proof: claude-lock.staging.json, the agent's version | A person applies it after the week. The old version stays for rollback. Waiting: claude-lock.production.json, made by the production apply. By a person: the run log |
Row 1 leaves out Ana's Claude project, whose cell is "by a person" (30.1). Each difference between columns is written down, in a file, with a proof.
How do you go back?
By naming the old version again. Nothing is deleted. A shipped prompt version is never edited (25.1), so the old prompt file is still in the repository. Going back on the prompt is one line, config/prompts.yaml#production.prompt, changed in a pull request like any other change. For the hosted agent, the lock file records the version applied (23.4). A session can name an earlier version by its id (25.1).
The ingestion stays, and the old prompt reads the same files, which production keeps in its own workspace until their expiry. To undo the ingestion too, revert the pull request.
Figure 30.6. One change, three columns. The required checks guard staging. A week of real questions and a person guard production. The old version stays, so going back is one step.
The operating rule: move one change column by column, with a gate between columns and a proof in every cell. Keep the old version until production has run the new one.
Do this now. Fill the same table for a different change: moving the pin to the newer model that Chapter 29's release plan names, [model id]. A new SDK major version can bring a new API version too (21.13). The current one, 2026-10-21, refuses some requests that older versions accepted. Anthropic's page says that "a request that sends temperature, top_p, or top_k returns a 400 error, even at the parameter's default value."1 Copy this line:
Read docs/environments.md. Fill a copy of the table for one change: the model pin moves to [model id] in every environment. For each column, say which file changes, who approves it, and what proves it worked. Name every cell that changes. Then check whether our requests send temperature, top_p or top_k, and say which rows a new API version would touch. Change no file.
Check yourself
Question 1 / 6
0 answered
In the worked run, what lets the change move from staging into production?
Sources
- Owner
- Panaversity