Skip to content

INSP · Inspections

One inspections table holds every kind: initial, checkpoint, handover, return and preparation. Each has checklist items, photos and damages. A damage can become a charge on the driver. Code INSP.

The checklist items and body panels themselves are master data: who adds, changes, retires and restores them is on Master data, R-MD-52 to R-MD-82.

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

  • INSP open 1 · Damage price
  • The inspection kind initial. A new car's first inspection is now the preparation inspection of its work order (R-VEH-22, D47); whether initial is still needed, for v1's migrated rows only, is for BE pack G2.
  • v1's checkpoint columns no step reads: 8 on the earlier copy of 2026-10-29 (the ledger's LED-UNC-03). Each is claimed by a rule or signed as ignored by zuki (R-MIG-10).
  • Loose ends the reconcile lists, not guesses: on the earlier copy of 2026-10-29, 1 checkpoint whose lead is not found. It loads with no rental (R-INSP-17).
  • The lookup may be adjusted after the first run. zuki: "we'll see the outcome and adjust later". R-INSP-17 finds the rental by lead and plate; the rule changes through the lead if the first run shows rentals wrongly linked or too many with none (the figures of R-INSP-17 are the expectation).

R-INSP-01 · An inspection answers each checklist item at most once

Section titled “R-INSP-01 · An inspection answers each checklist item at most once”
  • Status: built
  • Example: given a checkpoint with an answer for the front tyres, when a second answer for the front tyres is saved on it, then it is refused.
  • Refusal: none: unique_violation (23505).
  • Who: every writer.
  • Source: D9 (P4).

R-INSP-02 · A checklist item graded K (yellow) or M (red) has a note

Section titled “R-INSP-02 · A checklist item graded K (yellow) or M (red) has a note”
  • Status: built
  • Example: given a checkpoint, when the wipers are graded M with no note, then it is refused; graded H (green), no note is needed.
  • Refusal: none: check_violation (23514).
  • Who: every writer.
  • Source: [Ref] Data model V13: inspection_items.

R-INSP-03 · Only a return inspection has a return reason

Section titled “R-INSP-03 · Only a return inspection has a return reason”
  • Status: built
  • Example: given a checkpoint inspection, when it is saved with return_reason accident, then it is refused.
  • Refusal: none: check_violation (23514).
  • Who: every writer.
  • Source: [Ref] Data model V13: inspections.

R-INSP-23 · Every preparation inspection has an outcome, and no other kind has one

Section titled “R-INSP-23 · Every preparation inspection has an outcome, and no other kind has one”
  • Status: built
  • Example: given a preparation inspection, when it is saved with no outcome, then it is refused; given a checkpoint, a handover or a return, when it is saved with outcome ok, then it is refused. A preparation inspection with outcome ok, needs_maintenance or needs_insurance is accepted.
  • Refusal: none: check_violation (23514).
  • Who: every writer, the migration included: the operations step loads an outcome on every preparation row it loads and on no other (R-INSP-21), which BE-DP-42 counts on a local night before the constraint goes on.
  • Source: D94 (each inspection kind carries only its own fields; v1's free text is reduced to them, not widened to fit it); #587. A loaded row that breaks it is a rule question for zuki, not a dropped constraint.
Section titled “R-INSP-24 · Only a return or a preparation inspection links a work order”
  • Status: built
  • Example: given a checkpoint, when it is saved with a work_order_id, then it is refused; a return inspection or a preparation inspection with the work order of its car is accepted, and either may have none (R-WO-15).
  • Refusal: none: check_violation (23514).
  • Who: every writer, the migration included (BE-DP-42 counts the loaded rows first).
  • Source: D94; #587; D47 (a return opens the work order, and its preparation inspection is the Leader's check). A loaded row that breaks it is a rule question for zuki, not a dropped constraint.

R-INSP-04 · A BASTK number is unique within the organization

Section titled “R-INSP-04 · A BASTK number is unique within the organization”
  • Status: built
  • Example: given a handover with a BASTK number, when a second inspection with the same number is saved in the organization, then it is refused.
  • Refusal: none: unique_violation (23505).
  • Who: every writer.
  • Source: [Ref] Data model V13: inspections.

R-INSP-05 · A damage that isn't charged to the driver records who decided that

Section titled “R-INSP-05 · A damage that isn't charged to the driver records who decided that”
  • Status: built
  • Example: given a scratch found at return, when charge_driver is switched off with no charge_decided_by, then it is refused.
  • Refusal: none: check_violation (23514).
  • Who: every writer.
  • Source: [Ref] Data model V13: inspection_damages.

R-INSP-06 · A rented car's next checkpoint is due in the week checkpoint_interval_weeks after the week of its last checkpoint, or of its handover when it has none, Monday to Friday, in the pool's date

Section titled “R-INSP-06 · A rented car's next checkpoint is due in the week checkpoint_interval_weeks after the week of its last checkpoint, or of its handover when it has none, Monday to Friday, in the pool's date”
  • Status: built
  • Example: given a PML car handed over on Wednesday 2026-10-07 with no checkpoint since, and an interval of 2 weeks, when v_checkpoint_due is read, then its checkpoint is due any day from Monday 2026-10-19 to Friday 2026-10-23.
  • Refusal: none.
  • Who: v_checkpoint_due and everything that reads it: the checkpoint list, the gate.
  • Source: D9 (S2); #144 (insp 06: any day in the same week, not the exact date; zuki's answer 11: weekends don't count). checkpoint_interval_weeks replaces checkpoint_interval_days; which settings a pool can override stays open (R-SET-09).

R-INSP-07 · Reading inspections needs inspection:read at their pool

Section titled “R-INSP-07 · Reading inspections needs inspection:read at their pool”
  • Status: built
  • Example: given a finance user at PML, when they read inspections, then nothing comes back; a checker at PML sees them.
  • Refusal: none: hidden.
  • Who: super_admin, admin, admin_fleet, maintenance, asuransi, checker and viewer hold inspection:read.
  • Source: [Ref] Roles, policy matrix.

R-INSP-08 · Recording an inspection needs inspection:write at its pool

Section titled “R-INSP-08 · Recording an inspection needs inspection:write at its pool”
  • Status: built
  • Example: given a maintenance user at PML, when they record a checkpoint, then it is refused; a checker at PML may.
  • Refusal: none: insufficient_privilege (42501) on insert; no effect on update.
  • Who: super_admin, admin, admin_fleet and checker hold inspection:write.
  • Source: [Ref] Roles, policy matrix.

R-INSP-09 · Recording a handover or a return needs inspection:handover at its pool

Section titled “R-INSP-09 · Recording a handover or a return needs inspection:handover at its pool”
  • Status: built
  • Example: given a checker at SBY, when they record a handover at PML, then it is refused; a checker at PML may.
  • Refusal: none: insufficient_privilege (42501) on insert; no effect on update.
  • Who: super_admin, admin, admin_fleet and checker hold inspection:handover.
  • Source: [Ref] Roles, policy matrix.

R-INSP-10 · A checkpoint not done by the Friday of its due week is overdue from the Monday after

Section titled “R-INSP-10 · A checkpoint not done by the Friday of its due week is overdue from the Monday after”
  • Status: built
  • Example: given a checkpoint due from 2026-10-19 to 2026-10-23 and not done, when v_checkpoint_due is read on Saturday 2026-10-24, then it isn't overdue yet; on Monday 2026-10-26 it is.
  • Refusal: none.
  • Who: v_checkpoint_due, the checkpoint list and the gate.
  • Source: #144 (insp 06; zuki's answer 11).

R-INSP-11 · A damage charged to the driver at a checkpoint or a return is billed as a damage charge in the same step

Section titled “R-INSP-11 · A damage charged to the driver at a checkpoint or a return is billed as a damage charge in the same step”
  • Status: planned
  • Example: given a checkpoint that finds a new dent charged to the driver, when the inspection is saved, then a damage charge for it is created; if the charge can't be created, the damage isn't saved either. A damage not charged (R-INSP-05) makes no charge.
  • Refusal: none.
  • Who: the inspection function (M5).
  • Source: D45; General Flow VEH-11 → VEH-12.

R-INSP-12 · In a voluntary return, the return inspection and its BASTK are one event on the day the car comes back, and they end the rental

Section titled “R-INSP-12 · In a voluntary return, the return inspection and its BASTK are one event on the day the car comes back, and they end the rental”
  • Status: planned
  • Example: given a rental returning with reason contract_ended, when the checker records the return inspection with its BASTK at the pool on 2026-10-20, then the rental is ended that day (R-RNT-27) and its billing_ends_on is 2026-10-20 (R-RNT-28); the work order opens from the reason (D47).
  • Refusal: none.
  • Who: the return function (M5), with inspection:handover (R-INSP-09).
  • Source: D67 (in a voluntary return today the return inspection and the BAST are one event on the day the car comes back); General Flow VEH-16.

R-INSP-13 · A repossessed car's return inspection comes with its BASTK at the pool, not at its recovery, and ends the returned rental

Section titled “R-INSP-13 · A repossessed car's return inspection comes with its BASTK at the pool, not at its recovery, and ends the returned rental”
  • Status: planned
  • Example: given a repossession whose car was recovered on 2026-10-21 and reached the pool, so its rental is returned (R-RNT-26), when the checker records its return inspection with its BASTK on 2026-10-23, then the damages found then are charged as at a voluntary return (R-INSP-11), the rental is ended on 2026-10-23 with reason repossessed, and its billing_ends_on stays 2026-10-21 (R-RNT-28). The recovery records no inspection. The repo fine is charged when this BASTK is submitted (R-REP-30).
  • Refusal: none.
  • Who: the BASTK function for repossessions (M5), with inspection:handover (R-INSP-09).
  • Source: D67 (a repossession goes through returned when its BAST comes on a later day); General Flow VEH-15, VEH-16, COL-18; the CTO's review on #228 (2026-10-20) (the condition check that decides damage charges is the return inspection at the BASTK; the recovery records the date and the car's arrival).

R-INSP-14 · A return inspection's return_reason is its rental's end_reason

Section titled “R-INSP-14 · A return inspection's return_reason is its rental's end_reason”
  • Status: built
  • Example: given a rental returning with end_reason resigned, when its return inspection is recorded, then the inspection's return_reason is resigned, taken from the rental and not asked again; a return inspection saved with a different reason, such as accident, is refused. For a repossession it is repossessed.
  • Refusal: a key named by BE in #229, or a check.
  • Who: the return and BASTK functions (M5), and every writer of return inspections. Only a return inspection has a return_reason (R-INSP-03).
  • Source: the CTO's review on #228 (2026-10-20) (the return inspection takes the rental's reason; it doesn't ask for its own); D67.

R-INSP-15 · A receipt the driver shows at a checkpoint is kept as an inspection photo of kind receipt

Section titled “R-INSP-15 · A receipt the driver shows at a checkpoint is kept as an inspection photo of kind receipt”
  • Status: built
  • Example: given a checkpoint where the driver shows a fuel receipt, when the checker photographs it, then the photo is saved on that inspection with kind receipt; v1's checkpoint files labelled nota (17,076 of them) are copied the same way, matched by name like the rest (R-STO-13).
  • Refusal: none: the kind is an enum value, receipt, added to photo_kind.
  • Who: every writer of inspection photos (R-INSP-08), and the migration's photo copy.
  • Source: zuki on #184 (2026-10-22: nota are receipts the driver shows at a checkpoint, and belong to that inspection); #254. BE adds the enum value in the table pack before row 6.

R-INSP-16 · The operations step loads each v1 checkpoint as one inspection, its kind taken from its purpose through value_map: Checkpoint to checkpoint, Handover to handover, Return to return

Section titled “R-INSP-16 · The operations step loads each v1 checkpoint as one inspection, its kind taken from its purpose through value_map: Checkpoint to checkpoint, Handover to handover, Return to return”
  • Status: built
  • Example: given v1's 7,772 checkpoints on the v1 copy of 2026-11-02 (v1copy) (Checkpoint 4,303, Handover 2,028, Return 1,441), when the operations step has run twice, then v2 holds 7,772 inspections of those kinds, with the same ids both times (R-MIG-03), each at its car's home pool (R-CONV-10 for its date). A purpose with no value_map row stops the step (R-MIG-02). A checkpoint whose car can't be found by its unit or plate (R-VEH-30), or whose plate finds two cars, is listed in migration.unmatched with its reason (R-MIG-04) and loads no inspection; on v1copy all 7,772 find their car and none finds two. v1's lite_nama_driver, the driver's name, is not read: the driver is found by lead (R-INSP-17), and the column is signed as ignored (R-MIG-10; zuki on #439 (2026-11-03); D15). On the earlier copy of 2026-10-29 there were 6,315 (3,376, 1,769 and 1,170).
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. The step doesn't use the kind initial.

R-INSP-17 · A loaded inspection's rental is found from the checkpoint's lead and plate, in that lead's rental chain on that car; a lead with no row on that plate loads the inspection with no rental

Section titled “R-INSP-17 · A loaded inspection's rental is found from the checkpoint's lead and plate, in that lead's rental chain on that car; a lead with no row on that plate loads the inspection with no rental”
  • Status: built
  • Example: given a checkpoint of lead A on car X, when the step runs, then the rental is the row of that lead's rental chain (R-RNT-41) on that car that is live at the checkpoint's time; a checkpoint before the chain's first row gets the first row (a handover 1 to 3 days before, or on, the assigned date: the car is inspected before the date is entered), and one after the last row gets the last row. A lead with onboarding rows only on other plates, or with none at all, loads the inspection with its car and rental_id empty, as inspections.rental_id allows; none gets another lead's rental. The reconcile counts the inspections with a rental, and those with none split into 'lead has rows only on other plates' and 'lead has no row'. On the v1 copy of 2026-11-02 (v1copy): the lead has exactly one onboarding row on the checkpoint's plate for 3,016 of 4,303 Checkpoint, 1,185 of 2,028 Handover and 73 of 1,441 Return rows (never two rows: 0 pairs); rows only on other plates for 436, 157 and 332; no row at all for 851, 686 and 1,036. The 1,036 returns with no row are mostly rentals v1 later reset, since its onboarding keeps only the current rental. Figures move with v1 (D75).
  • Refusal: none.
  • Who: the data phase's operations step (#304).
  • Source: #356; zuki's answers of 2026-11-02, via the CTO, to section 1b of operations-values.sql on v1copy (a handover may be 1 to 3 days before or on the assigned date; the returns without a row are rentals v1 reset; "we'll see the outcome and adjust later"); R-RNT-41; R-MIG-02; R-MIG-03; R-MIG-04. This replaces the earlier rule that found a rental by time only (205 of 2,028 handovers and 16 of 1,441 returns found one that way).

R-INSP-18 · A v1 checkpoint with a return reason loads as a return inspection, its reason mapped through value_map onto return_reason

Section titled “R-INSP-18 · A v1 checkpoint with a return reason loads as a return inspection, its reason mapped through value_map onto return_reason”
  • Status: built
  • Example: given v1's 1,441 Return checkpoints on the v1 copy of 2026-11-02 (v1copy), each with a return reason (Repo 476, Cuti 407, Acara Keluarga 117, Replace 95, Suspend/PM 62, Resign 45, Laka 41, Pulang Kampung 38, Kecelakaan 36, Resign/Off Total 31, Sakit 28, Rusak 28, Tidak Sanggup Bayar 18, Kendala Unit 18 and 1 other value), when the step runs, then each loads with kind return and the return_reason of its value_map row (R-INSP-03: only a return has one): Acara Keluarga, Sakit, Pulang Kampung, Replace and Cuti to on_leave; Suspend/PM to suspended; Tidak Sanggup Bayar (KS/Claim), Resign/Off Total and Resign to resigned; Laka and Kecelakaan to accident; Repo to repossessed; Kendala Unit and Rusak to breakdown. A value with no row stops the step (R-MIG-02); the 1 other value, Selesai Kontrak, maps to contract_ended (BE-DP-38's first night; zuki on #439 (2026-11-03)), and nothing is guessed. A work order's reason is free text and is not mapped (R-WO-14). Who rejoins after a return_cuti_until date is not read by this step.
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. zuki signs the value_map rows in a pull request (R-MIG-02). Which return_reason each v1 label means is not decided here. The table is zuki's, 2026-11-02 (the run of operations-values.sql); the enum value swap has no v1 label here.

R-INSP-19 · A checkpoint's nota is unpacked onto inspection_items, one row for each of the 26 v1 items the nota marks, and kept in legacy_data without its inline files or the driver's personal keys

Section titled “R-INSP-19 · A checkpoint's nota is unpacked onto inspection_items, one row for each of the 26 v1 items the nota marks, and kept in legacy_data without its inline files or the driver's personal keys”
  • Status: built
  • Example: given v1's checklist marks on the v1 copy of 2026-11-02 (v1copy) (K 30, over 30 checkpoints, 23 of them without an item note; M 579, over 540 checkpoints, 499 without) and the 26 distinct items and H marks of the earlier copy of 2026-10-29 (H 160,819), when the step runs, then each mark becomes an inspection_items row on its inspection, H as h, K as k and M as m, at most one for each item (R-INSP-01), and each of the 26 items has a row in inspection_item_types or stops the step (R-MIG-02); a K or M mark that v1 holds with no note loads with the note -, which marks it as from v1, and R-INSP-02's refusal does not apply to a row the migration loads; an equipment item that v1 marks present or not becomes the row's present; a value such as fuel, battery or an odometer that is out of range or not a whole number is listed as a difference, never rounded (R-MIG-05). This rule is zuki's answer on #415 (2026-11-02). The nota itself, with its isEV flag (on the earlier copy: false on 192 of 6,315, true on 2,718, none on 3,405), is kept in legacy_data, read-only, as v1 wrote it with two changes. An inline file (a data: URI or a long base64 run, as app.has_inline_file defines one) is dropped and a marker left in its place, since a row never holds a file (R-STO-05); the reconcile counts the checkpoints that had one: 4 of 7,772 on the copy of 2026-11-03, one each in ttdPemeriksa, selfieDriver, fotoOdometer and bodyDiagram. The driver's personal keys nama, ktp and tlp (on about 7,670 notas each) are dropped, since the inspection finds its driver through the rental (R-INSP-17) and D15 keeps a person's value out of v2. selfieDriver and ttdUser stay as file references: their files are the photo copy's (R-STO-13), and app.anonymize_driver() deletes them (#189). Each item type's section is BE's, kept beside v1's name in migration.inspection_items, and stands as zuki on #439 (2026-11-03) accepted it.
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. The nota is v1's data; the grades are those of R-INSP-02. The inline files and the personal keys: zuki on #304 (2026-11-03: drop the three keys, keep the two file references), after BE-DP-38's second night stopped on inspections_legacy_data_no_inline_files; R-STO-05; D15.

R-INSP-20 · A nota's damaged panels load as their count in legacy_data and their photos as panel photos, with no inspection_damages row, and loading them bills nothing

Section titled “R-INSP-20 · A nota's damaged panels load as their count in legacy_data and their photos as panel photos, with no inspection_damages row, and loading them bills nothing”
  • Status: built
  • Example: given a v1 nota that counts two damaged panels (jumlah_panel, panelBaret) and keeps their photos, when the step runs, then its inspection has no inspection_damages row, because v1 never names which panel is damaged and a damage row needs its panel; the count stays in legacy_data with the nota (R-INSP-19), and the photos are attached by the photo copy as inspection photos of kind panel (R-STO-13). The step writes rows and doesn't call the inspection function (R-INSP-11), so no damage charge is created here; the charges v1 billed are the money step's (#295).
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. D45; R-INSP-11 belongs to the function, not to loaded history. No damage row: BE's recommendation in #439, accepted by zuki on #439 (2026-11-03).

R-INSP-21 · The operations step loads each checked v1 preparation row as an inspection of kind preparation, its outcome mapped to ok, needs_maintenance or needs_insurance; a row not yet checked does not load

Section titled “R-INSP-21 · The operations step loads each checked v1 preparation row as an inspection of kind preparation, its outcome mapped to ok, needs_maintenance or needs_insurance; a row not yet checked does not load”
  • Status: built
  • Example: given v1's 1,069 preparation rows on the v1 copy of 2026-11-02 (v1copy) (OK/Ready 1,017, Perlu Maintenance 26, Perlu Asuransi 24 and Belum Dicek 2), when the step runs, then 1,067 inspections of kind preparation load, with outcome ok, needs_maintenance and needs_insurance in those numbers, through value_map rows (R-MIG-02). The 2 rows with status 'Belum Dicek' (not yet checked, no outcome) do not load, and the reconcile lists them as 'not yet checked'. A row's reason is mapped through value_map to the same list as the checkpoints' (R-INSP-18), so a value with no row stops the step (R-MIG-02); the reason stays in legacy_data with v1's row, and the inspection's return_reason stays empty, since only a return holds one (R-INSP-03). In zuki's query of 2026-11-02 the reasons were Cuti 405, Repo 354, Acara Keluarga 55, Replace 54, Resign 49, Suspend/PM 48, Pulang Kampung 20, Resign/Off Total 14, Sakit 13, Tidak Sanggup Bayar (KS/Claim) 8, Kecelakaan 5, Rusak 3 and Laka 1; '-' (41 rows) is the default flow, with no special reason, and is not mapped. v1's preparation has no dest field. Each loads linked to the work order of its car that day (848 of the 1,069 have one, 221 do not), nothing merged (zuki, #415); one with no work order loads with the link empty (R-WO-15).
  • Refusal: none.
  • Who: the data phase's operations step (#304)
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. D47; zuki agreed on #304 (2026-10-28, via the CTO) that the step loads preparation; the reason counts and the absence of dest are from zuki's query on v1 preparation (#415, 2026-11-02). The outcomes are the proposal BE made there. 'Belum Dicek' rows do not load: zuki agreed, 2026-11-02. The reason mapped but never a return_reason: BE's recommendation in #439, accepted by zuki on #439 (2026-11-03).

R-INSP-22 · The operations step's reconcile compares inspections per kind, and each car's last checkpoint, with v1's

Section titled “R-INSP-22 · The operations step's reconcile compares inspections per kind, and each car's last checkpoint, with v1's”
  • Status: built
  • Example: given v1's Checkpoint 4,303, Handover 2,028, Return 1,441 and preparation 1,067 checked rows on the v1 copy of 2026-11-02 (v1copy), when the reconcile runs, then it compares the rows per kind and the checkpoints per month, and for each car it compares the date of its last checkpoint with v1's, since the next one due (R-INSP-06) is computed from it; a car that differs is listed unless zuki signed it (R-MIG-05, R-MIG-06). The 2 preparation rows not yet checked are listed apart (R-INSP-21). The photo counts are compared after the photo copy's rerun (BE-DP-23).
  • Refusal: none.
  • Who: the operations step's reconcile check.
  • Source: #356; BE-DP-35's run on the copy of 2026-10-29 (the CTO's reading on #356, 2026-10-30); R-MIG-02; R-MIG-03; R-MIG-04. D18; R-INSP-06.