Skip to content

BE-DP-35 · The values and shapes the operations step will meet

ID BE-DP-35 · Level L0 · Pack Row 5 · The domain steps · Run order row 5, before the operations step's rules (#356) and pull request · Issue #304

The operations step loads v1's checkpoints as inspections, its gate logs as gate passes, its insurance claims and ETLE rows, and Stock Opname's one session (D70, D75). No rule says yet how they load: DOC writes them on #356 from what v1 holds, and the step's value_map rows must ship complete (R-MIG-02). BE-DP-20 gave the keys of each table; this step prints their values and what the step would find for each row.

tools/migration/v1-copy/operations-values.sql prints:

  • 1 · Checkpoints: each purpose (keperluan) × whether it has a return reason, with how many rows find their car, their lead, and a rental live on that car at their time (the lead's onboarding row on the same plate). Then checkpoints per year, and those whose plate finds two cars.
  • 2 · Return reasons: each one with its rows, how many carry return_cuti_until, and the lead's status today.
  • 3 · A checkpoint's nota: the checklist marks (H, M and the rest), the equipment items present or not, panel counts, panel photos, body diagrams, fuel and battery outside 0 to 100, odometers that aren't whole km, and the service dates.
  • 4 · Gate logs: status × gate-in role × purpose (tujuan), with the cars and drivers found and the snapshots (CP overdue, service due, debt). Then the approvals per aspect, any key beyond the gate-in ones (an exit time, if v1 kept one), passes per month, and the exit tickets beside them.
  • 5 · Insurance claims: status × category, with the car found and each date filled; then accident type, insurer, location and partner; how many garages, and cars with two or more claims.
  • 6 · ETLE: status × billing status × driver status, with the car, the lead and the rental at the time found; then the violation types, and ticket numbers on two rows.
  • 7 · Stock Opname: the session (status, mode, its stored counts, the form of started_by), its expected cars by home pool (v1's service_area, the vehicles step's home pool) with the car found by unit and by plate, and stock_opname_scans' columns and rows.
  • 8 · Work orders, maintenance and preparation: rows per status with their years and the last 90 days, the values each would map, and how they overlap: work orders still open per car (v2 allows one), preparation rows and maintenance rows that sit on a work order, and returns that opened one. The Backend Engineer's proposal on #304 is written from it.

It prints codes, labels, column names and counts, never a name, a plate, a phone, a ticket number or a NIK (D15). A text value is printed only when 3 or more rows share it and it has at most 50 characters; any other is counted as (other). It reads the copy and changes nothing in it.

  • docker ps --filter name=v1copy lists the copy as Up.
  • You are at the root of your clone, on main, after git pull.
Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres < tools/migration/v1-copy/operations-values.sql

Eight sections, headed 1 to 8, in under a minute.

  • 1: its rows add up to 6,315, and those with a return reason to 1,170, as BE-DP-20 counted them.
  • 4: 1,180 gate logs, all Inside and Sistem; 12 exit tickets.
  • 5: 148 claims: Selesai 74, Proses Perbaikan 37, Proses Pengajuan 37.
  • 6: 183 rows: Terdeteksi 121, Lunas 59, Konfirmasi 3.
  • 7: one session, void, list_to_floor, with 111 expected cars.
  • 8: 1,234 work orders, 618 maintenance rows and 1,061 preparation rows.

Read every value column before posting: the purposes, return reasons, accident types, insurers, locations, partners, violation types and the values in section 8. Each should be a label, such as Return or Ganjil Genap. If one reads like a person's name, a plate or a number, delete that line and say you did. Then post the eight sections on #304.

  • ERROR: relation "public.…" does not exist: the copy isn't the one BE-DP-20 read. Post the line on #304.
  • Anything else: post the ERROR line on #304.

Nothing to undo: it reads only, and its tables are temporary.

Log each run as a comment on #304: date · who · result, with the eight sections.

Run of 2026-11-02: both scripts, on the fresh copy

Section titled “Run of 2026-11-02: both scripts, on the fresh copy”

The rules of #356 are merged (R-WO-10 to R-WO-15, R-INSP-16 to R-INSP-22, R-GATE-09 and R-GATE-10, since replaced by R-GATE-14, R-ASR-13 to R-ASR-15), and zuki answered #415. Two scripts read the copy of 2026-11-02, both read-only, both printing counts, labels and column names only (D15).

The first run found two things. operations-values.sql section 1 showed that only 205 of 2,028 Handover and 16 of 1,441 Return checkpoints have a rental "at that time" (the lead's onboarding row on the plate, assigned to released or now). And operations-claimed.sql section 4 ran 15 minutes, because it counted distinct values per row. Both are fixed; rerun both.

What changed in operations-values.sql. Sections 1 to 3 and 5 to 8 still print; section 4 is gone, with v1's gate logs and exit tickets (R-GATE-14, #527). Four parts gained lines the new rules cite:

  • 1b · what finds a rental for a checkpoint (R-INSP-17), per purpose (Checkpoint, Handover, Return): whether the lead has an onboarding row on the checkpoint's plate at any time (none, exactly one, two or more; rows only on other plates; no row at all); for the lead with exactly one row, the checkpoint's day against the row's dates (before assigned, assigned to released, after released) and, outside the window, the days out in buckets 0, 1-3, 4-14 and 15+, with whether the end is a release, the contract end or open; and the lead and plate pairs with two or more rows, how many have overlapping windows, and the checkpoints that sit on them.
  • 3 · where a note lives: the keys of a checkpoint's nota, and the K and M marks with and without a note (R-INSP-19). Read the keys first: if the notes live under a key whose name holds none of catatan, note or ket, the with-no-note count is wrong, so say so.
  • 5 · claims with and without an insurer, and the insurer and garage pairs with counts, then the number of distinct pairs and the claims naming both (R-ASR-14, R-ASR-15). Insurer and garage are business names.
  • 8b · for R-WO-10 to R-WO-15: work orders by status and dest (an empty dest included; preparation has no dest), maintenance by jenis_service and mode (R-WO-13), preparation by outcome and reason (R-INSP-21), and return checkpoints, preparation rows and maintenance rows with and without a work order on the same car and day, with the cars not found (R-WO-15).

What operations-claimed.sql is. zuki said on #415 that vehicle_status_log and claim_letters are important and need a claim; their shapes are not known yet. The script reads the columns itself, so it needs no names. Per table (and for checkpoints, asuransi_claims and etle, sections 0 to 2 only, for the columns v1 unclaimed lists):

  • 0: whether the copy has the table, and its rows. 1: each column, its type, the rows that fill it and its distinct values. 2: the keys of each jsonb column, with the JSON type and the rows that have and fill them.
  • 3 (the two tables): dates and times by year. 4: the columns and keys with at most 15 distinct values (a status, a kind), with counts; any column whose name suggests a person or a free text prints no value.
  • 5: how a vehicle_status_log row finds its car: which column or key equals a car's plate or unit_id, with the rows found and the rows found by none. 6: how a claim_letters row finds its claim: which column or key equals a column or key that belongs to one claim only, with the rows matched, matched by none, and matched to more than one.
  • Sections 4 to 6 now compute each column's distinct count once and match each table once, so the whole script should end in minutes. Sections 0 to 3 already ran on the first try; their output stands, but post the whole output of the rerun.

Before you run either: docker ps --filter name=v1copy lists the copy as Up, and you are at the root of your clone, after git pull on integration.

Terminal window
docker exec -i v1copy psql -qX -U postgres -d postgres < tools/migration/v1-copy/operations-values.sql
docker exec -i v1copy psql -qX -U postgres -d postgres < tools/migration/v1-copy/operations-claimed.sql

Read every value column before posting, as above, and in the second script sections 3 and 4: each should be a label or a count. If one reads like a person's name, a plate, a VIN or a number, delete that line and say you did.

What to post.

  • On #304: all of the first script's output (sections 1 to 8b) as one comment, and the second script's as another, with the date and the copy's table count.
  • On #356: section 1b (it decides what the rule says about an inspection's rental), section 3's note lines, section 5's insurer lines and 8b in short. Say whether a figure in a rule (for instance 1,531 work orders, 711 maintenance rows, 148 claims) differs on this copy.

If it fails: an ERROR: relation "public.…" does not exist means the copy lacks that table: post the line. The second script names a missing table and skips it. If a section still takes more than 10 minutes, stop it with Ctrl-C and post the last section header it printed. Anything else: post the ERROR line on #304. Nothing to undo: both read only, and their tables are temporary.