Chapter 1 · Sessions 1 and 2
What the old tool holds, and the tables that replace it
First you write down which projects you run, how work is requested and decided, and what the project tool costs, from its own pages and your invoices. Then one prompt adds the module's fourteen tables to your Foundation schema with the rules that keep a schedule honest, and you load a small network worked by hand as a test fixture and made-up projects as the seed.
25 min3 stepsSessions 1–2about 7 hours hands-on across six sessions
By the end of this chapter you can
- Inventory the projects, the request route and the tool's bill from real pages, never from memory.
- Have Claude Code check the spine and write the fourteen prj_ tables, with money as integer cents and links as rows, in one tested pull request.
- Keep the hand-worked schedule and earned value as a fixture, and the made-up seed shifted onto today.
What this module replaces
The module plans and controls improvement, new product introduction, shutdown and capital projects: intake and portfolio scoring, a work breakdown with all four dependency types and a critical path, baselines and slip, resources and timesheets, budgets with purchase order commitments and earned value, the RAID log, punch lists and status reports. Its specification names the tools it replaces: Smartsheet, Asana, monday.com, Microsoft Project, Wrike, ClickUp and Jira for work management, and Oracle Primavera P6 and Procore for capital projects [1]. PMI's PMBOK Guide and ISO 21502 give the vocabulary a project manager already uses [2][3].
| Capability | Tier | Built in these six sessions |
|---|---|---|
| WBS and scheduling: four dependency types with lag, critical path | MVP | Yes |
| Views: Gantt, board, list, calendar, portfolio timeline | MVP | Yes; the Gantt is a list on a phone |
| RAID and decisions | MVP | Yes |
| Intake and portfolio scoring | STD | Yes |
| Baselines and variance, slip alerts | STD | Yes |
| Resources and timesheets with approval | STD | Yes |
| Budgets, commitments from POs, forecast | STD | Yes; commitments read from M12, or entered from real POs |
| Punch lists, status reports | STD | Yes; an AI-drafted summary is optional and always approved by a person |
| Templates (kaizen, CAPEX, NPI, shutdown, IT) | STD | Written down; optional extension |
| Earned value snapshots | BIC | Yes: required in this course |
Session 1: Inventory your projects and the tool, from its own pages
60 minutesWhy
Replacing a project tool only makes sense if you know what it holds, who uses it and what it costs. Writing the inventory from the tool's own lists and your invoices gives Session 6 something real to compare against, and choosing one project to move first keeps the build anchored to work people do, not a demo.
Do this
Ask the tool's administrator for an hour with the project list, the user list and the billing page open. If your "tool" is a spreadsheet or a whiteboard, treat it as the tool and answer the same questions.
cd ~/code/acme-platform && git switch main && git pull && claudeOn a new branch projects/inventory, create docs/projects-inventory.md as an empty form for me to fill in from our current project tool. Do not invent any figure, price, date or count: every cell starts as "not yet read".
Sections, each a table:
1. Open projects: code, name, type (capex, improvement, kaizen, npi, it, shutdown, customer, regulatory), stage (proposed, approved, planning, executing, on hold, closing, closed), manager, sponsor.
2. How work is requested and decided today: the route (email, form, meeting), who decides, on what criteria, and any scoring used.
3. The tool: name, plan, users who sign in, yearly or monthly bill, renewal date, notice period, source (invoice or account page, with its date).
4. What the tool does for each capability: dependency types it allows (FS only, or SS, FF, SF too, with lag), whether it shows a critical path, whether it saves baselines, whether budgets show commitments from purchase orders, timesheets and who approves them, RAID log, punch lists, status reports.
5. The export: format (CSV or XML), which columns it holds (task, outline level, start, finish, duration, predecessors, assignee, percent complete), and three examples of how it writes a predecessor.
6. Workarounds people use today.
7. The first project to move, why, and its manager.
Add a line at the top: "Every number here comes from the tool's own pages or our invoices. Never estimate." Open a pull request titled "Projects inventory" and show me the link. I will fill it in on GitHub.Fill it in on GitHub with the administrator. Export one small project into a private folder outside the repository to fill in section 5, then delete the file.
You will see recreated screen
- Section 4 is where the module's three pitfalls show: FS only, no baseline, budgets without commitments.
- Empty on purpose. Refuse "typical" values.
You will see recreated screen
| ID | Task | Duration | Start | Finish | Predecessors |
|---|---|---|---|---|---|
| 1 | Design | 3d | Mon 05/01 | Wed 07/01 | |
| 2 | Order and receive | 2d | Thu 08/01 | Fri 09/01 | 1 |
| 3 | Install | 4d | Thu 08/01 | Tue 13/01 | 1FS+0d |
| 4 | Test | 2d | Wed 14/01 | Thu 15/01 | 2,3SS+1d |
- Write three examples like these in section 5. Session 5's import reads them, and a guess here becomes a wrong link there.
Check it worked
Pull request Projects inventory has every section filled in, each figure with its source, the bill and renewal date from an invoice, three predecessor examples copied from a real export, and the first project chosen with its manager. Owner two approves; merge.
Fastest path
Fill sections 3 and 4 with the administrator in one screen-shared sitting; both need pages only they can open.
If it goes wrong
Claude Code filled in typical figures
Say: Replace every value you wrote with "not yet read". I fill these in from our own tool and invoices.
The tool cannot export dependencies
Write that down: Session 5 then re-enters the links by hand for the first project only, and the module's own Gantt becomes the record from then on.
Nobody knows the bill
Write who can find it (finance) and ask for the last invoice. Never use the vendor's list price: your contract may differ.
The fourteen tables
Every table carries the standard columns id, site_id, created_at, created_by, updated_at, updated_by, row_version, archived_at and ext, and points at the tables docs/spine-map.md maps the spine names onto (core_person, core_site, core_calendar, core_equipment, core_party, core_attachment) instead of keeping its own lists. site_id takes the place of the specification's tenant_id, so each table keeps one simple access rule. Money is stored as integer cents (the Foundation rule, so a total is always exactly the sum of its parts), converted only on screen; the ratios SPI and CPI stay decimal. An arrow is a foreign key; soft link is a plain uuid that names another module's row without a foreign key.
| Table | Holds | Columns (req = required) |
|---|---|---|
| prj_portfolio | A portfolio with its scoring model | name req, unique per site; owner_id → core_person; scoring_model json |
| prj_request | An intake request | request_no req, unique per site; title req; problem_statement; benefits json; est_cost, est_benefit (cents); scores json; total_score num; requested_by → core_person req; status req (submitted, under_review, approved, rejected, converted); decided_by; project_id → prj_project |
| prj_project | A project | code req, unique per site; name req; portfolio_id; project_type req (capex, improvement, kaizen, npi, it, shutdown, customer, regulatory); status req (proposed, approved, planning, executing, on_hold, closing, closed, cancelled); gate (idea, define, plan, execute, close); sponsor_id; manager_id req; start_date, finish_date, baseline_finish; health (green, amber, red); budget_total (cents); currency; calendar_id → core_calendar |
| prj_task | A WBS element with its CPM results | project_id req; parent_id → prj_task; wbs_code req; name req; task_type req (task, milestone, summary, gate); duration_days; start_at, finish_at; early_start, early_finish, late_start, late_finish; total_float_days; is_critical; percent_complete; assignee_id; status req (not_started, in_progress, blocked, done, cancelled); effort_hours |
| prj_dependency | A link with type and lag | predecessor_id req; successor_id req; dep_type req (fs, ss, ff, sf); lag_days |
| prj_baseline | A saved plan, never edited | project_id req; name req; captured_at req; data json req |
| prj_assignment | A person on a task | task_id req; person_id req; units_pct req; planned_hours; actual_hours |
| prj_time_entry | A timesheet entry | person_id req; project_id req; task_id; work_date req; hours req; billable; status req (draft, submitted, approved, rejected); approved_by |
| prj_budget_line | Budget by cost code | project_id req; cost_code req; category req (equipment, installation, engineering, construction, validation, contingency, internal_labor, software, other); budget_amount req; committed_amount; actual_amount; forecast_amount (all cents) |
| prj_commitment | An amount promised on a purchase order | project_id req; budget_line_id; po_ref soft link to inv_purchase_order; vendor_party_id → core_party; amount req (cents); committed_at |
| prj_raid_item | Risk, assumption, issue, decision, dependency or change | project_id req; raid_type req; title req; description; probability int; impact int; score int; owner_id; due_at; response; status req (open, monitoring, closed) |
| prj_status_report | A periodic report, fixed once published | project_id req; period_end req; health req; summary req; accomplishments; next_steps; risks_summary; author_id; published_at |
| prj_punch_item | A defect to fix before handover | project_id req; equipment_id → core_equipment; description req; category req (a, b, c); raised_by; assigned_to; due_at; status req (open, in_progress, ready_to_verify, closed); photo_attachment_id → core_attachment; closed_at |
| prj_evm_snapshot | An earned value reading, insert only | project_id req; as_of req; pv, ev, ac (cents); spi, cpi num; eac, vac (cents) |
Session 2: Check the spine, then write the fourteen tables and their tests
40 minutesWhy
The module relies on spine tables a stamping-plant Foundation may not have yet (a working calendar, suppliers, approvals, signatures). Checking first and adding them in their own migration keeps the module's migration small. Writing the rules the specification leaves to you (no self-links, links within one project, money in whole cents, baselines that never change) as database rules with tests means every screen and import keeps them, and the schema check rebuilds the lot from nothing before it merges.
Do this
Read docs/naming-standard.md, docs/SCHEMA-PLAN.md and every file in supabase/migrations. Change nothing yet.
Tell me which of our tables or functions plays each of these roles, and which are missing: core_person (with email), core_site, core_calendar (code, name, site_id, timezone, holidays; the working week kept in ext.work_week), core_job_role, core_equipment, core_party, core_attachment, core_comment, core_approval (owner_type, owner_id, step_no, role_required, approver_id, decision, decided_at, comment, signature_id), core_e_signature, core_action_item, core_notification, core_event_outbox, core_status_history, core_number_sequence (entity_key, prefix, next_value, padding), core_audit_log with core_audit_row(), core_touch_row() and core_block_mutation() (refuses update and delete). Where our Foundation tables already hold the same thing (sites, parts, lots, equipment, memberships), map the core_ name onto them; never a copy.
Then, on a new branch spine/projects: add a section "M20 Projects" to the one shared docs/spine-map.md (create it if no module has yet; never a separate projects map): each core_ name and our table for it, and that the prj_ tables carry site_id (→ sites) in place of the specification's tenant_id. If anything is missing, one migration (npx supabase migration new spine_for_projects) with only the missing pieces, row-level security on and forced with no policies, and pgTAP tests in supabase/tests/core.test.sql. Push, open a pull request titled "Spine for projects", wait for every check, report in plain words, and stop.When the spine is on main, paste the table list from this page into the next prompt where it says:
On a new branch projects/tables:
1. Create docs/prj-tables.md from the table list I paste below, exactly as written, and docs/projects-rules.md listing every rule in point 3.
2. Run npx supabase migration new projects_tables and write all fourteen prj_ tables, following docs/naming-standard.md: the standard columns in docs/spine-map.md (site_id not null references sites, indexed, never tenant_id); timestamps as timestamptz; required means not null; allowed values are check constraints; foreign keys only to the tables docs/spine-map.md names, to sites and to each other; po_ref a plain uuid with no foreign key. Money columns (est_cost, est_benefit, budget_total, budget_amount, committed_amount, actual_amount, forecast_amount, prj_commitment.amount, pv, ev, ac, eac, vac) are bigint cents; spi and cpi numeric.
3. Rules: prj_portfolio.name, request_no and code unique per site, numbers from core_number_sequence through a security definer function with set search_path = ''; wbs_code unique within a project; a task never depends on itself; the same pair and type stored once; both ends of a link in the same project (a trigger); percent_complete 0–100; units_pct above 0; hours above 0 and at most 24 per entry; probability and impact 1–5.
4. Guards as triggers: a saved prj_baseline changes only archived_at; a prj_status_report with published_at set changes only archived_at; prj_evm_snapshot uses core_block_mutation() (insert only); a row with archived_at set refuses any update; core_audit_row() and core_touch_row() on every table. Row-level security on and forced on every table, no policies yet.
5. Add the fourteen tables to docs/matrix.json with empty cells.
6. pgTAP tests in supabase/tests/projects.test.sql: every table exists with row-level security forced; a project type outside the list, a task with no project, a self-link, a link across two projects, a budget with decimals and an update of a saved baseline are each refused; a published report refuses an edit; an EVM snapshot refuses an update.
7. Do not connect to any Supabase project.
Push, open a pull request titled "Projects tables", wait for every check, and report in plain words with the test counts. If a check fails, fix it and wait again.
The table list:
<paste the table "The fourteen tables" from element M20 here>You will see recreated screen
- Its timestamp puts it after the spine migration.
- A link is a row with a type and a lag: all four types, from the first table.
- Check the counts in the pull request's checks tab, not only here.
Check it worked
The M20 section is in docs/spine-map.md on main. Pull request Projects tables is green on its latest commit; docs/projects-rules.md lists every rule; owner two approves; merge, and the deploy workflow applies it to production.
Fastest path
Paste the table list into the prompt instead of describing the tables: allowed values and money types come through exactly, and the review is a comparison, not a rewrite.
If it goes wrong
Claude Code adds tenant_id, or puts the spine mapping in docs/prj-tables.md
Say: The prj_ tables carry site_id, never tenant_id, and the mapping lives only in the M20 section of docs/spine-map.md.
Money columns came out as numeric(14,4)
The specification's own DDL uses decimals; the Foundation rule is integer cents. Say: Make every money column bigint cents, converted only on screen, with a test that refuses a fraction of a cent.
The predecessor is a text column on prj_task
Say: Remove it. Every link is one prj_dependency row with dep_type and lag_days.
CI fails on a fresh database with "relation does not exist"
Something exists only where it was clicked into being. Say: Rebuild from nothing with only supabase/migrations, name the missing object, and add it as a new migration; never edit an applied one.
After merging main, a rule or test you added has gone
A revert on main took it with no conflict. Say: List every schema change and test this branch added and confirm each is still there. If any disappeared, find the commit that removed it and tell me before changing anything.
A network worked by hand
The schedule engine in Session 4 must give your answers, so the network it is tested on is worked on paper first. The convention: day 0 is the start of the first working day, a task's early finish is its early start plus its duration, and a milestone has 0 days. Dates use a Monday-to-Friday calendar starting Monday 2026-01-05. These are fixed dates, so they live in a test fixture, tests/fixtures/projects-cases.json; the seed for the screens, supabase/seeds/projects.sql, is shifted onto today.
| Task | Days | Predecessors (all FS) | ES | EF | LS | LF | Float | Dates |
|---|---|---|---|---|---|---|---|---|
| A Design | 3 | none | 0 | 3 | 0 | 3 | 0 | Jan 5–7 |
| B Order and receive | 2 | A | 3 | 5 | 5 | 7 | 2 | Jan 8–9 |
| C Install | 4 | A | 3 | 7 | 3 | 7 | 0 | Jan 8–13 |
| D Test and hand over | 2 | B, C | 7 | 9 | 7 | 9 | 0 | Jan 14–15 |
| E Go-live (milestone) | 0 | D | 9 | 9 | 9 | 9 | 0 | Jan 15 |
The critical path is A, C, D, E: nine working days. B can slip two days. With a budget at completion of 1,000,000 cents and percent complete A 100, B 100, C 25, D 0, as of 2026-01-09: 7 of 11 task-days were planned (PV 636,364), 6 of 11 are done (EV 545,455), the actual cost is 600,000, so SPI 0.857, CPI 0.909, EAC 1,100,000 and VAC −100,000, each within a cent of rounding.
Session 2: The hand-worked network as a fixture, made-up projects as the seed, and a look on the development project
35 minutesWhy
The schedule engine and the earned value sums need answers you trust before any code exists, and those answers need fixed dates. The screens need projects that look current next month too. Keeping the fixture and the seed apart prevents the two seed faults we hit: dates that age until every "this week" panel is empty, and later steps that expect counts the seed never made. Then you apply the module to the development project yourself and look.
Do this
On a new branch projects/seed:
1. Write tests/fixtures/projects-cases.json with the calendar (Mon–Fri, start Monday 2026-01-05, no holidays), the five tasks A–E with durations, links and percent complete, and every expected value from the tables I paste below (ES, EF, LS, LF, float, critical, dates; PV, EV, AC, SPI, CPI, EAC, VAC as of 2026-01-09 with BAC 1,000,000 cents). Add the six-task teaching network from element M20 chapter 3 (critical A, B, D, F; 14 days; C and E 4 days of float) and one pair of tasks per dependency type: A 5 days from day 0, B 3 days; FS lag 2 puts B at days 7–10; SS lag 2 at 2–5; FF lag 2 at 4–7; SF lag 4 at 1–4. These are worked by hand: never change an expected value to pass a test.
2. Write supabase/seeds/projects.sql and list it under [db.seed] sql_paths in supabase/config.toml (never append to supabase/seed.sql), with the Foundation seed's rules: the syn site, every date shifted onto today (read the clock once at seeding and keep every gap), every visible name starting "SYNTHETIC · ", safe to run twice (on conflict do nothing on every number and unique key): six people, one per role (manager, sponsor, assignee, team member, approver, stakeholder) with ext.weekly_hours 40; one portfolio weighting value 50, risk 25, fit 25; one request under review; two projects in executing with 6–10 tasks each using all four dependency types; assignments that over-allocate one person on two days; time entries in draft, submitted, approved and rejected; three budget lines with commitments, one of them archived; RAID items; four punch items (a open, b in_progress, b ready_to_verify, c closed); one draft status report.
3. Write docs/prj-seed-counts.md with every count the seed makes, and supabase/tests/projects-seed.test.sql asserting each one, that running the seed a second time changes no count, and that the newest task date is within the last 14 days.
Push, open a pull request titled "Projects seed and schedule cases", wait for the checks, and report.
The hand-worked tables:
<paste the network table and the earned value paragraph from element M20 here>When it is merged, apply the module and its made-up data to the development project yourself, in a terminal, with the development database password from the password manager. The first time, --include-seed loads every seed file listed in config.toml, projects.sql included; after a seed change, npm run seed:dev reloads them. Never reset the project. Production gets the migration from the deploy workflow, which never seeds it.
cd ~/code/acme-platform && git switch main && git pull && npx supabase link --project-ref tsrqponmlkjihgfedcba && npx supabase db push --include-seedhttps://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/editor
The development Table Editor. Check the project name says acme-platform-dev first.
You will see recreated screen
- The development reference, never abcdefghijklmnopqrst.
- Production gets the same migration from the deploy workflow, never the seed.
You will see recreated screen
| predecessor | successor | dep_type | lag_days |
|---|---|---|---|
| SYNTHETIC · Design | SYNTHETIC · Install | fs | 0 |
| SYNTHETIC · Dig | SYNTHETIC · Survey | ss | 1 |
| SYNTHETIC · Repair | SYNTHETIC · Final test | ff | 0 |
| SYNTHETIC · New system live | SYNTHETIC · Old system off | sf | 0 |
- All four types appear in the seed, so every view and test meets them from the first day.
Check it worked
The fixture holds the hand-worked values; the seed-count test is green; on the development project npx supabase migration list shows Local and Remote the same and the Table Editor shows SYNTHETIC projects dated around today.
If it goes wrong
db push lists the live project
Answer n. You are linked to abcdefghijklmnopqrst. Link to tsrqponmlkjihgfedcba and try again; production gets migrations only from the deploy workflow.
A week later every "this week" panel is empty
The seed has fixed dates. Say: Move every seeded timestamp by one offset so the newest record is the moment of seeding, reading the clock once, and test that the newest task date is recent. Our seeded data was 10.9 days old eleven days later.
A later step expects a count the seed does not make
Fix the seed, not the check, then reload it with npm run seed:dev: List every count a later step or test expects and show the seed line that makes it.
Knowledge check
Why are the A–E network and its earned value figures a test fixture rather than seed data?
Knowledge check
How is a dependency between two tasks stored?
References
- Smartsheet: best Gantt chart software. https://www.smartsheet.com/content/best-gantt-chart-software
- PMI: The PMBOK Guide and standards for project management. https://www.pmi.org/standards/pmbok
- ISO 21502:2020, guidance on project management. https://www.iso.org/standard/74947.html
- PostgreSQL Documentation: Constraints. https://www.postgresql.org/docs/current/ddl-constraints.html
Chapter 2 · Session 3
Who may request, plan, work, approve and read
Access is decided once, in the role matrix, and the database rules, the page list and the access tests are generated from it. This chapter adds six people's roles and one temporary machine login, walks every operation the later sessions need, and builds the phone screens, the approvals queue and the manager's views.
25 min3 stepsSession 36 roles, 1 machine login
By the end of this chapter you can
- Write the project roles and the cut-over importer into docs/matrix.json, with the two-person rules as restrictive rules.
- Keep docs/prj-operations.md and a check that fails when an operation has no cell.
- Build the operator, supervisor and manager surfaces and try them as each demo login on a phone.
Six roles and one machine login
| Role | Scope | Writes | Never |
|---|---|---|---|
| Project manager | Projects where manager_id is theirs | Requests (to under_review or converted), projects (not budget_total or approved), tasks, links, assignments, baselines, budget lines, commitments, RAID, punch, status reports (until published), EVM snapshots | Approve their own budget; set a project to approved |
| Sponsor | Projects where sponsor_id is theirs; every request under review | Decide requests (approved, rejected); approve or cancel projects; RAID decisions | Decide a request they raised |
| Task assignee | Own tasks; the rest of those projects to read | status and percent_complete on own tasks; raise RAID risks and issues; punch items to ready_to_verify | Close a punch item |
| Team member | Own rows | Own time entries while draft or rejected (submit, correct) | See anyone else's hours |
| Approver | Projects at their home site | Approve or reject time entries; budget approval with a signature; budget_total and currency | Approve their own time entry |
| Stakeholder | Projects that list them in ext.stakeholder_ids | Comments on published reports | Draft reports, time, budgets, earned value |
| Cut-over importer (machine, insert-only) | Rows with ext.imported true | Insert imported projects, tasks, links, assignments, baselines; set to NOLOGIN at cut-over | Any update or delete; anything after Session 6 |
Session 3: Put the roles in the matrix, list every operation, and generate the rules
35 minutesWhy
Access rules are generated from docs/matrix.json, so a right missing there is refused in the middle of Session 4, when the temptation is to widen a rule by hand. Writing every operation of Sessions 4 to 6 in docs/prj-operations.md now, with a script that fails if any has no cell, finds the gaps while they cost one line, and keeps finding them every time a later session adds an operation.
Do this
Read docs/matrix.json, scripts/gen-policies.mjs, docs/access-review.md, docs/prj-tables.md and docs/projects-rules.md. On a new branch projects/access:
1. Add the roles project_manager, sponsor, task_assignee, team_member, approver and stakeholder and the machine login prj_importer to docs/matrix.json with the cells in the table I paste below. Nobody gets delete. Add the two-person rules as restrictive rules: approver not on own time entry; sponsor not on own request; budget approval not by the manager who proposed it; punch item closed by someone other than assigned_to; published report and saved baseline never change; the importer inserts only rows with ext.imported true.
2. Write docs/prj-operations.md: one row per operation that Sessions 4, 5 and 6 of the projects module perform (session, screen or route, acting role, table, read, insert or update, status), and scripts/check-operations.mjs, which fails if a row has no matching cell, skipping rows whose status reads "retired" and a date. List the rows with no cell at the top under "Gaps" and stop to show me.Agree each gap with the manager you named in Session 1. The usual ones: the approver updating prj_assignment.actual_hours, the manager reading purchase order lines from M12, core_event_outbox for the slip alert, core_e_signature for the budget approval. Then:
Add the cells for the gaps we agreed. Run node scripts/gen-policies.mjs to generate the policy migration (never a hand-written policy) and the access tests (one allowed and one refused per cell, plus the cross-site test). In a separate migration, create the database login prj_importer with NOLOGIN, no BYPASSRLS, owning nothing, insert-only; I set its password myself in Session 5. Add tests for every restrictive rule, each giving one person both jobs; a test that runs every row of docs/prj-operations.md as its role against the seed and checks the row really changed; and run scripts/check-operations.mjs in CI. Update docs/access-review.md. Push, open a pull request titled "Projects access", wait for every check, and report with the allowed and refused counts.You will see recreated screen
- Gaps found before any step needs them.
- Restrictive rules hold whatever other cells allow.
- "Really changed": an update a role cannot read reports success and changes nothing.
Check it worked
Pull request Projects access is green; docs/prj-operations.md has no gap; check-operations runs in CI; no generated policy allows delete; docs/access-review.md shows every new role.
If it goes wrong
An approved time entry does not change the assignment's hours
The approver can update but not read prj_assignment rows, so the update finds nothing. Add the read cell, regenerate, and test that the row really changed.
A person with two jobs can approve their own hours
The two-person rule is a permissive cell, not a restrictive one. Say: Make it a restrictive policy and add the test that gives the approver the team member job too.
Claude Code edits a generated policy by hand
Say: Revert it. Rights come only from docs/matrix.json through scripts/gen-policies.mjs. Then read the Files changed tab.
Three surfaces
| Surface | Screens | For |
|---|---|---|
| Operator (phone) | /projects/my-tasks, /projects/time, /projects/punch, /projects/request | Assignee and team member: own tasks, hours, punch items with a photo; anyone allowed may raise a request |
| Supervisor | /projects/approvals | Approver (hours, budgets); sponsor (requests, projects) |
| Manager | /projects/gantt, /board, /list, /calendar, /portfolio, /budget, /raid, /status | Manager and sponsor; the stakeholder reads portfolio, list, calendar and published status |
Session 3: Build the operator, supervisor and manager screens
30 minutesWhy
The screens decide whether people stop updating the old tool. Building them against the seed with the access rules already generated means each person sees only their projects from the first day. The new pages are added to the matrix and the page list regenerated, so the sign-in guard keeps denying everything it was not told about, and the phone rules matter because assignees and team members update from the floor.
Do this
Before writing any page, read the routing and proxy guides in node_modules/next/dist/docs/ (this Next.js version differs from older guides; request checks live in proxy.ts) and lib/access/routes.ts.
On a new branch projects/screens:
1. Add the screens /projects/my-tasks, /projects/time, /projects/punch, /projects/request, /projects/approvals, /projects/gantt, /projects/board, /projects/list, /projects/calendar, /projects/portfolio, /projects/budget, /projects/raid and /projects/status to the screens section of docs/matrix.json with the roles from element M20 chapter 2, and regenerate lib/access/routes.ts with node scripts/gen-routes.mjs, as Session 9 does. Do not edit proxy.ts or routes.ts by hand.
2. Build them against the seed. On a phone the Gantt is a list with start, finish and float; bars appear from tablet width. Critical tasks are marked in words as well as colour. Any figure with nothing behind it shows "No data" or "not yet", never 0. The person on every record comes from the signed-in session on the server.
3. Foundation phone rules: 44 px targets, 16 px fields, 15 px text, no sideways scroll at 360 and 390 px, contrast 4.5:1.
4. Screen tests at phone size: signed out, every page goes to sign-in; each role opens its pages and is refused the others; the stakeholder sees no draft report, time entry or budget.
Push, open a pull request titled "Projects screens", wait for the checks and the Vercel preview, and give me the preview address.You will see recreated screen
- Critical is a word, not only a red bar.
- Saving sends only status and percent complete: the assignee's two columns.
Check it worked
On the preview, signed out, every projects page goes to sign-in; each demo role opens its own pages on a phone with nothing scrolling sideways; the screen tests are green.
If it goes wrong
Pages compile but a link opens a 404
Test by visiting: Start the production build, sign in as each role, visit every page and every link on it, and report each 404, error page and console error.
Earned value shows 0 for a project with no progress
Say: When EV is 0, store the ratios empty and show "not yet"; never 0. Test every panel with an empty project.
Claude Code wrote middleware.ts
Say: This Next.js uses proxy.ts, and its list comes from lib/access/routes.ts generated from the matrix. Remove the hand edit and regenerate.
Session 3: Demo logins on the development project, and a trial with the manager
20 minutesWhy
Tests prove the rules; people prove the screens. One demo login per role on the development project lets you and the manager use the module as each role will, with made-up data only. Ten silent minutes watching a manager and a person who logs time find the confusing parts before the workflow is built on them.
Do this
On the development project, create six users with Create new user and Auto confirm user: manager.test, sponsor.test, assignee.test, member.test, approver.test and stakeholder.test, all @example.com, each password generated and kept in the password manager.
https://supabase.com/dashboard/project/tsrqponmlkjihgfedcba/auth/users
Authentication, Users, on acme-platform-dev.
Write supabase/snippets/prj-demo-logins.sql for me to run in the development SQL editor. Do not run it. It finds the six demo users by email and links each to the seeded person of the same role, with a membership at the seeded site. It refuses to run if prj_project holds any row whose name does not start "SYNTHETIC · ". Open a pull request titled "Projects demo logins" and wait for the checks.After it merges, run it in the development SQL editor. Sign in on the preview as each role. Then watch the manager plan on /projects/gantt and a team member enter a day's hours on /projects/time, on their own phone, without explaining anything; write down where each stops.
You will see recreated screen
- Someone else's hours.
- The two-person rule, said on the screen as well as enforced in the database.
Check it worked
Each demo login sees exactly its role's pages on the preview; you have written notes from both trials, each fixed or decided.
If it goes wrong
The user waits for a confirmation email
You used Invite. Delete it and use Create new user with Auto confirm user: example.com addresses receive nothing.
The snippet refuses: rows not marked SYNTHETIC
Good: it found real data. Check you are in acme-platform-dev. Real records go there only with IT's written approval (Session 5).
Knowledge check
An approver also logs time on the same project. What happens when they try to approve their own entry?
Knowledge check
Where is the right for a later step added when a step is refused?
References
- Supabase Docs: Row Level Security. https://supabase.com/docs/guides/database/postgres/row-level-security
- PostgreSQL Documentation: Row Security Policies (permissive and restrictive). https://www.postgresql.org/docs/current/ddl-rowsecurity.html
- W3C: Web Content Accessibility Guidelines (WCAG) 2.2. https://www.w3.org/TR/WCAG22/
Chapter 3 · Session 4
The workflow: from request to critical path to earned value
One session builds the project's working life: a request is scored and decided, the schedule engine computes the critical path with all four dependency types, a baseline measures slip, hours are approved by someone else, budgets show commitments from purchase orders, earned value is a stored reading, and RAID, punch items and status reports close the loop. Every number is tested against the network you worked by hand.
35 min4 stepsSession 4tested against your hand count
By the end of this chapter you can
- Score, decide and convert a request with the two-person rule held by the database.
- Have Claude Code build the critical path engine with its tests written first, and show slip against a baseline.
- Approve hours, commit budgets from purchase orders, store earned value, and publish a status report that cannot change.
Intake and scoring
A request is scored on value, risk (5 is the lowest risk) and strategic fit, 1 to 5, weighted by the portfolio's scoring_model; total_score is the sum of weight times score divided by the sum of the weights, computed on the server. A request moves submitted, under_review, approved or rejected; an approved one is converted into a project and keeps its project_id.
Session 4: Intake, scoring and the decision
25 minutesWhy
Most project trouble starts before the project: work nobody chose, or chosen by the person asking for it. Scoring on the server and holding the decision to someone other than the requester turns the portfolio into a record the business can defend. Writing the rules in docs/projects-rules.md first means the code follows decisions you made, not ones Claude Code guessed.
Do this
Read docs/projects-rules.md, docs/prj-operations.md and docs/matrix.json. On a new branch projects/intake:
1. Add to docs/projects-rules.md, as settings I can change: the scoring scale (1–5, risk 5 = lowest risk) and formula (sum of weight × score ÷ sum of weights); which purchase order statuses count as committed (approved, sent, acknowledged, partially_received, received) and which do not (draft, pending_approval, closed, cancelled); planned and earned value weighted by duration_days; the risk score (probability × impact) and its bands; punch categories a, b, c and which must be closed before handover; when health turns amber and red; how many working days of slip on a critical task raise an alert.
2. Build /api/projects/requests (raise, numbered from core_number_sequence), /api/projects/decide (sponsor: approved or rejected, never on a request they raised), /api/projects/convert (manager: creates the prj_project, status proposed, and sets project_id) and /api/projects/approve (sponsor: project to approved). total_score is computed on the server; for weights 50, 25, 25 and scores 4, 3, 5 it is 4.00.
3. Tests: the score; the sponsor refused on their own request; a manager refused when setting a project to approved; each status move outside the allowed paths refused. Show each test failing with its rule removed, then passing.
4. Add the operations to docs/prj-operations.md and run scripts/check-operations.mjs.
Push, open a pull request titled "Projects intake", wait for every check, and report in plain words.You will see recreated screen
- A test that has never failed may not be able to fail.
- Check the 4.00 against your own sum.
Check it worked
On the preview, assignee.test raises a request, manager.test scores it (4.00 on the seed's scores), sponsor.test approves it, manager.test converts it into a project with status proposed.
If it goes wrong
The score differs from your sum
Check whether the code divides by the sum of the weights. 4 × 50 + 3 × 25 + 5 × 25 = 400; 400 ÷ 100 = 4.00. A plain average ignores the weights.
The sponsor approved their own request
The rule is a screen check, not a database rule. Say: Enforce it as the restrictive policy from Session 3 and test it with a sponsor who raised the request.
Four dependency types and the critical path
| Type | Rule for the successor | Plant example |
|---|---|---|
| FS | Start no earlier than predecessor's finish + lag | Paint after the plaster has dried (lag 2) |
| SS | Start no earlier than predecessor's start + lag | Begin the survey a day after digging begins |
| FF | Finish no earlier than predecessor's finish + lag | Final testing finishes after the last repair |
| SF | Finish no earlier than predecessor's start + lag | The old system stays on until the new one has started |
The forward pass gives each task its early start (the latest early finish of its predecessors) and early finish; the backward pass from the project finish gives late finish and late start. Total float is late start minus early start; tasks with zero float form the critical path [1][2]. A tool that knows only finish-to-start forces overlapping work into fake tasks, and the critical path then runs through links that are not real.
Session 4: The critical path engine, tests first, and the five views
40 minutesWhy
The finish date the sponsor is told comes from this engine, and a wrong critical path sends effort to the wrong tasks. Writing the tests first from the network you worked by hand means the engine must match your arithmetic. A pure function (same input, same output, no database) is easy to test; the route that runs it and the views that show it are then plumbing. The specification's definition of done asks for exactly this: textbook results, and successors that move when a predecessor does.
Do this
On a new branch projects/schedule:
1. Write tests/projects-cpm.test.ts first, from tests/fixtures/projects-cases.json: the four dependency-type pairs, the seed network A–E (critical A, C, D, E; B float 2; nine working days; dates Jan 5–15 2026), the six-task teaching network (A, B, D, F critical; 14 days), and a cycle refused. Run them and show me they fail because there is no engine yet. Never change an expected value.
2. Write lib/projects/cpm.ts as one pure function taking tasks, links and the calendar and returning early and late start and finish, total float and is_critical for each task, with all four types and lags. Make the tests pass.
3. Build /api/projects/schedule (manager): runs the engine and writes the results to prj_task and the dates to prj_project, rolling summary rows up. /api/projects/tasks (manager: tasks, links, assignments, refusing a cycle or a link across projects; assignee: only status and percent_complete on own tasks). Every update includes row_version in its WHERE clause, so a stale save is refused with a message.
4. Wire the Gantt (dependency lines; a list on phones), board, list, calendar and portfolio timeline to the results.
5. A test that lengthens a predecessor, runs the schedule, and checks the successors moved and the critical path was recomputed.
Push, open a pull request titled "Projects schedule", wait for every check, and report in plain words.You will see recreated screen
- Failing for the right reason.
- Your hand count, unchanged.
- The specification's second test: successors move and the path is recomputed.
Check it worked
The engine tests are green and tests/fixtures/projects-cases.json is not in the pull request's changed files. On the preview, manager.test opens /projects/gantt and sees the critical tasks named in words.
If it goes wrong
A test was "fixed" by changing an expected date
Say: Revert the fixture. It is worked by hand. Find which rule differs: day 0, the milestone, the lag or the calendar.
SF and FF dates come out a day off
Usually the convention: day 0 is the start of the first working day, and finish is start plus duration. Write it in docs/projects-rules.md and have the engine follow it.
Two managers edit the same task and one change is lost
The update does not check row_version. Say: Include row_version in the WHERE clause and refuse a stale save with a message; test two saves from one copy, expecting exactly one to succeed.
Baselines, money and earned value
| Measure | Formula | Reads as |
|---|---|---|
| SPI | EV ÷ PV | Below 1: behind schedule |
| CPI | EV ÷ AC | Below 1: over cost |
| EAC | BAC × AC ÷ EV (round once, in cents) | Likely total cost |
| VAC | BAC − EAC | Negative: forecast overrun |
| Budget variance | (forecast − budget) ÷ budget | Above 0: over budget |
Earned value follows the PMBOK Guide's measures; ANSI/EIA-748 sets guidelines for a full earned value management system if a contract asks for one [2]. AACE International's RP 18R-97 classifies cost estimates from Class 5 to Class 1; keep the class in ext.estimate_class on the budget line [3].
Session 4: Baselines and slip, hours, commitments from purchase orders, and earned value
45 minutesWhy
Two of the module's three pitfalls live here. Without a baseline nobody can say how late a project is; without commitments a budget looks healthy until the invoices arrive. Approved hours, committed purchase orders and stored earned value readings give the sponsor two numbers that say whether the project is on time and on cost, and every figure is checked against the hand count from Session 2.
Do this
On a new branch projects/control:
1. Baselines: /api/projects/baselines saves a prj_baseline (start, finish, duration of each task) and sets baseline_finish. On a scratch copy of the A–E network, save "Baseline 1", lengthen A to 5 days, run the schedule: C, D and E move two working days (E to 2026-01-19), the variance report on /projects/gantt shows start, finish and duration against Baseline 1, and the slip alert fires once (a prj.task.critical_slip row in core_event_outbox, a notification to manager and sponsor, an action item). Milestone hit rate as of 2026-01-19 on the scratch project is 0 of 1. Archive the scratch project.
2. Time: assignments with units_pct and planned_hours; the capacity heat map on /projects/portfolio shows the seeded over-allocation; /projects/time (draft, submit); /api/projects/timesheets/approve (approver) adds approved hours to actual_hours; a rejection needs a reason that reaches the person.
3. Money: budget lines proposed by the manager and approved by the approver with a core_e_signature, setting budget_total; /api/projects/commitments turns open purchase order lines (from M12 when installed: qty × unit_price in cents rounded once per line, keyed by po_ref and ext.po_line so a second run adds nothing) into prj_commitment rows, or the manager enters them from real POs; committed_amount = the sum of linked, non-archived commitments; contingency drawdown in one transaction with a RAID change item.
4. Earned value: /api/projects/evm takes an as_of date and inserts a prj_evm_snapshot. On the fixture as of 2026-01-09: PV 636,364; EV 545,455; AC 600,000; SPI 0.857; CPI 0.909; EAC 1,100,000; VAC −100,000 (each within one cent). When EV is 0, store the ratios empty and show "not yet".
5. Tests for every figure above against tests/fixtures/projects-cases.json, the approver refused on their own entry, and committed_amount equal to the linked open lines with an archived commitment not counted. Add the operations to docs/prj-operations.md and run the check.
Push, open a pull request titled "Projects control", wait for every check, and report in plain words.You will see recreated screen
- Your numbers from Session 2, reproduced.
- The definition of done, item by item.
You will see recreated screen
| Cost code | Budget | Committed | Actual | Forecast |
|---|---|---|---|---|
| EQ-100 equipment | 6,000.00 | 5,500.00 | 4,000.00 | 6,200.00 |
| IN-200 installation | 3,000.00 | 2,000.00 | 2,000.00 | 3,300.00 |
| CT-900 contingency | 1,000.00 | 0.00 | 0.00 | 1,000.00 |
- Committed is promised money; actual is part of it, not added to it.
- A stored reading with its date, so it never silently changes.
Check it worked
The control tests are green with the fixture unchanged; on the preview the budget screen shows committed beside actual, the variance report shows the two-day slip, and approver.test cannot approve its own hours.
If it goes wrong
The slip alert fires every time the schedule runs
Say: Raise the alert once per task and baseline, with a unique key, and test that a second run adds nothing.
Committed is larger than the purchase orders
An archived or cancelled line is counted, or a second run added rows again. Say: Count only non-archived commitments on open orders, key each row by po_ref and ext.po_line, and test a second run.
EAC is a few cents out
The code divided by a rounded CPI. Say: Compute EAC as BAC × AC ÷ EV in cents and round once at the end.
RAID, punch lists and status reports
For regulated capital projects, commissioning and qualification evidence (checklists and signatures) stays with the project record and is handed to Document Control at close; ISPE's Baseline Guide Volume 5 and ASTM E2500 describe the practice [4].
Session 4: RAID, punch items and a status report that cannot change
30 minutesWhy
The control records are where a project's honesty shows: a risk scored the same way every time, a punch item closed by someone who checked it, and a status report that says what was true on its date and is never quietly edited. An AI-drafted summary is optional; when used it is a draft a person approves, and its key is typed by you into Vercel, never into Claude Code.
Do this
On a new branch projects/raid-punch-status:
1. RAID: /api/projects/raid. The assignee raises risks and issues; the manager scores probability × impact into score, sets owner, due date, response and status; the sponsor may insert only raid_type decision.
2. Punch: on a phone the assignee raises an item with a photo (core_attachment) and moves it to in_progress and ready_to_verify; someone other than assigned_to closes it, which sets closed_at and writes prj.punch_item.closed to core_event_outbox. Open punch items by category at handover on /projects/status.
3. Status reports: the manager drafts from the numbers (health, SPI, CPI, open RAID by score); publishing sets published_at, writes prj.status_report.published and notifies stakeholders; a published report never changes (a correction is a new report). The summary is typed by hand. If I later enable an AI draft, it goes through one module, lib/ai/draft.ts, reading its key from AI_API_KEY, which I set in Vercel myself; the draft is stored as core_ai_suggestion until the manager approves it. Leave AI off.
4. Tests: a punch item closed by its assignee is refused; a published report refuses an edit; a sponsor cannot insert a RAID risk; punch counts by category on the seed match docs/prj-seed-counts.md. Show each failing first.
5. Write docs/prj-events.md with the line where prj.project.approved, prj.task.critical_slip, prj.status_report.published and prj.punch_item.closed are written. Add the operations to docs/prj-operations.md and run the check.
Push, open a pull request titled "Projects RAID, punch and status", wait for every check, and report.Then walk it on the preview: as assignee.test raise a punch item with a photo and move it to ready_to_verify; as manager.test close it; publish a status report and try to edit it (refused); as stakeholder.test read it.
You will see recreated screen
- Category a items must be closed before handover, as your rules say.
- The database refuses the edit; the screen says why.
Check it worked
The refusals are green tests; on the preview a punch item closed by its own assignee is refused and by the manager is accepted; a published report refuses an edit; docs/prj-events.md lists four events.
If it goes wrong
Claude Code wants the AI key to test the draft
Refuse. Say: Leave AI off. I set AI_API_KEY in Vercel myself if we turn it on; test with a fake provider.
The status report page claims it was sent to stakeholders, and nobody got it
Say: Count a notification as sent only when the provider returns an id; otherwise log the reason and show "not sent". A page that claims a send that did not happen locked our own operations lead out of production.
Knowledge check
In the seed network, B (2 days) and C (4 days) both follow A (3 days) and both lead to D. How much float does B have?
Knowledge check
A budget line has 4,000 actual and 5,500 committed on approved purchase orders, against a budget of 6,000. What does a report of actuals alone miss?
References
- PMI: standards, including the Practice Standard for Scheduling. https://www.pmi.org/standards
- PMI: The PMBOK Guide, including earned value and cost management. https://www.pmi.org/standards/pmbok
- AACE International (publisher of Recommended Practice 18R-97). https://www.aacei.org/
- ASTM E2500: Specification, design and verification of pharmaceutical manufacturing systems. https://store.astm.org/e2500-20.html
Chapter 4 · Sessions 5 and 6
Move the projects in, prove them, switch the old tool off
Real projects arrive only at the end, and only after a rehearsal. Session 5 maps the old tool's export, builds an import that saves the old plan as a new baseline and adds nothing when run twice, and rehearses it on the development project with a redacted copy IT has approved in writing, removed the same day. Session 6 imports into production only through the import workflow a person starts from main, with an export owner two approved, switches the importer off, and cancels the old subscription with the saving from invoices.
20 min4 stepsSessions 5–6ends with the module's gate
By the end of this chapter you can
- Map the old export's columns and predecessor text, and build an import with a dry run and a legacy key.
- Rehearse on the development project with a redacted, IT-approved copy, explain every difference from the old tool's dates and critical path, and remove it the same day.
- Run the final import into production only through import-projects.yml, set the importer to NOLOGIN, and record the saving.
| Key or secret | What it unlocks | Where it lives | Who holds it | Never |
|---|---|---|---|---|
| prj_importer password | The cut-over importer's insert-only database login | Password manager; set by a person in each project's SQL editor; inside the two secrets below | Owner one and owner two | Pasted into Claude Code or a file; kept after Session 6 |
| PRJ_IMPORT_DATABASE_URL_DEV, PRJ_IMPORT_DATABASE_URL_PROD | The import workflow's connection to the development and the live project | GitHub Actions repository secrets, typed by a person; names in docs/KEYS.md | Owners | Used by any other workflow; left in place after cut-over |
| AI_API_KEY (only if you turned AI drafts on) | Drafting status summaries | Vercel environment variable | Owners | Pasted into a prompt; used without a spending limit |
Session 5: Map the old export, and build an import with a dry run
40 minutesWhy
Each tool writes predecessors its own way, and a guessed mapping becomes a wrong critical path. A dry run that lists every unmatched person, unknown status, unparsable predecessor, cycle and impossible date shows the problems before anything is written. A legacy key on every imported row makes a second run add nothing, so the rehearsal can be fixed and rerun safely, and the old plan saved as a baseline keeps the comparison honest.
Do this
On a new branch projects/import:
1. Write docs/projects-import-map.md from the three predecessor examples and the column list in docs/projects-inventory.md: each old column to a new column; the predecessor text parsed into prj_dependency rows (dep_type and lag_days, with the lag unit stated); assignees matched to core_person by email; old statuses to prj_task.status; the old id kept in ext.import_key, unique per project.
2. A new migration (never edit an applied one) with a unique index on ext.import_key for prj_project, prj_task and prj_dependency.
3. Write scripts/import-projects.mjs, connecting as the insert-only prj_importer login with IMPORT_DATABASE_URL from the environment (never printed, never the service-role key). A dry run writes nothing and lists unmatched people, unknown statuses, unparsable predecessors, cycles, tasks with no dates and finishes before starts. A write inserts the project (ext.imported true), tasks, links and assignments, and one prj_baseline "Imported from <tool> <date>" holding the old start, finish and duration; closed projects arrive with archived_at set; on conflict do nothing on ext.import_key. No deployed upload or import page.
4. Write .github/workflows/import-projects.yml, started only by hand (workflow_dispatch) by a person, refusing any branch but main, with inputs target (development or production), file and mode (dry-run or write). It downloads the file from the private Storage bucket imports of the target project; computes its sha256; refuses the run unless that sha256, the target and the expected counts (projects, tasks, links by type, assignments) are listed in docs/imports/projects-approved.md on main; runs the script; and fails if any count differs from the listed one. Secrets: repository secrets PRJ_IMPORT_DATABASE_URL_DEV and PRJ_IMPORT_DATABASE_URL_PROD, typed by me. No GitHub environments and no "required reviewers" (not available for private repositories on our plan): the reviewed pull request that adds the approved line is the approval. Counts in the job summary.
5. scripts/import-count.mjs <file>, which I run on my own computer: prints the file's sha256 and the counts, never any content; and scripts/import-redact.mjs <file> <out>, which I run for the rehearsal copy: replaces every person's name and email with a consistent placeholder. docs/imports/projects-approved.md: one heading per approved export with target, file name, sha256, expected counts, IT's approval reference and, for the rehearsal, the date it was removed. supabase/snippets/remove-projects-rehearsal.sql, for me to run in the development SQL editor: removes only rows with ext.imported true, prints the counts, refuses unless the database is acme-platform-dev. Add the secrets' names to docs/KEYS.md.
6. Tests with a ten-row fixture export: the dry run report; running the write twice adds nothing; a non-FS link survives; an archived imported row refuses an update; the importer cannot update any row; the workflow refuses a file not listed and fails on a count mismatch.
Push, open a pull request titled "Projects import", wait for every check, and report in plain words.You will see recreated screen
- The problems are named; you decide each one in the mapping file.
- Run twice equals run once: what makes the rehearsal safe.
Check it worked
The pull request is green, the mapping file covers every column and predecessor form from your inventory, and the fixture's second write adds nothing.
If it goes wrong
Old tasks arrive with today's dates
The import let the database default the dates. Say: Keep the export's start, finish and duration on the tasks and in the imported baseline, with a test.
Every link arrives as FS
The predecessor parser drops the type. Say: Parse the type and lag from each predecessor form in docs/projects-import-map.md, and add one fixture row per form. FS-only is the pitfall this module exists to remove.
Claude Code asks for a real export to test with
Refuse. Real records stay out of tests and chats. Say: Use the ten-row fixture only.
Claude Code builds an upload page, runs the import on merge, or adds a GitHub environment with required reviewers
Say: No import page, no import on merge, no environments: a person starts import-projects.yml from main, reading the file from the private imports bucket, and the merged line in docs/imports/projects-approved.md is the approval. Required reviewers are not available for private repositories on the Team plan.
Session 5: Rehearse on the development project with an IT-approved copy
40 minutesWhy
The rehearsal is where mistakes are cheap: real volumes and real oddities, on the development project, with production untouched. Running the engine on the imported projects and comparing its dates and critical path with the old tool's own shows whether the mapping is right. Real project data can name people and suppliers, so it goes into the development project only redacted, with IT's written approval, and comes out the same day with the date recorded.
Do this
Ask IT in writing before any real export leaves the old tool:
Subject: Approval to rehearse the project import on our development database
We plan to load an export of <n> projects from <old tool> into our development database
(acme-platform-dev, Supabase, region us-east-2) for one rehearsal on <date>, and delete it the
same day. Names and email addresses are replaced with placeholders before it is loaded.
Access: the two platform owners and the project manager. Nothing leaves the company.
Please confirm in writing.When IT approves, on the rehearsal day: in your private folder run node scripts/import-redact.mjs on the export, then node scripts/import-count.mjs on the redacted copy. Record its sha256 and counts, with IT's approval reference, in docs/imports/projects-approved.md through a pull request owner two approves and merges. In the development SQL editor set the importer's password (alter role prj_importer with login password '…';, from the password manager), type the repository secret PRJ_IMPORT_DATABASE_URL_DEV (user prj_importer.tsrqponmlkjihgfedcba; the value only), and upload the redacted copy to the private bucket imports on the development project.
https://github.com/acme-ops/acme-platform/settings/secrets/actions
GitHub: Settings, Secrets and variables, Actions: New repository secret.
https://github.com/acme-ops/acme-platform/actions/workflows/import-projects.yml
Run workflow from main: target development, mode dry-run; read the report, fix the mapping; then write, then write again: it must add nothing.
The rehearsal import has run on the development project. On a new branch projects/rehearsal, run /api/projects/schedule on each imported project (on the development project only) and write docs/projects-cutover.md: the dry-run and write counts (export rows, imported rows, skipped rows with reasons), and for each imported project the old finish date against the engine's, the old critical path against ours, and ten tasks' start and finish side by side from the imported baseline's variance report. Leave a column "Why" for me to fill. Open a pull request titled "Projects rehearsal" and wait for the checks.The same day, when the Why column is filled: run supabase/snippets/remove-projects-rehearsal.sql in the development SQL editor, delete the file from the bucket and your local copies, write the removal date in docs/imports/projects-approved.md, reload the made-up data with npm run seed:dev, and tell IT in writing.
You will see recreated screen
| Check | Count |
|---|---|
| Projects in file | 14 |
| Tasks | 612 |
| Links (FS / SS / FF / SF) | 540 / 31 / 12 / 0 |
| People not matched | 3 |
| Predecessors not parsed | 2 |
| Cycles | 0 |
- Counts you will compare with the production run.
- Nothing is guessed: every problem waits for you.
Check it worked
IT's written approval is filed and the copy was redacted; expected, imported and skipped counts add up; the second write added nothing; docs/projects-cutover.md explains every difference in finish dates and critical paths; the same day the development project holds no imported row and the removal date is in docs/imports/projects-approved.md.
Fastest path
Do dry run, write and write-again from the Actions page in one sitting; the third run proves cut-over day can be rerun.
If it goes wrong
The engine's finish is two days later than the old tool's
Usually a calendar (the old tool skipped a holiday differently), a lag in hours not days, or a constraint the old tool kept. Write the cause in the Why column; never edit the imported baseline.
The run refuses the file, or fails on a count
It is doing its job: the file is not the one owner two approved, or it changed. Run import-count.mjs on the uploaded file, record its sha256 and counts through a pull request, and run again. Never loosen the check.
"password authentication failed for user prj_importer"
The user name must carry the project reference (prj_importer.tsrqponmlkjihgfedcba) and the password must be the development one.
Session 6: The final import into production, and the importer switched off
40 minutesWhy
Production holds the record the business will run on, so the final import runs only through the same tested workflow as the rehearsal, started by you from main, with production's password typed by you and an export whose fingerprint and counts owner two approved in a merged pull request. The old tool goes read-only first so nothing changes during the copy, and the importer is switched off straight afterwards: a login that can write imported rows has no business existing once the move is done.
Do this
- Write the cutover date, who tells the team, the date the old tool becomes read-only, and how to go back in the first week, in docs/projects-cutover.md.
- Set the old tool to read-only on the date.
- Take the final export, run import-count.mjs on it, and record its sha256 and counts in docs/imports/projects-approved.md through a pull request owner two approves and merges.
- In the live SQL editor set prj_importer's password; type the repository secret PRJ_IMPORT_DATABASE_URL_PROD (user prj_importer.abcdefghijklmnopqrst); upload the export to the private bucket imports on the live project.
- Start the workflow from main: target production, dry-run; compare its counts with the rehearsal's; then write. It refuses an export not listed and fails on any count mismatch.
https://github.com/acme-ops/acme-platform/actions/workflows/import-projects.yml
Run workflow from main: target production.
Then switch the importer off at cut-over:
The production import is done. On a new branch projects/cutover: a migration (npx supabase migration new projects_importer_off) that sets prj_importer to NOLOGIN, with a test that it cannot log in; remove prj_importer from docs/matrix.json and regenerate the rules with scripts/gen-policies.mjs; mark its rows in docs/prj-operations.md "retired 2026-…" with today's date; mark PRJ_IMPORT_DATABASE_URL_DEV and _PROD removed in docs/KEYS.md; and in docs/projects-cutover.md record the production counts I paste below beside the rehearsal's. Then, read-only on production, check three imported tasks' dates, assignee and dependency type, including one that is not FS. Open a pull request titled "Projects cutover record" and wait for the checks.
Production counts:
<paste the count table from the production run's summary>After it merges and the deploy workflow has applied the migration, delete both PRJ_IMPORT_DATABASE_URL secrets on GitHub.
You will see recreated screen
- Removing the role is a matrix change like any other, reviewed and tested.
- The non-FS links are the proof the first pitfall is gone.
Check it worked
The production run started from main with an approved export; its counts match the approved line and the rehearsal, with every skip explained; prj_importer is NOLOGIN and its secrets are deleted; three tasks checked against the old tool.
If it goes wrong
Production pages fail with "column does not exist"
A migration is merged but not applied. Check the deploy workflow's last run and the daily freshness check from Session 11; never run db push by hand. Our live database once fell nine migrations behind.
The counts differ from the rehearsal
Projects changed in the old tool after the rehearsal, before it went read-only. List the projects that differ from the dry run and explain each before writing.
Session 6: Retire the old tool, clear the last copies, and record the saving
25 minutesWhy
The module is finished when the old bill stops and the saving is a fact from invoices. Deleting the final export from the imports bucket and your computer, once it is in the records store, closes the last place real project data sits outside production's tables.
Do this
On a new branch projects/retired, update docs/projects-inventory.md: mark each project moved, archived or still in the old tool, with today's date; and add to docs/projects-cutover.md the saving: the old bill from the invoices (I will paste the figures), minus what the module adds to services we already pay for, plus any AI or message charges. Open a pull request titled "Projects retired" and wait for the checks.https://supabase.com/dashboard/project/abcdefghijklmnopqrst/storage/buckets
Live Storage: delete the final export from the imports bucket once it is in the records store.
Store the old tool's final export in the company's records store, read its cancellation terms on your account page, cancel or write the end date, and delete local copies.
You will see recreated screen
- Every figure from an invoice.
- Anything not moved is written down.
Check it worked
The old tool is cancelled or has its end date written; the final export is in the records store and gone from the bucket and local folders; docs/projects-cutover.md records the saving from invoices.
If it goes wrong
Someone wants to keep the importer for a late project
A late project is a new export: it is approved through docs/imports/projects-approved.md and the login switched on by a person for that one run, then set to NOLOGIN again.
The notice period means one more renewal
Write the end date and that renewal in docs/projects-cutover.md; count the saving from the end date.
Knowledge check
How is an old tool's plan held after the import?
Knowledge check
What happens to the cut-over importer after the final import?
References
- GitHub Docs: Manually running a workflow. https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow
- Smartsheet: best Gantt chart software (tools this module replaces). https://www.smartsheet.com/content/best-gantt-chart-software
- Supabase Docs: Database migrations. https://supabase.com/docs/guides/deployment/database-migrations
Chapter 5 · 12 questions · 80% passes
Final assessment
Twelve questions across the module. 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
Projects, Jobs and Tasks: Portfolio, Schedule, Cost and Earned Value as Governed Records
Element M20 complete · Learner
Your LMS records this completion. For the CivOps Foundation certificate, finish the Foundation Course at https://civops.io/learn.