Skip to content

TL-M0-24 · M0 exit check

Why: M0 ends, and the data phase starts, when every item of the M0 exit check holds (D17, D25). This step checks each item once, from a fresh clone of main, and logs the result on #27. Nothing here builds anything. If an item fails, the row that owns it is reopened and fixed, and this step runs again from the top.

Blocks 3 to 6 run in a throwaway clone outside your checkout, so they prove what a newcomer, or CI, gets from main alone. The local stack in your checkout is stopped first, because both clones use the same Docker containers.

ID TL-M0-24 · Level L0 · Run order row 36 · Issue #27

Each item of the M0 exit check is logged on #27 as holding, with the output that shows it, and #27 closes. The data phase's first rows, BE pack G2 (#162) and the copy of v1, can start.

  • Every M0 row above row 36 is Done, except rows 29a (the error pages) and 34a (FE pack F, Sentry's SDK), which aren't part of the exit check. Block 1 lists them.
  • Staging was rebuilt from main after the last migration change, BE pack G1b's included (BE-M0-33, logged on #22).
  • You are in ~/opleet-v2/opleet on main, up to date, and git status --short prints nothing. Docker Desktop is running.
  • <VERCEL_URL> is the production address from TL-M0-21, and <DOCS_URL> is the docs address from TL-M0-23.
  • About an hour.

Each M0 row's issue, in run order, with its state. Only #27, this step's own issue, may be open. #24 (TL-M0-22) is listed, because the Sentry project is an M0 row. FE pack F isn't.

Terminal window
for n in 9 10 69 11 12 13 14 149 150 164 165 15 16 151 142 17 18 19 20 21 22 23 24 25 26 27; do
gh issue view $n --repo Opleettop/monorepo --json number,state,title --jq '"\(.state) #\(.number) \(.title)"'
done

2 · Stop your checkout's stack and make a fresh clone

Section titled “2 · Stop your checkout's stack and make a fresh clone”
Terminal window
cd ~/opleet-v2/opleet && pnpm supabase stop
rm -rf ~/opleet-v2/exit-check
gh repo clone Opleettop/monorepo ~/opleet-v2/exit-check
cd ~/opleet-v2/exit-check
git log --oneline -1

3 · Install, lint, build and typecheck from the lockfile

Section titled “3 · Install, lint, build and typecheck from the lockfile”
Terminal window
pnpm install --frozen-lockfile
pnpm lint
pnpm build
pnpm typecheck
pnpm docs:rules

4 · The database from empty, every test, and the generated files

Section titled “4 · The database from empty, every test, and the generated files”
Terminal window
pnpm db:signing-key
pnpm supabase start
pnpm supabase db reset
pnpm supabase test db
pnpm db:types
pnpm docs:reference
git status --short

5 · The 44 acceptance checks still cite their rules

Section titled “5 · The 44 acceptance checks still cite their rules”

BE-M0-27's block 3, unchanged. Each line is a rule that one of the delivered M0's 44 checks maps to, followed by the test files that cite it.

Terminal window
for id in R-ACC-02 R-ACC-03 R-ACC-04 R-ACC-05 R-ACC-06 R-ACC-09 R-ACC-10 R-ACC-36 R-AUD-03 R-AUD-06 R-AUD-08 R-MON-07 R-MON-11 R-MON-15 R-MON-17 R-MON-18 R-MON-20 R-MON-29 R-NUM-01 R-NUM-02 R-NUM-03 R-NUM-08 R-NUM-09 R-RNT-01 R-RNT-02 R-RNT-03 R-RNT-04 R-SET-01 R-TEN-02 R-TEN-03 R-VEH-06 R-VEH-07 R-VEH-08 R-VEH-15; do echo "$id $(grep -l "'$id: " supabase/tests/database/*.sql | xargs -n1 basename | sed 's/.test.sql//' | tr '\n' ' ')"; done

6 · Each role signs in and sees its menu, and an access change signs a user out

Section titled “6 · Each role signs in and sees its menu, and an access change signs a user out”

The commands of the e2e job (TL-M0-19), in the clone. FE pack E's specs check every role's landing page and menu against its v1 role, and FE pack B2's spec checks that a role change sends the user to the sign-in page on their next request (D37, D48).

Terminal window
pnpm db:e2e-users
eval "$(pnpm supabase status -o env)"
printf 'NEXT_PUBLIC_SUPABASE_URL=%s\nNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=%s\n' "$API_URL" "$PUBLISHABLE_KEY" > apps/web/.env.local
pnpm --filter web build
pnpm --filter web exec playwright install chromium
pnpm --filter web e2e

7 · Throw the clone away, and start your checkout's stack again

Section titled “7 · Throw the clone away, and start your checkout's stack again”
Terminal window
pnpm supabase stop --no-backup
cd ~/opleet-v2/opleet
rm -rf ~/opleet-v2/exit-check
pnpm supabase start

<TL_M0_19_PR> is the pull request from TL-M0-19's block 3. It changed ci.yml, so every job ran on it.

Terminal window
gh pr checks <TL_M0_19_PR> --repo Opleettop/monorepo
gh api repos/Opleettop/monorepo/rules/branches/main \
--jq '.[] | select(.type == "required_status_checks") | .parameters.required_status_checks | map(.context)'
gh api repos/Opleettop/monorepo/rulesets --jq '.[] | "\(.name) \(.enforcement)"'

Then in Vercel: the project › Settings › Build and Deployment › Deployment Checks lists checks and e2e.

9 · Staging, the Vercel deployment and the docs site

Section titled “9 · Staging, the Vercel deployment and the docs site”

Replace <VERCEL_URL> and <DOCS_URL> first.

Terminal window
pnpm supabase migration list --linked
curl -s -o /dev/null -w '%{http_code}\n' "https://<VERCEL_URL>/login"
curl -sI "https://<DOCS_URL>" | head -n 3

migration list compares file names only. A migration edited in place (D11) keeps its name, which is why staging must have been rebuilt from main (Before). Then sign in on the production address as the E2E admin, as in TL-M0-21's block 9, and sign out with Keluar.

Comment on #27 with one line for each item of the exit check, in the timeline's order: the item, "holds", and the output that shows it (the commit from block 2, "Files=…, Tests=…" from block 4, the passed count from block 6, the lists from block 8, the status codes from block 9). If every item holds, close #27. Tell a CTO session that M0 is done, and the data phase starts with BE pack G2.

  • Block 1: every line starts with CLOSED, except OPEN #27.
  • Block 2: the clone's last commit is the same as main's on GitHub.
  • Block 3: install ends with "Done", and lint, build and typecheck end without errors. docs:rules prints one "Rules: …" line and nothing under it.
  • Block 4: test db ends with "All tests successful." and "Result: PASS". The final git status --short prints nothing: the committed types and reference pages match the schema.
  • Block 5: 34 lines, each a rule ID followed by at least one file name.
  • Block 6: db:e2e-users makes 11 logins, and Playwright ends with "passed" for every spec and no "failed" line.
  • Block 8: checks, database, e2e and pr-title pass on that pull request. The required checks are ["checks", "pr-title", "database", "e2e"], and the ruleset main is active.
  • Block 9:
    • Every migration shows the same version in the Local and Remote columns.
    • The Vercel address prints 200.
    • The docs address answers with a 302 whose location is your team's cloudflareaccess.com sign-in page, never a 200.
    • Signing in as the E2E admin lands on the app's home page.

The exit check's items, each with the block that proves it:

Exit check item Block
A fresh clone installs from the lockfile, builds and typechecks 3
Every migration and the seed apply from empty, and every test passes, the 44 acceptance checks included 4, 5
An E2E login for each role signs in and sees its v1 role's menu 6
DOC pack B, BE pack G1 and FE pack B2 are merged, with their follow-ups: a role change signs the user out on the next request 1, 6
CI is green on a pull request: checks, pr-title, database and e2e 8
Staging holds the schema, the seed and the E2E logins, and the Vercel deployment signs in against it 9
apps/docs is deployed behind Cloudflare Access 9
main is protected, and Vercel holds each production deploy until the checks pass 8
apps/docs holds V13's rules with IDs, pnpm docs:rules passes, and each of the 44 checks cites a rule 3, 5
The register lives in apps/docs, with its numbers unchanged 1 (#26 closed)

#27 is closed with a comment that has one "holds" line for each row of this table.

  • Block 1 lists an open issue other than #27: that row isn't done. Run it first, then start this step again.
  • Block 3 fails: main doesn't build from a fresh clone, often because of a file that exists only in your checkout. Paste the error into #27 and tell a CTO session. Don't go on.
  • Block 4's git status prints a file: a pull request merged without regenerated files. Paste the list into #27. The Backend Engineer commits them in a pull request (D33), then start again.
  • Block 4 or 6 fails a test or a spec: paste the failing lines into #27 and into the issue of the pack that owns it (BE for pgTAP, FE for Playwright). Don't go on.
  • Block 5 prints a rule ID with no file after it: a test lost its rule ID. Paste the line into #27, for the Backend Engineer.
  • Block 8's required checks lack database or e2e: TL-M0-18's or TL-M0-19's block 6 didn't apply. Run that block again.
  • Block 9's Local and Remote columns differ, or the sign-in fails: staging isn't built from main. Run BE-M0-33, log it on #22, then run block 9 again.
  • Block 9's docs address prints 200: Cloudflare Access isn't in front of it. Stop and see TL-M0-23's If it fails. The rules are internal until it is fixed.

Nothing to undo: the step only reads, and block 7 removes the clone. If block 7 didn't run, run it now.

Log each run as a comment on #27: the date, main's commit from block 2, and one line for each row of the Check table.