Skip to content

Plan: modules M0 to M7

What v2 builds and what each module covers. The timeline holds the order of the work and its status; this page holds each module's scope. Where they disagree on order, the timeline wins; where this page and a rule disagree on what v2 does, the rule wins (D27). A CTO session keeps this page.

It moved here on 2026-10-12 from the Google doc [Spec] v2 rebuild plan: modules M0 to M7, brought in line with D17, D19, D20, D21 and D25 on the way (#49). Its week estimates and calendar are gone: there is no cutover date (D20).

Owner: @zuki · Kept by a CTO session · Last reviewed: 2026-10-22 · Conforms to the decisions through D72

v2 is a new app on a new database, schema V13, built while v1 keeps running untouched (D2). The data moves once, on a cutover weekend, after the same migration has run every night on a fresh copy of v1 production and reconciled to zero unexplained differences (D18). Until Tuesday's point of no return, the way back is v1 itself (D21).

Lane What happens
v1, today's app Its own Supabase and Vercel projects. Still developing (D75): it may gain tables, columns and features until the cutover guide's change stop. Bug fixes are logged in the port log and become a rule or a test for v2. Read-only after cutover, then archived.
Nightly rehearsal Every night: snapshot v1, run the whole migration, reconcile, load v2 staging. Dozens of runs before the one that counts.
v2, the new app New Supabase projects and the Next.js app in this repository. From the data phase on, built and tested on yesterday's real data.
Cutover weekend v1 read-only, the final run, reconcile, smoke tests, then Saturday's go/no-go (cutover weekend and rollback).

v2 production stays empty until the cutover run fills it.

The work runs in four phases. The old plan had each module carry its own migration step; D17 split that into a data phase across every domain first, then the pages.

  1. M0 · Foundation. The repository, tooling and CI; V13's rules in apps/docs; schema V13 with its pgTAP tests; the app shell; staging, hosting and the docs site. Rebuilt from an empty folder, one step at a time, run by zuki (D25). The timeline lists every step.
  2. Data phase. Every domain's migration step and its reconcile checks, in dependency order, until a full night runs end to end (D17). Money comes first: a read-only study of v1's bills, debts and payments on a copy of v1, so what it finds changes the schema before pages depend on it. It starts when M0's exit check passes (D25); the v1 copy, the money study and the read-only user on v1 can run alongside M0, since they change neither the schema nor staging (timeline).
  3. M1 to M7 · Modules. Each module's database actions and pages, on the real data the data phase loads into staging every morning.
  4. Staff testing and cutover. Staff testing on staging, the go/no-go gate and the cutover weekend (D20, D21).

In this order, every module from M1 on (D19, D27):

  1. Its rules in apps/docs, each with an ID, from the Docs Engineer's DOC pack. Open questions that block the module are decided first; the timeline names them.
  2. Its database work, tests first: pgTAP tests that cite the rule IDs, then the functions for the module's actions (one transaction each), its views, its scheduled jobs and its error keys (D10, D30).
  3. Its pages, journeys first: the Playwright journeys the module owns (D19), then the pages in the Opleet design system, behind the module's permissions and in Indonesian first (D29).
  4. A demo to the team leads on v2 staging with real data.

v1's behaviour is captured as data: inputs, and the rows and balances they produce. The reconcile checks compare v2 with v1 on that data. There are no v1 page objects to keep passing on v2 (D19).

  • v1 is still developing (D75): the data phase builds the v2 tables, columns and permission codes for what v1 adds before the step that loads them, rules first. Bug fixes are written into the port log and carried into v2 as a rule or a test; a v1 feature is an issue.
  • Business rules live in Postgres (D3): functions, constraints and scheduled jobs, not browser stores. That is what removes v1's repair crons and cache bugs.
  • Real data from the data phase on: module work happens on staging rebuilt every night from v1, never only on toy data.
  • A demo per module to the team leads, so surprises come early.
  • A new project, not new tables beside v1's. contracts, payments, work_orders and etle exist in both, and a new project keeps v1 untouched.
  • v2 reads v1 read-only: a snapshot copies v1 into a legacy schema, and plain SQL transforms it in tools/migration. Fast, and repeatable every night.
  • Auth users move once, with their ids and password hashes, so nobody resets (D50). Roles come from v1's app_metadata into the access tables.
  • Photos move from base64 and v1 Storage to v2's buckets at D14 paths, by a script that skips what it already copied. The bulk goes up weeks early; cutover night copies only the difference.
Kept No longer needed
ERD V13, the conventions and the security rules Sync triggers and reverse syncs
value_map and id_map (lid to driver; unit id and every plate, former plates included, to vehicle) Feature flags per stage and compatibility views
The reconcile queries (balances, active rentals, statuses, checkpoints due) Rewriting v1's repositories
The stage order, now the order of the migration's domain steps Marker rows mixed into the old tables
Staging on a copy of production; the sealed E2E organization; Playwright Months of old and new side by side

The v1 line counts are page folders only (v1's stores add more); they show where the work is.

Module v1 pages (lines) Proved by
M0 Foundation auth, api/users (543, and part of 1,159) The 44 checks the delivered M0 had, as pgTAP; the per-role menu check
M1 Access and master data users, manajemen, master-data (1,658) Every dropdown value staff use exists; grant and deny behave as today
M2 Vehicles list-vehicle and [plat], vehicle-monitor, fleet-monitor (4,000) The plate change case; the unit QR scan; status per car equals v1
M3 Drivers, queue and screening antrian, antrian-admin, antrian-tv, lead-registration, monitoring-lead, background-check, driver-profile, driver-dashboard (6,080) Queue to lead to background check (virtual and visit opened at payment, the visit queue in P0 to P2 order); overwritten and duplicate lead cases
M4 Onboarding, booking and contracts onboarding, bastk, api/contracts (1,800, and the generator) Admin fee, pending rental, booking, contract number, handover; the re-handover case
M5 Operations checkpoints, vehicle-preparation, preparation, work-order, asuransi, gate-system, etle (7,600) The checkpoint due list; return with panel damages; work order routing; gate out blocked by debt or checkpoint, with approvals; double handover and swapped photo cases
M6 Money payment, rental-harian, aktivasi-tagihan, collection-dashboard, claim (4,740) Balance per driver equals v1's balance of record, with every difference signed; the balance of record is the instalments inside bills (D18, D34); the ledger cases; void, rebate, refund
M7 Reports and the rest dashboard, laporan, log-aktivitas, kalender, notifikasi, backup (1,890) Report numbers for the last 90 days equal v1

The journeys Playwright covers are D19's list: queue to lead to background check; booking, contract and handover; checkpoint inspection; return with damages; gate out with approvals; payment and allocation. D61 adds vehicle onboarding (a new car to ready) and collection (an overdue driver to a call, a surat hutang and a payment): with driver onboarding they are the flows that must not break at cutover, and they get the most tests. The rest is proved by pgTAP and by reconcile.

  • Scope: schema V13 with RLS on every table, the v1 roles seeded with their permissions, the audit log, document numbering, money integrity triggers, status guards and the core views; Storage buckets at D14 paths; the sealed E2E organization; the app shell (sign-in, sidebar by permission, pool switcher, theme, language, module placeholders, the refusal page); the Opleet design system; CI; staging, hosting and the docs site.
  • Status: being rebuilt from an empty folder (D25). The delivered M0 (mop-fleet-v2-M0.zip) is background only; no file of it is copied in. The timeline has the steps and their status.
  • Scope: the money study; the migration machinery in tools/migration (snapshot, value_map, id_map, unmapped values, unmatched rows, accepted differences); the domain steps in order (master_data, access, vehicles, drivers, rentals, operations, money), each with its reconcile checks; the photo copy; the nightly rehearsal job.
  • Decided: the balance of record is the instalments inside bills (D34), with v1's confirmed payments that no instalment records and its paid bills with no instalment (D74).
  • Decided: the rehearsal runs in GitHub Actions and may climb to L2 (D36).
  • First, BE pack G2: rental chains (D38), the driver stages available and inactive (D43), VIN unique (D47), and the rental lifecycle from the higher-ups' General Flow once #155 is decided (D41).
  • Decided: the load runs with the audit triggers off and writes one "migrated" entry per table (D52); v1's file links become private paths, and the copy reports whether v1's links are public (D60).
  • The domain steps, with what each reconciles:
    • access and master_data: v1 auth users into auth.users and profiles; app_metadata.role into member roles across pools; the allowed lists into overrides and partner scope; the organization, the TOP and MOP entities and the current pool; code constants and free text into master rows. Reconcile: every v1 user logs in with the same menus; every dropdown value in v1's data exists in v2.
    • vehicles: unit_id into unit_code; plates normalized, former plates kept; one status per car; id_map for unit ids and every plate. Reconcile: status per car equals v1.
    • drivers: one row per lid; the lead, background check and queue maps from the data mapping; id_map lid to driver. Reconcile: drivers by stage, clearance against v1's background check status.
    • rentals: onboarding rows into stage and rental; contracts per rental with their stored numbers. Reconcile: active rentals, car by car, equal v1.
    • operations: notas unpacked; inspections linked to the rental active at the time; panel lines matched; the old nota kept as it arrived; gate logs and exit tickets load nothing and are signed as ignored on purpose (R-GATE-14). Reconcile: the checkpoints due list equals v1.
    • money: each bill into one charge, as v1 billed it (R-MON-84), and a debt with no bill listed as unmatched with no charge (R-MON-81); embedded payments into one payment per transfer, with allocations as v1 recorded them, never from D72's suggested split; rebates and refunds into adjustments; claim letters into debt letters linked to charges. Reconcile: balance per driver against the balance of record, and payments per day and account, both read from the instalments inside bills, the confirmed payments rows no instalment records, and v1's paid bills with no instalment (D34, D74).
  • Where the steps are: the backend runbook's data phase and the timeline's data phase rows.
  • Scope: users and roles (members, roles per pool, grant and deny overrides, rental-company scope, organization roles); master data (legal entities, pools and pool settings, organization settings, brands, models, pricing groups, rental companies, garages, insurers and partner garages, charge types, lead sources, checklist items, body panels, contract templates, bank accounts). Master data that staff read in two languages carries name and name_en (D29).
  • Database: functions to grant and revoke roles and overrides, with audit; system rows locked; inviting a member, with no public sign-up (D50); the password rules and the 24-hour session (D51).
  • Pages: /users, /master-data.
  • Decided: D50, D51. Invitations and resets are sent from no-reply@opleet.com through Resend.
  • Scope: vehicles; documents (STNK, BPKB, insurance); GPS devices and positions; status history; plate history; insurance policies; the fleet monitor.
  • Database: change_plate(), which keeps the history; status only through set_vehicle_status, and ready only while the STNK is valid (D47); lookup by unit code or any plate; the Easygo GPS pull job.
  • Pages: /vehicles (list and detail sheet), /fleet-monitor.
  • Compatibility: the unit QR payload is unit_code, which is v1's unit_id, so printed barcodes keep working.
  • Decided: contract_status is supply_status (D56, renamed in BE pack G2). Vehicle onboarding is an essential flow (D61).
  • Scope: drivers with documents, addresses, emergency contacts, platform accounts and notes; queue tickets and events, with the TV screen and the public join page; background checks with the two-level clearance; pool transfers of a car or a driver, here because they need both vehicles (M2) and drivers. The pool transfer rules (R-TRF) belonged to no module until 2026-10-20.
  • Database: queue actions (call, start, skip, convert, refuse) as events, a ticket closed after MAX_QUEUE_MISS skips and one open ticket per NIK (D43); register_lead() from a ticket, refused for a blacklisted NIK; both checks opened when the admin fee is paid, and decided in the visit queue's P0 to P2 order, with the admin fee refunded on rejection (D42); the alert when a visit fails after handover; rejoin requests and the stages available and inactive (D43, #156, #159); v_driver_clearance reading the latest check of each kind (D54); the queue form's emergency contact, education and birth date (D55); the queue TV live through Realtime, from a view with no personal data (D58); driver:reject and driver:blacklist (D63). NIK and phone are shown in full to every role that can read a driver, and masked in the audit log (D31).
  • Pages: /queue, /drivers (list and profile), /screening; the public /antrian page, whose static QR keeps its URL; the queue TV. The public queue page, the queue TV and anything sent to drivers are Indonesian only (D29).
  • Decide first: #156. Decided: a month as available, or a repossession, makes a driver inactive, and a rejoin request leads back from it; the limit of repossessions before a blacklist is an organization setting (D66). Driver onboarding is an essential flow (D61).
  • Scope: the onboarding checklist view; pending rentals; booking and contract signing as one action; contracts per legal entity, with templates and snapshots; the handover inspection with BASTK; public BASTK links.
  • Database: approve_driver() (a pending rental); book_rental() (rental, contract and number in one transaction); cancel_booking(); handover() (inspection, rental active, car rented, stage listed; no training check until the training flow exists, D64); renewals (same rate: a new contract; new rate: a new rental); car swap (a new rental and contract); v_onboarding_progress.
  • Pages: /onboarding; the contract and BASTK PDFs, Indonesian only (D29); /bastk links, which find old ids through id_map.
  • Decided: every number Opleet issues reads TYPE/DIVISION/ENTITY/YYYYMMDD-NNN, with SH for surat hutang (zuki on #165) and Claim as a placeholder type (D40, D53).
  • Scope: inspections (checkpoint, return, preparation) with items, photos and damages; work orders and their events; maintenance; insurance claims at partner garages; gate passes with approvals; ETLE scans and violations; repo requests and repo work orders (D71).
  • Database: record_inspection(), where a charged damage also makes a draft surat hutang (D45); the return and repossession steps of the rental lifecycle (#155): the reason sets the stage (D43), and a repossession makes the driver inactive, or blacklisted at the organization's max_repossessions (D66) and the work order's starting route (D47), and the BASTK stops the rent; route_work_order(); the repair and ready steps, ready only through the Preparation Leader's check (D47); gate_in() and gate_out() with the exit check and approvals; the weekly ETLE job; the checkpoint reminder; claim codes in the shared format (D53); preparation_leader and repo roles (D63); repo requests from Collection and from missed checkpoints, repo work orders with their 24-hour limit, collection rate and failed units, and the repo_leader role with repo:assign (D71). v1's two repair crons are not rebuilt.
  • Pages: /inspections, /preparation, /work-orders, /maintenance, /insurance, /gate, /gate/approvals, /etle, the repo request list and the repo work orders, with the Repo Team's view on a phone.
  • Scope: charges; payments and allocations; adjustments; debt letters; collection calls; payouts; the cross-entity flag; the daily rent generator as a scheduled database job; the overdue view, with the amount limit of three days of the driver's rental fee beside the days limit (D46).
  • Database: the rent generator (idempotent), record_payment() (one bulk payment allocated across charges, marked manual or bulk reconciliation, D46), the suggested split of a payment, oldest due first across every charge type, which finance confirms, changes or replaces with its own before anything is allocated (D72), allocate(), void_payment(), adjust(), issue_debt_letter(), log_call(); a due date on every charge, defaulting from its charge type and changeable by finance (D57). margin and company_amount are read only with payment:margin (D31).
  • Pages: /collection, /payments, /daily-rent, /debt-letters.
  • Decide first: #158 (the overdue limits, invoices). Decided: the balance of record (D34); a bulk payment's suggested split, oldest due first, with finance deciding (D72).
  • Scope: the audit log page; utilisation, SLA and driver-profile reports rebuilt on V13; the dashboard's real numbers. Kalender and Notifikasi may follow after cutover; backup is dropped in favour of Supabase backups and the nightly pg_dump (D16).
  • Pages: /dashboard, /reports, /activity-log.
  • Scope: the v2 production project; personal data in place before go-live (D15); two weeks of staff testing on staging with a shadow day per team; the gate; the cutover weekend; afterwards, the migration files frozen into a baseline (D11).
  • The gate: 10 clean rehearsals in a row, every test green, each team lead's sign-off and a finance period close (D20). There is no fixed date; cutover takes the first suitable weekend after the gate is met.
  • Decided: driver onboarding, vehicle onboarding and collection must not break, and the gate needs them green (D61); zuki runs the migration and Syamsul Haris decides go/no-go (D62); the auth settings (D51); the E2E organization stays, sealed (D59).
  • Decide first: retention periods (OQ18).
  • How the weekend runs: cutover weekend and rollback.

After cutover, on v2:

  • The driver mobile app.
  • A second pool: the schema and roles are ready, so opening it is configuration.
  • SaaS onboarding for rental companies (plans, subscriptions, composite tenant keys).
  • Motorbikes.
  • The payment and collection roles (D63).
  • The training flow (DRV-19), with its role and rules (D64); driver_trainings is kept for it.
  • Kalender and Notifikasi, if they are cut for time. Cutting scope is the lever; moving these two after cutover saves about a week.