Skip to the lesson
CivOps AI Academy · M02Shift Handover: the Operations Log, the Signed Handover and Standing Orders
0%

Chapter 1 · Sessions 1–2

What the old handover holds, and the tables that replace it

Before anything is built, you find out how one area hands a shift over today, what the tool or chat costs, and what gets lost between crews. Then one prompt adds the module's nine tables to your Foundation schema, with the tests that try to break them and a made-up seed, and you try them on the development project before the pipeline takes them to production.

30 min5 stepsSessions 1 and 29 shf_ tablesabout 7.5 hours hands-on across six sessions

By the end of this chapter you can

  • Inventory one area's handover, its tool and its losses from the logs and the bills, inventing nothing.
  • Write down what the handover must carry and where each item comes from, and settle it with both leads.
  • Add the shf_ tables with one prompt, prove them on the development project, and let the pipeline apply them to production.

Check your names once. Every prompt, command and address below uses them.

Saved with your progress. Every prompt, command and address in the course now uses these names. Change them any time from Your names at the top of the page.

What Shift handover replaces

Shift handover gives every area a structured, searchable operations log and a consistent, signed handover filled in from live data, so open issues, holds, permits and equipment out of service cannot be lost between crews. It replaces electronic shift logs and handover tools; the module library names Hexagon j5 Shift Operations Management [1], Eschbach Shiftconnector [2], Tervene, Shiftworx, MaintainX (partly) and SharePoint or Excel logs. A paper logbook, a whiteboard or a chat group is a shift log too, and just as likely to lose a note.

The edge of shift handoverInside: operations log, handover report, sign-off, standing orders, shift tasks and rounds, and the event manager. Outside, each with its owner: permit-to-work issuance in M11, work order execution in M05, and the alarm system of record, which stays in SCADA. INSIDE SHIFT HANDOVER (M02)Operations logHandover reportSign-offStanding ordersShift tasks and roundsEvent managerOUTSIDE, WITH ITS OWNERPermit-to-work issuanceowned by M11Work order executionowned by M05Alarm system of recordstays in SCADA (ISA-18.2)
The edge of Shift handover. Inside: the log, the handover report, sign-off, standing orders, shift tasks and the event manager. Outside, each with its owner: permits (M11), work order execution (M05), and the alarm system of record, which stays in SCADA.
StandardUsed in this module for
UK HSE human factors: safety-critical communication at shift handover [3]A structured, two-way handover, written plus spoken
API RP 1168, Control Room ManagementHandover content and fatigue-aware practice in control rooms
ANSI/ISA-18.2 (IEC 62682)Alarm management principles for the event rules that write log entries
21 CFR Part 11 [4]Signed handovers and acknowledgements, where the log is a regulated record
Step 1

Session 1: Inventory one area's handover and what it costs

40 minutes, most of it in the area

Why

The module must replace the handover people really do, not the one in a procedure. Reading two weeks of the old log and sitting in on one live handover finds the losses nobody reports: the note that never reached nights, the hold the next crew did not know about. The bills tell you what the old tool costs. Claude Code writes it up in minutes, inventing nothing.

Do this

Choose one area that runs at least two shifts. With its supervisor's permission, read the last two weeks of its shift log or handover notes, and sit in on one live handover. Write down: the shifts and their times, who hands over to whom, where and how long, spoken or written or both, and three things that got lost between crews (with the date, never a person's name, and nothing that describes an injury). Open the old tool's bill on the vendor's own account page: amount and renewal date as printed, and what export it offers. Keep any copies in a private folder, never in the repository. Then:

Terminal (Mac) or PowerShell (Windows)
cd ~/code/acme-platform && git switch main && git pull && claude
Paste into Claude Code, after replacing the <...> part
I am starting the Shift handover module (M02). It replaces our shift log and handover tool with the platform. Do not write any code in this session.

On a new branch m02/inventory, create docs/handover-inventory.md from my notes below, with:
1. The area's shift pattern: the shifts with start and end times, the crews (jobs, never names), and one line for every handover: who hands over to whom, where, how long, spoken, written or both.
2. What a handover carries today, item by item, and where each item comes from (a screen, a whiteboard, memory).
3. Three things that were lost between crews: date, what was lost, what it cost (as I describe it), and what would have caught it.
4. Tools: name, owner (a job), the bill amount and renewal date exactly as I give them, and the export it offers.

Use only what is in my notes. Never fill in a price, a count, a date or a vendor feature I have not given you: write "unknown, ask <who>" instead. No person's name anywhere. End with "Questions to settle".

Open a pull request titled "M02: handover inventory", wait for the checks, and tell me the result in plain words.

My notes:
<paste your notes here>

You will see recreated screen

claude — acme-platform
⏺ Write(docs/handover-inventory.md)
+| Days → Afternoons | 13:50 at the press shop desk | 10 min | spoken + whiteboard |
+| Afternoons → Days (next morning) | 05:50 by phone | 3 min | spoken only |
1
⏺ Write(docs/handover-inventory.md)
+## Lost between crews
+- 14 Oct: P-04 clutch noise reported on afternoons; days ran it at full rate; not on the whiteboard.
2
⏺ Write(docs/handover-inventory.md)
+| Shared handover spreadsheet | supervisor | part of the office suite | unknown, ask IT | unknown, ask IT | export to CSV |
⏺ Pull request #38 adds docs/handover-inventory.md: 2 shifts, 3 handovers a day, 3 losses, 1 tool. The tool's cost is marked unknown, ask IT. One question: is the phone handover at 05:50 ever written down?
The inventory, written from your notes only. Where a figure was missing it says who to ask.
  1. Every handover, how it happens today.
  2. The losses are the case for the module, in your plant's words.

Check it worked

docs/handover-inventory.md is in a pull request with every handover, three losses, every bill copied from an invoice or marked with who to ask, and no person named.

If it goes wrong

Claude Code fills in a cost or a count you did not give it

Say: Remove every figure I did not give you and write unknown, ask <who>. Agents fill empty places so a page looks finished; on our platform a report showed a revenue figure the customer never gave. The saving you claim in Session 6 is only as good as these figures.

The old log is a chat group

It still counts. Export the chat if the service allows it, or note the dates you read. Do not copy messages that name people into the repository.

Step 2

Session 1: Write down what the handover must carry, and settle it with both leads

20 minutes

Why

The handover report is filled in automatically from other modules and from the log, so every item must have a source. Writing the list now, with the outgoing and incoming leads, decides the snapshot's contents, the categories people will really use, and how many minutes after shift end a handover may wait before it escalates. Each of those becomes a rule in a table next session.

Do this

Paste into Claude Code
Read docs/handover-inventory.md. On a new branch m02/content, write docs/handover/content.md for someone who does not write code:
1. Every item the handover report must carry for this area, and its source: the platform's own log (open and carried entries, equipment out of service, active standing orders), or another module's event (mes.shift_summary.ready for production against plan, OEE and downtime; cmms.work_order.status_changed for open work orders; qms.hold.placed for holds; ehs.permit.activated for active permits; ehs.incident.reported for safety events). Mark items whose module we do not have yet as "not yet available".
2. The log categories we will use (from production, quality, safety, maintenance, environmental, process, logistics, general) with one real example each from the inventory, and what each priority (info, low, medium, high, critical) means here.
3. N: how many minutes after shift end a handover must be accepted before it escalates, and who is told.
End with "Questions for the leads". Open a pull request titled "M02: handover content", wait for the checks, and show me the link.

Read it on GitHub with the outgoing and the incoming lead of one handover. Then:

Paste into Claude Code, after replacing the <...> parts
The leads answered the questions in docs/handover/content.md:
1. <their answer>
2. <their answer>
They also said: <anything else they changed>.
Update the file, add "Checked with the outgoing and incoming leads on <today's date>" at the top, and push to the same pull request.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/handover/content.md)
+| Open and carried entries | our log | always |
+| Holds placed this shift | qms.hold.placed | not yet available (M08 not installed) |
+| Presses out of service | our log: equipment status | always |
1
⏺ Write(docs/handover/content.md)
+N = 30 minutes after shift end. Escalates to: the shift supervisor.
2
⏺ Pull request #39 adds docs/handover/content.md: 9 items, 6 from our own log, 3 waiting for other modules. Two questions for the leads.
The content list: every item with its source, and the number that decides escalation.
  1. Each item with its source. Items from modules you do not have yet are listed, not invented.
  2. Your N, decided by the people who hand over.

Check it worked

docs/handover/content.md is merged with every item's source, the categories with real examples, N in minutes and who is told, signed off with both leads and the date.

If it goes wrong

The leads want everything in the snapshot

Ask what the incoming lead reads first, in the first five minutes. Put that first; the rest can be one click away in the log. A report nobody finishes reading is a lost handover too.

Nobody agrees on N

Take the time the procedure gives, or 30 minutes, write it down as provisional, and look at the on-time rate after the side-by-side week in Session 6.

The nine tables

The module library puts standard columns on every table: id, created_at, created_by, updated_at, updated_by, row_version, archived_at and ext, and a tenant_id; on your platform module tables carry site_id in place of tenant_id, so each keeps one simple access rule. The shared file docs/spine-map.md says which Foundation table plays each core_ name, the same for every module. The module keeps no list of people, equipment or shifts of its own; it points at the shared spine: core_shift_instance (one real run of a shift, such as the afternoon of 2 November), core_shift_definition, core_equipment (an area is equipment at the area level of the ISA-95 hierarchy [5]), core_person, core_data_tag and core_e_signature.

The nine shf_ tablesNine tables. A shift log has many log entries, many shift tasks and one handover. A task template makes shift tasks. An event rule has many occurrences, and an occurrence makes a log entry. A standing order has many acknowledgements. shf_task_templateshf_shift_taskshf_handovershf_event_ruleshf_event_occurrenceshf_shift_logshf_standing_ordershf_standing_order_ackshf_log_entrymakeshas manyhas onehas manyhas manymakeshas many
The nine tables. A shift log has entries, tasks and one handover; a task template makes tasks; an event rule has occurrences, each of which may make an entry; a standing order has acknowledgements.
TableOne row isColumns (req = required; {a, b} = only these values; → points to)
shf_shift_logThe log for one area and one shiftshift_instance_id → core_shift_instance req; area_equipment_id → core_equipment req; status req {open, handed_over, closed}; lead_person_id → core_person
shf_log_entryOne operational event or noteshift_log_id → shf_shift_log req; equipment_id → core_equipment; category req {production, quality, safety, maintenance, environmental, process, logistics, general}; priority req {info, low, medium, high, critical}; title text req; body text; status req {open, monitoring, closed}; carry_forward bool req; occurred_at ts req; author_id → core_person req; linked_type text; linked_id uuid; origin req {manual, event_rule, import}
shf_handoverThe signed handover between two leadsshift_log_id → shf_shift_log req; outgoing_lead_id → core_person req; incoming_lead_id → core_person; summary text; auto_snapshot json; signed_out_at ts; signed_in_at ts; outgoing_signature_id → core_e_signature; incoming_signature_id → core_e_signature; status req {draft, signed_out, accepted, escalated}
shf_standing_orderA time-bound instruction to acknowledgeorder_no text req, unique; title text req; body text req; area_equipment_id → core_equipment; issued_by → core_person req; effective_from ts req; effective_to ts; requires_ack bool req; priority req {normal, high, critical}; status req {draft, active, expired, withdrawn}
shf_standing_order_ackOne person's acknowledgement of one orderstanding_order_id → shf_standing_order req; person_id → core_person req; acknowledged_at ts req; signature_id → core_e_signature
shf_task_templateA recurring shift taskarea_equipment_id → core_equipment req; title text req; shift_definition_id → core_shift_definition; rrule text; form_template_ref → frm_template (soft link); active bool req
shf_shift_taskOne task for one shiftshift_log_id → shf_shift_log req; task_template_id → shf_task_template; title text req; assignee_id → core_person; due_at ts; done_at ts; result {done, not_done, not_applicable, issue_found}; note text
shf_event_ruleA rule on a data tag that writes entriesname text req; data_tag_id → core_data_tag req; condition json req; category text req; priority text req; dedupe_window_min int; active bool req
shf_event_occurrenceOne firing of a rule, and the entry it madeevent_rule_id → shf_event_rule req; triggered_at ts req; value text; log_entry_id → shf_log_entry; suppressed bool

Two links are deliberately soft, a uuid with no foreign key, because the module must work without the other module: form_template_ref (an M01 form) and linked_type with linked_id (the record an entry led to). The module library names two pitfalls: free-text entries with no equipment link, which can be read but never counted, and recomputing the snapshot when the handover is viewed, which Chapter 3 prevents.

The life of a log entryA log entry is open, monitoring or closed. An entry that is not closed and has carry_forward true is shown to the next shift. In this build a closed entry cannot change. openneeds actionmonitoringwatching, not yet fixedcloseddone, finalwatch itresolve itor close it straight awaycarry_forward = true, not closedshown to the next shift underCarried from earlier shifts, with its ageClosed is finalin this build a closed entry cannotchange; imported history arrives closed
The life of a log entry. Open, monitoring, closed. An entry not closed with carry_forward true is shown to the next shift with its age. In this build a closed entry cannot change; imported history arrives closed.
Step 3

Session 2: Check the spine before adding to it

10 minutes

Why

The module points at shared tables for shifts, crews, equipment, people, tags and signatures. If Claude Code cannot find them it creates its own, and you get two lists of equipment that drift apart. A read-only report first shows what exists, what plays the role under another name, and what is missing.

Do this

Paste into Claude Code
Read docs/spine-map.md (if another module made it), docs/SCHEMA-PLAN.md, docs/naming-standard.md, docs/matrix.json and every file in supabase/migrations. Do not change anything.

Shift handover (M02) needs these shared ("spine") tables and helpers. For each one: exists (file and line), exists under another name (which table plays the role, for example our equipment table for core_equipment), or missing:
core_person, core_site, core_equipment (with an area level), core_shift_definition, core_shift_instance, core_crew (with lead_person_id), core_data_tag, core_e_signature, core_attachment, core_comment, core_action_item, core_notification, core_event_outbox, core_number_sequence, core_audit_log, and a trigger that sets updated_at, updated_by and row_version.

Then tell me how a person's own area could be recorded (for example ext.area_id on the person), and how our generated access rules decide which rows a person may see. Finish with a short plan: the rows M02 adds to docs/spine-map.md, and one spine migration that adds only what is missing and reuses the rest. Our module tables carry site_id in place of tenant_id.

You will see recreated screen

claude — acme-platform
⏺ core_equipment: exists as equipment (line 12), with a kind column that already holds area, line and press. core_site: sites. core_person: sign-in users with a row in memberships.1
⏺ From M01, already merged: core_e_signature, core_attachment, core_comment, core_action_item, core_number_sequence, core_audit_log and the update trigger.2
⏺ Missing: core_shift_definition, core_shift_instance, core_crew, core_data_tag, core_notification, core_event_outbox. Plan: one spine migration adds these six; own area is ext.area_id on memberships, pointing at the area's equipment row.3
The report: what exists, what plays the role, and what is missing.
  1. Reuse: your equipment table already has the area level.
  2. Pieces another module already added are found, not rebuilt.
  3. Only these are new.

Check it worked

Every spine name is marked exists, exists as, or missing, and the plan reuses your Foundation and earlier module tables instead of creating copies.

If it goes wrong

The plan creates core_equipment next to your equipment table

Say: Reuse equipment for core_equipment. Never create a second table for something we already keep. Two names for one thing is how a rename goes half done: on our platform three ids for one demo company were live at once.

Shift times are hard-coded in the plan

Say: Shift definitions are rows in core_shift_definition, with start and end times and a time zone, so a change of shift pattern is data, not code.

Step 4

Session 2: One prompt: the spine pieces, the shf_ tables, their tests and the seed

20 minutes

Why

The tables, the tests that try to break them and the made-up data in one pull request means the proof arrives with the change and the next sessions have something to build on. The seed's counts are fixed now, so in Session 4 you can count them by hand and check every view against your count.

Do this

Paste into Claude Code
Read docs/handover/content.md, docs/naming-standard.md, docs/matrix.json and the spine plan you just gave me.

On a new branch m02/schema:

1. A spine migration (npx supabase migration new m02_spine) with only the missing pieces from the plan, each with the standard columns (id uuid primary key default gen_random_uuid(), created_at, created_by, updated_at, updated_by, row_version, archived_at, ext jsonb) and site_id in place of tenant_id, reusing our existing tables where they play the role. Every function has set search_path = ''. Add M02's rows to docs/spine-map.md (create it if missing).

2. The module migration (npx supabase migration new m02_shf_tables): these nine tables with the standard columns, a site_id and every column below. req means not null; {a, b} is a check constraint; → is a foreign key; "person" and "equipment" mean the tables the plan uses.
shf_shift_log: shift_instance_id → core_shift_instance req, area_equipment_id → equipment req, status req {open, handed_over, closed}, lead_person_id → person
shf_log_entry: shift_log_id → shf_shift_log req, equipment_id → equipment, category req {production, quality, safety, maintenance, environmental, process, logistics, general}, priority req {info, low, medium, high, critical}, title text req, body text, status req {open, monitoring, closed}, carry_forward bool req, occurred_at timestamptz req, author_id → person req, linked_type text, linked_id uuid, origin req {manual, event_rule, import}
shf_handover: shift_log_id → shf_shift_log req (one per log), outgoing_lead_id → person req, incoming_lead_id → person, summary text, auto_snapshot jsonb, signed_out_at timestamptz, signed_in_at timestamptz, outgoing_signature_id → core_e_signature, incoming_signature_id → core_e_signature, status req {draft, signed_out, accepted, escalated}
shf_standing_order: order_no text req (unique per site, from core_number_sequence), title text req, body text req, area_equipment_id → equipment, issued_by → person req, effective_from timestamptz req, effective_to timestamptz, requires_ack bool req, priority req {normal, high, critical}, status req {draft, active, expired, withdrawn}
shf_standing_order_ack: standing_order_id → shf_standing_order req, person_id → person req (one per person per order), acknowledged_at timestamptz req, signature_id → core_e_signature
shf_task_template: area_equipment_id → equipment req, title text req, shift_definition_id → core_shift_definition, rrule text, form_template_ref uuid (soft link to frm_template, no foreign key), active bool req
shf_shift_task: shift_log_id → shf_shift_log req, task_template_id → shf_task_template, title text req, assignee_id → person, due_at timestamptz, done_at timestamptz, result {done, not_done, not_applicable, issue_found}, note text
shf_event_rule: name text req, data_tag_id → core_data_tag req, condition jsonb req, category text req, priority text req, dedupe_window_min int, active bool req
shf_event_occurrence: event_rule_id → shf_event_rule req, triggered_at timestamptz req, value text, log_entry_id → shf_log_entry, suppressed bool
Every table: row-level security on with no policies yet, the update and audit triggers, an index on every foreign key. A trigger refuses any change to a closed log entry. linked_type and linked_id have no foreign key.

3. Add every new table to docs/matrix.json with no rights yet.

4. pgTAP tests in supabase/tests/m02_schema.test.sql: every new table exists with a primary key and row-level security on; a bad category, a bad status, a duplicate order number, a second handover for one log and an update of a closed entry are each refused.

5. Made-up data in supabase/seeds/m02.sql, listed under [db.seed] sql_paths in supabase/config.toml, marked SYNTHETIC, shifted onto today from one moment read once at the start, and safe to run twice: the press shop area with six presses (P-04 out of service); two shift definitions (Days 06:00 to 14:00, Afternoons 14:00 to 22:00) and two crews, each with a lead; shift instances for the last two days; three leads, nine operators in the area, one standing-order issuer and one log administrator, all SYNTHETIC; fourteen log entries over the first three logs (five open, two monitoring, seven closed; three open and one monitoring with carry_forward true; every category and priority used); three handovers with fixed auto_snapshot values: the first accepted 10 minutes after its shift ended, the second 50 minutes after, the third signed out and never accepted; standing order SO-0001 active and requiring acknowledgement from the nine operators: six before it took effect, one after, two never; one event rule on one synthetic tag with a 30-minute dedupe window.
   The hand-worked examples, with fixed dates, go in tests/fixtures/m02-hand-count.json (the same entries, handovers and acknowledgements) and tests/fixtures/m02-tag-stream.json (episodes 06:00–08:00, 09:00–09:10, 09:25–09:35 and 13:00–13:30), not in the seed. Add a test that loads the hand-count fixture and counts exactly that.

6. Do not connect to or change any Supabase project, and do not run supabase db push.

Push, open a pull request titled "M02: shf tables", wait for every check, and tell me in plain words: the tables added, the tests run and the fixture's counts. If a check fails, fix it and wait again before reporting. End with the exact commands I must type myself to try this on the development project.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx supabase migration new m02_shf_tables)
⎿ Created new migration at supabase/migrations/20261102094500_m02_shf_tables.sql
1
⏺ Write(supabase/migrations/20261102094500_m02_shf_tables.sql)
+create table public.shf_log_entry (
+ category text not null check (category in ('production','quality','safety',
+ 'maintenance','environmental','process','logistics','general')),
+ carry_forward boolean not null,
+ origin text not null check (origin in ('manual','event_rule','import')),
2
⏺ Bash(gh pr checks --watch)
⎿ schema / test pass 2m11s
⏺ Pull request #41 is green. The spine migration adds 6 pieces and reuses equipment, sites and M01's signatures; the module migration adds 9 tables, row-level security on, no policies yet. 41 tests passed, 11 trying bad data. The seed is in supabase/seeds/m02.sql; the fixture tests/fixtures/m02-hand-count.json has 14 entries (5 open, 2 monitoring, 7 closed; 4 carried), 3 handovers (on time, late, never accepted), SO-0001 with 6 of 9 acknowledged in time.3
Two migrations, the tests, the seed, and a fixture whose counts you will check by hand in Session 4.
  1. Spine first: its earlier time makes it run first everywhere.
  2. Every allowed value is a rule in the table, not only in a screen.
  3. The counts you hand-count in Session 4.

Check it worked

Pull request M02: shf tables is green on GitHub, and the summary gives the fixture counts: 14 entries (5, 2, 7; 4 carried), 3 handovers, 6 of 9 acknowledged in time.

Fastest path

"Wait for every check and fix it before reporting" saves a round trip: Claude Code reads the failure while you do something else.

If it goes wrong

CI fails: relation "core_shift_instance" does not exist

The module migration ran before the spine migration. Say: Give the spine migration a timestamp before the module migration on this branch, re-run the tests and push. Only rename migrations that have not reached any database.

The seed uses fixed dates

Say: Count every time back from one moment read once at the start of the seed. We hit this: a seed with fixed dates was ten days old by the next week, and every "this shift" panel was blank.

Claude Code says green, GitHub says 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. A summary is a claim; the check is the evidence.

Step 5

Session 2: Try it on the development project yourself, then merge

15 minutes

Why

A merge applies migrations to production automatically (Foundation Session 11), so the last place to catch a problem is before it. Applying the branch to the development project yourself shows the tables build on a database that already holds your Foundation data. Only a person does this, with the password from the password manager.

Do this

In a terminal, not inside Claude Code:

Terminal or PowerShell
cd ~/code/acme-platform && git fetch && git switch m02/schema && git pull
Terminal or PowerShell
npx supabase link --project-ref tsrqponmlkjihgfedcba

Type the development project's database password from the password manager (nothing shows as you paste). Check, then apply the migrations and the seed. --include-seed is for the first time a seed file is added; after that, reload made-up data with npm run seed:dev. Never supabase db reset on a project.

Terminal or PowerShell
npx supabase migration list
Terminal or PowerShell
npx supabase db push --include-seed
Open

https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/editor

The development project's Table Editor: shf_log_entry holds the fourteen SYNTHETIC entries.

Owner two (sam@acme.com) approves; merge. The deploy pipeline applies the migrations to production:

Open

https://github.com/acme-ops/acme-platform/actions

The deploy run for the merge: green, two migrations applied.

You will see recreated screen

Terminal
$ npx supabase migration list
Local | Remote | Time (UTC)
20261102094000 | | 2026-11-02 09:40:00
20261102094500 | | 2026-11-02 09:45:001
$ npx supabase db push --include-seed
Do you want to push these migrations to the remote database? • 20261102094000_m02_spine.sql • 20261102094500_m02_shf_tables.sql [Y/n] y2
Finished supabase db push.
Two files on your branch, not yet on the development project; db push applies exactly those, then the seed.
  1. Two new files, on your branch only.
  2. Check you linked tsrqponmlkjihgfedcba, the development project. If it lists files you do not expect, answer n.

You will see recreated screen

github.com/acme-ops/acme-platform/actions
M02: shf tables (#41)
Applying migration 20261102094000_m02_spine.sql...
Applying migration 20261102094500_m02_shf_tables.sql...
Finished supabase db push.
After the merge: the pipeline applied the migrations to production. Production's shf_ tables are empty.
  1. The pipeline, after review, changed production; no person ran db push there.

Check it worked

The development project has the shf_ tables and the SYNTHETIC rows from supabase/seeds/m02.sql; the deploy run is green; production's Table Editor (https://supabase.com/dashboard/project/abcdefghijklmnopqrst/editor) shows the shf_ tables, empty.

If it goes wrong

db push: Remote migration versions not found in local migrations directory

The development project has a migration this branch does not, often another module's branch tried there. Do not force anything. In Claude Code: supabase db push on the development project says remote versions are not in the local directory. Tell me which versions differ and which branch each came from, without changing any project.

The deploy run fails on the migration

Good: the pipeline stopped before the code went live. Do not fix it in the dashboard. In Claude Code: The deploy failed applying the m02 migrations. Show me the error and write the fix as a new migration on a new branch. Our production once fell nine migrations behind main because nothing applied them.

The seed fails with a duplicate key

Every seed must be safe to run twice. Say: supabase/seeds/m02.sql failed with a duplicate key when run again. Make it safe to run twice and add a test that runs it twice. Then reload with npm run seed:dev. Never use supabase db reset to get round it.

Knowledge check

Which of these does Shift handover leave to another system?

Knowledge check

Which entry can the analytics count later?

References

  1. Hexagon: j5 Shift Operations Management help. https://docs.hexagonppm.com/r/en-US/j5-Shift-Operations-Management-Help/Version-30/1046047
  2. Eschbach: Shiftconnector digital shift book. https://www.eschbach.com/en/shiftlog/
  3. UK Health and Safety Executive: human factors. https://www.hse.gov.uk/humanfactors/
  4. eCFR: Title 21, Part 11, Electronic records; electronic signatures. https://www.ecfr.gov/current/title-21/chapter-I/subchapter-A/part-11
  5. ISA: ISA-95 standard, Enterprise-Control System Integration. https://www.isa.org/standards-and-publications/isa-standards/isa-95-standard
  6. Supabase CLI reference: supabase db push. https://supabase.com/docs/reference/cli/supabase-db-push

Chapter 2 · Session 3

Who may do what, and the screens

Rights to the log, the handover and standing orders are decided once, in the role matrix, and the rules, the route list and the tests are generated from it. Then Claude Code builds the shift log, the handover report, the standing orders page and an offline phone view, and two leads try them at a real handover.

25 min4 stepsSession 35 roles + 2 machine accounts6 screens

By the end of this chapter you can

  • Add the module's roles, scopes, screens and machine accounts to docs/matrix.json and regenerate the rules and tests.
  • Have Claude Code build the screens with identity from the session and photos kept out of the project folders.
  • Prove the phone view sends what was written offline exactly once, and watch two leads use it at a real handover.

Rights start from nothing

Every role starts with no rights. Nobody deletes: a correction is a new entry or a status change, and a closed entry is never edited. Two scopes need a record behind them: a person's own area (ext.area_id on their membership, the area's equipment row) and a lead's own shift (the shift log's lead_person_id, copied from the crew's lead when the log opens). Role-based access control is described by NIST [2]; on your platform it is enforced row by row by the database [1].

Role (a job)ScopeWhat they do
operatorOwn areaWrite entries with photos and comments, finish shift tasks, acknowledge standing orders, use the phone view offline
outgoing leadOwn area, own shiftAs an operator, plus change any entry's status in the area, write the handover and sign out
incoming leadOwn areaAs an operator, plus work carried entries, ask on the handover and sign in
standing-order issuerSiteIssue, activate and withdraw orders, track acknowledgements, receive escalations
log administratorSiteTask templates, event rules, the import, read everything at the site
machine: shift schedulerNamed jobs onlyOpen logs, make draft handovers, escalate, expire orders
machine: event evaluatorNamed jobs onlyWrite entries and occurrences from event rules
ScreenAddressWho may open it
Shift log/shift/logoperator, outgoing and incoming lead
Handover report, sign-out and sign-in/shift/handoveroutgoing and incoming lead
Standing orders to acknowledge/shift/orderseveryone in the area
Issuer's page/shift/orders/issuestanding-order issuer
Templates, rules and import/shift/adminlog administrator
Offline phone view/shift/fieldoperator, outgoing and incoming lead
Step 6

Session 3: The module's rows in the matrix, and the rules generated from them

20 minutes

Why

One reviewed line in the matrix decides each right, and the database rules, the route guard and the tests all follow from it, so they cannot disagree. Testing in both directions, and reading a row back after every allowed change, catches the two access mistakes we hit most: a role that can do too much, and an update that reports success and changes nothing.

Do this

Paste into Claude Code
Read docs/matrix.json, scripts/gen-policies.mjs, lib/access/routes.ts and docs/access-review.md. Never edit a generated file by hand.

On a new branch m02/access, add Shift handover to the matrix:
- Roles (jobs): operator, outgoing lead, incoming lead, standing-order issuer, log administrator, reusing ours where they fit; and two machine accounts with named jobs only: shift scheduler (runs inside the database as a pg_cron job, so it never signs in) and event evaluator (signs in with its own password, set by a person and listed by name in docs/KEYS.md; never the service role key).
- Scopes: own area = the area in ext.area_id on the person's membership; own shift = the shift log's lead_person_id, or a handover's outgoing_lead_id, is the person.
- Rights, starting from nothing:
  operator: read the area's logs, entries, handovers and active orders; insert entries (origin manual) and comments and photos on them; finish their shift tasks; insert their own acknowledgement and its signature; read their own signatures and the attachments on the area's entries.
  outgoing lead: as operator, plus update any entry's status in the area while it is not closed, and insert and update the handover of their own shift while it is a draft, and sign out.
  incoming lead: as operator, plus sign in a signed_out or escalated handover of their area, never one they signed out.
  standing-order issuer: insert and update standing orders at the site; read acknowledgements; read escalations.
  log administrator: task templates and event rules at the site; read everything in the module at the site.
  shift scheduler: insert shift logs and draft handovers; set status to escalated; set orders to expired; insert notifications.
  event evaluator: insert entries with origin event_rule and occurrences.
  Nobody deletes. A closed entry never changes.
- Screens: /shift/log, /shift/handover, /shift/orders, /shift/orders/issue, /shift/admin, /shift/field, and the route the phone view sends to, /api/shift/sync.

Run scripts/gen-policies.mjs and scripts/gen-routes.mjs, then add to supabase/tests/access.test.sql one allowed and one refused test for every new cell, and: an operator of another area sees nothing here; nobody signs both sides of one handover; an operator cannot change a handover; for every role that updates a row, read it back and check it really changed.

Push, open a pull request titled "M02: who may do what", wait for every check, and tell me the result in plain words, quoting the new sections of docs/access-review.md.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/matrix.json)
+"shf_handover": {
+ "outgoing lead": { "insert": "own shift", "update": "own shift, while draft" },
+ "incoming lead": { "update": "sign in, area, never own sign-out" },
+ "shift scheduler": { "update": "status to escalated" }
1
⏺ Bash(node scripts/gen-policies.mjs)
⎿ Wrote supabase/migrations/20261104101000_policies.sql (+38 policies), lib/access/routes.ts, docs/access-review.md
⏺ Bash(gh pr checks --watch)
⎿ access / test pass 2m40s
⏺ Pull request #44 is green: 76 new access tests (38 allowed, 38 refused), the cross-area test, the both-sides test and 9 read-back tests. The machine accounts can do only their named jobs.2
The matrix change, the generated rules, and tests in both directions.
  1. Rights by job and scope, reviewed in one place.
  2. A machine account is a role too, with the narrowest rights.

Check it worked

The pull request is green, docs/access-review.md has a section for each new role and machine account, and the tests include the cross-area, both-sides and read-back tests.

If it goes wrong

Signing in a handover says success but the status stays signed_out

An update only finds rows the role can read, and the changed row must still pass the read rule; we hit this building the module courses. Say: Make the incoming lead's read rule cover the handover before and after sign-in, regenerate, and add a test that reads the row back.

A photo upload is refused although the operator may write entries

An insert that hands the new row back counts as a read. Say: Give the operator read on the attachments of their area's entries, regenerate, and test the upload end to end.

A check fails that names a generated list

The generated files are older than the matrix. Say: Open the failed check's log, run the command it names to regenerate, commit, and show me what changed.

Step 7

Session 3: The shift log, the handover report and standing orders

25 minutes

Why

These screens are where the record is made and read at shift change, often in a hurry. Who wrote an entry must come from the session on the server, never from the page, and photos must go to Supabase Storage: the app's own folders cannot be written on Vercel, and anything in public/ can be opened by anyone.

Do this

Paste into Claude Code
Before writing any page or route, read the guides in node_modules/next/dist/docs/ for routing, server actions and proxy.ts in our version of Next.js, and our operator-screen rules from Session 12.

On a new branch m02/screens, build against the development data:
1. /shift/log: the current shift's log for the person's area: carried entries first with their age, then this shift's; add an entry with equipment (required unless "whole area" is chosen), category, priority, title, body, carry-forward, photos (private Supabase Storage bucket, never public/ or a project folder) and mentions; filter and full-text search by area, equipment, category and dates.
2. /shift/handover: the handover report for the outgoing lead: the summary to write and, before sign-out, a preview of what the snapshot will hold; for the incoming lead, the stored snapshot, the carried entries, questions as comments, and Sign in.
3. /shift/orders: active standing orders for the area with an Acknowledge button; /shift/orders/issue for the issuer with who has and has not acknowledged.
4. /shift/admin for task templates and event rules (forms only; the rules engine comes in Session 4).
Who is signed in comes from the session on the server, never from the page. Everything goes through proxy.ts and the generated lib/access/routes.ts; nothing public. Playwright tests at 360 and 390 px for each role that may open each screen, a refused test for each role that may not, and a signed-out test that each lands on sign-in.

Push, open a pull request titled "M02: screens", wait for every check and the Vercel preview, and tell me the preview link and what each test proved.

You will see recreated screen

https://acme-platform.vercel.app/shift/log
Press shop · Days · 2 November
P-04 out of service · clutchmaintenance · high · open · 2 shifts old2
P-03 die clamp pressure droppingmaintenance · medium · monitoring · 1 shift old
New entry3
The shift log at 06:05, as the incoming day crew sees it: what was carried, and how old it is.
  1. Carried items first, so nobody starts a shift without them.
  2. Each entry names its press, category and priority, and shows its age.
  3. 44 px targets; equipment is required unless the whole area is chosen.

Check it worked

The pull request is green; the preview opens each screen for its roles at phone width and refuses the others; a photo added in the preview is in the Storage bucket, not the repository.

If it goes wrong

Photos save in development and vanish on the preview

The code wrote into a project folder, which is read-only on Vercel; we hit this when a register wrote where the server could not. Say: Store every photo in the private Supabase Storage bucket and add a test that fails if code writes into the project folders.

Every entry shows the same author

The page sent the author and the server trusted it; on our platform every record said it was made by the founder. Say: Take author_id from the signed-in session on the server and ignore anything the page sends. Add a test with two users.

Claude Code writes middleware.ts

This version of Next.js calls it proxy.ts. Say: Read node_modules/next/dist/docs/ on proxy.ts, use our proxy.ts, and delete middleware.ts.

Step 8

Session 3: The offline phone view, and the test that proves it

20 minutes

Why

Operators write entries at the press, where the signal is worst. The phone view keeps the area's open and carried items on the phone and sends what was written when the signal returns, once. A save that said "created" and was later gone is a failure we have had, so the prompt asks for tests that are shown failing first.

Do this

Paste into Claude Code
On a new branch m02/field, build /shift/field, reusing the outbox from Session 12:
- On opening, it keeps the area's open and carried entries and active orders on the phone (IndexedDB).
- A new entry or comment gets its id on the phone with crypto.randomUUID(), is saved as it is typed, and waits in the queue with the phone's occurred_at; the screen shows how many are waiting.
- /api/shift/sync inserts with on conflict (id) do nothing, takes author_id from the session, and keeps the phone's time as occurred_at and the server's as created_at. The same id again adds nothing; the same id with different text is refused as a conflict and shown. A refused item stays visible in the queue. If the sign-in expired, the queue waits for sign-in.
- Acknowledging a standing order needs a fresh password, so it stays online; the phone view says so.
Playwright tests with the browser offline: write three entries, close and reopen, still three waiting; go online, exactly three new entries with the phone's times; send them again, still three; a conflicting copy is refused and shown. Show each test failing with the on conflict line removed, then passing.
Push, open a pull request titled "M02: offline phone view", wait for every check, and tell me the result in plain words.

You will see recreated screen

claude — acme-platform
⏺ Bash(npx playwright test tests/shift-field.spec.ts)
⎿ 4 failed (on conflict removed: 6 entries stored, expected 3)
1
⏺ Bash(npx playwright test tests/shift-field.spec.ts)
⎿ 4 passed (11.2s)
⏺ Pull request #46 is green. Three entries written offline arrive once each with the phone's times; sending them again adds nothing; a conflicting copy is refused and shown in the queue.2
Red first, then green: the proof that a retry cannot store an entry twice.
  1. Without the safety line a retry stores entries twice: the test can fail, so it proves something.
  2. Green on GitHub, not only on Claude Code's word.

Check it worked

The pull request is green, and the summary says the tests failed with the safety line removed and passed with it.

If it goes wrong

The screen says "Saved" but no entry arrives

Say: Count an entry as sent only when the sync route answered with its id; otherwise keep it in the queue and say so. Add a test with the route switched off. A button that claims success while nothing happens is worse than an error.

Two leads change the same entry's status at once, and one change is lost

We hit this: a save said "Created" and a minute later the record was gone. Say: Include row_version in every update of shf_log_entry and refuse a stale save with a clear message; test two saves from the same starting copy.

The tests pass even with the safety line removed

They cannot fail, so they prove nothing. Say: Rewrite the test to count rows in the database; show it red without the fix and green with it.

Step 9

Session 3: Try it at a real handover

20 minutes

Why

A handover happens in ten minutes at the end of a long shift. Watching two real leads use the screens at one, without explaining anything, finds what no test can: the item they look for first, the word they do not understand, the button they cannot find with a cold thumb.

Do this

Open

https://github.com/acme-ops/acme-platform/pulls

Open the M02 screens and phone view pull requests: Vercel's comment on each has the preview link.

On a real phone: airplane mode on, write one entry, reconnect, watch it arrive. Then, at one real handover, let the outgoing lead use the preview's handover report beside the usual handover (the old way stays the record until Session 6), and the incoming lead read it. Say nothing; write down every place either stops or asks. Then:

Paste into Claude Code, after replacing the <...> part
Here are my notes from two leads trying the M02 screens at a real handover:
<paste your notes>
Write each as a one-line change request in docs/m02/try-out.md, marked screen, wording, or rule. Make the screen and wording changes on this branch with their tests; list the rule changes for me to decide. Push, wait for the checks, and tell me what changed.

Owner two approves each pull request; merge in order: access, screens, phone view.

You will see recreated screen

https://acme-platform.vercel.app/shift/handover
Handover · Afternoons → Days · press shop
Signed out22:04 by the afternoons lead1
2
Snapshot itemAt sign-out
Presses out of serviceP-04
Open and carried entries4
Active standing ordersSO-0001
QuestionIs P-03 still on the 180 bar die?3
Sign in
The handover report for the incoming lead: the stored snapshot, the carried items, and a place to ask.
  1. Who signed out and when, from the session.
  2. What the outgoing lead saw, stored, not recomputed.
  3. Two-way: the incoming lead can ask before signing.

Check it worked

An entry written in airplane mode arrived once; docs/m02/try-out.md lists what the leads hit; the three pull requests are merged.

If it goes wrong

The preview link answers 401

That is Vercel's preview protection, not your code. Sign in to Vercel on the phone, or use Vercel's Share button for the preview.

The leads say the report is too long

Ask what the incoming lead reads first, and move it to the top. Write the change in docs/handover/content.md too, so Session 4's snapshot follows it.

Knowledge check

An operator's photo upload on an entry is refused, though operators may write entries. Why, most likely?

Knowledge check

Where is "nobody signs both sides of one handover" written first?

References

  1. Supabase Docs: Row Level Security. https://supabase.com/docs/guides/database/postgres/row-level-security
  2. NIST: Role-based access control project. https://csrc.nist.gov/projects/role-based-access-control
  3. MDN: IndexedDB API. https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
  4. Playwright: BrowserContext.setOffline. https://playwright.dev/docs/api/class-browsercontext#browser-context-set-offline
  5. W3C: WCAG 2.2, Understanding Target Size (Enhanced). https://www.w3.org/WAI/WCAG22/Understanding/target-size-enhanced.html

Chapter 3 · Session 4

The handover, standing orders and event rules

The handover becomes a record the next crew can rely on: its snapshot is stored when the outgoing lead signs out and is byte-identical a week later, both leads sign, and one nobody accepts escalates on schedule. Standing orders are acknowledged person by person, an event rule writes exactly one entry per episode, and the three KPIs must match your count of the seed.

25 min4 stepsSession 43 definition-of-done tests1 hand count

By the end of this chapter you can

  • Store the snapshot at sign-out, sign both sides, and prove the stored record does not drift.
  • Escalate an unaccepted handover once, on schedule, and track standing order acknowledgements per person.
  • Make an event rule write one entry per condition episode, and check the KPIs against a hand count.

Stored, not recomputed

The module library names this pitfall first: recomputing the snapshot whenever the handover is opened. A week later the work orders have moved on and the holds are released, so the handover shows something the incoming crew never saw. The record has drifted. Stored at sign-out, it is the original record, which is what data-integrity guidance asks for [2].

What goes into the snapshotEvents from MES, CMMS, EHS and QMS, and the module's own log, flow into the sign-out route, which writes the auto-snapshot onto the handover record once. STATE OF THE ENDING SHIFTMESmes.shift_summary.readyCMMScmms.work_order.status_changedEHSehs.permit.activatedehs.incident.reportedQMSqms.hold.placedThis module's own logequipment out of service, open andcarried entries, active standing ordersSign-out routebuilds the snapshotonce, at sign-outshf_handoverauto_snapshot (json)stored with the record
What goes into the snapshot. Other modules' events and the module's own log feed the sign-out route, which writes the snapshot onto the handover once.
Recomputed or storedTwo lanes. When the snapshot is recomputed on view, a handover opened a week later shows today's data. When it is stored at sign-out, it shows the stored snapshot, byte-identical. RECOMPUTED WHEN VIEWED (THE PITFALL)Sign-outsnapshot built, not keptA week latersomeone opens the handoverShows today's datanot what the crew sawSTORED AT SIGN-OUT (THE RULE)Sign-outsnapshot written to the recordA week latersomeone opens the handoverShows the stored snapshotbyte-identical
Recomputed or stored. A snapshot rebuilt a week later shows today's data; one written at sign-out shows the same bytes a week later.

Each signature is a core_e_signature row: who, when, what it means (authored for the outgoing lead, acknowledged for the incoming lead), and a hash of what was signed, as Part 11 asks for signed records [1]. The hash is of one JSON object holding the summary and the snapshot, written with its keys sorted and no extra spaces, so anyone can rebuild it and compare.

The states of a handoverA handover is a draft, then signed_out when the outgoing lead signs, then accepted when the incoming lead signs in. A signed_out handover not accepted in N minutes becomes escalated, and an escalated handover can still be accepted. draftoutgoing lead writessigned_outsnapshot storedacceptedincoming lead signed inescalatedsupervisor notifiedoutgoing signsincoming signs innot accepted in N mincan still be acceptedN is the business's choice; the seed in this course uses 30 minutes.A draft that was never signed out is not escalated: the supervisor is told and it stays a draft.
The states of a handover. Draft, signed_out when the outgoing lead signs, accepted when the incoming lead signs in. Not accepted within N minutes: escalated, once; it can still be accepted.
StatusMeansMoved on by
draftBeing written. Still unsigned at the due time: the supervisor is told once, and it stays a draft so it can still be signed outThe outgoing lead
signed_outSigned by the outgoing lead; the snapshot is storedThe incoming lead
acceptedSigned in by the incoming leadNobody: the end
escalatedSigned out but not accepted in N minutes; the supervisor was toldThe incoming lead can still accept
Step 10

Session 4: Sign out stores the snapshot; both leads sign

25 minutes

Why

The first definition-of-done test is that the snapshot stored at sign-out is byte-identical when re-opened a week later. Writing it once, in the same transaction as the signature, and refusing any later change in the database, makes that true for every screen, import and agent. The hash lets anyone prove it later without trusting the screen.

Do this

Paste into Claude Code
Read docs/handover/content.md. On a new branch m02/signout:
1. Sign-out (outgoing lead, own shift, draft only): after the password is confirmed again, in one transaction: build auto_snapshot from docs/handover/content.md (our log, equipment out of service, active orders, and the other modules' latest events in core_event_outbox, marking unavailable items "not available"); write core_e_signature (signer from the session, meaning authored, record_type shf_handover, a SHA-256 hash of {"auto_snapshot": ..., "summary": ...} with keys sorted and no extra spaces, signed_at from the server clock); set signed_out_at and status signed_out; mark the shift log handed_over.
2. Sign-in (incoming lead of the area, never the person who signed out): password confirmed again; core_e_signature with meaning acknowledged and the same hash; signed_in_at; status accepted.
3. A trigger refuses any change to summary or auto_snapshot once signed_out_at is set. Viewing a handover never rebuilds the snapshot.
4. A database trigger writes shf.handover.signed_out and shf.handover.accepted into core_event_outbox; no person or route gets write rights on the outbox.
Tests: sign out, then add a hold event and set a press out of service; the stored snapshot is byte-identical and its rebuilt hash equals record_hash; changing the summary after sign-out is refused; the outgoing lead cannot sign in. Show the byte-identical test failing when the report rebuilds the snapshot on view, then passing.
Push, open a pull request titled "M02: stored snapshot and sign-off", wait for every check, and tell me the result in plain words.

Try it on the development project as in Step 5, then prove it yourself in its SQL editor:

Open

https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/sql/new

The development project's SQL editor: paste the text below and Run. It must fail.

Supabase SQL Editor, development project
-- Development project only. Must be refused: a signed-out handover cannot change.
update public.shf_handover set summary = 'edited after sign-out'
where signed_out_at is not null;

You will see recreated screen

claude — acme-platform
⏺ Bash(npx supabase test db)
⎿ not ok 4 - snapshot unchanged after source data moved (rebuilt on view)
1
⏺ Bash(npx supabase test db)
⎿ ok 4 - snapshot unchanged after source data moved ok 5 - rebuilt hash equals record_hash ok 6 - summary change after sign-out refused
⏺ Pull request #49 is green. After sign-out I placed a hold and took P-02 out of service: the stored snapshot is byte-identical and its hash matches the signature. The outgoing lead cannot sign in their own handover.2
The proof of the first definition-of-done test, red first, then green.
  1. Red first: rebuilding on view makes the record drift, and the test catches it.
  2. The same bytes, proven by the hash, not by looking.

You will see recreated screen

supabase.com/dashboard/project/tsrqponmlkjihgfedcba/sql/new
update public.shf_handover set summary = 'edited after sign-out'
where signed_out_at is not null;
The refusal in the SQL editor: the database keeps the rule, for everyone.
  1. Refused even in the dashboard. That is the point.

Check it worked

The update in the development SQL editor is refused; the byte-identical and hash tests are green and were shown red with the snapshot rebuilt on view.

If it goes wrong

The hash does not match when rebuilt

The object was written differently (key order, spaces) at signing and when checking. Say: Use one function to write the signed object, keys sorted, no extra spaces, for both signing and checking, and test it with a fixed example.

The report still shows today's open work orders on an old handover

It rebuilds on view. Say: The report must read auto_snapshot only, never live tables, once signed_out_at is set.

Handover acceptance against the due timeA shift ends at minute 0 and a handover is due to be accepted by minute 30. Handover 1 is accepted at 10 minutes. Handover 2 is not accepted by minute 30, so it would have been escalated then, and is accepted at 50 minutes; the seed stores it as accepted. Handover 3 is never accepted and is escalated once, at the 30-minute due time. Drawn to scale. shift ends1030: due5060 minWindow: 30 minutesPast dueHandover 1: accepted at 10 min, on timeHandover 2: past due at 30 min (would be escalated), accepted at 50 min, lateHandover 3: escalated once at 30 min, never acceptedDrawn to scale, 14 px a minute. The three handovers are the synthetic seed from Session 2.
Acceptance against the due time, to scale. The shift ends at minute 0; acceptance is due by minute 30. Handover 1 was accepted at 10 minutes, handover 2 at 50 (late), and handover 3 never: it was escalated once, at minute 30.
Step 11

Session 4: Escalation on schedule, and standing orders acknowledged person by person

20 minutes

Why

An unaccepted handover must stop being silent, once, at the time you chose in Session 1, however often the scheduler runs. A standing order counts people, not clicks, so each acknowledgement is one signed row per person. Running the scheduler inside the database with pg_cron means no new key is needed for it.

Do this

Paste into Claude Code
Read docs/handover/content.md (N and who is told). On a new branch m02/schedule:
1. A function, run every five minutes by pg_cron (Supabase Cron) as the shift scheduler: a signed_out handover not accepted N minutes after its shift's end is set to escalated, once, and the supervisor gets one core_notification; a draft still unsigned at that time stays a draft and the supervisor is told once. It also opens each new shift's log and draft handover, and sets standing orders past effective_to to expired. Running it twice in a row changes nothing the second time.
2. Standing orders: the issuer creates an order (number from core_number_sequence), activates it, and sees who has and has not acknowledged. Acknowledging needs the password again and writes one shf_standing_order_ack and its core_e_signature (meaning acknowledged); a second acknowledgement by the same person is refused. A trigger writes shf.standing_order.issued into core_event_outbox on activation.
3. Write both rules into docs/shift-rules.md.
Tests on tests/fixtures/m02-hand-count.json: handover 3 escalates exactly once and handovers 1 and 2 never; running the function twice adds no second notification; SO-0001's compliance is 6 of 9; a second acknowledgement is refused.
Push, open a pull request titled "M02: escalation and standing orders", wait for every check, and tell me the result in plain words.

Try it on the development project, merge after owner two approves, and check the job is scheduled:

Open

https://supabase.com/dashboard/project/abcdefghijklmnopqrst/integrations/cron/jobs

Production: Integrations, Cron. The escalation job is listed, every five minutes, with its last run.

You will see recreated screen

https://acme-platform.vercel.app/shift/orders/issue
SO-0001 · P-04: run at 80% stroke rate until the clutch is replaced
Effective from2 Nov 06:00 · priority high
Acknowledged before it took effect6 of 9 · 67%1
Late1
Not yet2 operators · chase2
The issuer's page: who has acknowledged before the order took effect, and who to chase.
  1. Compliance counts acknowledgements before the effective time, one per person.
  2. The ones to chase, by job and crew.

Check it worked

docs/shift-rules.md holds both rules; the tests show handover 3 escalated exactly once and SO-0001 at 6 of 9; the cron job is listed in production.

If it goes wrong

The supervisor gets a notification every five minutes

The function escalates every run. Say: Make escalation set the status and notify only when the status was not already escalated, in one statement, and test two runs in a row.

The cron job is not listed in production

Cron jobs created in a migration reach production with the merge. Run npx supabase migration list on the development project to check the migration exists, and check the deploy run applied it.

One entry for each condition episodeA tag condition is true from 06:00 to 08:00, from 09:00 to 09:10 and again from 09:25 to 09:35, and from 13:00 to 13:30. With a 30 minute dedupe window the return at 09:25 is suppressed, so there are four occurrences and three log entries. Drawn to scale. 06:0008:0010:0012:0014:00Entry 1Entry 3Entry 2Suppressed: back inside the windowAmber: the dedupe window, 30 minutes from when the condition clears (this build's rule).Four occurrences, one suppressed, three log entries: one entry for each episode.Drawn to scale across eight hours, on a replayed synthetic tag stream.
One entry per episode, to scale. The condition is true from 06:00 to 08:00, 09:00 to 09:10, 09:25 to 09:35 and 13:00 to 13:30. With a 30-minute window counted from when the condition clears, the return at 09:25 is suppressed: four occurrences, three entries.
Step 12

Session 4: An event rule writes exactly one entry per episode

20 minutes

Why

A rule that wrote an entry every minute while a tank stayed high would bury the log, and the next crew would stop reading it. The third definition-of-done test is one entry per condition episode. Predicting the count on paper first, then replaying a made-up tag stream, tells you whether the rule or the prediction is wrong. The alarm system of record stays in SCADA.

Do this

Paste into Claude Code
On a new branch m02/events, build the event evaluator (machine account, named jobs only):
- It signs in as its own machine account, with a password a person sets and stores (named in docs/KEYS.md, never the service role key), and reads tag values from the plant connector's feed (Session 20), or from a replay script on the development project.
- A shf_event_rule's condition is a threshold, a state change or a duration. When an episode starts, it inserts a shf_event_occurrence and, unless the rule is shelved (active false) or the episode starts within dedupe_window_min of the previous episode clearing, a shf_log_entry with origin event_rule, the rule's category and priority, and the tag's equipment; otherwise the occurrence is suppressed true. suppressed is always true or false, never empty.
- A unique index on (event_rule_id, triggered_at), and a partial unique index on (event_rule_id, ext->>'episode_key') where suppressed is false, so replaying the same stream adds nothing. The occurrence is inserted first with on conflict do nothing; the entry is made only when the occurrence was really inserted.
- scripts/replay-tags.mjs replays tests/fixtures/m02-tag-stream.json, made-up tag values, through the evaluator on the development project only, and refuses any other project.
Tests with the fixture's rule and a 30-minute window: the stream 06:00–08:00, 09:00–09:10, 09:25–09:35, 13:00–13:30 makes 4 occurrences and 3 entries; a second replay adds nothing; shelved, a new episode makes no entry; unshelved, the same new episode makes exactly one.
Push, open a pull request titled "M02: event rules", wait for every check, and tell me the counts in plain words.

Before you read Claude Code's counts, predict them on paper from the rule and the stream: occurrences, entries, suppressed. Then compare.

You will see recreated screen

claude — acme-platform
⏺ Bash(node scripts/replay-tags.mjs --project tsrqponmlkjihgfedcba tests/fixtures/m02-tag-stream.json)
⎿ 4 occurrences (1 suppressed), 3 log entries, origin event_rule
1
⏺ Bash(node scripts/replay-tags.mjs --project tsrqponmlkjihgfedcba tests/fixtures/m02-tag-stream.json)
⎿ 0 new occurrences, 0 new entries
2
⏺ Pull request #52 is green: 4 occurrences, 3 entries, the 09:25 return suppressed; a second replay adds nothing; shelving and unshelving behave as you predicted.
The replay matches the prediction, and a second replay adds nothing.
  1. Your paper prediction: 4 and 3. If it differs, find out whether the rule or the prediction is wrong.
  2. Replaying again changes nothing: the unique indexes keep it so.

Check it worked

The counts match your paper prediction (4 occurrences, 3 entries), a second replay adds nothing, and the shelving tests pass.

If it goes wrong

A second replay adds entries

Say: Add the unique index on rule and triggered_at and the partial unique index on rule and episode key, insert the occurrence first with on conflict do nothing, and make the entry only when it was inserted.

The replay script ran against production

It must refuse any project but the development one. Say: Make replay-tags refuse unless the project reference is tsrqponmlkjihgfedcba, and test the refusal. Then list, without deleting, every entry with origin event_rule in production made by the replay.

KPIDefinitionOn the fixture
Handover on-time sign-off rateHandovers accepted within N minutes of shift end ÷ handovers1 of 3
Open carry-forward itemsCount and age of carried items not closed, by area4: 3 open, 1 monitoring
Standing order ack complianceAcknowledged before the effective time ÷ required6 of 9
A hand count on a synthetic seedFourteen seeded log entries: five open, two monitoring and seven closed. Four are carry-forward items not yet closed, three open and one monitoring. One of three handovers was accepted on time, and six of nine people acknowledged the standing order before it took effect. 1234567891011121314Open: 5Monitoring: 2Closed: 7Carry-forward: 43 open and 1 monitoringwith carry_forward trueOn-time sign-off: 1 of 3accepted within 30 minutes1 ÷ 3 = 33%Acknowledged: 6 of 9before SO-0001 took effect6 ÷ 9 = 67%Fourteen log entries in the synthetic seed, and the three KPIs counted by hand.
A hand count on the fixture. Fourteen entries: five open, two monitoring, seven closed; four carried items not closed. One of three handovers on time. Six of nine acknowledged before the order took effect.
Step 13

Session 4: The three KPIs, checked against a hand count

15 minutes

Why

A number nobody can reproduce by hand is a number nobody should trust. The fixture's counts are fixed, so a count on paper shows whether each view uses the same rule as the paper. Every widget says where its number comes from and shows "No data" rather than a number nobody measured.

Do this

Count the fixture first, and write your counts down. It is a readable file with fixed dates:

Open

https://github.com/acme-ops/acme-platform/blob/main/tests/fixtures/m02-hand-count.json

The hand-worked example on GitHub: entries, handovers and acknowledgements.

Paste into Claude Code
Read docs/shift-rules.md. On a new branch m02/kpis, add to the dashboard from Session 15: handover on-time sign-off rate (accepted within N minutes of shift end, divided by handovers), open carry-forward items with age by area, and standing order acknowledgement compliance (acknowledged before the effective time, divided by required), each saying where its number comes from and showing "No data" when there is none, never 0 for unknown. Add a test on tests/fixtures/m02-hand-count.json expecting 1 of 3, 4 carried (3 open, 1 monitoring), and 6 of 9. Push, open a pull request titled "M02: KPIs", wait for every check and the preview, and tell me the numbers each widget shows on the development data.

You will see recreated screen

https://acme-platform.vercel.app/dashboard
Handovers on time33% · 1 of 3 within 30 min1
Carried, not closed4 · oldest 2 shifts2
SO acknowledgements67% · 6 of 9 before effective
From shf_handover, shf_log_entry and shf_standing_order_ack; N = 30 minutes (docs/shift-rules.md).
The three KPIs on the preview, against the seed, each with its source.
  1. The late handover counts against the rate even though it was accepted.
  2. Open and monitoring entries with carry_forward true.

Check it worked

Your hand count and the widgets agree exactly: 1 of 3, 4 carried, 6 of 9. Then merge.

Fastest path

Count first, then read the dashboard: reading it first makes it too easy to count your way to its answer.

If it goes wrong

The dashboard says 2 of 3 on time

Fix the query, not the count. Say: The on-time widget says 2 of 3; my hand count says 1. Show me which handover you count on time and against which N. Usually the late one was counted because it was accepted.

The test expects counts the fixture never makes

We found this in reviews of five Academy modules. Say: For every count this test expects, show me the fixture rows that create it. Fix the fixture, not the test.

Knowledge check

A handover opened a week after sign-off shows a hold that did not exist at sign-out. What went wrong?

Knowledge check

A rule's condition clears at 09:10 and returns at 09:25, with a 30-minute dedupe window. What does the module record?

References

  1. eCFR: 21 CFR 11.50, Signature manifestations. https://www.ecfr.gov/current/title-21/chapter-I/subchapter-A/part-11/subpart-C/section-11.50
  2. FDA: Data integrity and compliance with drug CGMP: questions and answers (2018). https://www.fda.gov/regulatory-information/search-fda-guidance-documents/data-integrity-and-compliance-drug-cgmp-questions-and-answers
  3. Supabase Docs: Cron. https://supabase.com/docs/guides/cron
  4. PostgreSQL Documentation: Unique and partial indexes. https://www.postgresql.org/docs/current/indexes-partial.html

Chapter 4 · Sessions 5–6

Move the history in, and switch the old tool off

The old log's history is imported as closed entries tagged origin import, with the items the next crew still needs loaded open and carried. The import is rehearsed on the development project, then run into production through the pipeline with counts that must match. You run old and new side by side, cut over on a written date, and cancel the old tool with the saving from real invoices.

25 min4 stepsSessions 5 and 6History arrives closedCounts must match

By the end of this chapter you can

  • Build the history import as reviewed code and rehearse it on the development project.
  • Prove the module side by side with the old handover for a week, with every difference explained.
  • Import the history into production through the pipeline after a backup, cut over, and record the saving.

The module library gives the migration in one line: export the historical logs as CSV and import them as closed entries tagged origin import. Closed, because history is evidence of what happened; tagged, so every report can tell old from new. Items still open in the old tool that the next crew needs are the exception: loaded open with carry_forward true, and listed by name for the leads to confirm.

Key or secretWhat it unlocksWhere it livesWho holds itNever
Event evaluator's passwordThe machine account that writes event-rule entries, nothing elseWhere the evaluator runs, set by a person; listed by name in docs/KEYS.mdpat@acme.com, sam@acme.comNever the service role key; never in a chat or a file
Plant connector's sign-in (Session 20)Sending tag values to the event evaluatorWhere Session 20 put itThe connector, as a machine accountNever reused by a person or another job
Step 14

Session 5: Build the import, and rehearse it on the development project

35 minutes

Why

Old entries are evidence, so they arrive closed and can never be edited. Building the import as reviewed code, run from main by a workflow with an insert-only account, means real records reach production only through the pipeline, with their fingerprint and counts printed, never through a laptop or a chat. A rehearsal on the development project, with a copy IT approved in writing, finds the mapping problems first.

Do this

Take the export yourself from the old system's own export page, into a private folder outside the repository. Claude Code never reads it. Give it the first line of each file only, the column names:

Paste into Claude Code, after replacing the <...> part
We will move the old shift log's history in. The export file stay outside the repository and you will not read it. The first line of each, the column names only:
<paste the first line of the export: column names only, no data>

On a new branch m02/import:
1. scripts/import-m02.mjs, which reads the export file in this format and maps each row to a shf_log_entry with origin import, status closed, the original time as occurred_at, the original author's name as text in ext.original_author, the old tool's name in ext.source_tool, its equipment matched to our equipment by tag or name, and its category and priority mapped to our lists; each old shift becomes a closed shf_shift_log. Rows marked still open in the old tool are loaded open with carry_forward true and listed separately. Rows it cannot match are not imported but listed with the reason. It prints each file's sha256 and the counts: rows, records it would create, rows skipped. In dry-run mode it writes nothing.
2. A migration that creates this module's import account: a database role import_m02 that can log in, with insert only on shf_shift_log and shf_log_entry and on an insert-only table import_log (module, file, sha256, counts, run_at, run_by), read on the private Storage bucket imports, and nothing else: no update, no delete, never the service role key. Imported closed entries are protected by the closed-entry trigger. A file whose sha256 is already in import_log is refused.
3. .github/workflows/import-m02.yml, started only by hand from main (workflow_dispatch), with inputs target (development or production), file (its path in the bucket imports) and apply (default false). It downloads the file from the target project's bucket, signs in as import_m02 with a password a person stores as a GitHub secret (IMPORT_M02_PASSWORD_DEV and IMPORT_M02_PASSWORD_PROD, listed by name in docs/KEYS.md), and runs the script. For production with apply true it refuses unless docs/imports/m02-approved.md on main lists this file's sha256 and expected counts, and it fails on any count mismatch. It never prints a row of the export.
4. Tests on a made-up ten-row file per export (SYNTHETIC values): a dry run writes nothing; apply creates the expected counts; the same file again is refused; an unknown press is listed; an imported closed entry cannot change; import_m02 cannot update or delete anything.
Do not run the workflow and do not set any password. Push, open a pull request titled "M02: import", wait for every check, and tell me the result in plain words, with the secrets I must create myself.

Try it on the development project and merge it, as in Step 5. Then a person creates the import account's password in the password manager, sets it on each project in the SQL editor, and types the same value as the GitHub secret. Nobody pastes it into Claude Code or a file.

Supabase SQL Editor, each project
-- Typed by a person, once per project. The password comes from the password manager.
alter role import_m02 with login password '<from the password manager>';
Open

https://github.com/acme-ops/acme-platform/settings/secrets/actions

Add IMPORT_M02_PASSWORD_DEV and IMPORT_M02_PASSWORD_PROD: paste the value only, never NAME=value.

Key or secretWhat it unlocksWhere it livesWho holds itNever
import_m02 password (one per project)Inserting imported records into this module's tables, nothing elseGitHub Actions secrets, and the password managerpat@acme.com, sam@acme.comNever in a chat, a file or a log; set to NOLOGIN at cut-over

The rehearsal uses a copy of the export that IT has approved in writing for the development project, redacted where it holds personal, injury or pay data. It is the only real data a development project ever holds, and it is removed the same day.

Open

https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/storage/buckets

Development project, Storage: upload the approved copy to the private bucket imports.

Open

https://github.com/acme-ops/acme-platform/actions/workflows/import-m02.yml

Run workflow from main: target development, the file's path, apply false. Read the counts; then again with apply true.

Open three imported entries on the development preview beside the same three in the old tool: time, press, text and status must match. Then, the same day, remove the rehearsal from the development project: delete the file from the bucket, and run:

Supabase SQL Editor, development project
-- Development project only, the same day: remove the rehearsal's real records.
delete from public.shf_log_entry where origin = 'import';
delete from public.shf_shift_log where ext->>'origin' = 'import';
delete from public.import_log where module = 'm02';
Paste into Claude Code, after replacing the <...> part
On a new branch m02/rehearsal, write docs/imports/m02-rehearsal.md: the date of IT's written approval and who gave it (a job, not a name), what was redacted, the rehearsal's counts and skipped rows from the run log below, the three records checked, and the date the copy was removed from the development project:
<paste the counts and the dates>
Open a pull request titled "M02: rehearsal record", wait for the checks, and show me the link.

You will see recreated screen

github.com/acme-ops/acme-platform/actions/workflows/import-m02.yml
import-m02 · development · apply: false
file    shiftlog-2026-11.csv
sha256  4be1…07c9
rows                  4,880
shift logs to create    736
entries to create     4,861  (closed, origin import)
loaded open               6  (carry forward)
rows skipped             13  (press 'P-7' not in equipment)
The rehearsal on the development project: a dry run first, the file's fingerprint and every count printed.
  1. Every skipped row has a reason. Fix the mapping, or decide to leave them out, and write which.
  2. Read before you apply.

Check it worked

The import is merged; the import account's password is set on both projects and in GitHub secrets, by a person; the rehearsal ran dry, then applied, with every skipped row explained; three entries matched the old tool; the copy was removed the same day and docs/imports/m02-rehearsal.md records it.

If it goes wrong

Claude Code asks to read the export "to get the mapping right"

Say no. Give it the column names and, if needed, a made-up row you write yourself. Real records reach the platform only through the import workflow.

IT will not approve a copy in writing

Then no real data goes to the development project. Rehearse with a made-up file in the same columns (Claude Code can write one from the header), and keep the first production run a dry run. Write the decision in docs/imports/m02-rehearsal.md.

The workflow cannot sign in as import_m02

The password on the project and the GitHub secret differ, or the secret holds NAME=value. Set both again from the password manager, value only. Never give the import account more rights to get past it.

Step 15

Session 6: Run side by side for a week, and write the cutover

30 minutes, after a week of running both

Why

The module is ready to replace the old handover only when both have handled the same week and every difference is explained. Comparing handover counts and open carried items, and the three record tests on production, shows the new way caught everything the old way did, and usually what it missed.

Do this

For one week, both run: the old handover stays the record, and the leads also sign out and in on the platform. At the end, count the old way (handovers written, items carried, from the old tool's own report or the binder) and read the same from the dashboard. Then:

Paste into Claude Code, after replacing the <...> parts
On a new branch m02/cutover, write docs/cutover.md with a side-by-side table for the week of <dates>: handovers, handovers accepted within N minutes, open carried items at the end of the week, and standing order acknowledgements, one column from my count of the old way and one from the platform:
Old way (<the old tool's report or the binder>): <your counts>
Explain every difference in one line, or mark it "not explained". Add the three definition-of-done checks with the query and its result on production: a snapshot re-opened is byte-identical to sign-out (rebuilt hash equals record_hash) for every handover of the week; every unaccepted handover escalated exactly once; every event rule episode made at most one entry. Then add the cutover date, who tells each crew, when the old log and whiteboard go, where the old export is kept and by whom, and the way back: if the platform is down, the paper handover sheet, entered within 24 hours as late with the reason. Do not change any data. Open a pull request titled "M02: side by side and cutover", wait for the checks, and show me the link.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/cutover.md)
+| Week 45 | Old way (spreadsheet) | Platform |
+| Handovers | 14 | 14 |
+| Accepted within 30 min | not recorded | 12 |
+| Open carried at week end | 3 | 5 |
+Difference: 2 carried items were only on the whiteboard, never in the spreadsheet.
1
⏺ Pull request #57 adds docs/cutover.md. Every difference is explained. On production: 14 of 14 snapshots match their signatures; 2 escalations, each once; no event episode made two entries.2
Two columns, every difference explained, and the three record tests run on production.
  1. The platform shows what the old way kept only on a whiteboard.
  2. The three definition-of-done tests, run on production by query.

Check it worked

docs/cutover.md has no "not explained" line, the three checks pass on production, and the cutover date and way back are written.

If it goes wrong

A difference cannot be explained

You are not ready. Run another week and ask the leads to watch the item that differs.

Leads sign in without reading

Look at the time between sign-out and sign-in on the platform. Ten seconds is not a handover. Talk to the supervisor; the record shows it, which the old way never could.

Step 16

Session 6: Import into production through the pipeline

20 minutes

Why

Real records go into production once, through reviewed code, after a backup, from a file whose fingerprint and counts owner two approved in the repository. The workflow refuses any other file and fails on any count mismatch, and the import account can only insert, so nothing already there can be changed by it.

Do this

Open

https://github.com/acme-ops/acme-platform/actions

First, run the nightly backup workflow from Session 11 by hand (its Run workflow button) and wait for it to finish green.

Open

https://supabase.com/dashboard/project/abcdefghijklmnopqrst/storage/buckets

Production, Storage: upload the full export to the private bucket imports.

Open

https://github.com/acme-ops/acme-platform/actions/workflows/import-m02.yml

Run workflow from main: target production, the file's path, apply false. Copy the sha256 and the counts from the log.

Paste into Claude Code, after replacing the <...> part
On a new branch m02/import-approval, write docs/imports/m02-approved.md: today's date, the source (the old system's name and the export's date), and for each file its path, its sha256 and the expected counts exactly as in this dry-run log, with the skipped rows' reasons as a list, and the entries that will be loaded open, by press and title, for the leads to confirm:
<paste the sha256 and counts from the run log>
Open a pull request titled "M02: approve the import", wait for the checks, and show me the link.

The leads confirm the open items; owner two approves; merge. Then run the workflow again from main: target production, the same file, apply true.

You will see recreated screen

github.com/acme-ops/acme-platform/actions/workflows/import-m02.yml
import-m02 · production · apply: true
shift logs created   736
entries created    4,861 (closed)
loaded open            6 (carry forward)
import_log: m02, 4be1…07c9
The production run: the approved fingerprint and counts checked first, then the import, with the same numbers.
  1. The approval is a file on main that owner two approved.
  2. The same numbers, or the run fails.

Check it worked

The backup ran green first; docs/imports/m02-approved.md is on main; the production counts equal it; an imported closed entry opens read-only and a change is refused; the six open items appear carried on the next shift's log.

If it goes wrong

The workflow refuses: sha256 not in the approved file

The file in the bucket is not the one you approved, often a second export taken later. Do not edit the approved file to match. Upload the approved file, or dry-run the new one and approve it in a new pull request.

The run fails: counts do not match

Nothing was imported: the run is one transaction. Ask Claude Code: The m02 import failed on a count mismatch. Show me which count differs and why, from the log, without running anything.

The backup workflow has no Run workflow button

Say to Claude Code: Add workflow_dispatch to the nightly backup workflow so a person can run it before an import. Merge that first. A backup nobody has restored is only a hope: Foundation Session 23 drills the restore.

Step 17

Session 6: Cut over, and cancel the old tool

15 minutes

Why

Cutting over on the written date means nobody is unsure which handover counts. The saving is real only when it comes from the old invoices and the vendor's own terms, so the old tool is cancelled after the history is safely imported, and the arithmetic is written down.

Do this

On the date: each crew is told at its first handover; the old log, spreadsheet or whiteboard is retired; the platform is the record. Watch the first day's handovers arrive and get accepted. Then read the old vendor's cancellation terms on its own account page (notice period, renewal date, how long you can still export). Then:

Paste into Claude Code, after replacing the <...> part
On a new branch m02/saving, add to docs/cutover.md: the old tool's bill, renewal date and notice period exactly as I give them below, the date it is cancelled or ends, and the saving with its arithmetic: the old cost minus what the module adds to our running costs (none: it runs on the services we already pay for). Mark the area as cut over in docs/handover-inventory.md with the date. Add a new migration that sets the import account import_m02 to NOLOGIN, now that the import is done.
Old bill and terms: <from your invoice and the vendor's account page>
Open a pull request titled "M02: saving", wait for the checks, and show me the link.

You will see recreated screen

claude — acme-platform
⏺ Write(docs/cutover.md)
+## Saving
+Old tool: as on invoice INV-4410 (monthly; 30 days' notice; export available 90 days after cancelling).
+Cancelled on 2026-12-03; last bill 2027-01-01.
+Module running cost: none added.
1
⏺ Pull request #61 records the saving using only your invoice figures and marks the press shop cut over on 2026-12-01.2
The saving, from the invoice, with its arithmetic.
  1. Every figure points at the document it came from.
  2. One area cut over; others follow the same steps.

Check it worked

The first day's handovers were signed out and accepted on the platform; docs/cutover.md has the saving with its arithmetic; the old tool is cancelled or its end date recorded; after the merge, import_m02 can no longer sign in.

If it goes wrong

Another area still uses the old tool

Keep it until that area cuts over too, and write its date in docs/handover-inventory.md. Cancel when the last area moves, and record the saving then.

The notice period means another renewal

Write the end date and the export window in docs/cutover.md, set a reminder before the notice deadline, and keep using the platform.

Before you go on · The module is done whenTick each one

Knowledge check

How do historical entries from the old tool arrive?

Knowledge check

What lets the production import apply its rows?

References

  1. GitHub Docs: Manually running a workflow. https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow
  2. Supabase Docs: Storage buckets. https://supabase.com/docs/guides/storage/buckets/fundamentals
  3. PostgreSQL Documentation: CREATE ROLE (LOGIN, NOLOGIN). https://www.postgresql.org/docs/current/sql-createrole.html
  4. Supabase Docs: Database backups. https://supabase.com/docs/guides/platform/backups
  5. Fabrico: best shift handover software 2026. https://www.fabrico.io/blog/best-shift-handover-software/

Chapter 5 · 12 questions · 80% passes

Final assessment

Twelve questions across the element. 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

Choose one answer for each question, then submit. You will see the right answer and why for every question.

1. What is the main purpose of Shift Handover?
2. Which of these is outside Shift Handover and owned by another module or system?
3. Which standard does the module name for the alarm management principles behind its event rules?
4. Which is a log entry the analytics can count by equipment and category?
5. Once the shf_ migrations are merged, how do they reach production?
6. An entry is open and carry_forward is true when the shift ends. What happens?
7. Why is the auto-snapshot stored at sign-out and not recomputed when the handover is viewed?
8. Who signs a handover, and in what order?
9. A handover is signed out but nobody accepts it within N minutes. What does the module do?
10. Six of nine required people acknowledged a standing order before it took effect. What is the acknowledgement compliance?
11. A rule on a tag fires, clears, and fires again inside its dedupe window. What should the module do?
12. How is history from the old shift log imported?