Skip to content

Reconcile ledger · Every line and odd row, step by step

What this is. The single place that collects every reconcile line and every odd or unattributed row the migration steps print, with the ones already solved. Syamsul checks each item directly in Supabase with the queries at the end; a report and a visualisation will be built on this structure later, so every step has one table with the same columns. zuki, 2026-10-29: "This reconciling and all the reconciles from other tables mapping should be collected first … Be as detailed as possible … Including the solved ones. Some recent decision might be changed based on Syamsul's discern. We should proceed and complete mapping for now and collect those odd/unattributed data." (#302)

Source of every count. From the night of 2026-10-29, BE-DP-36 on the integration at 8037eb7 (local stack, the v1 copy of that day, all four steps run: master_data 97 rows, vehicles 1,896, drivers 11,333, rentals 2,642). Counts only (D15): no names, plates, phones or NIKs, and v1 ids only as counts. Access is from the night of 2026-10-29 as well (BE-DP-29, 66 logins on the v1 copy of that day). Updated with the night of 2026-11-02, BE-DP-36's rerun on the copy of that day (45 tables: 31 real, 14 manual backups; counts only): rentals 2,552, contracts 317, unmatched rows 46 (drivers 35, rentals 11), v1 unclaimed 60. A cell that carries a count from this night says so; one that still carries the night of 2026-10-29 is not re-sourced. Updated with the night of 2026-11-04 for the operations step and master_data: BE-DP-36 run 1 then BE-DP-38 run 2 on the copy of 2026-11-03, integration at 7178ad1, logged clean by zuki on #304: master_data 107, vehicles 1,898, drivers 13,067, rentals 2,870, operations 280,908; the reconcile held 8 checks, unmatched rows 47 (BE-DP-36's 46 and 1 work order). A second clean night that day, at 2d4c938 (#521, R-WO-18): operations 280,914, unmatched rows 46. Updated with the night of 2026-11-05 for money only: BE-DP-40 run 2 on the copy of 2026-11-05 (#306); its section names its source. Where a number was not in the night's output, the cell says not sourced and names the query that gives it.

  • One row is one reconcile line or one group of unmatched rows, not one v1 row. The reconcile (R-MIG-05) prints a line per check key; migration.unmatched lists a row per v1 row, grouped here by step, table and reason (R-MIG-04).
  • ID is stable: LED-<STEP>-<n>. Solved items are SOL-<n> and keep the ID of the line they replaced where there is one.
  • Status: open (nobody has decided what to do with it), decided (zuki ruled and the code follows), solved by rule (a rule makes the line disappear or explains it fully), provisional (decided, but Syamsul's review could change the decision).
  • Check in Supabase is a query id; the patterns are at the end, with :id placeholders to fill in Supabase Studio, on v2 (the local or staging database) and, where marked v1, on the v1 copy (public.* there is legacy.* in v2).
  • Dates are zuki's, from the issue comment named in the Decision column.
Check Row key Signed by When Reason in short
files expected one set: v1 records before 2026-08-24 zuki 2026-10-22 v1 kept no photos before that date (#184)
v1 unclaimed 12 tables and columns (one row each) zuki 2026-10-28 empty tables and columns no step will read (#324); its four backups are now under the pattern below
v1 unclaimed every table whose name contains backup, in any case, by pattern zuki 2026-11-10 v1's manual backups; one line, tables named backup, gives their count and never a name, as some name a person (D15, #591)
rentals ignored on purpose Approve zuki 2026-10-29 the old-data Approve rows load no rental (R-RNT-64); signed in 20261006001800_migration_rentals.sql, once the pull request that carries this page merges
rentals ignored on purpose Listed zuki 2026-11-05 the Listed row 2155 is not in a rental in v1 and loads nothing (R-RNT-66, LED-RNT-06, #369); signed in 20261006001800_migration_rentals.sql
v1 unclaimed table gate_logs zuki 2026-11-03 v1's gate logs are test data and load nothing (R-GATE-14, #304)
operations stock opname counts session void zuki 2026-11-03 v1's void session stores 0 missing, while its 111 loaded expected cars give 111 (R-OPN-13, R-OPN-14)
operations inspection rentals checkpoint, handover, return zuki 2026-11-03 a print (R-INSP-17)
operations no work order maintenance, preparation, return inspections zuki 2026-11-03 a print (R-WO-15)
operations etle payer Ditanggung Fleet, Lunas Driver zuki 2026-11-03 a print (R-ETLE-08)
operations etle driver unknown Tidak Diketahui zuki 2026-11-03 a print (R-ETLE-07)
operations preparation not checked Belum Dicek zuki 2026-11-03 a print (R-INSP-21)
operations nota inline files checkpoints zuki 2026-11-03 a print (R-INSP-19, LED-OPS-01)
operations status history cars zuki 2026-11-03 a print: one line with the count of cars whose status isn't their latest v1 history row's, 113 (R-VEH-31)
operations maintenance open maintenance zuki 2026-11-03 a print: one line with the count of records with no end date in v1, 10 (R-WO-13)

The 14 operations lines are zuki's on #304 (2026-11-03: "sign the stock opname difference and all the prints", then "void, A"), from BE-DP-38's third night on the copy of 2026-11-03, signed in 20261006001900_migration_operations.sql. Each key is a label, so no v1 id or unit code is in the repository (D15): the stock opname line is keyed by the session's status, and operations status history and operations maintenance open print one counted line each instead of a line per car or record, with the rows listed by a local query in BE-DP-38 block 4. A signature names a check and a row key, never the detail, so a signed line stays hidden when tomorrow's copy changes its count; BE-DP-38 block 5 reads the counts from the checks.

Nothing else is signed from the earlier steps. zuki holds the rest for the review: the cost print, the rate-history print, the four cancelled stage lines, the unclaimed columns and the no-term lines.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-MD-01 master_data master pricing A pricing group (a v1 tariff) with a model it does not own, a model in two tariffs, or no admin fee that names its models. The load takes what v1 says and the line asks for a v1 fix. 2 lines on the night of 2026-11-02 (9 on 2026-10-29), both by design: the tariff "Binguo Ciciclan ADM join" (the admin fee is paid inside the rental fee until covered) and "Rental Avanza" (a replacement car for drivers with an accident, no admin fee) decided (by design) R-MD-17, R-MD-18 migration.check_master_data (master_data) Fix list and four questions (a) to (d) on #316 (BE, 2026-10-27); zuki answered lines 1, 3, 4 (2026-10-27 08:56); the v1 fixes of #316 are made in v1 (the Geely ex 2 tariff, 295,000 with an admin fee of 800,000, is provisional); the two left are by design (zuki on #316, 2026-10-30: Binguo Cicilan ADM join is an anomaly, the driver's rental fee covers the admin fee for a while; Rental Avanza, "option 1": keep the entry, no admin fee, a replacement car; both signed with the report) No: a v1 fix, not a v2 decision Q-10 with :check_name = 'master pricing'
LED-MD-02 master_data master insurers added An insurer only v1's claims name, which v1's insurer list (asuransi) lacks: the step adds it, spelled as most claims spell it, and the line names it with its claim count so a stray spelling can be mapped (R-ASR-15). A tie between two spellings stops the night instead (R-MIG-02). 11 lines on the night of 2026-11-04 (the copy of 2026-11-03), as R-MD-21 expected decided R-MD-21, R-ASR-15 migration.check_master_data (master_data) zuki on #304 (2026-11-03, answer 1(a)) and #444 (2026-11-03: the reconcile prints the insurers added) No Q-10 with :check_name = 'master insurers added'
LED-VEH-01 vehicles vehicle brands A car whose brand in v1 is a model name (so the brand list would hold a model). 0 lines on the night of 2026-11-02 (3 on 2026-10-29) solved R-MD-17, R-VEH-30 migration.check_vehicles (vehicles) Same fix list, lines 10 to 12 (#316); the v1 change is made (#316, night of 2026-11-02: 0 lines) No: a v1 fix Q-10 with :check_name = 'vehicle brands'

Loaded by these two steps, for the record: 1,750 vehicles, 146 plate-history rows, 9 brands, 22 models, 21 pricing groups, 11 rental companies, 6 insurers, 23 garages, 2 legal entities, 1 pool, 1 organization.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-DRV-01 drivers driver NIKs A driver loaded with no NIK because v1's is not 16 digits. 0 lines on the night of 2026-11-02 (20 on 2026-10-29: all fixed in v1) solved R-DRV-01 migration.check_drivers('niks') "A v1 fix (zuki or Syamsul), not a code problem" (CTO reading of zuki's answer, #281, 2026-10-29) No: a v1 fix Q-07
LED-DRV-02 drivers driver repossessed away A repossessed driver on Cuti or Suspend with an Approve row keeps v1's stage (D78); listed for review before cutover. 5 lines decided R-DRV-37, D78 migration.check_drivers('repossessed_away') zuki on #310 (2026-10-27: "go with (a)") Yes: D82 and D83 changed how their Approve rows load, and Syamsul may revisit Q-01 with :stage for their stages
LED-DRV-03 drivers unmatched leads: "deleted in v1 (deleted_leads)" A lead v1 deleted but still holds in leads; no driver is loaded. 8 rows on the night of 2026-11-02 (5 on 2026-10-29) solved by rule R-DRV-41, R-MIG-04 migration.step_drivers Rule from the drivers step's design; no separate decision No Q-02 with :step = 'drivers', :reason = 'deleted in v1 (deleted_leads)'
LED-DRV-04 drivers unmatched leads: "no phone in v2's form" A lead whose hp is not a mobile number (v2 needs 628…), so no driver is loaded. 5 rows (unchanged on 2026-11-02) open R-DRV-53, R-DRV-54, R-CONV-16 migration.step_drivers None yet: zuki or Syamsul fix the number in v1, or decide a placeholder (a queue ticket already takes one, #281) Yes Q-02 with :step = 'drivers', :reason = 'no phone in v2''s form'; v1 side Q-07b
LED-DRV-05 drivers unmatched bc: "its lead isn't loaded" A background check of a lead that is not loaded (LED-DRV-03 and LED-DRV-04). It follows them. 21 rows on the night of 2026-11-02 (13 on 2026-10-29) solved by rule R-DRV-41, R-MIG-04 migration.step_drivers Follows LED-DRV-03 and LED-DRV-04 No Q-02 with :step = 'drivers', :reason = 'its lead isn''t loaded'
LED-DRV-06 drivers the old-data drivers made inactive Drivers whose Approve row has an empty rental fee name are put on inactive (a Resign or blacklisted lead keeps what its status gives). 33 rows provisional R-DRV-55, D73 migration.step_drivers zuki on #369 (2026-10-29: "just make them inactive"; the source condition did not hold, so the criterion is the empty fee name alone) Yes: "most are not active now" is a reading; Syamsul may find some are Q-03
LED-DRV-07 drivers unmatched leads: a NIK equal to an earlier lead's One lead whose NIK is the one an earlier lead already holds: lead 2850 against lead 2844, the same person (#397). No driver is loaded for the later lead. 1 row on the night of 2026-11-02 open R-DRV-01, R-MIG-04 migration.step_drivers None yet: the duplicate is a v1 fix or a decision on which lead stands Yes Q-02 with :step = 'drivers'

Unmatched rows of the drivers step on the night of 2026-11-02: 35 (21 bc, 8 leads deleted in v1, 5 no phone, 1 NIK equal to an earlier lead's).

Stage counts of the night, for the report: listed 1,525, blacklisted 608, on_leave 453, lead 301, resigned 139, on_process 129, suspended 80, approved 71, rejected 32, inactive 31, booked 19, screening 9 (from the CTO's reading on #281, before the old-data rule; not re-sourced after it).

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-RNT-01 rentals rentals cancelled Approve rows loaded cancelled because their driver is not approved, one line per driver stage. 4 lines, 652 rentals: 275 on_leave, 22 suspended, 294 blacklisted, 61 resigned provisional R-RNT-33, R-RNT-49, D78, D82, D83 migration.check_rentals('cancelled') D82 (zuki "(a)", #302, 2026-10-29) widened D78 to leave and suspend; D83 (zuki, "Cancelled, like D82", 2026-10-29) to every other stage Yes: a driver who is cancelled here may be one Syamsul says is active Q-01
LED-RNT-02 rentals rentals ignored on purpose Approve rows with an empty rental fee name load no rental and no contract; their drivers are inactive (LED-DRV-06). 1 line, 33 rows provisional (signed) R-RNT-64, R-RNT-52, R-DRV-55 migration.check_rentals('ignored') zuki signed the line "from the BE-DP-36 night" (2026-10-29, #302); the 33 are #369's Yes, with LED-DRV-06: signing the line does not make the decision final Q-03
LED-RNT-03 rentals rentals no term, rentals terms unused A contract loaded with no term_months because v1's validity is empty or out of range; never a default of 6. zuki gives the term in a row of migration.contract_terms (lead id, term_months, reason, signed_by, signed_at), written in 20261006001800_migration_rentals.sql in a pull request; the step reads it only for such a contract. rentals no term keeps listing a contract that has no row; rentals terms unused lists a row the step did not use ("term given where v1 has one", "term given for no contract"). 0 lines on the night of 2026-11-02 (the six terms of #410 are used; contracts_with_no_term 0); 6 lines on 2026-10-29, before any row was given solved R-RNT-61, R-RNT-67 migration.check_rentals('no_term'), migration.check_rentals('terms_unused') zuki on #302: no invented 6 (2026-10-29); R-RNT-67 accepted (2026-10-30). The six terms (leads 602, 876, 1406, 2514, 3314, 3702; 6 months each, v1's validity was 0) were given on #399, 2026-10-30 Yes: the terms are zuki's, per contract Q-05
LED-RNT-04 rentals rentals rate history A print, not a difference: the history rows used, those ignored on purpose, and the drivers whose changes before the handover were not carried. From #405 it prints one line for each of five kinds ignored on purpose and a total, which add up to the view's rows, and a difference line when they don't (R-RNT-72). 1 line; 1,110 history rows used and 35 activity_log rows ignored on purpose, 1,145 in all; 51 drivers with 64 changes before the handover not carried (night of 2026-11-04; 24 with 31 on 2026-11-02) open (held by zuki) R-RNT-41, R-RNT-43, R-RNT-72 migration.check_rentals('history') zuki holds it for the review (2026-10-29) Yes: the pre-handover rule is zuki's reading (#302, 2026-10-29, "I accept your suggested rule") Q-04
LED-RNT-05 rentals rentals company cost A print: every migrated rental loads company_daily_cost 0 because v1 has no company cost. 1 line; the rentals in v2 are 2,552 on the night of 2026-11-02 (2,360 on an earlier count; chains included) decided (held by zuki) R-RNT-53 migration.check_rentals('cost') R-RNT-53 (BE's choice, #302); zuki holds the print Yes: finance may give a real cost Q-11
LED-RNT-06 rentals rentals ignored on purpose · Listed The one Listed row with an empty deduction_stopped flag loads no rental and no contract: a check in v1 found its driver in no rental. It is counted beside the Listed count, not listed as unmatched. 1 line, 1 row decided R-RNT-66, R-RNT-52, R-RNT-36 migration.check_rentals('ignored') zuki on #369 (2026-10-29: "a deduction stopped", but "an anomaly"; 2026-11-05: the driver is not in a rental, remove it; signed 2026-11-05) No: signed 2026-11-05 in accepted_differences Q-06
LED-RNT-07 rentals unmatched v_rental_fee_audit: "its last rate in the history isn't the fee on its v1 row today" A driver whose last rate in the history differs from the fee on his onboarding row today; no row of his loads. 0 drivers on the night of 2026-11-02 (3 on 2026-10-29: 731, 758 and 2605) solved R-RNT-42, R-RNT-59 migration.step_rentals The cause was a tie, not a vehicle change (#404, fixed by #411): 731 and 758 had two changes at an identical timestamp, and the recovery sorted before the dip. Both load; 2605 loads because v1 changed No Q-02 with :step = 'rentals', :reason = 'its last rate in the history isn''t the fee on its v1 row today'; v1 side Q-04b; Q-16 (did the driver change vehicles?)
LED-RNT-08 rentals unmatched onboarding: "its lead is missing or deleted in v1" An onboarding row whose lead is missing from leads or deleted. 5 rows on the night of 2026-11-02 (4 on 2026-10-29) solved by rule R-RNT-47 migration.step_rentals Rule; no separate decision No Q-02 with :step = 'rentals', :reason = 'its lead is missing or deleted in v1'
LED-RNT-09 rentals unmatched onboarding: "its driver isn't loaded (the drivers step lists him)" An onboarding row whose driver the drivers step could not load (LED-DRV-03, LED-DRV-04). It follows them. 5 rows on the night of 2026-11-02 (4 on 2026-10-29) solved by rule R-RNT-47, R-DRV-41 migration.step_rentals Follows LED-DRV-03 and LED-DRV-04 No Q-02 with :step = 'rentals', :reason = 'its driver isn''t loaded (the drivers step lists him)'
LED-RNT-10 rentals the placeholder contract template and the migrated contracts' status One inactive template "Kontrak dari v1" stands for v1's documents; each contract's status follows its rental (active or paused: active; pending or booked: signed; cancelled: terminated). 1 template; 317 contracts on the night of 2026-11-02: 212 active, 11 signed, 94 terminated (281 on 2026-10-29: 198, 11, 72) provisional R-RNT-54, R-RNT-55 migration.step_rentals BE's choice, accepted in the rule (the CTO, #302, 2026-10-29); not a separate zuki answer Yes: the 94 terminated follow LED-RNT-01 Q-12
LED-RNT-11 rentals the original assignment date (v1 has it on 30 Listed rows) v1's original assignment has no column in rentals or contracts, and R-RNT-17 would make it a chain's first handover. Not loaded; listed until a step claims it or zuki signs it. 30 Listed rows (from #302's table 3 on the copy of 2026-10-28; not re-counted tonight) open R-RNT-17, R-MIG-10 Not printed by a check yet "Still zuki's to decide" (#302, 2026-10-29) Yes Not sourced: the v1 column is in BE-DP-34 table 3
LED-RNT-12 rentals onboarding rows with a kontrak date and no contracts row Loaded with no contract; no number is made up. Whether those contracts exist only on paper is for zuki. 1,820 rows (R-RNT-44, on the copy of 2026-10-28; not re-counted tonight) open R-RNT-44 Not printed by a check "Still for zuki" (#302, 2026-10-29) Yes Q-14 (v1)
LED-RNT-13 rentals a driver at one pool and a car at another The step takes a rental's pool from its driver and never compares it with the pool of the car; a driver at one pool with a car at another would load without a line. No rule says what to do, and no check lists it. 0 on the night of 2026-11-02 (Q-17) open (no case yet) none yet Not printed by a check None: Syamsul's call (zuki, 2026-10-30: collect first) Yes Q-17

Rentals loaded, by status, on the night of 2026-11-02: 2,552 in all: pending 91, booked 2, active 1,505, paused 5, cancelled 836, ended 113 (113 earlier rows of 112 chained drivers); contracts 317; repo requests 0. Unmatched rows of the rentals step: 11 (5 driver not loaded, 5 lead missing or deleted, 1 held, #369); rate-history unmatched 0. On 2026-10-29: pending 70, booked 19, active 1,519, paused 2, cancelled 652, ended 98 (earlier rows of 98 chains). The checks rentals per status, rentals car by car and rentals and stage printed nothing.

Source: the night of 2026-10-29, BE-DP-29 on the v1 copy of that day, as read for #278 and #391 (counts only, D15). The night was clean: the access step left no unmatched login and printed no access reconcile line. The section therefore lists what the step decided and loaded, so the report in #392 has the solved items beside the open ones. Cells the night did not print say not sourced and name the query.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-ACC-01 access unmatched logins A v1 login the step could not load. 0 rows solved by rule R-ACC-71, R-MIG-04 migration.step_access None needed: the night printed none No Q-02 with :step = 'access'
LED-ACC-02 access access logins, access hashes, access menus, access modules The access step's reconcile checks (a v1 login, hash, menu or allowed page that did not carry over). 0 lines solved by rule R-ACC-71, R-ACC-75, R-ACC-81, R-MIG-05 migration.check_access None needed: the night printed none No Q-09 with :check_name like 'access%'
LED-ACC-03 access the photo reader left out One of v1's logins is the photo reader. It is not a person, so it is not loaded. 1 login of 66 solved by rule R-ACC-73 migration.step_access Listed in migration.logins_left_out (TL-DP-03's reader, #240); signed in the migration file, so no reconcile line No Q-15
LED-ACC-04 access v1 logins loaded as members Each other login becomes a user, an identity (with its v1 password hash), a membership and a role at every pool. 65 logins: 65 users, 65 identities, 65 memberships, 65 roles solved by rule R-ACC-58, R-ACC-71, D50 migration.step_access Rules; no separate decision No Q-15
LED-ACC-05 access permission overrides and rental-company rows A login's v1 grants and denies become overrides; a login limited to partners becomes rental-company rows. 209 permission overrides; 5 rental-company rows solved by rule R-ACC-75, R-ACC-76 migration.step_access Rules; no separate decision No Q-15
LED-ACC-06 access the partner PSA v1 gained the partner PSA (1 login) after #319; the step stopped as an unmapped value until it was mapped. master_data already loads a rental company PSA, so it maps like AVIS, POJ and Takari. 1 login solved by rule R-ACC-76 migration.unmapped_values() (domain access), fixed in #391 zuki, 2026-10-29, in the session that wrote #391 ("signed by zuki in this session") No Q-13 with :domain = 'access'
LED-ACC-07 access sessions and stamps No v1 session is ended (R-ACC-74), and no migrated profile has an access_changed_at stamp. stamped 0 for v1's logins; the 11 stamped profiles the night saw are the E2E logins, not v1's solved by rule R-ACC-74 migration.step_access Rule No Q-15
LED-ACC-08 access the hashes out of the night migration.finish_run empties v1_auth_users and v1_auth_identities itself (R-MIG-09). logins_held 0 solved by rule R-MIG-09, D15 migration.finish_run Rule No Q-15
LED-ACC-09 access sign-in with a migrated v1 password A migrated login signs in to the local stack with its v1 password. 1 sign-in tried: signed in solved by rule R-ACC-58 BE-DP-29 block 5 zuki ran it, 2026-10-29 No none: a one-time proof on the night, run again at cutover

Counts the night did not print, for the report: logins by v1 role, permission overrides split into grants and denies, members per pool, and the role names the step mapped. Not sourced; Q-15 gives them.

The night's two runbook bugs (BE-DP-29 block 5: KeyError: 'ANON_KEY' and EOFError) are fixed in #391 and are not data items, so they have no row here.

Source: the night of 2026-11-04, BE-DP-38 run 2 on the v1 copy of 2026-11-03, logged clean by zuki on #304 (counts only, D15). The step loaded 280,908 rows at 7178ad1, and 280,914 on the second clean night at 2d4c938 (#521), with unmatched rows 46; on both, no operations line printed in the reconcile: each check was empty or signed (the 14 signed lines are under "What is signed already"; their counts that night are in BE-DP-38 block 5). The second night on that copy, which stopped before loading a row, made LED-OPS-01 necessary.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-OPS-01 operations operations nota inline files A loaded checkpoint whose nota held a file inline (a data: URI or a long base64 run) instead of a file reference. The value is kept as the marker inline file not loaded (R-INSP-19), since a row never holds a file (R-STO-05). One line, a count. 4 of 7,772 on the night of 2026-11-04 (one each in ttdPemeriksa, selfieDriver, fotoOdometer and bodyDiagram, as the copy of 2026-11-03 holds them) decided R-INSP-19, R-STO-05, D15 migration.check_operations (operations) zuki on #304 (2026-11-03: "(a), drop the three, keep the two"); the line is signed (zuki on #304, 2026-11-03: "sign … all the prints") No Q-09 with :check_name = 'operations nota inline files'
LED-OPS-02 operations unmatched work_orders: "Ready in v1 with no readyAt" A work order v1 marks Ready with no readyAt: v2's check work_orders_ready_at needs the time, and none is made up (R-WO-02). It now takes the time of its last Ready or Di-Ready-kan history entry, which v1 recorded; only one with no such entry stays unmatched (R-WO-18). 0 rows on the night of 2026-11-04 at 2d4c938 (1 at 7178ad1): 1,515 work orders, 1,415 ready, unmatched rows 46 solved R-WO-18, R-WO-10, R-WO-02, R-MIG-04 migration.step_operations (operations) zuki on #304 (2026-11-04): option b No Q-02
LED-OPS-03 operations operations status history, operations maintenance open Prints, each one counted line: the cars whose status isn't their latest v1 history row's (R-VEH-31), and the maintenance records with no end date in v1, loaded with completed_on empty (R-WO-13). The rows are listed by BE-DP-38 block 4's local query, never in the repository (D15). 113 cars and 10 records on the night of 2026-11-04 decided R-VEH-31, R-WO-13, R-MIG-06 migration.check_operations (operations) zuki on #304 (2026-11-03: "sign … all the prints", then "void, A") No BE-DP-38 block 4
LED-OPS-04 master_data, operations insurer and garage pairs The pairs R-ASR-14 adds before the claims load. 38 on the night of 2026-11-04 (39 in R-ASR-14's count on the copy of 2026-11-02) solved by rule R-ASR-14 migration.step_operations (operations) zuki on #415 (2026-11-02) No BE-DP-38 block 3

Source: BE-DP-40 run 2, 2026-11-05, on the v1 copy of 2026-11-05, from integration at a71bb16 plus the one value_map row that #548 then merged (Jabodetabek), closed succeeded and logged by zuki on #306; the lists are on #544 (counts only, D15). All five balance checks printed no line, and the open balance, Rp 2,314,031,168, equals the balance of record. Nothing below moves a loaded driver's balance. Run 2 came after D90, R-MON-95 to R-MON-97 and R-COL-21, and before R-ETLE-09 (#538). Where a cell still holds run 1's count (2026-11-05, the copy of 2026-11-02, at 7896527) or Syamsul's review on live v1 of 2026-11-05, it says so.

#544's items are settled (zuki, 2026-11-05): by Syamsul's review on #544 and by D90, except the 39 leads with a duplicate NIK created on 2026-11-04, which stay open under zuki until the next night shows them (LED-MON-01).

Lines per check on run 2, for the report: money pending payments 327, money lunas short 57, money zero instalments 38, money refunds on bills not paid in full 60, money letters renumbered 43, money letters whose text or plate disagree 10, money letters on several leads 32, money letters with another lead's item 29, money debts of another amount 1, money owed with dibayar 1, money refund flag with no amount 1, money charges with no company 1,021, unmatched rows 226, v1 unclaimed 32. Loaded: 26,183 charges, 72,442 payments, 72,483 allocations, 141 rebates, 161 refunds, 1,170 letters, 1,934 items; 174,516 rows in 6 min 56 s with the other steps.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase
LED-MON-01 money unmatched bills, claim_letters and payments: "its lead's driver isn't loaded" The bills of leads the drivers step left out load nothing, so v2 has no balance for that money. On run 1 these were 14 leads: 8 deleted in v1, 5 with no phone in v2's form, 1 whose NIK is an earlier lead's. Syamsul found 39 more leads with a duplicate NIK and bills, created on 2026-11-04 after run 1's copy; if they are the same people as earlier leads, they drop out of v2. Run 2: 77 bills on left-out leads (dibayar Rp 72,900,993 on them); money unmatched 143: bills 78 (77 and 1 due before its charge), letters 29, debts 31, payments 5, all reasons. By why the lead was left out: not sourced on run 2 (Q-16). Run 1: 41 bills on 14 leads (Rp 89,330,000 billed, Rp 76,041,243 paid, Rp 12,778,757 still owed), 6 letters, 4 payments rows open (the 39 duplicate-NIK leads only) R-MIG-04, R-MON-84, R-COL-18 migration.step_money (money) Settled by Syamsul's review on #544, item 1, except the 39 duplicate-NIK leads of 2026-11-04: open under zuki until the next night shows them (zuki, 2026-11-05) No Q-16, Q-17
LED-MON-02 money money pending payments v1 payments rows that are Pending or Ignore and match no instalment, so they load no payment. If one is money a driver really paid, the balance is too high in v2 and in v1's balance of record alike, and no balance check can see it. Run 2: 327 rows; the split not sourced (Q-18, Q-19). Run 1: 329 rows: 205 on left-out leads (the same money as LED-MON-01, not to be added to it), 4 with no such bill, 120 (Rp 27,597,941) on loaded drivers, of which 52 on charges still owed. Live v1 (Syamsul): 17 older rows with proof on owed charges. It falls as finance clears them decided R-MON-59 migration.step_money (money) Settled by Syamsul's review on #544, item 2a (zuki, 2026-11-05) No Q-18, Q-19
LED-MON-03 money money letters not paired Letters whose items load with no amount from v1. Balances aren't touched: the charge carries the money. R-COL-21 pairs by type. Run 2: 1,843 of 1,934 items with an amount, so 91 without; the line's letter count not sourced (Q-20). Run 1, before R-COL-21: 124 letters, 303 of 1,765 items, on charges of Rp 410,571,550 decided R-COL-20, R-COL-21 migration.step_money (money) #544, item 2b (2026-11-05): pair by type; settled by Syamsul's review (zuki, 2026-11-05) No Q-20, Q-21
LED-MON-04 money rebates, block 3 of BE-DP-40 Rebates load as v1 holds them. On run 1, 75% of the money was on 10 panel charges, almost all of it one charge entered wrongly and rebated. Wawan verified it on #544 (2026-11-05). Run 2: 141 rebates; their sum and the gap to v1 not sourced (Q-22). Run 1: 123 rebates, Rp 143,953,284, 13 with no reason, against v1's 127 bills with rebates, Rp 145,963,284 (Rp 510,000 of the gap on left-out leads, Rp 1,500,000 unexplained) decided R-MON-73, R-MON-78 migration.step_money (money) Settled by Syamsul's review on #544, item 3a (zuki, 2026-11-05) No Q-22, Q-23, Q-24
LED-MON-05 money v1 unclaimed: payments' unread columns Columns of payments no step reads. verif_by and verif_at, finance's confirmation trail, load as a note and are claimed (R-MON-97). Run 2: 7 columns: bukti, jenis, pic, plat, tgl_hari, edited_at, edited_by. Of 47,982 rows on run 1: bukti 4,569, edited_at and edited_by 37, the others all decided R-MIG-10, R-MON-97 v1 unclaimed (all steps) Settled by Syamsul's review on #544, item 3b (zuki, 2026-11-05) No Q-25
LED-MON-06 money money charges with no company A migrated charge takes its company from its car's platform, its driver's pref_akun or its own payments' accounts. A charge none of them answers loads with no legal entity, and is listed by v1 id for ops to settle in v1. Before D90 a charge took its contract's entity, so run 1 flagged 420 allocations (Rp 170,843,252) cross-entity only because v1's one template says MOP. Run 2: 1,021 lines; 25,162 of 26,183 charges have a company decided R-MON-95, R-MON-96, R-MON-17, R-MON-38, D90 migration.step_money (money) D90, on #544, item 3c (2026-11-05). Open with ops: the company of a driver on both platforms, and whether pref_akun follows a switch Yes Q-26, Q-27, Q-28
LED-MON-07 money money violations with several bills A v1 ETLE violation whose key more than one ETLE bill holds: no bill is chosen and no charge is linked, and the line lists it by v1 id. A violation with exactly one bill links to that bill's charge; one with none stays unlinked. Not sourced: R-ETLE-09 came after run 2, and zuki's next money run shows it on real rows. BE-DP-40's Expect puts it at 0 (etle several), from a read of the 260 ETLE rows on the copy of 2026-11-05 solved by rule R-ETLE-09, R-MON-84 migration.step_money (money) #538 No Q-09 with :check_name = 'money violations with several bills'

Source: not collected yet. The counts come from the next photo copy run on #262 (BE-DP-23, or block 7 of TL-DP-04 on staging). The copy of 2026-10-23 (logged on #262) lost its records to a db reset, and BE-DP-40's run 2 didn't rerun the photos. Counts only (D15): never a path, a file name or an object id.

ID Step Check or reason Meaning Count Status Rules and decisions Produced by Decision (zuki, when) Provisional? Check in Supabase

The check v1 unclaimed (R-MIG-10) prints every v1 table or column that no step reads yet. 60 lines on the night of 2026-11-02 (the 7 rentals columns of D84, plus whole tables and columns of operations and money; v1 gained one more manual backup table and no real table), 50 on 2026-10-29 (11 tables and 39 columns, after the 16 signed). Most belong to steps not run tonight, so they are expected until those steps merge; the ones in the rentals step are the only ones that would stay unclaimed after it.

ID Step that would read it (inferred) Tables Columns Status Rules and decisions Decision Provisional? Check in Supabase
LED-UNC-01 rentals none contracts 2, v_rental_fee_audit 5 on the night of 2026-11-02; from #405 the step reads all but the two nama columns (D84), so 2 lines: contracts.nama and v_rental_fee_audit.nama open (held by zuki) R-MIG-10, R-RNT-62, R-RNT-73 zuki signs the two nama columns as ignored with the report (D84) Yes Q-09
LED-UNC-02 money debts 1 payments 19, bills 1 written, waits for BE-DP-40 R-MIG-10 The money step (#306) claims all four tables, and of payments the columns it reads; the ones it leaves show in BE-DP-40's block 5 for zuki (LED-MON-05) No Q-09
LED-UNC-03 operations (#304) maintenance 1, work_orders 1, preparation 1, gate_logs 1, exit_tickets 1, vehicle_status_log 1, stock_opname_expected 1, stock_opname_sessions 1 checkpoints 8, vehicle_status 2, etle 1 open R-MIG-10 zuki: the operations step loads work_orders, maintenance, preparation (#324, 2026-10-28); gate_logs loads nothing and is signed, like exit_tickets (R-GATE-14; zuki on #304, 2026-11-03) No Q-09
LED-UNC-04 claims and insurance claim_letters 1 asuransi_claims 1 open R-MIG-10 None yet No Q-09
LED-UNC-05 none (undecided) onboarding_deleted 1 none open R-MIG-10 None yet; deleted onboarding rows are not read by any step Yes Q-09

The grouping by step is inferred from the table names, not from a claim; the exact lines are the output of Q-09.

Backups are signed by pattern (zuki, #591, 2026-11-10). A table no step reads whose name contains backup, in any case, is not listed by name: the check prints one line, tables named backup, with how many there are (D15: several names hold a person's name). On TL-DP-04's L0 run 1, 28 of the 40 lines were backups, so those 28 lines become one and the check prints 13. The line's count also takes in the four backups that were signed by name on 2026-10-28, whose signatures the pattern replaces, so it reads 32 if v1 still has them. A table a step claims is never under the pattern, so its unread columns are still listed.

Each item below printed a line or stopped a run on an earlier night and no longer does. They stay here so Syamsul can see what was decided and why.

ID Step What it was Count How it was solved Rules and decisions Decision (zuki, when) Provisional? Check in Supabase
SOL-01 rentals rentals and stage listed pending rentals of blacklisted and resigned drivers. 355 (294 blacklisted, 61 resigned) D83: an Approve row is pending only for an approved driver; any other stage loads it cancelled. The check now accepts cancelled for any stage but approved. R-RNT-33, R-RNT-49, D83 zuki, 2026-10-29, #302 Yes (LED-RNT-01) Q-01, Q-11
SOL-02 rentals 297 cancelled rentals where D78 had meant 5. 297 (275 on_leave, 22 suspended) D82: cancel them all; D83 then widened it (LED-RNT-01). R-RNT-33, D82 zuki "(a)", 2026-10-29, #302 Yes (LED-RNT-01) Q-01
SOL-03 rentals The rate history never loaded: the view was absent from the local v1_live, the step skipped it silently and the history check crashed. 877 rows in the copy's view The step now refuses with migration.step_rentals_no_rate_history; the history check no longer fails; v1_live is relinked with BE-DP-07. R-RNT-41, R-RNT-43 CTO and zuki, 2026-10-29 No Q-04
SOL-04 rentals Rate histories that did not fit and loaded no rental. 22 before, 3 on 2026-10-29 (19 loaded by the rule), 0 on 2026-11-02 A fee change dated before the handover is set aside; the first row starts at the handover with the fee after it. The 3 left were LED-RNT-07, solved by SOL-15. R-RNT-41, R-RNT-42, R-RNT-59 zuki, "I accept your suggested rule" (#302, 2026-10-29) Yes Q-04
SOL-05 rentals Several fee changes on one day were unmatched. Not sourced (not counted separately) They merge into one new row at the last rate of the day (as R-RNT-22 does). R-RNT-59, R-RNT-22 zuki, #302, 2026-10-29 No Q-04
SOL-06 rentals A change of the plate alone made a chain row. 253 of 877 history rows A chain row begins only at a change of the fee; the pending rentals are not chained. R-RNT-41 zuki, #302, 2026-10-29 No Q-04
SOL-07 rentals, drivers Approve rows with an empty rental fee name stopped the run (R-RNT-38) and had an empty frequency. 33 rows (32 with an empty frequency, 1 with a fee set and a frequency) They are old data: the drivers go inactive, the rows load no rental (LED-DRV-06, LED-RNT-02). One of them is a resigned driver whose row v1 treats as old. R-RNT-64, R-DRV-55 zuki, #369, 2026-10-29 Yes Q-03
SOL-08 rentals An empty deduction_frequency on a loaded row stopped the run. 2 rows (drivers who left before v1 and rejoined) A value_map row zuki signed maps it to daily; the code holds no default. R-RNT-39, R-RNT-65 zuki, #369, 2026-10-29 No Q-13
SOL-09 rentals The Listed row with an empty deduction_stopped flag stopped the run. 1 row A value_map row maps it to paused; the row itself is ignored on purpose and loads nothing (LED-RNT-06). R-RNT-36, R-RNT-66 zuki, #369, 2026-10-29 Yes (LED-RNT-06) Q-13
SOL-10 rentals The code gave a contract with no validity a term of 6. 6 contracts on 2026-10-29; 0 on 2026-11-02 No invented term: term_months is empty and the contract is listed (LED-RNT-03); zuki gave 6 months in migration.contract_terms (R-RNT-67, #399, merged in #410). R-RNT-61 zuki, #302, 2026-10-29; the terms on #399, 2026-10-30 Yes Q-05
SOL-11 rentals Booking, release and deduction end dates, and kontrak_platform, had no column. Not sourced Signed as ignored on purpose, not loaded. R-RNT-62, R-RNT-63 zuki, #302, 2026-10-29 No Q-09
SOL-12 vehicles vehicle_master and vehicle_status disagreed on a car's status. 642 cars vehicle_status is the live status; vehicle_master is the fallback and everything else. R-VEH-30 zuki, #324, 2026-10-28 (his count at 08:55) No Q-09
SOL-13 all Tables nobody will read, and the empty ones. 16 tables and columns signed Signed as v1 unclaimed; an empty table is listed again the night it has rows. R-MIG-10 zuki, #324, 2026-10-28 15:27 No Q-09
SOL-14 files v1 kept no photos before 2026-08-24. one set Signed under files expected. R-MIG-06 zuki and the higher-ups, #184, 2026-10-22 No Q-09
SOL-15 rentals Drivers 731 and 758 (and 2605) listed as unmatched, "its last rate in the history isn't the fee on its v1 row today" (LED-RNT-07). 3 on 2026-10-29, 2 on the first rerun of 2026-11-02, 0 after the fix Two changes at an identical timestamp (a dip and its recovery) were ordered by fee, so the recovery sorted first and the history seemed to end at the dip. Changes with the same timestamp are now ordered by walking the chain back from the fee on the row today; a dip and its recovery net to nothing. 2605 loads since v1 changed. R-RNT-42, R-RNT-59, R-RNT-22 Found by BE on #404, fixed in #411; no rule changed No Q-02 with :step = 'rentals', Q-04b
SOL-16 operations The step loaded v1's gate logs as gate passes, with their approvals (R-GATE-09, R-GATE-10), and operations gate passes printed 582 passes with no rental on BE-DP-38's third night. 1,376 gate logs, 582 with no rental Retired: v1's gate logs are test data, so the step loads none and table gate_logs is signed as ignored, like exit_tickets; the check operations gate passes is gone. R-GATE-14 zuki, 2026-11-03, #304 No Q-09 with :check_name = 'v1 unclaimed'

These areas print no line tonight because their step was not run in this night. Run each, then fill its table above in the same columns.

Area Issue What to run Expected to print
Photo copy, into its section above #262, #184 BE-DP-23, on the stack with the v1 files link files expected, file_map rows by status

Fill the :placeholders. Run on v2 unless marked v1. :run_id is (select max(id) from migration.runs).

Run once. Each pattern was run once on 2026-10-29 on the night's local stack with sample values and returned without error, except Q-15, which was written on 2026-10-30 and has not been run; the patterns that take an id return rows only for ids that exist. They have not been checked against staging. There is no Q-08: the ids are kept as the ledger cells cite them.

Q-01 · Cancelled rentals by driver stage (LED-RNT-01, LED-DRV-02, SOL-01, SOL-02)

-- the lines the check prints
select d.stage, count(*) from public.rentals r
join migration.id_map m on m.entity = 'rental' and m.v2_id = r.id and m.v1_key !~ ':'
join public.drivers d on d.id = r.driver_id
where r.status = 'cancelled' group by 1 order by 1;
-- the rows of one stage, by v1 ids
select d.legacy_id as lead_id, m.v1_key as onboarding_id from public.rentals r
join migration.id_map m on m.entity = 'rental' and m.v2_id = r.id and m.v1_key !~ ':'
join public.drivers d on d.id = r.driver_id
where r.status = 'cancelled' and d.stage = :stage;

Q-02 · Unmatched rows by step, table and reason

select step, v1_table, reason, count(*) from migration.unmatched
where run_id = :run_id group by 1, 2, 3 order by 1, 2, 3;
-- the rows of one reason, by v1 key
select v1_table, v1_key from migration.unmatched
where run_id = :run_id and step = :step and reason = :reason;

Q-03 · The old-data rows (LED-DRV-06, LED-RNT-02, SOL-07)

-- v1: the rows (Approve, empty rental fee name), and how many have an empty frequency or a fee
select count(*), count(*) filter (where coalesce(trim(data ->> 'deduction_frequency'), '') = '') as empty_frequency,
count(*) filter (where coalesce(trim(data ->> 'rental_fee'), '') <> '') as fee_set
from legacy.onboarding
where trim(data ->> 'status') = 'Approve' and coalesce(trim(data ->> 'rental_fee_name'), '') = '';
-- v2: the stage their drivers got, by v1 lead status
select d.stage, trim(l.data ->> 'status') as v1_lead_status, count(*)
from legacy.onboarding o
join legacy.leads l on l.lid::text = o.data ->> 'lid'
join public.drivers d on d.legacy_id = l.lid
where trim(o.data ->> 'status') = 'Approve' and coalesce(trim(o.data ->> 'rental_fee_name'), '') = ''
group by 1, 2 order by 1, 2;
-- v2: no rental of theirs
select count(*) from public.rentals r join public.drivers d on d.id = r.driver_id
where d.legacy_id = :lead_id;

Q-04 · Rate history, and the changes set aside (LED-RNT-04, SOL-03 to SOL-06)

-- history rows by source and whether the fee changed
select sumber, rental_fee_before is distinct from rental_fee_after as fee_changed, count(*)
from legacy.v_rental_fee_audit group by 1, 2;
-- changes dated before the handover (in the pool's date), for a loaded active rental
select a.driver_id as lead_id, a.waktu_perubahan, a.rental_fee_before, a.rental_fee_after,
migration.v1_day(o.data ->> 'tgl_assign') as handover
from legacy.v_rental_fee_audit a
join legacy.onboarding o on o.data ->> 'lid' = a.driver_id::text
join migration.id_map m on m.entity = 'rental' and m.v1_key = o.id::text
join public.rentals r on r.id = m.v2_id and r.status = 'active'
join public.drivers d on d.id = r.driver_id join public.pools p on p.id = d.pool_id
where a.sumber = 'bills_archive' and a.rental_fee_before is distinct from a.rental_fee_after
and (a.waktu_perubahan at time zone p.timezone)::date < migration.v1_day(o.data ->> 'tgl_assign')
and a.driver_id = :lead_id;
-- Q-04b (v1 side, LED-RNT-07): one driver's history beside his fee today
select a.waktu_perubahan, a.rental_fee_before, a.rental_fee_after, o.data ->> 'rental_fee' as fee_today
from legacy.v_rental_fee_audit a join legacy.onboarding o on o.data ->> 'lid' = a.driver_id::text
where a.driver_id = :lead_id order by a.waktu_perubahan;

Q-04c · The chain figure for R-RNT-41 (LED-RNT-04, SOL-04). The repo text does not show which number R-RNT-41 meant: the 98 of the night of 2026-10-29 is a count of earlier rows (rentals with a : in their id_map key), not of drivers; BE-DP-34's 117 is Listed drivers with any fee change in v1, and its 97 is drivers with two or more audit rows. They measure different things. Answered on the night of 2026-11-02: 112 chained drivers (113 earlier rows) on the copy of that day; on the copy of 2026-10-29 the figure is 98 (101 drivers with a change after the handover, less 3 whose days net to zero). The 98 and the 117 were never the same measure, and the figure grows with v1. This pair compares like with like. zuki runs both, on the local stack of that night; read only, counts only.

-- v2: what the step loaded (be-dp-36 block 3)
select count(distinct r.driver_id) as chained_drivers, count(*) as earlier_rows
from public.rentals r join migration.id_map m on m.entity = 'rental' and m.v2_id = r.id and m.v1_key ~ ':';
-- v1 side: Listed drivers with a bills_archive fee change dated on or after the handover (Asia/Jakarta, the one pool),
-- less the drivers the step listed as unmatched. Several changes on one day count once, as the step merges them.
select count(distinct a.driver_id) as listed_drivers_with_a_change_after_handover
from legacy.v_rental_fee_audit a
join legacy.onboarding o on o.data ->> 'lid' = a.driver_id::text and trim(o.data ->> 'status') = 'Listed'
where a.sumber = 'bills_archive' and a.rental_fee_before is distinct from a.rental_fee_after
and (a.waktu_perubahan at time zone 'Asia/Jakarta')::date >= migration.v1_day(o.data ->> 'tgl_assign')
and a.driver_id::text not in (select u.v1_key from migration.unmatched u
where u.run_id = (select max(id) from migration.runs) and u.step = 'rentals'
and u.v1_table = 'v_rental_fee_audit');

If the two driver counts differ, the difference is the drivers whose changes the step set aside or merged to nothing (a change back to the same fee on the same day), or whose history the step could not place. Say the count here once run.

Q-05 · Contracts with no term, and the terms given (LED-RNT-03, SOL-10)

select d.legacy_id as lead_id, c.status, c.effective_on from public.contracts c
join public.rentals r on r.id = c.rental_id join public.drivers d on d.id = r.driver_id
where c.term_months is null;
-- the v1 validity behind one of them
select o.data ->> 'validity' from legacy.onboarding o where o.data ->> 'lid' = :lead_id::text;
-- R-RNT-67: the terms zuki has given, and the rows the step did not use (counts and ids only)
select lead_id, term_months, signed_by, signed_at from migration.contract_terms order by lead_id;
select row_key, detail from migration.check_rentals('terms_unused') order by 1;

Q-16 · Did the driver change vehicles? (LED-RNT-07). Answered on #398 (zuki ran it on the copy of 2026-10-29; the verdict is the lead's reading of his output): the three histories hold 3, 3 and 4 plates, so the drivers changed vehicles; that did not explain the fee comparison. The cause was a timestamp tie (SOL-15). Read only; counts and v1 ids only, no plate is printed (D15). For the 3 drivers of LED-RNT-07 (onboarding 100, 127, 1346; leads 731, 758, 2605). zuki runs it on the v1 copy of 2026-10-29. Each row compares the history's last rate with the fee on the onboarding row today, and the vehicle on the row today with the vehicles the history belongs to. A driver whose plate_today_in_history is false, or whose plates_in_history is more than 1, changed vehicles; the history then belongs to more than one car.

with h as (
select a.driver_id, a.waktu_perubahan, a.rental_fee_after, a.plat_before, a.plat_after,
row_number() over (partition by a.driver_id order by a.waktu_perubahan desc) as rn
from legacy.v_rental_fee_audit a
where a.sumber = 'bills_archive' and a.driver_id in (731, 758, 2605))
select o.id as onboarding_id, (o.data ->> 'lid')::int as lead_id,
(select h.rental_fee_after from h where h.driver_id = (o.data ->> 'lid')::int and h.rn = 1) as last_rate,
o.data ->> 'rental_fee' as fee_today,
(select count(distinct p) from h, lateral (values (h.plat_before), (h.plat_after)) v (p)
where h.driver_id = (o.data ->> 'lid')::int and p is not null) as plates_in_history,
exists (select 1 from h where h.driver_id = (o.data ->> 'lid')::int
and upper(regexp_replace(o.data ->> 'assigned_plat', '[^A-Za-z0-9]', '', 'g'))
in (upper(regexp_replace(h.plat_before, '[^A-Za-z0-9]', '', 'g')),
upper(regexp_replace(h.plat_after, '[^A-Za-z0-9]', '', 'g')))) as plate_today_in_history,
(select (upper(regexp_replace(h.plat_after, '[^A-Za-z0-9]', '', 'g'))
= upper(regexp_replace(o.data ->> 'assigned_plat', '[^A-Za-z0-9]', '', 'g')))
from h where h.driver_id = (o.data ->> 'lid')::int and h.rn = 1) as plate_today_is_last_in_history
from legacy.onboarding o
where o.id in (100, 127, 1346) order by o.id;

Q-17 · A driver at one pool and a car at another (LED-RNT-13). Run on the night of 2026-11-02: 0. v2, counts only. In the copy of 2026-10-29 there is one pool, so the expected count is 0; it matters when a second pool loads.

select count(*) as rentals_with_driver_and_car_at_different_pools
from public.rentals r join public.drivers d on d.id = r.driver_id join public.vehicles v on v.id = r.vehicle_id
where d.pool_id is distinct from v.home_pool_id;

Q-06 · The ignored Listed row (LED-RNT-06)

-- the count beside the Listed count, and no rental or unmatched row for it
select row_key, detail from migration.check_rentals('ignored');
select count(*) from migration.unmatched where step = 'rentals' and v1_table = 'onboarding' and v1_key = :ob_id;
select count(*) from migration.id_map where entity = 'rental' and v1_key = :ob_id;

Q-07 · NIKs and phones (LED-DRV-01, LED-DRV-04)

-- v2: drivers loaded with no NIK
select d.legacy_id from public.drivers d where d.nik is null and d.legacy_id is not null;
-- Q-07b (v1): leads whose NIK is not 16 digits, and those whose hp is not a mobile number
select l.lid, length(regexp_replace(coalesce(l.data ->> 'ktp', ''), '[^0-9]', '', 'g')) as nik_digits
from legacy.leads l
where length(regexp_replace(coalesce(l.data ->> 'ktp', ''), '[^0-9]', '', 'g')) <> 16;
select l.lid from legacy.leads l where l.lid = :lead_id;

Q-09 · The reconcile, line by line

select check_name, count(*) from migration.reconcile() group by 1 order by 1;
select row_key, detail from migration.reconcile() where check_name = :check_name;
-- what is signed
select check_name, count(*) from migration.accepted_differences group by 1;

Q-10 · master pricing, master insurers added and vehicle brands (LED-MD-01, LED-MD-02, LED-VEH-01)

select row_key, detail from migration.reconcile() where check_name = :check_name;

Q-11 · Rentals per status (LED-RNT-05, SOL-01)

select status, count(*) from public.rentals group by 1 order by 1;
select count(*) from public.rentals r join migration.id_map m on m.entity = 'rental' and m.v2_id = r.id;
select row_key, detail from migration.reconcile() where check_name in ('rentals per status', 'rentals and stage');

Q-12 · Contracts by status and the placeholder template (LED-RNT-10)

select status, count(*) from public.contracts group by 1 order by 1;
select name, is_active from public.contract_templates where name = 'Kontrak dari v1';

Q-13 · The signed empty values (SOL-08, SOL-09)

select field, v1_value, v2_value from migration.value_map
where domain = 'rentals' and v1_value = '';

Q-14 · Onboarding rows with a contract date and no contracts row (LED-RNT-12, v1)

select count(*) from legacy.onboarding o
where coalesce(o.data ->> 'kontrak', '') <> ''
and not exists (select 1 from legacy.contracts c where c.lid::text = o.data ->> 'lid');

Q-15 · The access step's loaded rows (LED-ACC-03 to LED-ACC-08)

-- the rows the step wrote, as the audit log counts them
select table_name, (new_data ->> 'rows')::int as rows from public.audit_log
where action = 'migrated' and record_id = (select max(id) from migration.runs)::text and new_data ->> 'step' = 'access'
order by id;
-- members by role (v2): counts only
select r.code, count(*) from public.member_roles mr join public.roles r on r.id = mr.role_id group by 1 order by 1;
-- profiles stamped (should be the E2E logins only, none of v1's)
select count(*) filter (where access_changed_at is not null) as stamped, count(*) as profiles from public.profiles;
-- the logins left out of the load
select count(*) from migration.logins_left_out;

The money queries. Q-16 to Q-28 are #544's, run by zuki on the night of the copy of 2026-11-02. Each takes the latest money run. Those marked legacy read legacy.*, so they need a loaded night, and a db reset empties it.

Q-16 · The bills left out, by why their lead was left out (LED-MON-01, legacy)

with left_out as (
select b.data ->> 'lead_id' as lead_id,
(b.data ->> 'total')::numeric as total,
coalesce(nullif(trim(b.data ->> 'rebate'), '')::numeric, 0) as rebate,
coalesce(nullif(trim(b.data ->> 'dibayar'), '')::numeric, 0) as dibayar
from legacy.bills b
left join migration.id_map m on m.entity = 'driver' and m.v1_key = b.data ->> 'lead_id'
where m.v2_id is null)
select coalesce(u.reason, '(no reason recorded)') as why_left_out,
count(distinct l.lead_id) as leads, count(*) as bills, sum(l.total) as billed,
sum(l.rebate) as rebated, sum(l.dibayar) as paid,
sum(greatest(l.total - l.rebate - l.dibayar, 0)) as still_owed
from left_out l
left join migration.unmatched u on u.step = 'drivers' and u.v1_table = 'leads' and u.v1_key = l.lead_id
and u.run_id = (select max(run_id) from migration.money_lists)
group by 1 order by 3 desc;

Q-17 · What else of theirs was left out (LED-MON-01)

select v1_table, reason, count(*) as rows from migration.unmatched
where step = 'money' and run_id = (select max(run_id) from migration.money_lists)
and (reason like '%driver isn''t loaded%' or reason like '%loaded no charge%')
group by 1, 2 order by 1, 3 desc;

Q-18 · Every payments status, and how much of it is on the list (LED-MON-02, legacy)

select p.verif_status, count(*) as rows, sum(p.amount) as amount,
count(l.v1_key) as listed, sum(p.amount) filter (where l.v1_key is not null) as listed_amount,
count(*) filter (where l.v1_key is not null and nullif(trim(p.bukti), '') is not null) as listed_with_proof
from legacy.payments p
left join migration.money_lists l on l.list = 'pending payments' and l.v1_key = p.id::text
and l.run_id = (select max(run_id) from migration.money_lists)
group by 1 order by 2 desc;

Q-19 · The risky pending rows: is the bill still owed, and how old is the row (LED-MON-02, legacy)

select coalesce(c.status::text, '(no charge)') as charge_status,
case when p.tanggal >= now() - interval '30 days' then 'last 30 days' else 'older' end as age,
count(*) as rows, sum(p.amount) as amount, count(distinct p.lead_id) as drivers
from migration.money_lists l
join legacy.payments p on p.id::text = l.v1_key
left join migration.id_map m on m.entity = 'charge' and m.v1_key = p.bill_id::text
left join public.charges c on c.id = m.v2_id
where l.list = 'pending payments' and l.run_id = (select max(run_id) from migration.money_lists)
group by 1, 2 order by 4 desc;

Q-20 · The empty letter items by charge type (LED-MON-03)

select t.code, count(*) as items, count(distinct i.debt_letter_id) as letters, sum(c.amount) as charges
from public.debt_letter_items i
join public.charges c on c.id = i.charge_id
join public.charge_types t on t.id = c.charge_type_id
where i.legacy_amount is null
group by 1 order by 2 desc;

Q-21 · Why those letters didn't pair, and v1's total for them (LED-MON-03, legacy)

select case when jsonb_array_length(t.data -> 'debtIds') <> jsonb_array_length(t.data -> 'items')
then 'lengths differ' else 'one length, a sumber differs' end as why,
count(*) as letters, sum(nullif(trim(t.data ->> 'total'), '')::numeric) as v1_total
from legacy.claim_letters t
join migration.id_map m on m.entity = 'debt_letter' and m.v1_key = t.id::text
where jsonb_typeof(t.data -> 'debtIds') = 'array' and jsonb_typeof(t.data -> 'items') = 'array'
and exists (select 1 from public.debt_letter_items i where i.debt_letter_id = m.v2_id and i.legacy_amount is null)
group by 1;

Q-22 · v1's rebates against what loaded (LED-MON-04, legacy)

select count(*) as v1_bills_with_rebate, sum(nullif(trim(b.data ->> 'rebate'), '')::numeric) as v1_rebated
from legacy.bills b where coalesce(nullif(trim(b.data ->> 'rebate'), '')::numeric, 0) > 0;

Q-23 · Rebates by charge type, with the missing reasons (LED-MON-04)

select t.code, count(*) as rebates, sum(a.amount) as rebated, sum(c.amount) as charges,
count(*) filter (where a.amount = c.amount) as in_full,
count(*) filter (where a.reason = 'v1: no reason recorded') as no_reason
from public.charge_adjustments a
join public.charges c on c.id = a.charge_id
join public.charge_types t on t.id = c.charge_type_id
where a.kind = 'rebate'
group by 1 order by 3 desc;

Q-24 · The reasons on the panel rebates, one row each: read in Studio, never paste it out (LED-MON-04)

select a.reason, a.amount as rebated, c.amount as charge
from public.charge_adjustments a
join public.charges c on c.id = a.charge_id
join public.charge_types t on t.id = c.charge_type_id
where a.kind = 'rebate' and t.code = 'panel_damage'
order by 2 desc;

Q-25 · How much each unread payments column holds (LED-MON-05, legacy)

select count(*) as rows, count(nullif(trim(bukti), '')) as bukti, count(edited_at) as edited_at,
count(nullif(trim(edited_by), '')) as edited_by, count(nullif(trim(jenis), '')) as jenis,
count(nullif(trim(pic), '')) as pic, count(nullif(trim(plat), '')) as plat,
count(tgl_hari) as tgl_hari, count(verif_at) as verif_at, count(nullif(trim(verif_by), '')) as verif_by
from legacy.payments;

Q-26 · Charges with a rental, with and without an entity (LED-MON-06)

select count(*) as charges, count(legal_entity_id) as with_entity, sum(amount) as amount,
sum(amount) filter (where legal_entity_id is null) as amount_no_entity
from public.charges where rental_id is not null;

Q-27 · Rentals with a contract, and contracts by entity (LED-MON-06)

select count(distinct r.id) as rentals, count(distinct c.rental_id) as with_contract
from public.rentals r left join public.contracts c on c.rental_id = r.id;
select e.code, count(*) as contracts
from public.contracts c
join public.contract_templates t on t.id = c.template_id
join public.legal_entities e on e.id = t.legal_entity_id
group by 1;

Q-28 · Which account paid which entity's charge (LED-MON-06)

select pe.code as paid_to, ce.code as charge_entity, count(*) as allocations, sum(a.amount) as amount,
count(*) filter (where a.cross_entity) as flagged
from public.payment_allocations a
join public.payments p on p.id = a.payment_id
join public.company_bank_accounts b on b.id = p.bank_account_id
join public.legal_entities pe on pe.id = b.legal_entity_id
join public.charges c on c.id = a.charge_id
left join public.legal_entities ce on ce.id = c.legal_entity_id
group by 1, 2 order by 1, 2;

LED-DRV-04, LED-DRV-07, LED-RNT-11, LED-RNT-12, LED-RNT-13, LED-MON-01 (the 39 duplicate-NIK leads of 2026-11-04, under zuki, until the next night shows them), LED-UNC-01 to LED-UNC-05. Provisional (decided, but a review could change it): LED-RNT-03 (the six terms are zuki's), LED-MON-06, LED-DRV-02, LED-DRV-06, LED-RNT-01, LED-RNT-02, LED-RNT-04, LED-RNT-05, LED-RNT-10, SOL-04, SOL-07.