Booking/inspection/maintenance/outbox dates were authored as absolute timestamps around a fixed 2026-08-01 anchor and never re-anchored at seed/reset time, so demo scenarios (e.g. BK-DEMO-RETURN) silently drifted into the past. Every reset now shifts seeded dates by (today - authored anchor); dashboard's "today" filter uses real wall-clock time instead of the now-removed frozen demo_today setting. Adds seed-validation tests proving scenarios S1/S2/S4/S5 are present and internally consistent after every reset.
69 lines
2.9 KiB
Markdown
69 lines
2.9 KiB
Markdown
# Seed and demo scenarios
|
||
|
||
## Dataset
|
||
|
||
`seed/generate_seed.py` creates a deterministic snapshot for a chosen anchor date and random seed. The committed CSV files are generated with:
|
||
|
||
```bash
|
||
python seed/generate_seed.py --anchor 2026-08-01 --seed 20260801
|
||
```
|
||
|
||
Target scale:
|
||
|
||
- 50 vehicles;
|
||
- 180 customers including three duplicate pairs;
|
||
- 220 historical and 25 current/future bookings;
|
||
- realistic inspections and maintenance records;
|
||
- fixed quality and workflow scenarios.
|
||
|
||
## Required named scenarios
|
||
|
||
### S1 — Odometer regression return
|
||
|
||
Booking `BK-DEMO-RETURN` for vehicle `MO-024` is active. Submit a return reading below the canonical odometer. Expected: inspection saved, canonical odometer unchanged, vehicle blocked or cleaning according to other flags, quality issue created, event queued and audit visible.
|
||
|
||
### S2 — Duplicate customer merge
|
||
|
||
Customers `CUS-0012` and `CUS-0178` share normalized contact data and similar names. Expected: issue with explainable signals, merge rewires bookings, loser becomes tombstone, audit preserved.
|
||
|
||
### S3 — Missing inspection before next booking
|
||
|
||
Vehicle `MO-031` has a near-future booking and an unresolved operational attention item. Expected: dashboard links to its record.
|
||
|
||
### S4 — Legacy booking overlap
|
||
|
||
Vehicle `MO-016` has two imported overlapping reservations. Expected: visible quality issue; normal booking command would reject the same overlap.
|
||
|
||
### S5 — Failed workflow
|
||
|
||
One seeded outbox/workflow record is failed with a safe simulated connection error. Expected: dashboard and Automation page show it; Operations Manager can retry.
|
||
|
||
### S6 — Grounded damage question
|
||
|
||
Question: “What must I do when a vehicle returns with damage?” Expected: answer cites damage handling and return inspection procedures.
|
||
|
||
## Date anchoring
|
||
|
||
The committed CSVs store absolute ISO timestamps authored around a fixed anchor date
|
||
(`SEED_AUTHORED_ANCHOR = 2026-08-01` in `backend/app/seed_loader.py`, matching the
|
||
`--anchor` used to generate them). Every seed/reset shifts every seeded booking,
|
||
inspection, maintenance and outbox timestamp by `today − SEED_AUTHORED_ANCHOR`, so
|
||
"today"/"near-future"/"currently overlapping" scenarios stay true to the real moment the
|
||
environment was (re)seeded instead of decaying as real time passes between resets. Public
|
||
refs and entity relationships are untouched by the shift — only datetime columns move.
|
||
`load_seed()` returns the resolved `anchor_date`/`seeded_at`, and records a
|
||
`demo_data_seeded` audit event carrying both the resolved anchor and the original
|
||
authoring anchor, so the shift applied on any given reset stays traceable.
|
||
|
||
## Demo reset
|
||
|
||
Reset must:
|
||
|
||
- require Operations Manager;
|
||
- rebuild the deterministic dataset;
|
||
- re-establish scenario references;
|
||
- re-anchor scenario dates to the real reset moment (see above);
|
||
- clear non-seed audit/workflow state;
|
||
- complete safely and visibly;
|
||
- be covered by a test.
|