fix(demo): anchor seeded dates to the real reset moment

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.
This commit is contained in:
NuklearRabbit
2026-08-03 13:08:02 +02:00
parent 7c94eb9e87
commit 8989ffb23c
9 changed files with 218 additions and 15 deletions
+35
View File
@@ -507,3 +507,38 @@ any change at `docs/functional-completion/server-baseline.md`.
re-verified against the live server after every batch. See
`artifacts/functional-completion/final-summary.md` for the definitive acceptance
evidence.
## Demo productization (in progress, same branch `feat/mobilityops-functional-completion`)
Follows the functional-completion work above; turns the now feature-complete PoC into a
guided, honestly-labelled demo (fictional org "Northstar Mobility", guided tour, 5 named
scenarios, demo manifest, About page). Gap audit: `docs/demo-release/current-demo-gap-audit.md`.
### Batch 1 — seed date anchoring (complete)
- **Real bug fixed**: `seed/bookings.csv` etc. store absolute ISO timestamps authored
around a fixed anchor (`2026-08-01`). Nothing previously re-anchored them at seed/reset
time, so scenario bookings (e.g. `BK-DEMO-RETURN`) silently drifted into the past every
day the environment wasn't reset. `dashboard.py::_today()` compounded this by filtering
"today's movements" against the same frozen `demo_today` setting instead of real time.
- Fix: `seed_loader.py` now computes `shift = today - SEED_AUTHORED_ANCHOR` once per
`load_seed()` call and applies it to every seeded booking/inspection/maintenance/outbox
datetime column, so scenarios stay "today"/"near-future" relative to the actual reset
moment. `SeedResult` now also carries `anchor_date`/`seeded_at`; `POST /api/v1/demo/reset`
returns them; a `demo_data_seeded` audit event records the anchor for traceability.
`dashboard.py::_today()` switched from the frozen `demo_today` setting to real wall-clock
UTC date. The now-dead `demo_today` setting/env var was removed from `config.py`,
`compose.yaml`, `.env`, `.env.example` (nothing else referenced it).
- Added seed-validation tests (`backend/tests/test_seed.py`) proving S1 (`BK-DEMO-RETURN`/
`MO-024`), S2 (`CUS-0012`/`CUS-0178`/`DQ-DEMO-DUPLICATE`), S4 (`MO-016`/
`BK-DEMO-OVERLAP-A`/`-B`/`DQ-DEMO-OVERLAP`) and S5 (seeded failed outbox event
`00000000-0000-4000-8000-000000000020`, confirmed genuinely `failed` immediately after a
fresh reset, not silently auto-healed by the background dispatcher since it only claims
`pending` rows) are fully present after every reset, plus a dedicated anchoring test
asserting the shift and the audit marker.
- Live-verified locally: reseeded and confirmed via `psql` that `BK-DEMO-RETURN` now ends
today and `BK-DEMO-NEXT`/overlap bookings sit in the near future (today = 2026-08-03).
- Evidence: `pytest` **122 passed** (117 + 5 new/expanded seed tests), `ruff check .`
clean, `mypy app` clean (46 files, canonical `make` scope).
- Exact next action: `GET /api/v1/demo/manifest` + Dutch demo entry screen + permanent
demo badge (task #30), then the Demo Guide + scenario overview (task #31).