Chapter 1 · Session 12
Design the screen with the operator
The operator surface is where the plant's data is born. Before any code, Claude Code writes the screen out in plain words from your intent, schema and role matrix, and you check it with an operator at the press, on paper, in gloves.
30 min2 stepsNo code yetAbout 3 hours hands-on in all
By the end of this chapter you can
- Say why the operator screen decides the quality of every number above it.
- Apply the floor rules: 44 px targets, 64 px for gloves, text sized for the distance, calm until abnormal, blank is never 0.
- Have Claude Code write a plain-English screen plan, and check it with an operator at the press.
Where data is born
Every chart the manager reads and every hold the quality lead decides starts with an operator typing a number at a press. On paper, a smudged number is caught later, if at all. On a screen, a mis-tap is never caught, unless the screen is designed so the mis-tap cannot happen. That is why the operator screen comes first: the supervisor review and the manager view (Session 13) can only be as good as what this screen records.
The course example is the stamping plant's first-piece entry: after a die change, the operator measures the first part off the press against the part's characteristics and enters the results for the new lot. Each result becomes one row in inspections, which you made in Session 5. Use your own plant's first task in its place.
The floor rules
These rules come from published guidance, adjusted for the floor. Apple asks for tap targets of at least 44 by 44 points [1]. The web's accessibility standard, WCAG 2.2, sets 24 by 24 CSS pixels as the minimum and 44 by 44 as the enhanced level [2] [3]. Gloves make the contact patch bigger and less precise, so the course rule is higher still for the main action.
| Rule | Why | How it is checked |
|---|---|---|
| Every target at least 44 by 44 px, with 8 px between targets | A finger is wider than a mouse pointer; a wide contact must not hit two buttons | A screen test measures every control at 360 and 390 px wide (Step 7) |
| The main action (Save) at least 64 px high, full width, at the bottom | Gloves, and the thumb is already at the bottom | The same test, plus ten entries in gloves (Step 5) |
Fields at 16 px or larger, with the decimal keypad (inputmode="decimal") | Phones zoom into smaller fields and the page jumps; the keypad has big keys and no letters [4] | Screen test, and tapping a field on the phone |
| Capital letters at least the viewing distance divided by 156 | Readability depends on the angle a letter fills at the eye, not on pixels | A ruler at the press (Step 5) |
| Calm until abnormal: grey while values are inside limits; a value outside is the only thing in colour, with words | When colour is rare it always means something; about 1 in 12 men cannot tell red from green [5] | Enter a value outside its limits and read the words |
| Context always on top: site, press, part, lot, shift, who is signed in | A shared tablet must never record under the wrong person or press | Look at the top of the screen |
| A blank field means not measured, and is saved as no value, never 0 | Zero is a real reading. We once showed an unreadable sensor as 0, and a screen full of invented values as finished | A screen test saves a blank field and reads the row |
Ask Claude Code for a screen plan, not a screen
10 minutesWhy
Asking for a screen straight away gets you something that looks finished and that you cannot check. A plan in plain words, written from your intent, schema and role matrix, can be read by an operator in ten minutes and corrected for the cost of a sentence. It also makes Claude Code read the rules the screen must keep before it writes any of it.
Do this
cd ~/code/acme-platform && git switch main && git pull && claudeRead docs/INTENT.md, docs/SCHEMA-PLAN.md, docs/matrix.json and docs/naming-standard.md. Do not write any code.
On a new branch ui/operator-first-piece-plan, write docs/screens/operator-first-piece.md: the operator's first-piece entry screen, in plain English, for someone who does not write code. It covers one task only: after a die change, the operator records the first-piece results for the new lot on one press.
Give:
1. Who uses it (the operator role in docs/matrix.json), where (standing at the press, phone or tablet, gloves on), and how often.
2. What the top of the screen always shows: site, press, part, lot, shift and who is signed in.
3. Every field, in order: which characteristic, its unit, its limits as stored in the characteristics table, and the keypad it needs. Nothing the operator does not record on paper today.
4. What the screen decides and what it leaves to others: it shows whether each value is inside its limits; it never holds or releases a lot (the quality lead does).
5. The floor rules: every target at least 44 px with 8 px between targets, Save at least 64 px high and full width at the bottom, fields at 16 px or larger, capital letters at least the viewing distance divided by 156, status in words as well as colour, nothing that needs hover, and a blank field means "not measured" and is never shown or saved as 0.
6. What happens with no network: the entry is kept on the device, the screen says how many entries are waiting, and each is sent exactly once when the network returns.
7. Everything the database or the access rules can refuse for this entry, and the plain sentence the operator sees for each.
8. A text sketch of the screen at phone width, top to bottom.
9. "Questions for the operator": anything the intent, schema or matrix does not settle.
Then open a pull request titled "Operator first-piece screen: plan" and show me the link.You will see recreated screen
- It reads the matrix to find who may use the screen. If it does not, say: Read docs/matrix.json first.
- Each field comes from the characteristics table, with its unit and limits. No invented fields.
- The refusals and questions are the most valuable part: they become tests and corrections.
Check it worked
The pull request has one new file, docs/screens/operator-first-piece.md, with fields, the floor rules, what happens offline, what can be refused, a text sketch and a list of questions.
If it goes wrong
Claude Code started writing the page anyway
Say: Stop and remove the code. I need the plan in plain words first, as asked. A screen nobody has checked with the operator is a screen you build twice.
The plan adds fields the intent never mentions (photos, comments, a signature pad)
Say: Move every field the intent and the paper form do not need under a heading Not now, with the reason. Every extra field is a tap the operator makes forever.
It lists a refusal you do not understand
Ask: Explain refusal N to me as you would to the operator, and say which rule in the schema or the matrix causes it. If no rule causes it, it should not be in the plan.
Check the plan with an operator, at the press
20 minutesWhy
The operator knows what the plan cannot: whether gloves come off to measure, where the tablet would hang, which value they skip at night. Each answer is a field, a size or a rule. Finding it at the press costs twenty minutes; finding it after go-live costs a rebuild, a retest and the operator's trust.
Do this
Print the text sketch from the plan, or draw it on paper at full phone size (the Form Builder tool in the course pack does the same, if you use it). Take it to the press where the screen will be used, at the time of a real die change, with the area supervisor's permission and the plant's safety equipment. With the operator:
- Hold it where it will be used. Phone in the hand or tablet on a stand? Measure the distance to their eyes. Capital letters must be at least that distance divided by 156 (700 mm gives 4.5 mm).
- Tap it in their gloves. Ask them to point at each field and the Save button with a gloved finger. Any target they hesitate over is too small or too close to another.
- Walk the task. "The die is changed. What do you measure first? What do you write down?" Note any value they record that the plan lacks, and any field they never fill.
- Answer the questions at the end of the plan, in their words.
Then give Claude Code the answers:
The operator on press <number> checked docs/screens/operator-first-piece.md with me at the press:
1. <paste their answer to question 1>
2. <paste their answer to question 2>
The device will be <a phone in the hand | a tablet on a stand>, read from <distance> mm. They also said: <anything else they changed>.
Update the plan to match, including the minimum capital-letter height for that distance, add a line "Checked with the operator on press <number> on <today's date>" at the top, and push to the same pull request.When the plan is right, owner two approves and the pull request merges.
You will see recreated screen
- Who checked it, where and when.
- A rule that came from the press. This is what the step is for.
Check it worked
docs/screens/operator-first-piece.md is merged on main, with the sign-off line, the device and distance, and no open questions.
Fastest path
Go at a real die change, not between them. You see the task done, the gloves and the light as they are, and one visit answers every question.
If it goes wrong
The operator wants the screen to decide hold or release
That is the quality lead's decision (your intent says so). Write their wish in the plan under Not now, and show them the supervisor review in Session 13: it is where an out-of-limit result gets a person's decision quickly.
The operator's gloves do not work on the touchscreen at all
Many work gloves do not register on a phone or tablet. Ask the safety lead whether touchscreen-compatible gloves are allowed at that press, and test with them. If not, a stylus on a lanyard or a larger tablet with 64 px targets everywhere are the usual answers. Record the choice in the plan.
Knowledge check
Operators at the press wear touchscreen gloves. Under the course rule, how big must the Save button be?
Knowledge check
The operator leaves burr height blank because they did not measure it. What should be saved?
References
- Apple Human Interface Guidelines: Accessibility. https://developer.apple.com/design/human-interface-guidelines/accessibility
- W3C: Understanding WCAG 2.2 Success Criterion 2.5.8 Target Size (Minimum). https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html
- W3C: Understanding WCAG 2.2 Success Criterion 2.5.5 Target Size (Enhanced). https://www.w3.org/WAI/WCAG22/Understanding/target-size-enhanced.html
- MDN Web Docs: inputmode. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
- National Eye Institute: Color blindness. https://www.nei.nih.gov/learn-about-eye-health/eye-conditions-and-diseases/color-blindness
- W3C: Understanding WCAG 2.2 Success Criterion 1.4.3 Contrast (Minimum). https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html
Chapter 2 · Session 12
Build it with one complete brief
One brief, in the Session 3 template, with its acceptance checks written first, turns the signed-off plan into the screen, the outbox that keeps entries through a network drop, and the tests that prove both. You read Claude Code's answers to seven questions; GitHub runs the proof.
40 min2 stepsOne pull request
By the end of this chapter you can
- Explain the outbox: an entry kept on the device, with an id made there, accepted by the database exactly once.
- Give Claude Code one complete brief that builds the screen, the outbox and its tests in one pull request.
- Read the change through seven questions, each answered with the line that proves it.
Working when the network drops
Every plant has a dead spot. An operator who loses an entry once goes back to paper. A plain web form sends the entry when the operator taps Save; if the network is down the entry is gone. Worse is the half-failure: the entry reaches the database, the reply is lost, the device thinks it failed and sends it again, and the first-piece result is recorded twice.
The answer is an outbox on the device:
- When the operator taps Save, the screen makes an id for each result on the device (
crypto.randomUUID()[1]) and keeps the entry in the browser's IndexedDB storage, which survives a reload or a closed tab [2]. The screen says Saved on this device. - A small sender tries to send each waiting entry, waiting a little longer after each failure (backoff). An entry leaves the outbox only when the database confirms it.
- The
inspectionstable gets a new column,client_id, that must be unique. A second arrival with the same id is ignored [3], so a retry can never make a second row. The column arrives as a new migration: Session 5's rule that an applied migration is never edited still holds. - A service worker, a small script the browser keeps beside the page, stores the screen and the part's limits so the screen opens with no network at all [4].
Why one complete brief
You learned the brief in Session 3: goal, context, acceptance checks written first, out of scope, and how to show it works. This step's brief is long because each line replaces a round of back and forth. It names the documents to read, the tests that must fail before the code exists, the files Claude Code must not touch, and what to report. One complete brief builds the screen, the outbox, the migration and the tests in one pull request, and Claude Code fixes its own red checks before it reports.
Two things in it are specific to this stack. This version of Next.js differs from older guides, so the brief tells Claude Code to read the guides in node_modules/next/dist/docs/ before writing a page or the service worker; request middleware is in proxy.ts [5]. And sign-in denies every route by default (Session 9), so a new page is refused for everyone until docs/matrix.json opens it for a role. The brief adds the screen to the matrix and regenerates the route list; it never edits the generated file by hand.
One brief: the screen, the outbox and its tests
20 minutesWhy
Writing the brief with its acceptance checks first means the proof arrives with the screen, and you never merge a screen nothing tests. Putting the plan, the floor rules, the offline behaviour, the matrix change and the report you want into one prompt replaces the dozen messages it takes to add each rule as you remember it.
Do this
Save everything between the two lines of dashes below as docs/briefs/12-operator-first-piece.md on a new branch ui/operator-first-piece, commit it, then carry it out.
----------
# Brief 12: the operator's first-piece entry
## Goal
After a die change, an operator at a press records the first-piece results for the new lot, gloves on, at arm's length, even where the wi-fi drops, and every result reaches the inspections table exactly once.
## Context (read first)
- docs/screens/operator-first-piece.md (signed off by the operator): the screen, field by field.
- docs/INTENT.md, docs/SCHEMA-PLAN.md, docs/matrix.json, docs/naming-standard.md, CLAUDE.md.
- supabase/migrations/ (inspections is append-only: a correction is a new row), lib/access/routes.ts and proxy.ts.
- This Next.js version differs from older guides. Before writing any page, the service worker or proxy code, read the relevant guides in node_modules/next/dist/docs/ and follow them.
## Acceptance checks (write these first, run them, show me they fail, then build)
Playwright tests in tests/e2e/operator-first-piece.spec.ts, at 360 and 390 px wide with touch, signed in as the operator test user, against the local Supabase database with the made-up seed, the same way the Session 9 route tests run. Never against the development or production project.
1. Every tappable control is at least 44 x 44 px with 8 px between them; Save is at least 64 px high and full width; every field's text is at least 16 px; there is no sideways scroll.
2. Each measurement field uses inputmode="decimal".
3. Three entries saved offline show "3 waiting to send"; back online the screen shows "All sent" and the database holds exactly the new rows for those three entries, never twice as many.
4. The same result sent twice with the same client_id makes one row.
5. An entry the database refuses (a lot at the other made-up site the Session 8 cross-site test uses) stays on the screen with a plain sentence saying why, is never shown as sent, and is never dropped.
6. A blank field is saved as no value, never 0, and the screen says "not measured".
7. Each row's recorded_by is the signed-in operator, set by the database from the session, whatever the page sends.
8. Signed out, /operator/first-piece sends you to sign in; signed in as a role the matrix does not give this screen, it is refused.
## What to build
1. A new migration (npx supabase migration new inspections_client_id) adding client_id uuid, unique, to inspections, with a pgTAP test that a second row with the same client_id is refused. Do not edit any existing migration.
2. The screen at /operator/first-piece, exactly as the plan describes. Add it to the screens in docs/matrix.json for the operator role only, and regenerate lib/access/routes.ts with the existing generator. Do not edit generated files by hand.
3. The outbox: on Save, give each result a client_id from crypto.randomUUID(), keep the entry in IndexedDB, show "Saved on this device", and send in the background with backoff. Insert with the operator's own session, never the service role key, and treat a duplicate client_id as already sent. An entry leaves the outbox only when the database confirms it.
4. A service worker so the screen and the part's limits open with no network. Cache only this screen and the reference data it needs. Clear the outbox and the cache when a different person signs in.
5. A status line: "All sent" or "N waiting to send". Never "Online" from navigator.onLine.
6. Run the screen tests in CI on every pull request (in the existing phone check if there is one, otherwise as a new job).
## Out of scope
Supervisor review and the manager view (Session 13). Holding or releasing lots. Changing any existing test, check or limit. Touching the development or production project.
## How to show it works
Open a pull request titled "Operator first-piece screen". Wait for every check on GitHub to finish. Then report in plain words: each acceptance check, pass or fail, and how you showed it failing before the code existed; the new migration's file name; and the preview link. If a check fails, fix the code, never the check, and wait again before reporting.
----------You will see recreated screen
- It reads this Next.js version's own guide before writing the service worker. If it does not, say: Read the guides in node_modules/next/dist/docs/ first.
- Red first: the tests fail because nothing exists yet. A test that never failed proves nothing.
- The screen opened for the operator role only, in the matrix. Default deny keeps it shut for everyone else.
Check it worked
Pull request Operator first-piece screen is green on GitHub, and Claude Code's report lists all eight acceptance checks as passing and says how each was shown failing first.
Fastest path
"Wait for every check and fix it before reporting" saves a whole round trip: Claude Code reads its own red checks and fixes them while you do something else. Leave it running and come back to the report.
If it goes wrong
The page exists, but every role, even operator, is sent to sign in or refused
That is default deny working: the screen is not in docs/matrix.json, or the route list was not regenerated. Say: The new screen is refused for the operator. Add it to the screens in docs/matrix.json for the operator role and regenerate lib/access/routes.ts with the generator. Do not edit the generated file or the proxy by hand.
A check named for a list fails (the routes or the policies), though the screen works
The generated list no longer matches the matrix. Say: The "<check name>" check failed. Read its log, run the command that regenerates the list, commit the result, and show me what changed in it. If the list shows a screen open to a role I did not ask for, stop and tell me.
Saving fails with "new row violates row-level security policy"
An insert that returns its new row also needs the right to read it. Say: The insert into inspections is refused by row-level security. Check the operator's read right covers the row after the insert. Do not use the service role key. If the matrix must change, show me the change and wait.
Claude Code made the tests pass by changing them (a smaller size, a skipped test)
Say: Undo every change to the acceptance checks. Fix the screen, not the check. If you think a check is wrong, explain why and wait. Read the list of changed files on every pull request before the summary.
It reports success but a check on GitHub is red
Say: The check on the pull request is red. Run gh pr checks, read the failed log, fix the cause and wait for green before you report. We learned to trust the check on GitHub, never the summary.
It tries the same failing fix again and again
After the second identical failure, say: Stop. Do not try again yet. Tell me what failed (quote the error), what you have tried, and whether the cause is in our code or outside it.
Read the change through seven questions
15 minutesWhy
You do not need to read TypeScript to review a screen. You need to know it does what the plan says, keeps the floor rules and the access rules, and invents nothing. Seven fixed questions, each answered with the file and line that proves it, turn a large change into yes-or-no answers you can check in the Files changed tab, and catch the plausible shortcuts agents take.
Do this
Explain pull request "Operator first-piece screen" to me as you would to the operator. Then answer each question below with Yes or No, the file and line that shows it, and anything I should worry about:
1. Does the screen show only what docs/screens/operator-first-piece.md lists, and nothing extra?
2. Is the client_id change a new migration, with client_id unique, and is every existing migration unchanged?
3. Is every insert made with the operator's own session, never the service role key, and does recorded_by come from the database, not from the page?
4. Is there anywhere a value is shown or saved that nobody typed: a 0 for blank, a default, a sample number, a hard-coded limit instead of the characteristics table?
5. Does the screen say "sent" only after the database confirmed it, and keep every refused entry with its reason?
6. Was the screen added to docs/matrix.json for the operator role only, and lib/access/routes.ts regenerated rather than edited?
7. Did any existing test, check, limit or CI step change?
Do not change anything. If any answer is not what it should be, say what you would change and wait.You will see recreated screen
- Seven answers with file and line: each can be checked in the Files changed tab.
- The note is where the real findings are. This one is a question for the quality lead, not a bug.
Check it worked
Questions 1, 2, 3, 5 and 6 are Yes; questions 4 and 7 find nothing. Any note has been answered or turned into a change.
If it goes wrong
An answer is not what it should be
Say: Make the change you described, push it, wait for every check to be green, then answer the seven questions again.
Question 4 finds a made-up or default number
Say: Remove it. Where there is no value, show "not measured" or "no data", and add a test that renders the screen with no data and expects those words. Our own platform once showed a savings counter that ticked up by itself, a chart graded on twelve hard-coded points, and seven admin users who did not exist. Each looked finished.
Question 3 shows the service role key, or a user id sent from the page
Stop: do not merge. The service role key ignores every access rule, and a user id from the page can be anyone's. Say: Insert with the operator's own session only, and let the database set recorded_by from the session. Add a test that two different operators each save an entry and each row records the right person.
Knowledge check
The database saved an entry but the reply was lost in a dead spot, so the device sends it again. What stops a second row?
Knowledge check
The new page is refused for every role, even operator, though the code is right. What is the likely cause?
References
- MDN Web Docs: Crypto.randomUUID(). https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID
- MDN Web Docs: IndexedDB API. https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
- PostgreSQL Documentation: INSERT (ON CONFLICT clause). https://www.postgresql.org/docs/current/sql-insert.html
- MDN Web Docs: Service Worker API. https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
- Next.js Docs: Progressive Web Apps guide. https://nextjs.org/docs/app/guides/progressive-web-apps
- Supabase Docs: JavaScript client, insert data. https://supabase.com/docs/reference/javascript/insert
Chapter 3 · Session 12
Prove it: on a phone, offline, and in CI
Green checks are where you start, not where you stop. You open the preview on a real phone, in gloves, at the press distance; you take it offline and count the rows; you make Claude Code show that the screen tests fail when the screen is broken; then you merge and let the deploy apply the migration.
35 min4 stepsEnds with a gate
By the end of this chapter you can
- Apply the branch's migration to the development project yourself, and open the preview on a phone.
- Check the screen in gloves and with a ruler, and take it offline by hand.
- Prove the screen tests can fail, then merge and confirm the deploy applied the migration.
The screen testing protocol
These are the checks every operator screen in this course must pass before it merges. Each one is here because we shipped without it once:
| Check | What it proves | Why it is here |
|---|---|---|
| Targets, fields and no sideways scroll at 360 and 390 px | The screen works on the smallest phones operators carry | Sizes that look fine on a laptop are too small under a gloved thumb |
| Offline: N entries saved, N rows arrive, never 2N | No entry is lost or doubled by a dead spot | A doubled first-piece result corrupts every count above it |
| Refused entries kept, with the reason | The screen never says saved when the database said no | We shipped a button that reported every message sent while none left the building |
| Blank is not 0 | Nothing on screen or in the table was invented | An unreadable sensor shown as 0 is a false reading, not a missing one |
| The author comes from the session | The right person is on every record | On our platform every record once said it was created by the founder, whoever was signed in |
| Signed out and wrong-role visits refused | Default deny still holds for the new screen | A new page is the easiest place for an open route to appear |
| Each test shown failing first | The test can catch the fault it is named for | We found tests that could never fail: one reported 350 pages present and 0 absent |
Open the preview on a phone, in gloves, at the press
15 minutesWhy
The preview is the pull request running at its own address, on the development project's made-up data (Session 11 pointed previews there), before anything reaches the floor. Opening it on the real device, in gloves, at the real distance, finds what no test at a desk can: glare, a thumb that cannot reach, a letter too small at 700 mm. The new column must exist in the development project first, and changing a database is kept for a person.
Do this
In a terminal (not inside Claude Code), apply the branch's migration to the development project. It asks for that project's database password: copy it from the password manager entry Supabase: acme-platform-dev database password.
cd ~/code/acme-platform && git fetch && git switch ui/operator-first-piece && npx supabase link --project-ref tsrqponmlkjihgfedcba && npx supabase migration listnpx supabase db pushFrom Session 11 on, production gets migrations only from the deploy workflow on merge. Your computer stays linked to the development project. Then open the pull request and its preview link:
https://github.com/acme-ops/acme-platform/pulls
Open Operator first-piece screen, then the Vercel comment's Visit Preview. Send the link to your phone and add /operator/first-piece if it is not there.
Sign in as the development project's operator test user. Then, at the press, with the operator:
- Enter a lot's first piece ten times in gloves. Count every mis-tap and write down what was hit instead.
- Hold a ruler against a capital letter in a field label and in an entered value. Each must be at least the distance from the plan divided by 156.
- Enter a value outside its limits. The value is the only thing in colour, and the words say by how much and which way.
You will see recreated screen
- The new migration, on the branch only.
- Check the prompt names the development project's migration, and only that one.
You will see recreated screen
- Who and where, always shown: a shared tablet never records under the wrong press or person.
- The abnormal value in words, not colour alone.
- Blank stays blank. Nothing is invented.
- Full width, at the bottom, at least 64 px.
Check it worked
Ten gloved entries with no mis-tap you could not explain, letters at least the distance divided by 156, and the out-of-limit value named in words. Write any finding as a comment on the pull request.
Fastest path
Do this at the same press visit as Step 2's next die change: the operator, the gloves and the light are all there, and their comments go straight onto the pull request.
If it goes wrong
The preview asks me to sign in to Vercel
That is Vercel's Deployment Protection: previews are only for your team. Sign in to Vercel on the phone with your acme.com account, then sign in to the platform. A refusal from Vercel before the platform's own sign-in page is not your code.
The preview shows "column client_id does not exist"
The migration is on the branch but not in the development project. Run the two commands above. If migration list shows it under Remote already, ask Claude Code: The preview says column client_id does not exist although the development project has the migration. Check which Supabase project the preview's environment points at, by variable name only.
Remote migration versions not found in local migrations directory
The development project has a migration your branch does not (another branch was pushed there). Do not force anything. Merge main into the branch first (ask Claude Code: Merge origin/main into this branch, no rebase, and push), then run the commands again. If it still differs, ask Claude Code to explain which versions differ without changing any project.
There is no operator test user in the development project
Create one by hand: tsrqponmlkjihgfedcba/auth/users" href="https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/auth/users" target="_blank" rel="noopener">Authentication, Users, Add user, Create new user, with an address at acme.com and Auto confirm on, password in the password manager. Then ask Claude Code for the SQL that gives that user the operator role at cle in memberships, and run it yourself in the development project's SQL editor. Never in production.
Gloved taps hit the wrong field
Comment on the pull request and say to Claude Code: Operators in gloves hit <field> when aiming at <field>. Increase the space between targets to at least 16 px and make every field 64 px high, keep the acceptance checks as they are, and wait for green.
Take it offline by hand, and count the rows
10 minutesWhy
The outbox exists for the dead spot behind the press, so prove it there, not only in a test. Counting rows in the development project is the honest check: the screen saying All sent is a claim; the table is the evidence.
Do this
On the phone, with the preview open on the screen: turn on airplane mode. Enter three first pieces for three different lots. The screen must say 3 waiting to send. Close the browser tab and open it again from the history (still offline): the three must still be waiting. Turn airplane mode off and wait for All sent. Then count the rows:
https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/sql/new
The development project's SQL editor. Paste the query below and press Run.
-- Results saved from the new screen (they have a client_id), one line per lot. Each result must appear once.
select l.lot_code, count(*) as results, count(distinct i.client_id) as distinct_ids
from public.inspections i join public.lots l on l.id = i.lot_id
where i.client_id is not null
group by l.lot_code order by l.lot_code;Then walk the real phone to the worst wi-fi spot in the plant, enter one more, walk back, and run the query again.
You will see recreated screen
select l.lot_code, count(*) as results, count(distinct i.client_id) as distinct_ids …
| lot_code | results | distinct_ids |
|---|---|---|
| L-0412 | 3 | 3 |
| L-0413 | 3 | 3 |
| L-0414 | 2 | 2 |
- Results equal distinct ids: nothing doubled. L-0414 has two because burr was not measured, and blank is not a row.
- If a lot is missing, its entry is still waiting or was refused: look at the phone.
Check it worked
Every entry made offline is in the table exactly once, and the phone says All sent. Note the date and the place you tested in the pull request.
If it goes wrong
The phone says All sent but a lot is missing from the table
Stop: the screen claims success it did not have. Say to Claude Code: An entry made offline shows as sent but is not in inspections. Find where the outbox removes an entry without a confirmed insert, fix it so only a confirmed insert or a duplicate client_id removes it, and add a test for this case that fails before the fix.
A lot shows results greater than distinct_ids
Two rows have the same client_id, so the unique rule is missing in this database. Run npx supabase migration list: the client_id migration must be under Remote. If it is, ask Claude Code why a duplicate client_id was accepted.
After reopening the tab offline, the screen does not load
The service worker is not caching the screen. Say: With no network, /operator/first-piece does not open. Read the service worker guide in node_modules/next/dist/docs/ again, fix the caching for this screen and its reference data only, and add a Playwright test that opens the screen offline after one online visit.
Make Claude Code show the screen tests can fail
5 minutesWhy
A test that cannot fail is worse than none: it is green while the screen is broken, and everyone trusts it. We found tests that only checked a word was present in a file, and a probe that could only ever answer present. Planting each fault once, and watching the test turn red, is the cheapest proof the tests guard what their names say.
Do this
On the branch ui/operator-first-piece, without committing anything, prove three of the acceptance checks can fail:
1. Make the Save button 40 px high; run the size test; show it fails; undo.
2. Make the outbox remove an entry before the database confirms; run the offline test; show it fails; undo.
3. Save a blank field as 0; run the not-measured test; show it fails; undo.
For each, show me the command, its exit code and the last lines of its output, run directly, not through a pipe. Finish with git status showing nothing changed, and add the three results to the pull request description under "Shown failing".You will see recreated screen
- The exit code, not the summary: 1 means the test failed.
- Nothing committed. The proof is in the description, not in the code.
Check it worked
The pull request description has a Shown failing section with three red results, and the checks on GitHub are still green.
If it goes wrong
A planted fault leaves its test green
The test cannot catch what it is named for. Say: Test <name> stayed green with its fault planted. Rewrite it so it checks what the operator would see or what the database would hold, show it failing with the fault and passing without, and push.
Claude Code shows output piped through tail or head
A pipe reports the exit code of the last command, not of the tests. Say: Run the test command on its own and show me its exit code.
Merge, and let the deploy apply the migration
5 minutesWhy
Since Session 11, merging is what changes production: the deploy workflow applies the new migration before the new code goes live, and the daily check compares production with main. Watching this first screen go through proves the pipeline carries a schema change and a screen together, with no person touching the live database.
Do this
Owner two reads the pull request (description, Shown failing, Files changed), opens the preview, approves; merge it. Then watch the deploy:
https://github.com/acme-ops/acme-platform/actions/workflows/deploy.yml
The latest run, for the merge commit. Open it and find the migration step.
https://acme-platform.vercel.app/operator/first-piece
The live screen. Signed out, it must send you to sign in.
You will see recreated screen
- The migration reached production through the pipeline, not from anyone's laptop.
- The daily comparison from Session 11, green.
Check it worked
The deploy run is green with the migration applied, and https://acme-platform.vercel.app/operator/first-piece sends a signed-out visitor to the sign-in page.
If it goes wrong
The deploy run fails at the migration step
Production keeps the old code: the pipeline stops before the new code goes live. Do not run anything against production yourself. Say to Claude Code: The deploy failed at the migration step. Read the log and explain in plain words why, without changing any project. Then follow docs/runbook.md.
The production deploy shows Canceled
A newer merge replaced it within a minute. A canceled deploy that a newer ready deploy replaced is not a failure: check the newest run instead.
The live screen opens without sign-in
Stop and treat it as an incident (docs/runbook.md): the route list or the proxy is wrong. Ask Claude Code which file lets it through, without changing anything, and roll back first.
Knowledge check
The phone says All sent, but a lot is missing from the table. What does that show?
Knowledge check
Why does a person, not Claude Code, apply the branch's migration to the development project?
References
- Playwright: Emulation (viewport, touch, offline). https://playwright.dev/docs/emulation
- Playwright: BrowserContext.setOffline. https://playwright.dev/docs/api/class-browsercontext#browser-context-set-offline
- Vercel Docs: Deployment protection. https://vercel.com/docs/deployment-protection
- Supabase CLI reference: supabase db push. https://supabase.com/docs/reference/cli/supabase-db-push
- Chrome for Developers: Network features reference (DevTools). https://developer.chrome.com/docs/devtools/network/reference
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
The Operator Surface: Touch First, Readable, and Working Offline
Element F10 complete · Learner
Your LMS records this completion. For the CivOps Foundation certificate, finish the Foundation Course at https://civops.io/learn.