Skip to content

WO · Work orders and maintenance

A return opens a work order, the hub until the car is ready again; so does adding a car (R-VEH-22). The return's reason sets where it starts: an accident or a breakdown waits for the Preparation Team to route it to insurance, maintenance or a pool repair, and every other reason goes to preparation. It becomes ready only through the Preparation Leader's check. Preparation is every step that gets a car to ready, not cleaning, and the Preparation Team is the checker team, led by admin_fleet (D94, glossary). Every hand-off is a work_order_events row. Code WO.

D61 names three flows that must not break on the first Monday after cutover: driver onboarding (the queue to an approved driver), vehicle onboarding (a new car to ready) and collection (an overdue driver to a call, a surat hutang and a payment). Their rules get the most tests, refusals included, and the hardest review. On this page:

  • Vehicle onboarding: R-WO-01 to R-WO-04, R-WO-08 and R-WO-09: a new car's work order to the Preparation Leader's check.

These questions are open in #84. Each gets a rule with a new ID once it is answered.

  • The Work orders rules after the review. R-WO-01 to R-WO-04 stay open after #144. D47 settles the routing and the leader's check (R-WO-05 to R-WO-09).
  • A pool repair when no maintenance is needed (VEH-21 Tidak → VEH-23): the sheet asks what it means; it stays as drawn.
  • How the enum reason is filled, or made nullable, for loaded work orders. v2's work_orders.reason is return_reason not null (migration 20261006000700_operations.sql), so it can't hold v1's free text (R-WO-14). BE proposes; not decided here.
  • A replacement car (v1's 'UNIT GS', unit ganti sewa). Needs no mapping in v2: the driver's current rental ends and a new rental row with the replacement car is created, as the v2 flow. The rules for it are with the rentals page (R-RNT); nothing is loaded by this step.
  • Rows whose pic or createdBy names a person. They stay text in a note (R-WO-10); whether any becomes a member is for zuki.
  • The checker's quick check (VEH-29): answered by D94. The checker team routes a return at its inspection: a car that is fine goes to preparation, one that needs repair to insurance, maintenance or a pool repair, and no separate quick-check record is kept. Its rules and functions are M5's.

R-WO-01 · A car has at most one open work order

Section titled “R-WO-01 · A car has at most one open work order”
  • Status: built
  • Example: given a car with a work order still routed to maintenance, when a second work order is opened for it, then it is refused.
  • Refusal: none: unique_violation (23505), from work_orders_one_open_per_vehicle.
  • Who: every writer.
  • Source: [Ref] Data model V13: work_orders.

R-WO-02 · A ready work order records when it became ready

Section titled “R-WO-02 · A ready work order records when it became ready”
  • Status: built
  • Example: given a work order, when its status is set to ready with no ready_at, then it is refused.
  • Refusal: none: check_violation (23514).
  • Who: every writer.
  • Source: [Ref] Data model V13: work_orders.

R-WO-03 · Reading work orders and maintenance records needs work_order:read at their pool

Section titled “R-WO-03 · Reading work orders and maintenance records needs work_order:read at their pool”
  • Status: planned
  • Example: given a checker at PML, when they read work_orders, then nothing comes back; a maintenance user at PML sees them.
  • Refusal: none: hidden.
  • Who: super_admin, admin, admin_fleet, maintenance, asuransi and viewer hold work_order:read.
  • Source: [Ref] Roles, policy matrix.

R-WO-04 · Adding or changing a work order or a maintenance record needs maintenance:write at its pool

Section titled “R-WO-04 · Adding or changing a work order or a maintenance record needs maintenance:write at its pool”
  • Status: planned
  • Example: given an asuransi user at PML, when they route a work order, then nothing changes; a maintenance user at PML may.
  • Refusal: none: insufficient_privilege (42501) on insert; no effect on update.
  • Who: super_admin, admin, admin_fleet and maintenance hold maintenance:write.
  • Source: [Ref] Roles, policy matrix.

R-WO-05 · A work order opened for a return with reason accident or breakdown starts with no route, waiting for the Preparation Team to route it to insurance, maintenance or a pool repair

Section titled “R-WO-05 · A work order opened for a return with reason accident or breakdown starts with no route, waiting for the Preparation Team to route it to insurance, maintenance or a pool repair”
  • Status: planned
  • Example: given a car returned after an accident, when its work order is opened, then it is waiting with no route; the Preparation Team routes it to insurance (VEH-20), maintenance (VEH-22) or a pool repair (VEH-23).
  • Refusal: none.
  • Who: the return and work order functions (M5).
  • Source: D47; General Flow VEH-17 → VEH-18 → VEH-19, VEH-21.

R-WO-06 · A work order opened for a return with any other reason starts routed to preparation

Section titled “R-WO-06 · A work order opened for a return with any other reason starts routed to preparation”
  • Status: planned
  • Example: given a car returned because its driver resigned, when its work order is opened, then it is routed to preparation (VEH-24); so is a repossessed or swapped car's.
  • Refusal: none.
  • Who: the return and work order functions (M5).
  • Source: D47; General Flow VEH-17 → VEH-24 (through VEH-29).

R-WO-07 · The Preparation Team may change the route a work order starts on

Section titled “R-WO-07 · The Preparation Team may change the route a work order starts on”
  • Status: planned
  • Example: given a work order that starts on preparation, when the Preparation Team finds a fault and routes it to maintenance, then the route is maintenance and a work_order_events row records the change.
  • Refusal: none: no effect without maintenance:write (R-WO-04).
  • Who: the Preparation Team, through the work order functions (M5).
  • Source: D47 (the reason only sets where it starts); General Flow VEH-19, VEH-21.

R-WO-08 · A work order becomes ready only when its preparation inspection, the Preparation Leader's check, has outcome ok

Section titled “R-WO-08 · A work order becomes ready only when its preparation inspection, the Preparation Leader's check, has outcome ok”
  • Status: planned
  • Example: given a work order whose repair is done, when the Preparation Leader's preparation inspection reads ok, then the work order is ready, with ready_at and ready_by (R-WO-02); setting it ready without that inspection is refused.
  • Refusal: a key named by BE in M5.
  • Who: holders of preparation:approve: admin_fleet, the Preparation Team's leader, with admin and super_admin (R-ACC-65, D94).
  • Source: D47; D41 (VEH-24 → VEH-28 stays blocked); General Flow VEH-26, VEH-27 → VEH-28 (Data Constraints: the QC guard). The Who: D94 (no preparation_leader role, #587).

R-WO-09 · A Preparation Leader's check with outcome needs_insurance or needs_maintenance sends the work order back to be routed

Section titled “R-WO-09 · A Preparation Leader's check with outcome needs_insurance or needs_maintenance sends the work order back to be routed”
  • Status: planned
  • Example: given a car whose preparation inspection reads needs_maintenance, when it is saved, then the work order goes back to waiting for the Preparation Team to route it, and the car stays not ready.
  • Refusal: none.
  • Who: the work order functions (M5).
  • Source: D47; General Flow VEH-27 → VEH-18 (rework).

R-WO-10 · The operations step loads each v1 work order as one work order, its status through value_map: Menunggu to waiting, Diarahkan to routed, Selesai Perbaikan to repair_done, Ready to ready

Section titled “R-WO-10 · The operations step loads each v1 work order as one work order, its status through value_map: Menunggu to waiting, Diarahkan to routed, Selesai Perbaikan to repair_done, Ready to ready”
  • Status: built
  • Example: given v1's 1,515 work orders on the v1 copy of 2026-11-02 (v1copy) (Ready 1,415, Diarahkan 93, Menunggu 7), when the step has run twice, then v2 holds 1,515 work orders with the same ids both times (R-MIG-03): 1,415 ready, 93 routed, 7 waiting, none repair_done on that copy (Selesai Perbaikan keeps its value_map row). The 100 that aren't ready are the cars in the workshop at cutover. v1's dest (the field belongs to work orders, not to preparation) becomes the route through value_map (R-MIG-02): preparation 1,280, asuransi 159, maintenance 69 and 7 empty, all 7 empty being the Menunggu ones. A work order with an empty dest keeps its route empty (nullable). These counts move with v1 (D75), so the step's reconcile reads the live copy; the earlier copy of 2026-10-29 had 1,234 (Ready 1,149, Diarahkan 80, Menunggu 3, Selesai Perbaikan 2). Its reason is free text kept in legacy_reason (D84's naming), never mapped to a return_reason (R-WO-14). A ready work order has ready_at (R-WO-02): v1's readyAt, or, where v1 has none, the time R-WO-18 takes from its history. Its inspection is the return inspection of the same car on the same day (1,436 of the 1,441 returns have a work order that day, R-INSP-18), empty when there is none. v1's pic and createdBy are text and are kept as the note of the opened event, not guessed as members.
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; zuki agreed on #304 (2026-10-28, via the CTO) that the step loads work_orders, maintenance and preparation, and on #324; BE's proposal on #304; BE-DP-35's run on the copy of 2026-10-29; R-MIG-02; R-MIG-03; R-MIG-04.

R-WO-11 · A car with two or more work orders that aren't ready in v1 loads its latest only, and the others are listed as unmatched

Section titled “R-WO-11 · A car with two or more work orders that aren't ready in v1 loads its latest only, and the others are listed as unmatched”
  • Status: built
  • Example: given a v1 car with two work orders neither Ready, when the step runs, then the latest loads as the car's one open work order (R-WO-01) and the other is listed in migration.unmatched with its reason (R-MIG-04); no row is dropped without being listed. On the v1 copy of 2026-11-02 (v1copy) no car has two (0 cars; the 100 not Ready are on 100 cars).
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; zuki agreed on #304 (2026-10-28, via the CTO) that the step loads work_orders, maintenance and preparation, and on #324; BE's proposal on #304; BE-DP-35's run on the copy of 2026-10-29; R-MIG-02; R-MIG-03; R-MIG-04.

R-WO-12 · Each entry of a v1 work order's history loads as a work_order_events row, in order and with its time

Section titled “R-WO-12 · Each entry of a v1 work order's history loads as a work_order_events row, in order and with its time”
  • Status: built
  • Example: given v1's work orders holding 4,823 history entries, when the step runs, then 4,823 work_order_events rows load on their work orders, in the order and at the time v1 wrote them, each with an action from the value_map row of the entry's first word (R-MIG-02) and the entry's text in the note: Masuk to opened, Diarahkan to routed, Ready and Di-Ready-kan to ready, and Preparation, Checker, Tujuan, Klaim, Service, Sinkron, Ganti, Pemulihan and Dikembalikan to note, since a work order's status comes from v1's status, not from its events; an entry whose first word doesn't give its meaning is a note with its text kept, and a first word with no row stops the step; an entry with no time is listed (R-MIG-05), never given one.
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; zuki agreed on #304 (2026-10-28, via the CTO) that the step loads work_orders, maintenance and preparation, and on #324; BE's proposal on #304; BE-DP-35's run on the copy of 2026-10-29; R-MIG-02; R-MIG-03; R-MIG-04. The first words and their actions: BE-DP-38's first night, accepted by zuki on #439 (2026-11-03); the rows are in #442. Dikembalikan to note: zuki on #701 (2026-11-20).

R-WO-13 · The operations step loads each v1 maintenance row as one maintenance record, its mode through value_map: Sudah Terjadi to occurred, Rencana to planned

Section titled “R-WO-13 · The operations step loads each v1 maintenance row as one maintenance record, its mode through value_map: Sudah Terjadi to occurred, Rencana to planned”
  • Status: built
  • Example: given v1's 708 maintenance rows on the v1 copy of 2026-11-02 (v1copy) (jenis_service Berkala 625, Non Berkala 60, Ban 18, Aki 5), when the step has run twice, then 708 records load with the same ids both times (R-MIG-03). Its kind comes from jenis_service through value_map: Berkala to periodic, Non Berkala to non_periodic, Ban to tyre and Aki to battery, each of v1's four values having a v2 kind, so a fifth value stops the step (R-MIG-02). Its mode maps Sudah Terjadi to occurred and Rencana to planned (545 and 73 on the earlier copy of 2026-10-29, which held 618 rows), and its priority maps Rendah, Sedang and Tinggi to low, medium and high. The '2. Undermaintain - TOP' and 'Asuransi' texts are another field and don't set the kind. It is linked to the work order open on the same car at its start date (112 of the 708 have one, 596 do not; the 596 load with the link empty, R-WO-15). The rows with no end date (13 on the earlier copy) load with completed_on empty, and no date is made up; the reconcile prints one line under operations maintenance open with their count (10 on the copy of 2026-11-03), not a line per record, and zuki on #304 (2026-11-03) signed that line (R-MIG-05, R-MIG-06). The records themselves are listed by a local query in BE-DP-38.
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; zuki agreed on #304 (2026-10-28, via the CTO) that the step loads work_orders, maintenance and preparation, and on #324; BE's proposal on #304; BE-DP-35's run on the copy of 2026-10-29; R-MIG-02; R-MIG-03; R-MIG-04.

R-WO-14 · A v1 work order's reason is free text and loads as the text v1 wrote, never stopping the step and never mapped to a category

Section titled “R-WO-14 · A v1 work order's reason is free text and loads as the text v1 wrote, never stopping the step and never mapped to a category”
  • Status: built
  • Example: given v1's work orders whose reason holds about 50 one-off texts (54 values used fewer than 3 times) and common ones such as '1. Not Ready' (21 rows), 'MASUK ASURANSI' (5) and 'UNIT GS' (4), when the step runs, then every work order loads and its reason text is kept as v1 wrote it in legacy_reason, with no enum, no value_map row and no category. work_orders.reason, the return_reason v2 gives every new work order, is nullable and stays empty on a loaded row, and a check requires one of reason and legacy_reason, so an empty v1 reason loads as empty text in legacy_reason. No text is read for a person's name, and nothing here prints one (D15).
  • Refusal: none.
  • Who: the data phase's operations step (#304).
  • Source: zuki on #415 (2026-11-02: the reason is free text; keep it as a string, no categorization until the higher ups want it); D84 (v1-only data in legacy_ columns). The nullable reason, legacy_reason and the check: BE's proposal in #439, accepted by zuki on #439 (2026-11-03). What the odd texts mean, as the Source of this rule and not as a mapping: '1. Not Ready' is a returned car for which a work order is made for its preparation phase; Cuti, Selesai Kontrak and '-' are the default flow, with no special reason; 'UNIT GS' is a unit ganti sewa, a replacement car while the driver's car is in repair.
Section titled “R-WO-15 · A v1 return, preparation or maintenance row with no work order loads with its work order link empty, and the reconcile counts it as "no work order in v1"”
  • Status: built
  • Example: given a v1 return checkpoint whose car has no work order that day, when the step runs, then its inspection loads with no work order link (R-WO-10) and no work order is made for it; the same holds for a preparation row (R-INSP-21) and a maintenance row (R-WO-13). The reconcile prints, per table, how many rows had no work order in v1, and lists none of them as a difference: on the v1 copy of 2026-11-02 (v1copy), 5 of the 1,441 return checkpoints, 221 of the 1,069 preparation rows and 596 of the 708 maintenance rows (no work order open at their start).
  • Refusal: none.
  • Who: the data phase's operations step (#304); the reconcile check.
  • Source: zuki on #415 (2026-11-02: option b; no work order is invented for older data); R-MIG-05.

R-WO-16 · A maintenance record is read at its work order's pool or at its car's home pool

Section titled “R-WO-16 · A maintenance record is read at its work order's pool or at its car's home pool”
  • Status: planned
  • Example: given a maintenance record of a PML car whose work order is at SBY, when a maintenance user at PML reads it, then it comes back; so does it for one at SBY; one at a third pool gets nothing. A record with no work order is read at the car's home pool. This widens R-WO-03's pool for records.
  • Refusal: none.
  • Who: super_admin, admin, admin_fleet, maintenance, asuransi and viewer hold work_order:read (R-WO-03).
  • Source: zuki's answer on #236 (2026-10-26, #84 WO open 1: read at the work order's pool or the car's home pool), accepted on 2026-11-02.

R-WO-17 · A request for maintenance is made only at the car's pool, never across pools

Section titled “R-WO-17 · A request for maintenance is made only at the car's pool, never across pools”
  • Status: planned
  • Example: given a PML car, when a maintenance user at SBY makes a maintenance request for it, then it is refused; one at PML may. The request is a maintenance record made for the car (R-VEH-20 holds the same for work orders while allow_cross_pool_operations is off).
  • Refusal: none: insufficient_privilege (42501) on insert.
  • Who: every writer of maintenance records (R-WO-04).
  • Source: zuki's answer on #236 (2026-10-26, #84 WO open 1: a request is made only at the car's pool), accepted on 2026-11-02. If "request" means something other than the maintenance record, it is for the CTO.

R-WO-18 · A v1 work order that is Ready with no readyAt takes as ready_at the time of its last history entry whose first word is Ready or Di-Ready-kan, and with no such entry it is unmatched

Section titled “R-WO-18 · A v1 work order that is Ready with no readyAt takes as ready_at the time of its last history entry whose first word is Ready or Di-Ready-kan, and with no such entry it is unmatched”
  • Status: built
  • Example: given a v1 work order whose status is Ready, with no readyAt key and five history entries, exactly one of them a Ready entry with a time, when the operations step runs, then the work order loads as ready with ready_at the at of that entry (R-WO-02), the time v1 itself recorded, never a guess; when two such entries have a time, the last one is taken. Given a Ready work order with no readyAt and no Ready or Di-Ready-kan entry with a time, then it is listed in migration.unmatched as "Ready in v1 with no readyAt" (R-MIG-04) and doesn't load. On the copy of 2026-11-03 this is 1 work order (dest asuransi, opened in 2026-09), so the step loads 1,515 work orders, 1,415 of them ready (R-WO-10).
  • Refusal: none.
  • Who: the data phase's operations step (#304).
  • Source: zuki on #304 (2026-11-04): option b for LED-OPS-02; R-WO-02; R-WO-12 (the first words Ready and Di-Ready-kan map to ready); R-MIG-04. The row isn't faulty, as v1 holds the time, so D87 doesn't apply.