docs+test: phase 4 wrap-up (platform-v2 step 4.99)

- Pack README: CS-3 now says orders are queued by id and priced on sync, refused lines
  are shown, and no request a screen waits for may hang; rows for the waiter's texts /
  colours guards and the table, ordering and bookings pages.
- run-all: the waiter suite's label lists what it covers.
- waiter.mjs: the language check waits for the profile save (the screen changes first).
- android.mjs: the "server really down" check accepts the offline screen in place of the
  app (the start-up data failing shows it there since the bootstrap time limit), not only
  on /offline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 12:09:18 +02:00
co-authored by Claude Opus 5.5
parent eba630e06e
commit 1fc34d6c9e
4 changed files with 11 additions and 5 deletions
+5 -2
View File
@@ -54,7 +54,9 @@ The manager calls the API **same-origin, with relative paths**. The waiter app r
| `waiter_pwa/src/native/pairing.js`, `src/pages/VenuesPage.jsx` | Pairing with a venue (QR / typed address) and the venue switcher | | `waiter_pwa/src/native/pairing.js`, `src/pages/VenuesPage.jsx` | Pairing with a venue (QR / typed address) and the venue switcher |
| `waiter_pwa/src/api/client.js`, `src/api/bootstrapCache.js`, `src/api/venueSettings.js`, `src/api/errors.js` | The waiter's client on `@xenia/api` (since 4.1): token, 401 → logout, no answer → `backend-offline`, the manager-approval retry; `<AccessProvider cache>` keeps the last bootstrap per venue so an offline restart stays signed in (CS-3); one shared, offline-cached read of the venue settings; `apiError(err, fallback)` shows backend error codes in the user's language | | `waiter_pwa/src/api/client.js`, `src/api/bootstrapCache.js`, `src/api/venueSettings.js`, `src/api/errors.js` | The waiter's client on `@xenia/api` (since 4.1): token, 401 → logout, no answer → `backend-offline`, the manager-approval retry; `<AccessProvider cache>` keeps the last bootstrap per venue so an offline restart stays signed in (CS-3); one shared, offline-cached read of the venue settings; `apiError(err, fallback)` shows backend error codes in the user's language |
| `waiter_pwa/src/context/LiveContext.jsx`, `src/hooks/useWebSocket.js` | Real-time lifecycle, event → store/cache updates, visibility refresh; the socket itself is `createLiveClient` from `@xenia/api` | | `waiter_pwa/src/context/LiveContext.jsx`, `src/hooks/useWebSocket.js` | Real-time lifecycle, event → store/cache updates, visibility refresh; the socket itself is `createLiveClient` from `@xenia/api` |
| `waiter_pwa/src/db/posdb`, `src/services/offlineOrders` | Offline cache and queued orders | | `waiter_pwa/src/db/posdb`, `src/services/offlineOrders` | Offline cache and queued orders (lines by id, priced on sync; refused lines kept in `kv.refused_lines`, `components/RefusedLines.jsx`; 4.4) |
| `waiter_pwa/src/i18n.js`, `src/logic/colour.js`, `tests/no-greek.test.mjs`, `tests/no-colours.test.mjs` | The waiter's texts (`waiter` namespace, `tw()`, `money()`; 4.5) and colours (tokens only, `fade()`; 4.6), and the guards that keep them so |
| `waiter_pwa/src/pages/TableDetailPage.jsx`, `AddItemsPage.jsx`, `BookingsPage.jsx`, `components/TableHistory.jsx` | The table (actions by permission key 4.3, combine lines and close-with-unpaid 4.8, history 4.7), ordering (server-priced cart 4.4), bookings (4.8) |
| `nginx-proxy/nginx.conf` | Proxy config used in dev / by hand | | `nginx-proxy/nginx.conf` | Proxy config used in dev / by hand |
| `install.sh` | Site installer. **Writes its own copy of the proxy config.** | | `install.sh` | Site installer. **Writes its own copy of the proxy config.** |
| `docker-compose.yml` / `docker-compose.dev.yml` | Prod (pull images) / dev override (build + expose ports) | | `docker-compose.yml` / `docker-compose.dev.yml` | Prod (pull images) / dev override (build + expose ports) |
@@ -84,8 +86,9 @@ Control frames from `routers/ws.py` (3.1a) are not stored and have no seq: `devi
**CS-3. The waiter app must survive bad networks.** **CS-3. The waiter app must survive bad networks.**
Waiters walk in and out of WiFi range and phones sleep. Any new waiter flow must: Waiters walk in and out of WiFi range and phones sleep. Any new waiter flow must:
- work from the IndexedDB cache when offline, or clearly block with an offline state - work from the IndexedDB cache when offline, or clearly block with an offline state
- never lose an order that was entered (queue it) - never lose an order that was entered (queue it): queue it **by id** (`@xenia/api` `wireLine`, step 4.4) so the server prices it when the phone is back, and show what the server refused instead of dropping it (`kv.refused_lines`, the "Not sent" sheet)
- tolerate duplicate or replayed events - tolerate duplicate or replayed events
- never hang on a request: every request that a screen waits for has a time limit or a retry (the bootstrap: 8 s, then offline + retry; step 4.6)
**CS-4. Money and prices are snapshotted.** **CS-4. Money and prices are snapshotted.**
Prices, costs and discounts are copied onto order items and logs when the action happens (snapshot pattern, `PriceEventLog`). Reports read the snapshots, never the live catalogue. Prices, costs and discounts are copied onto order items and logs when the action happens (snapshot pattern, `PriceEventLog`). Reports read the snapshots, never the live catalogue.
+3 -1
View File
@@ -217,7 +217,9 @@ async function rediscovery() {
await backend.stop() await backend.stop()
v = await stale(v) v = await stale(v)
const offlineShown = await onScreen(async vv => (await vv.evaluate('location.pathname')) === '/offline', 45_000) // the offline screen: its own route, or in place of the app when the start-up data can't load (4.6)
const offlineShown = await onScreen(async vv => (await vv.evaluate('location.pathname')) === '/offline'
|| (await vv.evaluate("!!document.querySelector('#root') && document.body.innerText.includes('Search the network')")), 45_000)
r.check('server really down: saved address untouched', (await venuesState(v)).venues['test-site-1'].baseUrl.includes('.99:')) r.check('server really down: saved address untouched', (await venuesState(v)).venues['test-site-1'].baseUrl.includes('.99:'))
r.check('server really down: offline screen', !!offlineShown, await v.evaluate('location.pathname + " | " + document.body.innerText.slice(0, 200)').catch(e => String(e))) r.check('server really down: offline screen', !!offlineShown, await v.evaluate('location.pathname + " | " + document.body.innerText.slice(0, 200)').catch(e => String(e)))
await v.evaluate("[...document.querySelectorAll('button')].find(e => e.textContent.includes('Search the network')).click()") await v.evaluate("[...document.querySelectorAll('button')].find(e => e.textContent.includes('Search the network')).click()")
+1 -1
View File
@@ -23,7 +23,7 @@ const suites = [
['license (cloud + site)', PYTHON, ['license_e2e.py'], E2E], ['license (cloud + site)', PYTHON, ['license_e2e.py'], E2E],
['browser', 'node', ['browser.mjs'], E2E], ['browser', 'node', ['browser.mjs'], E2E],
['ui (@xenia/ui + @xenia/i18n)', 'node', ['ui.mjs'], E2E], ['ui (@xenia/ui + @xenia/i18n)', 'node', ['ui.mjs'], E2E],
['waiter (sign-in, lock, approvals)', 'node', ['waiter.mjs'], E2E], ['waiter (sign-in, keys, prices, languages, history, look, bookings)', 'node', ['waiter.mjs'], E2E],
['manager (login, bootstrap, approvals)', 'node', ['manager.mjs'], E2E], ['manager (login, bootstrap, approvals)', 'node', ['manager.mjs'], E2E],
['terminal (pairing, sign-in, states)', 'node', ['terminal.mjs'], E2E], ['terminal (pairing, sign-in, states)', 'node', ['terminal.mjs'], E2E],
['order app (cloud: takeaway + delivery + bookings)', 'node', ['order_app.mjs'], E2E], ['order app (cloud: takeaway + delivery + bookings)', 'node', ['order_app.mjs'], E2E],
+2 -1
View File
@@ -266,7 +266,8 @@ try {
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 }) await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
await a.getByTestId('menu-language-el').click() await a.getByTestId('menu-language-el').click()
const greek = await waitFor(async () => (await navText()).includes('Τραπέζια'), 8000, 300) const greek = await waitFor(async () => (await navText()).includes('Τραπέζια'), 8000, 300)
const me = await api('GET', '/api/auth/me', { token: tokenA }) // the screen changes first, the profile is saved right after: wait for it
const me = await waitFor(async () => { const u = await api('GET', '/api/auth/me', { token: tokenA }); return u.language === 'el' && u }, 8000, 300) || {}
r.check('4.5: menu → Ελληνικά: the screen turns Greek at once and it is saved for the person', !!greek && me.language === 'el', me.language) r.check('4.5: menu → Ελληνικά: the screen turns Greek at once and it is saved for the person', !!greek && me.language === 'el', me.language)
await a.reload() await a.reload()
r.check('4.5: …still Greek after a reload', !!(await waitFor(async () => (await navText()).includes('Τραπέζια'), 15_000, 500))) r.check('4.5: …still Greek after a reload', !!(await waitFor(async () => (await navText()).includes('Τραπέζια'), 15_000, 500)))