WFDASH-WEBAPP/src/app
Dave f355895c75 fix(search): send the PB auth token, and a second instance of the same bug
Universal search returned 401 "Not authenticated." on every query.

Cause: dashboard auth is a PocketBase token in the `Authorization`
header, NOT a cookie — `assertBrowserSession` reads the header and
refreshes it against PB. The page used a bare `fetch()`, which sends
neither. The service underneath was always correct.

Worth being explicit about what was missed: the service was verified
end-to-end against live PB, and the route compiles, but curl against
the dev server returns the same auth-gated shell as /orders does — so
the authenticated path was never actually exercised until a human
opened it in a browser. Green tests plus a working backend is not the
same as a working feature.

The cache-warm call had the same defect, which mattered more than it
looks: an unauthenticated warm is a server no-op, so the first real
search would have quietly paid the full ~4.5s cold build every session.

SECOND INSTANCE, same root cause

`customer-form.tsx` fetched `/api/v1/customers/sites` — a guarded route
— with no Authorization header. The `.catch` swallowed the 401, so the
site-location autocomplete has always silently returned an empty list,
which is indistinguishable from "no sites in use yet". Fixed in the same
pass.

Audited the rest: cross-referenced every route that calls
assertBrowserSession against every client caller, and this is the only
other real one. The `x-wfdash-auth` header installed by
`installAuditFetch` is attribution for the audit trail, not auth, which
is probably what makes this easy to get wrong.

New: 5 tests on the search page covering the auth header on both the
search and the warm call, the truncated-group "showing N of TOTAL"
rendering, the failed-source row, and session expiry. Verified the two
auth tests fail when the header is removed while the other three keep
passing.

Also completed the customer-form pocketbase test mock, which was missing
`authStore` — the real SDK always has one.
2026-10-14 11:49:30 +02:00
..
(app) fix(search): send the PB auth token, and a second instance of the same bug 2026-10-14 11:49:30 +02:00
(auth) fix: preserve destination through the login redirect 2026-09-01 15:47:27 +02:00
(counter) fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
(mobile) feat(mobile-dashboard): add light/dark toggle, switch accent to red, bigger numbers 2026-09-07 15:02:10 +02:00
(print) feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
(rep)/rep feat(rep): add /rep/visits map with heatmap, per-customer clusters 2026-09-20 23:50:03 +02:00
(tv) feat(tv-dashboard): enhance TV dashboard with driver stops and performance metrics 2026-08-19 10:16:49 +02:00
api feat(search): universal search across every collection 2026-10-14 10:32:14 +02:00
scan fix(scan): speed up QR recognition and keep scanning 2026-10-05 09:43:53 +02:00
favicon.ico
globals.css feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
layout.tsx fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
offline.tsx
page.tsx