feat(demo): make return, data-quality and knowledge flows demo-legible

Fixes a real honesty bug in Knowledge.tsx (body copy named "RAGcore" while
the active provider is the demo one) and a second real bug discovered
while fixing it: the brief's suggested Dutch questions would silently
return "insufficient evidence" against the English-only demo knowledge
base -- verified empirically and fixed by keeping suggested questions in
English. The return flow now pre-fills the odometer-regression scenario's
suspicious reading instead of asking a visitor to invent one, and links
to automation/audit after committing. Data-quality issues get a shared
plain-language "what's wrong / why it matters" explainer per rule type,
a post-resolution confirmation with audit/vehicle links, and a "demo
scenario's only" list filter. Also fixes a real async race where the
odometer pre-fill could clobber text a visitor had already started typing.
This commit is contained in:
NuklearRabbit
2026-08-03 14:41:02 +02:00
parent 6b864596e0
commit ddc3a98e4b
9 changed files with 394 additions and 29 deletions
+44
View File
@@ -640,3 +640,47 @@ scenarios, demo manifest, About page). Gap audit: `docs/demo-release/current-dem
the server demo-ready.
- Exact next action: layer plain-language Dutch explanation onto the return flow, the 5
data-quality panels, and fix the knowledge assistant's RAGcore-naming bug — task #33.
### Batch 4 — return/data-quality/knowledge demo legibility (complete)
- **Fixed a real honesty bug**: `Knowledge.tsx` named "RAGcore" in the body copy and the
retrieval-flow diagram even though the active provider is the demo TF-IDF one (the
small badge below was already honest, contradicting the prose one line above). Now
derives a `providerLabel` ("Demo knowledge base" vs "RAGcore") from the real health
check and uses it everywhere; added an explicit disclosure note when not RAGcore.
Added 4 suggested-question chips. **Discovered and fixed a second real bug in the
process**: the brief's suggested Dutch questions (and my own Demo Guide step 6 wording)
would have returned "insufficient evidence" against the demo provider, because the
indexed procedures are English-only — verified empirically (Dutch question →
`insufficient`, its English equivalent → `grounded`). Fixed by keeping suggested
questions in English (matching the indexed content) and rewording the Guide step to
explain the knowledge base is English, rather than mistranslating the demo's
centerpiece feature into silently returning wrong answers.
- Return flow: `BookingDetail.tsx` now detects the one named return-anomaly scenario
booking (via the manifest, not a hardcoded ref) and fetches that vehicle's real
canonical odometer to pre-fill `ReturnForm`'s "End odometer" field with a suspicious
value below it, plus a callout explaining why — the brief explicitly requires the demo
not ask a visitor to invent a suspicious number themselves. Scoped narrowly to that one
scenario booking; ordinary returns are unaffected. `ReturnResultPanel` now links to
Automation and Audit trail (previously only the vehicle), and shows a "Ga verder met de
demo" button when the Demo Guide is open (advances the guide and navigates to the next
step). **Fixed a real regression caught by the existing return-review e2e test**: the
async pre-fill could silently overwrite odometer text a visitor had already started
typing, if the vehicle-detail fetch resolved after they began typing — fixed with an
`odometerEditedByUser` ref guard.
- Data quality: added a shared `RuleExplainer` (what's wrong / why it matters, in plain
language) for all 5 rule types on `DataQualityIssueDetail.tsx`; added a generic
post-resolution confirmation (audit-trail link, vehicle link, "Ga verder met de demo")
for the 4 rule types that previously just silently flipped their status badge with no
explicit confirmation, and extended `VehicleStatusConflictPanel`'s existing confirmation
with the same links rather than duplicating it. Added a "Demo scenario's only" checkbox
filter on `DataQuality.tsx` (client-side `public_ref.startsWith("DQ-DEMO-")`, no new
business logic) so the curated issues are easy to find among the full queue.
- Evidence: frontend `tsc -b` clean, `npm run build` clean; full Playwright suite
**51 passed** (47 existing + 4 new `demo-legibility.spec.ts`: return pre-fill + why-
suspicious explanation + result links, rule explainer visible, demo-scenario filter
narrows correctly, knowledge suggested question returns grounded evidence with the
correct provider label). Backend untouched this batch.
- Exact next action: plain-language integration-status labels, richer audit narration,
the full "Over deze demo" page content (currently a first pass from Batch 2), and
wiring reset into the guide/About/OM menu narrative — task #34.