# 30.6 One change, three environments (/building-ai-workers/shipping-claude-applications/one-change-three-environments)

---
type: Document
title: "30.6 One change, three environments"
description: "One change taken from development through staging to production: what changed in each environment, who approved it, the full table, and how to go back."
status: stable
order: 330.06
ksor:
  owner: team:panaversity
  audience:
    - public
  approval:
    by: process:panaversity
    at: 2026-11-30T10:58:03Z
chapter: '30'
part: III
expert_status: builder-only
concepts: [ "30.6" ]
last_verified: '2026-11-30'

sources:
  - id: api-migration-2026-10-21
    title: Migrating to API version 2026-10-21 (Claude API docs, verified 2026-11-30)
    resource: https://platform.claude.com/docs/en/api/migration-2026-10-21
generated:
  at: 2026-11-30T10:58:03Z
  by: esl-rewrite/1.2.0+ksor.1
trust_tier: unverified
build_id: sha256:d6ce3f28a2cf8e492a60bae1b426b7cc6466e35e83d70c3b9763db2c55009f4b
dirty: true
ksor_version: 0.0.60
---

**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](#307-claude-in-ci-and-the-release-pipeline)), then the pull request's reviewer. Ana reads the prompt's words where they state an AP rule ([25.1](../prompts-and-structured-output/a-prompt-is-code.md)) | 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 |

<!-- OPEN: the suite's count on the laptop, [n of N], comes from a recorded run. Lab 25's proposed count is 42 of 42 (part-2-facts row 25.10, proposed). No run is recorded. -->
<!-- EDITOR: who applies to production, and how, is not decided (spec point 20). Lab 23 made the production workspace and key, but applying to production was "an extension, not run in this lab". claude-lock.production.json is made by the production apply, which Task 4 writes as a plan, by a second federation rule or a person's apply. -->

<!-- EDITOR: "a week of real questions in staging" is a proposed story fact (see the overview's note): the book has a staging copy of the portal, but says staging holds test data only. -->

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](../agent-loop-by-hand/versions-models-and-keys.md)). Proof: `.gitignore` covers the log folder | Recorded answers and traces in CI. Sessions kept until deleted ([23.3](../hosted-agents/reading-a-session.md)). 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](../hosted-agents/keys-that-expire-and-no-keys-at-all.md)). 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 |

<!-- OPEN: row 3's staging cell for CI's live job waits for Lab 24's open question on how a pull request's live job gets its credential, since 23.13's rule accepts only main (evaluating-ai-workers/lab.md:232). Row 2's fileExpirySeconds key and row 3's workspace key are the spec's proposal (point 23). claude-lock.production.json does not exist until the production apply makes it (point 20). -->

Row 1 leaves out Ana's Claude project, whose cell is "by a person" ([30.1](#301-one-model-many-surfaces)). 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](../prompts-and-structured-output/a-prompt-is-code.md)), 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](../hosted-agents/resources-as-code.md)). A session can name an earlier version by its id ([25.1](../prompts-and-structured-output/a-prompt-is-code.md)).

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." Three tall boxes in a row, left to right, labeled "Development: the laptop", "Staging: CI and the staging workspace", "Production: the portal". A box labeled "the change: scanned invoices and the next extraction prompt" sits in the development column, and copies of it sit in the other two, joined by arrows pointing right. On the arrow from development to staging, a gate labeled "required checks: the suite and check:environments". On the arrow from staging to production, a gate labeled "a week of real questions, then a person". Under the production column, a smaller box labeled "the old version". A curved arrow points from production back to "the old version", labeled "rollback". Alt text must say: one change moves left to right from development to staging to production; the gate into staging is the required checks, the suite and check:environments; the gate into production is a week of real questions in staging and then a person; the old version stays beside production, and a rollback arrow points back to it. -->

*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](../agent-loop-by-hand/versions-models-and-keys.md)). 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."[^api-migration-2026-10-21] 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.

<!-- OPEN: the newer model id waits for Chapter 29's release plan (spec point 9). Until it is named, the line keeps [model id]. -->

[^api-migration-2026-10-21]: Migrating to API version 2026-10-21, Claude API docs, Anthropic.
