Chapter 1 · Session 19
One protocol for every gate
By now the platform has tests in many places: the schema tests from Session 5, the access tests from Session 8, the security suite from Session 18 and more. This chapter writes them down as one protocol, gate by gate, and then checks that each test proves what it claims, because a test that cannot fail is worse than no test at all.
35 min2 stepsdocs/testing-protocol.md
By the end of this chapter you can
- Say why a written protocol, not "all tests pass", is the evidence that the platform works.
- Have Claude Code draft docs/testing-protocol.md from what exists: every gate, what it proves, how to run it, when, who signs.
- Audit the tests: rewrite any that only check a word is present, and show a sample of them failing.
Why one written protocol
"All tests pass" is a claim, and claims are cheap. We recorded an agent run that printed npm: not found, and ten minutes later the same job reported 1,326 tests passing. A protocol replaces the claim with a list anyone can check: each gate, what it proves, the exact command or workflow that runs it, when it runs, where its latest result is on GitHub, and who signs it. It is also what IT reads in Session 21, and what lets someone else run the platform in Session 23.
Every gate below exists because we, or the CivOps platform before us, shipped without it once. Most of them you have already built; this session writes them into one page, adds the few that are missing, and proves each one can fail [1].
| Gate | What it proves | Built in | Runs |
|---|---|---|---|
| Schema protocol | The migrations alone rebuild the database; every table has a primary key and row-level security; bad rows are refused; history cannot change; names follow the standard | Session 5 | Every pull request (schema) |
| Seed is current and correct | Made-up data is shifted onto today, marked synthetic, never in production | Session 6 | Every pull request |
| Access tests per matrix cell | One allowed and one refused test for every role and table, plus another site | Session 8 | Every pull request (schema) |
| Default deny on every route, both ways | Signed out and forged cookies refused, each role allowed exactly what the matrix gives, public pages still open, an unlisted route fails | Sessions 9 and 18 | Every pull request (security) |
| Refused role for every destructive or admin action | Delete, approve, release and settings refused for every role the matrix does not name, wherever the code lives | Sessions 8 and 9 | Every pull request |
| Lint, type check and unit tests | No type error or failed unit test reaches main | Sessions 3 and 10 | Before every commit and every pull request (ci) |
| The ten clamps, required checks, CODEOWNERS | Nothing merges red; sensitive folders need a named reviewer | Session 10 | Every pull request (clamps) |
| Production has every migration | The live database matches main | Session 11 | On merge, and daily |
| Backups, and a restore drill | A backup restored to a copy works, counts within 1%, timed, signed by a second person | Sessions 11 and 23 | Nightly; drill quarterly and before each customer install |
| Security suite (OWASP Top 10) | Every risk in docs/owasp.md has a test; demo switches dead in production; no secret in the browser | Session 18 | Every pull request, and weekly with the live site checked signed out |
| Show it red first | Every new test was seen failing with its protection removed | Session 18 | Every pull request that adds a test |
| Screens at phone size | Every screen works at 360 and 390 px, 44 px targets | Session 12 | Every pull request |
| End-to-end journeys and failure paths | A lot goes from first piece to release on a phone; each thing that goes wrong ends in a clear message and the right record | This session | Every pull request (e2e) |
| Whole-site sweep, per role | Every page opens for every role with no crash, failed call or dead link | This session | Nightly |
| Nightly production check with a must-not-exist address | Live pages exist, protected pages refuse, a fake address is 404, the alarm reaches a person | Sessions 11 and 18, finished here | Nightly |
| Conformance | Every line of the intent and every role has a criterion, a test and today's result | This session | Every pull request; signed by the decision-maker |
Draft the protocol from what exists
15 minutesWhy
Claude Code can read every test file and workflow in minutes; you cannot. Asking it to write the protocol from what is really there, gate by gate, with the latest result taken from GitHub rather than from its own memory, gives you an honest page: what is proven, what is missing, and what could not be measured. The gaps it finds are the work for the rest of this session.
Do this
Read every file in .github/workflows/, supabase/tests/, tests/, every other test file, package.json's scripts, .claude/settings.json, docs/clamps.md, docs/owasp.md and docs/runbook.md. Do not change any code.
On a new branch tests/protocol, write docs/testing-protocol.md: the complete testing protocol of this platform, for someone who does not write code. One row per gate, in this order: the schema protocol (rebuild from nothing, row-level security on every table, primary keys, bad rows refused, history unchangeable, names to the standard); seed current and correct; access tests per matrix cell and another site; default deny on every route both ways; refused role for every destructive or admin action; lint, type check and unit tests; the clamps, required checks and CODEOWNERS; production has every migration; backups and the restore drill; the security suite; show it red first; screens at phone size; end-to-end journeys and failure paths; whole-site sweep per role; nightly production check with a must-not-exist address; conformance; and, marked "not needed yet, and when to add it", email honesty and build memory headroom. Also check that .claude/settings.json still denies db push, db reset, push to main and vercel --prod, and list that as a gate.
For each gate give: what it proves in one sentence; the files and the workflow and job that run it; the exact command to run it by hand; when it runs (every pull request, before commit, nightly, weekly, quarterly); whether it is a required check on main; who signs (owner one, owner two, or the decision-maker); and its latest result with the link to the run on GitHub.
Rules:
- Take every result from GitHub (gh run list, gh run view), never from memory or a summary. If a gate has not run, or you cannot tell, write "could not measure" and why. Never "passed".
- A gate with no test yet is "missing", with one sentence on what the test must do.
- Never read a test's exit code through a pipe.
Open a pull request titled "Testing protocol" and give me the counts: gates proven, missing, could not measure.You will see recreated screen
- Results come from GitHub's own record of runs, not from what Claude Code remembers.
- One row per gate: what it proves, how it runs, when, whether it is required, who signs, the latest result.
- Honest counts. The four missing gates are this session's work; the restore drill is Session 23's.
Check it worked
Pull request Testing protocol adds docs/testing-protocol.md with one row per gate, each with a command, a schedule, a signer and a latest result linked to a run on GitHub, or marked missing or could not measure.
Fastest path
Merge the draft protocol now, gaps and all. Every later step in this session updates a row, so the page always says what is true today.
If it goes wrong
The protocol says everything passed, with no links
Say: For every gate you marked passed, give me the link to the run on GitHub, the commit it ran on and how far that commit is behind main. Anything without a run on the latest main is "could not measure". A result about an old commit is not a result about today's code.
A result counts tests from a command piped into tail or head
The pipe's exit code is tail's, not the tests', so a red suite reads green. Our main branch went red for exactly this reason in a deploy script. Say: Run it without a pipe and give me the test command's own exit code. Add set -o pipefail to the top of every shell script in the repository.
It marks a gate passed because a workflow file exists
A workflow file is not a result. Say: Only a completed run on main counts. Show me the run.
A test must prove behaviour, and must be able to fail
Two kinds of test look like proof and are not. The first checks that a word appears in the code: our platform found three in one night's work that searched a file for a function's name, and passed while the feature they guarded was broken. The second can never fail: a probe of our live site reported 350 pages present and 0 absent, because the site answered 200 for every address, real or not. Both stay green for ever. The cure for both is the same check from Session 18: break the thing on purpose and watch the test go red [2].
Audit the tests themselves
20 minutesWhy
The protocol is only as good as its tests. Asking Claude Code what behaviour each test proves finds the ones that only check a word is present, and planting a few defects on a throwaway branch shows whether the rest can fail. Doing it for a sample of every gate takes one CI run; finding out the day a real fault slips past takes much longer.
Do this
Read docs/testing-protocol.md and every test it lists.
1. On a new branch tests/audit: for each test file, list in plain words what behaviour it proves. Any test that only checks that a name or word appears in a file, or only checks a response code without checking what was stored or shown, rewrite to call the code or the route and check the result (what the user sees, or what the database holds afterwards). Add set -o pipefail to every shell script. Push, open a pull request titled "Tests prove behaviour", wait for every check, and report what you rewrote and why.
2. Then, from main, on a throwaway branch tests/red-first-do-not-merge, plant one defect per gate, one commit each, without changing any test:
- a migration that lets the holds table be updated (schema);
- a matrix role given a right it should not have in the generated policies (access);
- lib/access/routes.ts marking /supervisor/review as public (default deny);
- the release action accepting a release by the person who held the lot (failure paths, once they exist);
- the dashboard's hold-time measure off by one hour (conformance, once it exists).
Open it as a DRAFT pull request titled "DO NOT MERGE: red-first check of the protocol", wait for the checks, and give me a table: defect, the tests that failed, and any defect that turned nothing red. Then close it without merging and delete the branch here and on GitHub.
Update docs/testing-protocol.md with the date of this red-first check, and any gate whose defect turned nothing red as "cannot fail: fix".You will see recreated screen
- A test that checked a word, rewritten to check behaviour: the route is called and the database is read afterwards.
- Every planted defect turned a gate red. The last two wait until their tests exist; they are planted again in Step 7.
Check it worked
Pull request Tests prove behaviour is merged; the red-first draft pull request showed each planted defect turning a gate red and is closed unmerged; docs/testing-protocol.md records the date.
If it goes wrong
A planted defect turned nothing red
That gate cannot fail as written. Say: Defect <n> turned no test red. Write the test that catches it, show it failing against that defect on a throwaway branch, and open a pull request with the test. Then mark the gate fixed in the protocol.
Claude Code changes a test on the red-first branch
Say: Do not change any test on this branch. Revert that and report the failures as they are. The point is to see the tests as they are on main.
Claude Code says it rewrote a test, and the old one is gone with no new one
Read the Files changed tab, not the summary. Say: List every test this branch removed or skipped, and why. Never remove, skip or loosen a test without asking me.
Knowledge check
Claude Code reports "1,326 tests passed". What makes that evidence?
Knowledge check
A test searches proxy.ts for the word 'deny' and passes. What is wrong with it?
References
- NIST SP 800-218, Secure Software Development Framework (SSDF) Version 1.1. https://csrc.nist.gov/pubs/sp/800/218/final
- Stryker Mutator: mutation testing (planting defects at scale). https://stryker-mutator.io/
- GitHub CLI manual: gh run. https://cli.github.com/manual/gh_run
Chapter 2 · Session 19
Journeys, and the things that go wrong
Each part of the platform has been tested on its own. A journey test drives the real app in a browser at phone size, through a whole decision, as each person in turn. Failure-path tests do the same for each thing that goes wrong on the floor, and check that it ends in a clear message and the right record.
40 min3 stepsPhone size, made-up data
By the end of this chapter you can
- Have Claude Code write end-to-end journeys for the stamping plant's decision, at phone size, on a throwaway database.
- Write a failure-path test for each thing that goes wrong, checking both the message and the database.
- Add a nightly whole-site sweep per role and finish the nightly production check with a must-not-exist address.
The shape of the suite
Fast, small tests carry the detail; a few slow browser tests prove the journeys join up. Keep many of the first and few of the second, so the whole suite still runs on every pull request [1][2].
The journeys
| Journey | Who, in order | Must end with |
|---|---|---|
| Die change | Operator records first-piece results on a phone → a value outside the part's limits is flagged → quality lead holds the lot, with a reason → after a re-check, a different person releases it → manager view shows the lot released and the hold time | lot_status released; two rows in holds; the hold time on the dashboard matches a hand-worked value |
| Hourly check, offline | Operator loses the network, saves an hourly gauge result, the network returns | The result arrives exactly once |
| Review | Supervisor rejects a record with a reason; the operator sees why and corrects it | The original and the correction both kept, the correction pointing at the original |
End-to-end journeys at phone size
15 minutesWhy
Every unit test can pass while the journey fails at a join: the operator's save never reaches the quality lead's list, or the release button works for the wrong person. A journey test drives the real app in a browser at 390 px, as each role in turn, on a throwaway database with made-up data, and checks the database at the end. Writing all three in one prompt, with the same sign-in helpers the security suite uses, gets them in one round.
Do this
Read docs/INTENT.md, docs/matrix.json, docs/measures.md and docs/testing-protocol.md, and look at how tests/security/setup.mjs prepares the CI database and signs in each role. Reuse it; do not copy it.
On a new branch tests/journeys, add end-to-end tests with Playwright in tests/e2e/, at a phone size of 390 by 844, on the CI database only (the local Supabase that GitHub Actions starts, with the seed; never acme-platform-prod or acme-platform-dev). Use made-up data relative to today, so the tests do not age.
1. Die change: an operator records first-piece results for a lot on press P-03; one value is outside the part's limits and is flagged; the quality lead holds the lot with a reason; a different person releases it after a re-check; the manager view shows the lot released and its hold time. At the end, check in the database: lot_status is released, holds has two rows with the right people and reasons, and the hold time shown matches the value worked by hand in docs/measures.md.
2. Hourly check, offline: the operator's browser goes offline, saves a gauge result, comes back online; the result is stored exactly once.
3. Review: the supervisor rejects a record with a reason; the operator sees the reason and corrects it; both rows are kept and the correction points at the original.
Each journey follows every message a person would see, and fails on any console error or failed request. Add .github/workflows/e2e.yml, with a job named e2e, on every pull request: start Supabase, prepare the data, build and start the app, run the journeys, and keep Playwright's report and screenshots as an artifact. Update docs/testing-protocol.md.
Push, open a pull request titled "End-to-end journeys", wait for the e2e check, and tell me in plain words what each journey did and how long it took.You will see recreated screen
- The test uses the screen as a person does: labels and buttons, at phone size, then checks the database.
- Each journey in plain words, with the database checked at the end, not just the last screen.
You will see recreated screen
| Journey | Result | Time |
|---|---|---|
| die change: first piece to release | passed | 38 s |
| hourly check offline, stored once | passed | 21 s |
| review: reject with reason, corrected | passed | 26 s |
- Three journeys. The screenshots are what an operator saw at each step.
Check it worked
Pull request End-to-end journeys is green with an e2e check whose report shows the three journeys passed, and the die-change journey's hold time matches the hand-worked value.
If it goes wrong
A journey fails some days and passes on others
Usually time: the made-up data was dated, and as it ages the lots fall out of today's screens. We had a dashboard go blank this way. Say: Make every date in the journey's data relative to now, and give each test its own lot so order does not matter. Never mark a flaky test optional.
The journey passes, but the record is wrong in the database
A screen saying "Saved" is not a saved record. Say: After each action, read the row from the database and check its values, not just the message on screen.
The browser lands on the sign-in page in the middle of a journey
The test user's session was not set up for that role, or it expired. Say: Sign in each role with the helper from tests/security/setup.mjs at the start of its part, and fail with "could not sign in" instead of continuing.
The things that go wrong
Most real failures live on the unhappy path, and agents tend to test only the happy one. Each row below is something that happens on a stamping floor, or happened to us. Each test checks two things: the person sees a clear, true message, and the database holds the right record afterwards.
| Failure path | Must see | Why it is here |
|---|---|---|
| Reject or hold with no reason | Refused; the record stays as it was | The rule from Session 5, now proven through the screen |
| Release by the person who held the lot | Refused, with who may release | The quality lead's rule from Session 5 |
| Double tap on Save | One row, not two | Gloves and slow networks |
| Session expires mid-entry | The entry is kept, sign in, saved once | A shift is longer than a session |
| Network drops during save | Kept on the phone, sent once when back | The operator surface works offline (Session 12) |
| Another site's lot number typed in | Not found, never the record | Session 18's changed-id test, from the screen |
| A key missing or wrong at start-up | A plain message naming the setting, never its value | We had a key whose value was its own name pasted in, and sign-in emails silently never arrived |
| A stand-in service in production | Refuses, never claims success | We had a Send button mark every recipient "sent" while no email left |
| No data for a measure | "No data", never 0 | We had a chart grade twelve invented points "In control" on 87 screens |
| A server error | A page with a way back, no stack trace | Session 18's A10 test, from the screen |
A test for each thing that goes wrong
15 minutesWhy
Each of these failures happens on the floor every week, and each one, untested, has a cheerful default: a duplicate row, a lost entry, a zero where nothing was measured, "sent" when nothing was. One prompt with the full list gets every failure-path test in one pull request, each checking both the message and the database, and fixes what they find with the test that proves it.
Do this
Read docs/testing-protocol.md and tests/e2e/. On a new branch tests/failure-paths, add Playwright tests in tests/e2e/failure-paths.spec.ts, at 390 by 844, on the CI database, one per failure below. Each checks the message the person sees AND the row in the database afterwards (or that no row was written):
1. A reject or a hold with no reason is refused; the record stays as it was.
2. A release by the person who held the lot is refused, and the message says who may release.
3. A double tap on Save writes one row, not two.
4. The session expires in the middle of an entry: the entry is kept, the person signs in again, and it is saved once.
5. The network drops during a save: the entry is kept on the phone and sent once when the network returns.
6. Another site's lot number typed into the lot search: "not found", never the record.
7. A missing or malformed key at start-up (run the app once with NEXT_PUBLIC_SUPABASE_URL blank, once with it set to its own name): a plain message naming the setting, never its value.
8. Any stand-in service (email, files, AI) in production refuses with a clear message instead of reporting success.
9. A measure with no data shows "No data", never 0.
10. A server error shows a page with a way back, and no stack trace or SQL.
If a test fails because the app really does the wrong thing, keep the test, fix the app in this pull request, and tell me what was wrong. Add the file to the e2e job, update docs/testing-protocol.md, push, open a pull request titled "Failure paths", wait for the checks and report each path's result.You will see recreated screen
- Real problems found by the tests, fixed in the same pull request, each now guarded.
- The database is checked, not just the screen. A message alone can lie.
Check it worked
Pull request Failure paths is green; its report lists ten failure paths, each passed; any problem found is fixed with its test in the same pull request.
If it goes wrong
A test checks only the message on screen
Say: For every failure path, also read the database afterwards and check what was or was not written. A button that claims success while nothing happened passes any test that only reads the screen.
Claude Code skips path 8 because there are no stand-ins
Good, if true. Ask: List every external service the app calls (email, file storage, AI, payments) and what it does when that service is not configured in production. Anything that returns success without doing the work is a stand-in.
A nightly sweep, and a production check that can say "no"
10 minutesWhy
Journeys cover the main paths; a sweep opens every page, as every role, and records any crash, failed call or dead link. On our platform a sweep opened 424 static and 139 dynamic pages and found what no journey had: links that compiled and went nowhere, and shared services a redesign had dropped. The nightly production check from Session 11 needs one more thing: an address that must not exist, so it can tell "present" from "answers everything", and an alarm someone has heard.
Do this
On a new branch tests/sweep:
1. Add tests/e2e/sweep.spec.ts and a nightly workflow .github/workflows/nightly.yml (03:17 UTC, and by hand): on the CI database, sign in as each role in docs/matrix.json, open every page in lib/access/routes.ts that role may open, follow every link on each page, and record any console error, failed request, error page, 404 or page without styles. Fail with a list per role and page.
2. In the same nightly workflow, check the live site https://acme-platform.vercel.app signed out, changing nothing: the public pages answer 200 with their real content; every protected page lands on the sign-in page; /this-page-must-not-exist-7f3a answers 404; landing on the sign-in page where content was expected, a 5xx or a timeout is "could not measure" and fails the run.
3. If anything fails, open a GitHub issue labelled nightly, assigned to both owners, with the failing step, the run's link and the first 40 lines of its log. Add a workflow_dispatch input fire_alarm that fails one step on purpose with "alarm test".
Update docs/testing-protocol.md. Push, open a pull request titled "Nightly sweep and production check", wait for the checks and tell me the result.After it merges, run it once with the alarm on and check the issue arrives; close it, and run it again with the alarm off:
https://github.com/acme-ops/acme-platform/actions/workflows/nightly.yml
Choose Run workflow, set fire_alarm to true, and press Run workflow.
You will see recreated screen
| Role | Pages | Links followed | Problems |
|---|---|---|---|
| operator | 6 | 41 | 0 |
| supervisor | 9 | 63 | 0 |
| quality lead | 10 | 70 | 0 |
| manager | 7 | 52 | 0 |
production: 4 public pages present, 17 protected pages → /sign-in /this-page-must-not-exist-7f3a → 404 ✔ (absent, as it must be)
- Every page each role can open, and every link on it.
- The must-not-exist address answered 404, so a "present" from this check means something.
Check it worked
The nightly workflow is on main; the alarm run opened an issue (now closed); the run with the alarm off is green, with the must-not-exist address reported absent.
If it goes wrong
The production check reports every page present, including the fake address
The site answers 200 for every address, or the check counts the sign-in page as the page it wanted. That check could only ever say "fine", and we had one. Say: Make the fake address fail the run unless it answers 404, and treat the sign-in page as "could not measure" where content was expected.
The sweep finds links to pages that do not exist
A link that compiles is not a link that resolves: we had 130 tool links pointing at an address that did not exist. Say: For each dead link, show me where it is and what it should point to, and fix it with the sweep as the test.
The alarm fails but no issue appears
Say: The alarm test failed and no issue was opened. Show me the issue step's log, give the workflow issues write permission if that is the cause, and run the alarm test again.
Knowledge check
A double tap on Save stores two inspection rows. The screen showed "Saved" once. Which test catches it?
Knowledge check
Why does the nightly production check include an address that must not exist?
References
- Martin Fowler: The Practical Test Pyramid. https://martinfowler.com/articles/practical-test-pyramid.html
- Google Testing Blog: Just Say No to More End-to-End Tests. https://testing.googleblog.com/2015/04/just-say-no-to-more-end-to-end-tests.html
- Playwright documentation: Getting started. https://playwright.dev/docs/intro
- Playwright documentation: Emulation (phone sizes, offline). https://playwright.dev/docs/emulation
- Google Testing Blog: Flaky Tests at Google and How We Mitigate Them. https://testing.googleblog.com/2016/05/flaky-tests-at-google-and-how-we.html
Chapter 3 · Session 19
Conformance, and the signed protocol
Secure and working is not yet enough: the platform must do what your intent promised. Conformance traces every line of the intent and every role in the matrix to a criterion, a test and today's result. Then the whole protocol is run once from main, and signed by the people who own it.
30 min2 stepsEnds with a gate
By the end of this chapter you can
- Have Claude Code write docs/conformance.md: every intent line and role traced to a given-when-then criterion, a test and a result.
- Keep hand-worked values as independent evidence that no agent may update.
- Run the whole protocol from main, record the results from GitHub, and sign it.
From a line of intent to a green check
Your intent (Session 2) says what the platform is for and what it must never do by itself. The matrix (Session 7) says who may do what. Conformance means each of those promises has a test, and each test has a result. Written as a table in the repository, one row per promise, it is called a traceability matrix, and it is exactly what an auditor or IT reviewer wants to see [1].
Write each criterion as given (the starting situation), when (what someone does) and then (what must happen). It is plain enough for the quality lead to confirm and precise enough for Claude Code to turn into a test [2].
| Intent line (stamping plant) | Given · when · then |
|---|---|
| The quality lead decides at each die change whether to hold a lot | Given a first-piece result outside the limits, when the operator saves it, then the lot appears in the quality lead's hold list within one minute |
| A hold always says why | Given a lot, when anyone holds it without a reason, then the hold is refused and the lot stays as it was |
| The system never releases a lot by itself | Given a held lot and no person acting, when a day passes, then the lot is still held |
| Managers see hold time per press each shift | Given the seeded shift for press P-03, when the manager opens the dashboard, then the hold time shows the value worked by hand in docs/measures.md |
Trace the intent: docs/conformance.md
15 minutesWhy
Every promise in the intent with no test is a promise nobody checks, and every test with no promise is work nobody asked for. Tracing them in one table shows both. Asking Claude Code to write the missing tests in the same pull request, against hand-worked values it may not touch, turns the table from a document into evidence; and the decision-maker signing it means the person who owns the decision agrees the platform does what they need.
Do this
Read docs/INTENT.md, docs/matrix.json, docs/measures.md and docs/testing-protocol.md, and the tests in tests/e2e/.
On a new branch tests/conformance, write docs/conformance.md: one row per line of the intent (including the "never by itself" rule and each thing it says we are not building), one per role in the matrix, and one per dashboard measure. Each row: the promise in the intent's own words; a criterion as "given ..., when ..., then ..."; the test that proves it (file and test name); its latest result with the link to the run on GitHub. For each allowed action, add the unhappy-path row that says what is refused.
Write any missing test in tests/e2e/conformance.spec.ts, on the CI database, at 390 by 844. For measures, assert the value worked by hand in docs/measures.md. Never change a hand-worked value: if the platform shows something different, stop and tell me both numbers.
Leave a line at the top: "Checked with <decision-maker's role> on <date>". Update docs/testing-protocol.md. Push, open a pull request titled "Conformance", wait for every check, and report: promises, criteria, tests passing, and anything you could not test and why.Then sit with the decision-maker, read docs/conformance.md on GitHub together, and ask: is each criterion what you meant? Is any promise missing? Give their changes to Claude Code in their words, then fill in the sign-off line:
The quality lead read docs/conformance.md and said: <paste their changes>. Update the criteria and tests to match, fill in the top line "Checked with the quality lead on <today's date>", and push to the same pull request. Wait for the checks.You will see recreated screen
- Every promise traced to a criterion, a named test and a run on GitHub.
- It stopped on a mismatch instead of changing the hand-worked number. That is exactly the rule.
You will see recreated screen
| Promise | Latest |
|---|---|
| A hold always says why | passed |
| Never releases a lot by itself | passed |
| Release by another person | passed |
| Hold time per press | passed |
- The person who owns the decision agrees the platform does what they need.
Check it worked
docs/conformance.md is merged, signed by the decision-maker, with every promise in the intent and every role traced to a criterion and a test passing on GitHub; any mismatch with a hand-worked value was decided by a person.
If it goes wrong
Claude Code updated a hand-worked value so the test passes
Say: Revert the change to docs/measures.md. Hand-worked values are only changed by a person. Show me both numbers and how each was worked out. Then decide with the decision-maker.
A promise in the intent cannot be tested
Usually it is too vague ("faster decisions"). Ask the decision-maker what they would see on the day it is true, write that as given-when-then, and test that. If it truly cannot be tested, the row says so and why.
Tests exist that no promise asks for
List them in the table under "Not in the intent". Some are protections (security, phone size) and stay; others are work nobody asked for, and the intent or the test should change.
Run the whole protocol from main, and sign it
15 minutesWhy
Each gate has passed on its own pull request; the protocol is only true when every gate has run on the same commit of main and passed there. Running them together once, with results taken from GitHub, and two people signing (one who ran it, one who checked it) is the evidence IT asks for in Session 21 and the habit the platform runs on after you hand it over. Making the new e2e check required means the journeys protect every later change, too.
Do this
Run the whole protocol in docs/testing-protocol.md on the latest commit of main. Start every workflow that does not run on its own with gh workflow run (including nightly, security-weekly and e2e), wait for each with gh run watch, and plant again, on a throwaway branch tests/red-first-2-do-not-merge, the two defects from the audit that waited for their tests (a release by the person who held the lot; the hold-time measure off by one hour). Show both turning a test red in a DRAFT pull request, then close it without merging and delete the branch.
On a new branch tests/protocol-run, update docs/testing-protocol.md: for every gate, the run link, the commit, the date and the result from GitHub. A gate with no run on this commit is "could not measure", never "passed". Add at the top: "Run by pat@acme.com on <date> at commit <short hash>. Checked by sam@acme.com on <date>. Next full run: <date three months from now>, and before each customer install." Open a pull request titled "Testing protocol: first full run" and wait for the checks.https://github.com/acme-ops/acme-platform/settings/rules
Open the ruleset protect main. Under Require status checks to pass, add e2e beside ci, schema, clamps and security. Save.
Owner two opens three of the run links at random, checks each is on the commit named at the top, and approves. Merge.
You will see recreated screen
- Every gate on the same commit, with honest labels for what is not yet measurable.
- Two signatures: one who ran it, one who checked it.
You will see recreated screen
| Status check | Source |
|---|---|
| ci | GitHub Actions |
| schema | GitHub Actions |
| clamps | GitHub Actions |
| security | GitHub Actions |
| e2e | GitHub Actions |
- e2e joins the required checks: a change that breaks a journey or a failure path cannot merge.
Check it worked
docs/testing-protocol.md on main names the commit every gate ran on, each with a run link and result, signed by both owners with the next run date; e2e is a required check.
Fastest path
Start all the workflows first and let them run side by side; waiting for each before starting the next triples the time.
If it goes wrong
A check is red for a reason that has nothing to do with the protocol
Ask first: Which commit did this run on, how far behind main is it, and has main fixed anything since? A verdict on an old commit, or a canceled deploy replaced by a newer one, is not a failure of today's code. Re-run on the latest main; only diagnose what is still red.
The summary says everything passed but a run link shows red
Trust the run. Say: Run <link> is red. Give me its exit code and the last 20 lines of its log, fix the cause or mark it failed in the protocol, and never report a gate passed without its run.
Owner two finds a run link on a different commit
The result is about other code. Say: Re-run <gate> on commit <hash> and update its row. Then check the others.
Knowledge check
The hold-time test fails after a formula change. What should happen?
Knowledge check
Why must every gate's result in the protocol come from a run on the same commit of main?
References
- NIST SP 800-218, Secure Software Development Framework (SSDF) Version 1.1. https://csrc.nist.gov/pubs/sp/800/218/final
- Cucumber: Gherkin reference (Given, When, Then). https://cucumber.io/docs/gherkin/reference/
- GitHub CLI manual: gh workflow run. https://cli.github.com/manual/gh_workflow_run
- GitHub Docs: Available rules for rulesets (require status checks). https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets
Chapter 4 · 12 questions · 80% passes
Final assessment
Twelve questions across the session. Score 80% (10 of 12) to pass. Your LMS records your score and each answer; you can review the chapters and try again.
15 min12 questions≈ 15 minutesRetake allowed
Your result
CivOps AI Academy
Prove It Works: the Complete Testing Protocol, Journeys and Conformance
Element F17 complete · Learner
Your LMS records this completion. For the CivOps Foundation certificate, finish the Foundation Course at https://civops.io/learn.