Skip to content

M0 · Monorepo move

Rewritten on 2026-10-05 for D25. M0 is rebuilt from an empty folder, in the order of [Runbook] v2 timeline: from empty folder to cutover. Packs A to E below fill the timeline's rows 24, 25, 26, 28 and 29. Updated 2026-10-07 for D28 and D29: packs C and D are written. Pack D was rebuilt on 2026-10-16 for D30 and D35. Pack B2 (row 25b) was written on 2026-10-19 for D37 and D48, and pack E (row 29) the same day.

  • D3 · apps/web composes pages, forms and labels. Rules and access live in Postgres; pages ask for them, as with my_permissions() in pack C.
  • D4 · Types come only from @opleet/db-types, from pack B on. No type is written by hand.
  • D5 · apps/web is the Next.js 16 app in the pnpm and Turborepo workspace, deployed to Vercel in Singapore (timeline row 33).
  • D6 · Conventional Commits with the web scope. Biome checks all of apps/web except design/opleet, which apps/web/biome.json excludes so the design system's copies stay byte for byte.
  • D7 · Indonesian first: html lang is id unless the user picks English (pack D), every string a user sees goes through t() with its Indonesian default, and money is written Rp 4.250.000.
  • D8 · design/opleet and components/opleet stay in apps/web behind @ui/ (pack A).
  • D24 · One Sentry project per app; apps/web reports to opleet-web, with staging and production as environments (TL-M0-22). The SDK starts only where a DSN is set, keeps personal data out (D15), and gets source maps from production builds only (pack F).
  • D35 · Tailwind CSS v4 for layout and spacing in pages and the shell, installed by TL-M0-29 (row 25a). Utilities sit in a cascade layer below opleet.css, so they never restyle an op-* component. Values come from the tokens through design/opleet/theme.css, which pnpm --filter web tokens writes (FE-M0-15). Pack C's layout is utilities; style={{ }} stays only for values known at runtime. Pack B is unchanged.
  • D10 · Refusals from the database reach the user through the error-key mapper (pack D). Sign-in failures are worded from Supabase Auth's error code, never from its message (pack B).
  • D12 · Sign-in is proven on the local Supabase stack (FE-M0-08).
  • D13 · Only the publishable key in apps/web. proxy.ts checks sessions with getClaims(), verified with the stack's ES256 key (pack B).
  • D19 · Playwright covers the smoke specs and the per-role menu check (pack E).
  • D22 · apps/web makes its own Supabase clients with @supabase/ssr (pack B).
  • D25 · M0 is rebuilt from an empty folder in the timeline's order. The design system comes from the Opleet Design System artifact; the delivered M0 is background, and nothing is copied from it.
  • D27 · apps/docs is the source of truth: rules with IDs first, then the tests that prove them, then the code. Playwright specs live in apps/web/e2e, and every test title starts with the ID of the rule it proves; pnpm docs:rules checks the link in CI (TL-M0-26). FE changes only a rule's Status. M0's FE steps stay runbook steps that zuki runs; from the data phase on, packs arrive as pull requests in the repository (D28).
  • D28 · Opleettop/monorepo is on GitHub Team: a ruleset on main requires a pull request with the checks and pr-title jobs green and allows squash merges only; zuki merges. Every FE pack reaches main through a pull request, and no FE step commits on main or pushes to it. Agents reach the repository only through the Claude GitHub app, on branches and pull requests. Once TL-M0-27 has merged, this runbook moves into apps/docs build/ unchanged, in one pull request; until that merges, this Google doc is in force.
  • D29 · Option A1: every string a user sees is t('module.screen.element', 'Indonesian default'). The catalog is plain TypeScript in apps/web/i18n behind @i18n, with no library: the Indonesian catalog is collected from the calls, English sits beside it under the same keys, and typecheck fails on two defaults for one key or an out-of-date catalog. Enum labels are an exhaustive record per language, and badge tones a separate map. The language is profiles.locale, with the opleet-locale cookie as the fast path. One mapper turns a refusal into text. All of this is pack D; until it runs, pack C's t() returns the Indonesian default.
  • D30 · The error keys are the Postgres enum public.error_key (OQ24, option E1). Pack D reads it from the generated types, and typecheck fails when a key has no text. The E2 path is gone.
  • D37 · A change to a user's access ends their sessions in the database, and proxy.ts refuses a login token issued before it: after getClaims(), every request calls session_is_current(), and anything but a plain true (false, an error, no answer in five seconds) clears the session and sends the user to /login, which says why (pack B2, R-ACC-48).
  • D48 · A suspended or removed membership and a change to a role's permissions end sessions the same way. The database decides (BE pack G1b); proxy.ts's check doesn't change.
  • @opleet/db-types with generated types (FE-R1) · Answered: TL-M0-10 creates the package and BE pack E (row 22, BE-M0-26) writes the first types. Whether apps/web needs transpilePackages is answered in BE-M0-26. Needed by FE-M0-06.
  • The local ES256 signing key, so getClaims() verifies locally (FE-R4) · BE pack A (row 18, BE-M0-10 and BE-M0-11): Done 2026-10-06. Needed by FE-M0-08.
  • E2E logins on the local stack (FE-R2) · BE pack E (row 22, BE-M0-25): planned. Needed by FE-M0-08 and pack E.
  • my_permissions() (FE-R3) · Answered: rpc('my_permissions') with no arguments returns one row per pool and permission: organization_id, pool_id, pool_code and permission_code. Built in BE pack B (row 19, BE-M0-13). Needed by pack C.
  • profiles.locale and set_my_locale() (FE-R5) · BE pack B (row 19, BE-M0-13): final 2026-10-07; row 19 is Ready after row 14c. Needed by pack D (FE-M0-14).
  • The E2E logins' names for Playwright (FE-R6) · Agreed 2026-10-06, in BE pack E (row 22, BE-M0-25): the logins script writes E2E_PASSWORD and one E2E_<ROLE>_EMAIL per role to the git-ignored .env.e2e at the repository root. It makes a random password on the first run and reuses it after that, so no value appears in a runbook or a chat. Needed by pack E and the CI end-to-end job.
  • session_is_current() (D37) · Answered: RPC with no arguments, for authenticated users only, true when the caller's token was issued after their last access change, false otherwise or with no profile. Built in BE pack G1 (row 22b, BE-M0-35), merged in #154, in the generated types on main. Needed by pack B2 (FE-M0-20).
  • The error-key list's source (FE-R7, OQ24) · Answered by D30: the enum public.error_key, which the generated types in packages/db-types hold (23 keys on 2026-10-16). Needed by FE-M0-13.

The rules pack E's specs cite (D27). Asked 2026-10-06; answered by #188 on 2026-10-19 as R-APP-01 to R-APP-06 on the App shell page, in this order. The sentences below are FE's proposal as asked; the rules are the page's.

  • Signed out · A visitor without a session who opens any page except /login is sent to /login.
  • Wrong password · A wrong email or password is refused with “Email atau kata sandi salah.”, and the email stays filled in.
  • Sign-out · After Keluar the session ends, and the next page opened is /login.
  • Landing page · After sign-in each role lands on its page: finance /collection, satpam /gate, background_check /screening, every other role /dashboard ([Ref] Roles, permissions and row-level security).
  • Menu · Each role's menu shows the modules its permissions allow, the same as its v1 role sees.
  • Design preview · /design-preview stays off unless NEXT_PUBLIC_DESIGN_PREVIEW=1: a signed-in user gets 404 and a signed-out visitor is sent to /login, so it never shows on staging or production.

Each pack fills one timeline row and runs when its row says so. A step is done when its Runs line shows zuki's clean run. A pack ships as a zip from the FE chat: its first step checks the zip's SHA-256 and unzips it to ~/opleet-v2/packs, and each step then copies only its own folder into the repository, so every file is reviewed and committed in a step. Commands are for zsh on zuki's Mac, run in ~/opleet-v2/opleet.

Withdrawn on 2026-10-05 by D25: FE-M0-01 (copy the delivered M0's web code into apps/web; never run). Its ID isn't reused.

Pack A · The Opleet design system in apps/web (timeline row 24)

Section titled “Pack A · The Opleet design system in apps/web (timeline row 24)”

Delivers the design system's tokens, op-* stylesheet, logos and app icons as unchanged copies with their checksums; tokens.css generated from tokens.json; twelve components ported to React (Avatar, Badge, Button, DataTable, GlassCard, Icon, IconButton, Input, Logo, Select, StatCard, Toast) behind @ui/; Lucide icons through a typed registry; lib/format (Rp 4.250.000, 1.248, B 1234 TOP) with tests; t() returning the Indonesian default until pack D; and /design-preview, which is off unless NEXT_PUBLIC_DESIGN_PREVIEW=1. No database. Four steps on one branch, merged as one change.

Two departures from the design system's React components, both for keyboard access: DataTable leaves out whole-row click, and GlassCard and StatCard leave out onClick. Row click comes back with the first page that opens a Sheet (M1), reachable by keyboard; a clickable card is wrapped in a link or a button. Icon names are checked against the registry when the code is typechecked.

Ships as fe-pack-a.zip, SHA-256 7b351a95bbfb66ef0a9e6cde81777dfc9b039842d85b8a6926b572b4cd21f8ed. Status: Done (timeline row 24).

Pack B · Supabase clients, proxy.ts, sign-in and sign-out (timeline row 25)

Section titled “Pack B · Supabase clients, proxy.ts, sign-in and sign-out (timeline row 25)”

Delivers the server client and the session refresh in proxy.ts with @supabase/ssr and the publishable key (D22, D13); getClaims() on every request, verified with the local stack's ES256 key; /login in Indonesian, with error text chosen from Supabase Auth's error code; sign-out; and .env.example with the variable names. The home page shows who is signed in until pack C replaces it with the role's landing page.

Ships as fe-pack-b.zip, SHA-256 322bc5739498f9ea114c2e771852999fc775bfe6a44b4b799c1464a43ed046a7. Runs after timeline rows 18 and 22. Status: written; row 18 is Done (2026-10-06), so it is Ready once row 22 is Done.

Pack B2 · Sign out when access changes, and a pool required (timeline row 25b)

Section titled “Pack B2 · Sign out when access changes, and a pool required (timeline row 25b)”

Delivers apps/web's half of D37 and D48, and closes the empty-shell case of R-ACC-04. Issue #151.

  • proxy.ts (R-ACC-48). After getClaims(), every request from a signed-in user calls session_is_current(), /login included. Only a plain true lets it through. False, an error, or no answer within five seconds counts as not current: proxy.ts ends this browser's session with a local sign-out (also capped at five seconds), clears every sb-…-auth-token cookie whatever the sign-out did, and redirects to /login?signed_out=access or ?signed_out=check. An error is logged with its code only (D15). A visitor with no session is still sent to /login with no query string (R-APP-01).
  • /login shows the design system's Toast, warning tone: “Anda sudah dikeluarkan” and “Anda dikeluarkan karena akses akun Anda berubah. Silakan masuk lagi.”, or that the session couldn't be checked. Any other value of signed_out shows nothing. The texts are auth.signed_out.*, with English (D29).
  • Pool required. The current pool is the chosen one if the user's permissions open a page there, else the first pool that does; the pool switcher lists only those, and choosePool refuses any other. With none, the user gets /no-access, never an empty shell. /no-access now says which case it is: no role at any pool (the text pack C wrote), or roles that open no page (shell.no_access.no_pages). Every system role opens a page, so the second case needs an organization's own role or an override; unit tests and a stand-in prove it, and no rule names it yet.
  • gate:write (R-GATE-04). gate:write opens no page: it is the action to record at the gate, which M5 builds. lib/nav.test.ts now reads each system role's permissions and landing page from the generated roles page rather than a copy, which had missed gate:write, payment:margin and the end of vehicle:delete. It asserts that super_admin, admin and satpam hold gate:write and the viewer reads the gate only, and still checks each role's menu against v1's. FE pack E repeats the check in the browser with the E2E logins.

Checked on 2026-10-19 by replaying FE-M0-20 and FE-M0-21 as written from the zip on a fresh checkout of main (0ec8c64): every BASE.sha256 line says OK, Keys 95 then 96, 38 then 41 tests, typecheck, lint and the build are clean, and the commits hold 6 and 8 files; FE-M0-10's three greps print what FE-M0-21 expects. The fonts came from Next's mocked Google response, as this workspace can't reach Google. The built app ran against a local stand-in for Supabase (its JWKS with an ES256 key, session_is_current(), my_permissions() and a logout that answers 404, as Auth does once D37 has ended the session): a stale token, a failing check and a check that never answers each redirected to the right /login address with the session cookie expired, also when the request was for /login itself; the notice showed in Indonesian and English; no pool and a pool with no page each led to /no-access with its text; and a chosen pool with no page fell back to the one with pages. Not checked: the real local stack and the browser, which this workspace can't run (FE-M0-22, zuki's run).

Ships as fe-pack-b2.zip, SHA-256 6c9ead71f15a3cd590cc285e7bf560b74bfcce441b09ad79c408e1ca61bf9d89: whole files and a BASE.sha256 per step, as pack D. Runs after pack D (FE-M0-16) and BE pack G1 (row 22b). Pack F's FE-M0-17 changes i18n/messages.en.ts too, so whichever of B2 and F merges second has its zip rebuilt first. Status: written 2026-10-19.

Delivers the access model, the page list and the app shell. my_permissions() is read once per request and grouped by pool; lib/nav.ts lists the 27 pages, each with its label through t(), icon, permission, module and the v1 menus it replaces, and the menu, each role's landing page and the refusal page all come from that one list. The shell is the design system's: the floating sidebar (a menu button at phone width) and the top bar with the pool switcher (opleet-pool cookie), the theme toggle (opleet-theme cookie, data-theme on the html element) and Keluar. A page not built yet shows a placeholder, a page outside the role shows the refusal page, and a login with no pool gets /no-access. t() now comes from getT() in server code and useT() in client components, and still returns the Indonesian default until pack D. Four steps on one branch, merged as one pull request: FE-M0-15, the token theme for Tailwind (D35), runs after FE-M0-09.

Layout is Tailwind utilities (D35): flex, grid, gap, padding, widths and breakpoints around the design system's components, named from the tokens, such as gap-space-4 and w-sidebar-w. A component's own look stays its op-* classes: no utility restyles one, and a variant a component lacks is asked for in an issue. No hex colour, no pixel value in a class name, no Tailwind default colour, no dark: variant (the theme follows data-theme). style={{ }} is for values known only at runtime. The rules and the class names are in Using the Opleet design system.

A role lands on the first of /dashboard, /collection, /screening and /gate that it may open: finance /collection, satpam /gate, background_check /screening, every other role /dashboard ([Ref] Roles, permissions and row-level security). Each role's menu matches its v1 role's, through the permission renames; v1's Backup menu has no v2 page. The pool switcher shows pool codes, since my_permissions() returns no pool names.

Checked in the FE workspace against stand-ins: types generated from a local copy of the Interface, and a stand-in for the local stack's Auth and my_permissions(). FE-M0-09's typecheck is the first check against the real generated types (D4). That check was made before D35, with the layout in inline styles; it is repeated on the zip once its layout code is Tailwind.

Ships as fe-pack-c.zip, SHA-256 075051072dc506a1a6869c5eb145e26cd1aaf1ba91dc2d28f755fc32124bdc3e: the zip as sent on 2026-10-07, before D35. The zip is rebuilt when its layout code moves to Tailwind, and then this SHA and FE-M0-09's Expect change. Runs after timeline row 25 (pack B) and row 25a (TL-M0-29, Tailwind, D35). Status: written 2026-10-07; FE-M0-15 (the token theme) written 2026-10-13. Ready once rows 25 and 25a are Done and the pack's layout code in the zip has been changed from inline styles to Tailwind utilities (D35); that is not done yet.

Pack D · Languages and the error-key mapper (timeline row 28)

Section titled “Pack D · Languages and the error-key mapper (timeline row 28)”

Delivers D29 as accepted (option A1). The translator moves to apps/web/i18n behind @i18n, with the language list, pickName() for the four master tables with name_en, the Indonesian catalog that pnpm --filter web i18n writes from every t() call, and English in i18n/messages.en.ts under the same keys. typecheck (which now also runs tokens --check, so a stale tokens.css or theme.css fails the checks job) fails when the catalog is out of date, when one key has two defaults, when an English text has other placeholders than the Indonesian, or when a strict prefix lacks English (i18n/strict.json: auth, error, locale, nav, shell). A module's prefix turns strict when its pages are done.

lib/errors maps a database refusal to text: a known key, filled from the JSON detail; else its SQLSTATE class (42501, 23505, 23503, 23514); else error.unknown, reported with the code only, never the message or details (D10). The known keys are the enum public.error_key from the generated types (D30), so a key without Indonesian and English text fails typecheck. internal.unknown_error_key, which the database raises when a function names a key the enum lacks (R-CONV), is not in the enum: the mapper shows a general text and reports it. The report goes to the server log until the Sentry SDK is wired (timeline row 34). Enum labels sit in i18n/enums.ts, an exhaustive record per language over the generated enums, and badge tones in lib/labels.ts.

The language is profiles.locale, with the opleet-locale cookie as the per-request fast path. The ID | EN toggle in the top bar saves both through set_my_locale() (FE-R5); sign-in copies the profile's language into the cookie; client components get one language from a provider. Three steps on one branch, merged as one pull request.

Layout follows D35: the switcher is utilities around the design system's op-seg classes, and style={{ }} holds only the thumb's place, which depends on the chosen language. The zip holds the whole new version of every file a step adds or changes, including the files pack C merged (the shell, the root layout, the design preview, app.css, nav.ts), so each can be read before it is copied. Each step first checks those files against its BASE.sha256 with shasum -c, and its block stops at the first failure, so a file that has moved on is never overwritten. The first rebuild of 2026-10-16 used git apply of patches instead; a patch that failed on zuki's Mac let the block go on, so the shell never got the switcher and four imports stayed on the old path. That zip is withdrawn too. FE-M0-14's Check runs the same three layout greps as FE-M0-10.

Checked on 2026-10-16 by running FE-M0-12 and FE-M0-13 as written from the zip, FE-M0-14's file steps (block 1 and the typecheck, lint and build in block 2) and FE-M0-16's blocks 1 to 3 and Check, on a fresh checkout of main (921ec25) with its generated types: 26, then 33 tests pass, typecheck, lint and build are clean, every BASE.sha256 line says OK, and the three greps print what FE-M0-14 expects. A hand-edited lib/nav.ts made FE-M0-12 block 3 print FAILED and stop with nothing moved or copied. Not checked: the browser steps (4 and 5) and the profile round trip, which need the local stack and are zuki's run. The switcher was measured in Chromium on /design-preview (two equal 40 px halves; the thumb sits exactly under the selected one).

Ships as fe-pack-d.zip, SHA-256 22f9b5f98c549488fabd0e4a74642cc7219b9eb1548611e99a4dbcab09325aa4: rebuilt on 2026-10-16 with whole files and a checksum guard (the first rebuild of that day, ebc56b5f…, is withdrawn). It replaces the zip of 2026-10-07 (SHA-256 ecbff7abc49e03d945be36d1dcddca04a0ad1de11ebff81188202537690565cc), whose shell, preview and root layout files predate D35 and would have undone pack C's layout if copied. Runs after pack C, with BE pack B's profiles.locale, set_my_locale() and error keys in the generated types (row 22). Status: written 2026-10-07, rebuilt 2026-10-16; Ready once row 26 is Done.

FE-M0-16 (2026-10-16, from the Lighthouse audit) rides in the same zip and runs after pack D is merged, because its app/layout.tsx and app/app.css are pack D's with the fonts added. design/opleet/opleet.css imports Google Fonts on its first line, a render-blocking CSS @import to two other origins. The copy stays byte for byte (D8): postcss.config.mjs drops that one @import, app/layout.tsx loads Inter Tight and JetBrains Mono through next/font/google (self-hosted at build time, with a size-matched fallback), and app/app.css puts the generated names first in the font stacks of tokens.css. design/opleet/SOURCE.md records both, and also lists theme.css as generated (the CTO's answer 6 on #17). Checked with Next's mocked Google response and local stand-in font files, because this workspace can't reach Google: the build passes, the output holds two .woff2 files and no Google URL, the fonts are preloaded, the font-face names are the same as in tokens.css, and every checksum in design/opleet still matches. Not checked: the real download, the real glyphs and the Lighthouse score, which are zuki's run.

Delivers D19's smoke specs and the per-role menu check, against the local stack with the E2E logins (FE-R6). Issue #19.

  • Set-up, in the names TL-M0-19 expects. @playwright/test 1.64.1 in apps/web, the specs in apps/web/e2e, and pnpm --filter web e2e. playwright.config.ts starts the built app itself (next start on port 3100, so a dev server on 3000 doesn't clash) and writes the HTML report to apps/web/playwright-report; the report and test-results are git-ignored. One worker, because the session spec changes a login's access while the others sign the same logins in; the run takes about a minute.
  • Logins. The config reads .env.e2e at the repository root (written by pnpm db:e2e-users) and apps/web/.env.local, with Node's process.loadEnvFile. No spec holds an email or a password; a missing variable stops the run and names the command that writes it.
  • Citations (D27). Every test title starts with the ID of the rule it proves: R-APP-01, -02, -03 and -06 in app-shell.spec.ts; R-APP-04 (where each role lands) and R-APP-05 (its menu) once for each of the 11 roles in roles.spec.ts; R-ACC-48 in session.spec.ts. 27 tests. The same pull request sets R-APP-01 to R-APP-06 from planned to built and changes nothing else in apps/docs, so R-ACC-48 stays planned for now.
  • The menu against v1 (R-APP-05). roles.spec.ts writes out each role's v1 menus, from [Ref] Roles, and reads the menu a person sees by its links' addresses. lib/nav.ts says which v1 menus each page replaces, and the union must equal the role's v1 menus, so the browser check doesn't rest on lib/nav.ts's mapping alone. The 11 lists were checked against the generated roles page and the v1 menu map in lib/nav.test.ts before they were written.
  • An access change (R-ACC-48, D37, pack B2). The E2E super_admin, signed in through the API, gives the signed-in viewer a grant override of a permission the viewer already holds, as a user manager would, and the database's trigger ends the viewer's sessions (R-ACC-08). The viewer's next page load must land on /login?signed_out=access with the notice; then the override is removed. After a one-second wait (a token from the same second as the change counts as older), the viewer signs in again and lands on /dashboard.

Checked on 2026-10-19 by replaying FE-M0-23 as written from the zip on a fresh checkout of main (6df6228): every Expect matched, pnpm docs:rules passes with the six rules built, and the commit holds 9 files. This workspace can't run the local stack or Playwright's own Chromium, so the specs ran against a stand-in for Supabase built from the migrations' behaviour (Auth's password grant, the JWKS, my_permissions() from the generated roles page at E2A and E2B, session_is_current() against an access-change stamp, and the membership, pool and override endpoints with D37's trigger), in Chromium 153 from npm: 27 passed in 23 seconds, also from the replayed branch. Then the stand-in was broken on purpose: with session_is_current() always true, R-ACC-48 failed; with satpam's gate:read removed, satpam's R-APP-04 and R-APP-05 failed. Not checked: the real local stack (RLS, the grant guard and the trigger behind the override) and Playwright's own Chromium, which are FE-M0-24, zuki's run.

Ships as fe-pack-e.zip, SHA-256 bd9b7948fd9a0496a81bb10dd7537eef4b4c0ca69cebaac64d31bff550e54746: whole files and a BASE.sha256, as pack D. Runs after packs B2 and C and the six rules (rows 25b, 26 and 28a). Pack F's FE-M0-17 also changes apps/web/package.json, so whichever of E and F merges second has its zip rebuilt first. Status: written 2026-10-19.

Pack G · The error pages (timeline row 29a)

Section titled “Pack G · The error pages (timeline row 29a)”

Builds R-APP-07 to R-APP-10 (DOC #201, merged in #204) from Next.js's error-handling guide and the docs bundled with Next 16.3.8, where error pages get retry(). Issue #202. Unlike packs A to F, the code arrives in the pull request itself, with the rules set to built; zuki's steps run it.

  • Not found (R-APP-07). (shell)/not-found.tsx shows the 404 page inside the shell, with a link to the user's landing page (landingFor). The shell's layout became components/shell/ShellFrame.tsx, so app/not-found.tsx, which catches /design-preview's notFound() (R-APP-06), shows the same page with the menu. A user with no pool gets the text with a link to /, which leads to /no-access (R-ACC-04).
  • Page failures (R-APP-08). (shell)/error.tsx, under the shell, so the menu stays: a short text through useT(), "Ref:" and Coba lagi calling retry(). It never renders error.message. The reference is Next.js's error.digest; an error from the browser has none, so the page makes a ten-digit number (lib/errors/reference.ts).
  • Layout failures (R-APP-09). app/error.tsx catches a failure in the shell's layout, which (shell)/error.tsx can't, and in the pages outside the shell (/login, /no-access, the 404 pages). app/global-error.tsx catches the root layout, with its own <html> and <body>. Both show components/errors/PlainError.tsx: Indonesian first and English below, a reference, Coba lagi · Try again and a plain link to /login. It reads no catalog and no stylesheet, so its text is written in it rather than through t(), and its look is inline styles in the browser's system colours.
  • Reporting. Each error page calls reportBoundaryError(error, reference) in lib/errors/report.ts once: the error's name, its digest and the reference shown, never the message, stack or details (D15). Pack F sends the same fields to Sentry.
  • Refusals as text (R-APP-10). Every control that calls a Server Function goes through useControlAction (components/shell/ActionForm.tsx). A returned refusal shows its mapped text, and a call that gets no answer shows the mapper's general text (mapRequestFailure), in both cases under the control in the top bar, while the page stays. Next.js's redirects pass through unstable_rethrow. What changed:
    • choosePool() returns an ActionResult. It used to throw when my_permissions() failed and quietly ignore a pool the user can't open; it now uses readAccess(), the non-throwing read, and refuses that pool with the 42501 text.
    • toggleTheme() returns an ActionResult.
    • The ID | EN switcher shows its refusal under the control instead of in a toast, as R-APP-10 says, and catches a failed call that used to escape its transition to an error page.
    • The theme toggle and Keluar keep a failed call's text beside them; signOut() itself is unchanged.
    • Sign-in keeps its own wording (R-APP-02). No forbidden(), unauthorized() or catchError yet; the Forbidden component stays.
  • Forced failures for the specs. Only a server started with E2E_FAULTS=1 can fail on purpose, and only playwright.config.ts starts one. It is a server variable read at request time, never compiled into the browser bundle, so neither the CI build nor a Vercel build changes. On such a server, the cookie opleet-e2e-fault (page, client, shell or root) says where to fail, and /e2e-faults in the shell is the page that fails; anywhere else that page is a 404 and the cookie is never read. This replaces #202's first idea, a build flag NEXT_PUBLIC_E2E_FAULTS, so TL-M0-19's e2e job needs no change.
  • Specs. e2e/errors.spec.ts, 7 tests: R-APP-07; R-APP-08 on the server and, in English, in the browser; R-APP-09 for the shell and the root layout; R-APP-10 for a real refusal (set_my_locale('xx') from the fault page's button) and for a call with no answer from each top-bar control (language, pool, theme, Keluar), checking that the text sits just under the control. 34 specs in all.

Checked on 2026-10-19 on a checkout of main (e25fe0f) with this branch: 45 unit tests, typecheck, lint, pnpm docs:rules, and the build. The 34 specs passed against the stand-in for Supabase that pack E's check used, with set_my_locale() added, in Chromium 153 from npm. Then the code was broken on purpose: an error page that showed error.message failed both R-APP-08 specs, and a control that let a failed call escape failed R-APP-10's network spec. Not checked: the real local stack and Playwright's own Chromium (FE-M0-25), and the deployment (FE-M0-26), which are zuki's runs.

Merged in #209 on 2026-10-20; FE-M0-25 and FE-M0-26 run from main.

Pack F's FE-M0-17 used to create app/global-error.tsx. Pack G made it first, and pack F, rebuilt on 2026-10-21, sends reportBoundaryError's fields to Sentry instead, so it leaves the file as pack G wrote it (#173). Status: written 2026-10-19.

Pack H · The design system's version 2 (timeline row 34b)

Section titled “Pack H · The design system's version 2 (timeline row 34b)”

Delivers the Opleet Design System's version 2 (shadcn/ui components, Tailwind v4, artifact, version 1793774664-d15c) in apps/web, replacing the op-* stylesheet and the twelve ported components (D88). One branch, one pull request into integration.

Delivers @sentry/nextjs 11.7.0 in apps/web against the opleet-web project that TL-M0-22 made (D24, #173). Set up by hand, as Sentry's manual setup for Next.js describes, never with its wizard: instrumentation-client.ts, instrumentation.ts (with onRequestError), sentry.server.config.ts, sentry.edge.config.ts and withSentryConfig in next.config.ts, which version 11 exports from @sentry/nextjs/config. All three runtimes start from one sentryOptions() in lib/sentry/options.ts.

Rebuilt on 2026-10-21 as a pull request, like pack G. The zip of 2026-10-19 (075fa722…) copied whole files over pack D's, and packs B2, E and G have changed them since. It was also never committed, and the session that made it is gone. So the code was written again on main (04840a8), with pack G's error pages in place, and arrives in the pull request itself. FE-M0-17 and FE-M0-18 now check it on the Mac instead of copying files. The design is unchanged except where pack G already decided:

  • Off without a DSN. Sentry.init runs only where NEXT_PUBLIC_SENTRY_DSN is set, which is Vercel's Production and Preview. The Mac and CI send nothing, and their builds talk to no Sentry server. environment comes from NEXT_PUBLIC_SENTRY_ENVIRONMENT, staging until cutover.
  • Personal data stays out (D15, D31). sendDefaultPii is off. There is no Replay or feedback widget, and the session integrations (BrowserSession, ProcessSession, which ask Sentry to fill in the IP address) and the local-variable ones are left out. beforeSend keeps a request's method and path only. It drops cookies, headers, bodies, query strings and the user, and gives fields named like nik, phone, sim_number, address, emergency_contact or account_number the value [Filtered] at any depth. It strips the query from any URL or path field, Next.js's own request_path among them, and cuts runs of eight or more digits out of messages and error texts. Console breadcrumbs are dropped. This is a second line behind the organization's scrubber.
  • Tracing is off. There is no sample rate, because a span of a Supabase call carries its URL, and a filter in it can be a NIK. So there is no onRouterTransitionStart either; next.config.ts silences Sentry's reminder about it.
  • What apps/web reports itself goes through lib/errors/report.ts. error.unknown from the error-key mapper is one message, tagged db.code and error.key and grouped by them, never with the database's message or details (D10). Pack G's reportBoundaryError, which every error page calls (app/global-error.tsx among them), sends error.boundary tagged with the error's name, digest and the reference the page shows. So a reference a user quotes finds its event, and global-error.tsx needs no Sentry call of its own. An error from server rendering or a Server Function also reaches Sentry with its stack, through onRequestError.
  • Source maps are made and uploaded only by a build with SENTRY_AUTH_TOKEN, which is Vercel Production only, and deleted from that build afterwards. Every other build makes none for the browser. If the upload fails, for example when Sentry is down, the build still passes and logs one line, so Sentry can't block a deployment. The release is the commit.
  • Proof: /system/sentry causes a test error in the browser or on the server. Only user:write opens it (super_admin among the system roles); anyone else gets the 404 page of R-APP-07. The server button's failure shows as text under it, as R-APP-10 asks for any control, so the page stays and Sentry gets exactly the two test events. It stays in the app for later checks.

Checked on 2026-10-21 on this branch, rebased on main (04840a8):

  • 52 unit tests, 7 of them for what leaves the app; typecheck (Keys 107), pnpm biome ci . and pnpm docs:rules.
  • Pack E's and pack G's 34 Playwright specs passed against the stand-in for Supabase, in Chromium 153 from npm.
  • A build without a DSN or token made no source map under .next/static and printed nothing about Sentry.
  • A build pointed at a local stand-in for Sentry's ingest received:
    • the browser and server test errors and a server page failure, each with environment staging and the request's path (and the server's method) only;
    • both error pages' error.boundary events, with the digest or the page-made reference as tags;
    • error.unknown from the server, for a refusal with a key apps/web doesn't know, with its code only.
  • Nothing else reached the stand-in. A NIK and a phone number in the query string, the session cookie, the user, the IP address and any session envelope all stayed out.
  • A build with a token, against an unreachable sentry.io, logged the failed upload, passed, and left no source map under .next/static.
  • /system/sentry opened for super_admin and gave the 404 page to admin and admin_fleet.

Not checked: the real upload, readable stack traces in Sentry and the staging logins, which are FE-M0-19, zuki's run.

Runs after packs D, E and G (rows 28, 29 and 29a) and TL-M0-22 (row 34). Status: rebuilt 2026-10-21; merged in #237 the same day, so FE-M0-17 to FE-M0-19 run from main.

For the CTO: what CI and Vercel need (timeline rows 13, 30 and 33)

Section titled “For the CTO: what CI and Vercel need (timeline rows 13, 30 and 33)”

TL-M0-13, TL-M0-19 and TL-M0-21 are the CTO's steps. From the frontend side, they need the following.

  • Runs on pull requests that touch apps/web, supabase or tools/db, once pack E exists.
  • pnpm install --frozen-lockfile, then the database the way BE's job starts it: pnpm db:signing-key, pnpm supabase start, pnpm supabase db reset.
  • The E2E logins from BE's script (FE-R6), which writes .env.e2e at the repository root; Playwright reads it.
  • apps/web/.env.local written from pnpm supabase status -o env, as in FE-M0-06 block 5. NEXT_PUBLIC_DESIGN_PREVIEW stays unset: a spec proves the preview is off.
  • pnpm --filter web build, pnpm --filter web exec playwright install --with-deps chromium, then pnpm --filter web e2e, which starts the built app itself.
  • Upload apps/web/playwright-report when a spec fails, and run pnpm supabase stop --no-backup at the end, also after a failure.
  • No repository secret: the local stack's keys and the E2E logins exist only inside the job.
  • pnpm docs:rules in the checks job already reads apps/web/e2e (TL-M0-26); this job doesn't repeat it.

The checks job (TL-M0-13), from packs C and D on

Section titled “The checks job (TL-M0-13), from packs C and D on”
  • apps/web's unit tests don't run in CI: number formats, the access model, each role's menu and landing page, the translator and the error mapper (33 tests after pack D). pnpm --filter web test in the checks job, or a test task in turbo.json, would catch a menu or money regression on every pull request.
  • With E2 (OQ24), apps/web's typecheck also compares lib/errors/keys.ts with supabase/migrations. Turborepo hashes only apps/web's files for that task, so a change to supabase/migrations alone can replay a cached pass; adding $TURBO_ROOT$/supabase/migrations/** to web's typecheck inputs closes that. With E1 nothing is needed: the generated types change with the enum.
  • Root directory apps/web, framework Next.js, function region Singapore (sin1). Node 24 comes from engines. Vercel follows packageManager (pnpm 12.8.1) only with Corepack on: set ENABLE_EXPERIMENTAL_COREPACK=1 and check that the build log shows pnpm 12.8.1.
  • The default build works: apps/web's build needs no database, because the pages that read one render on demand.
  • NEXT_PUBLIC_ values are compiled into the build, so changing one needs a redeploy.
  • Staging's Auth site URL (TL-M0-20) is the Vercel URL. Password sign-in doesn't use it; admin invites will (OQ2).
  • NEXT_PUBLIC_SUPABASE_URL: <STAGING_SUPABASE_URL> on Vercel; the local stack's URL on a Mac and in CI.
  • NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: <STAGING_PUBLISHABLE_KEY> on Vercel. Never the secret key: apps/web refuses a key that starts with sb_secret_.
  • NEXT_PUBLIC_DESIGN_PREVIEW: 1 on a Mac only, to look at the preview; unset in CI and on Vercel.
  • E2E_PASSWORD and E2E_<ROLE>_EMAIL: Playwright only, from .env.e2e; never on Vercel.
  • Sentry (TL-M0-22, pack F): NEXT_PUBLIC_SENTRY_DSN and NEXT_PUBLIC_SENTRY_ENVIRONMENT on Vercel's Production and Preview; SENTRY_ORG and SENTRY_PROJECT there too, and SENTRY_AUTH_TOKEN on Production only, at build time for source maps. None of them on a Mac or in CI.