refactor(connect): one live connection, no token in any address (SSE removed)
Plan step 4.0. Owner (2026-11-17): no phone in use needs to keep working, so no
compatibility path.
- Removed the SSE channel: routers/sse.py (/api/sse/stream, which still accepted a JWT whose
session had ended — a signed-out phone could keep listening), services/sse_bus.py (every
backend module now calls services/ws_bus.broadcast_sync directly), waiter useSSE.js.
- Credentials only in the first frame: the waiter's useWebSocket and the manager's
LiveProvider send {token} there like the terminal; routers/ws.py no longer reads ?token=
(a token in a URL ends up in proxy and server logs).
- Waiter: SSEContext → LiveContext (LiveProvider, useLiveContext, liveAlive, the
'live-event' / 'live-reconnected' window events), dead SSE compat code removed.
- Tests: a token in the address is refused, /api/sse/stream is 404; e2e browser (3 delivery
modes) and manager assert no token in the live connection's address. Android taps now
wait for their element (the fixed sleeps made the suite flaky, KI-009).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,8 @@ try {
|
||||
page.on('pageerror', e => errors.push(e.message))
|
||||
const bootstraps = []
|
||||
page.on('request', q => { if (q.url().includes('/api/platform/bootstrap')) bootstraps.push(q.headers().authorization || 'anonymous') })
|
||||
const managerWs = []
|
||||
page.on('websocket', ws => managerWs.push(ws.url()))
|
||||
|
||||
// ── Wrong password: the message shows, no reload ───────────────────────────
|
||||
await uiLogin(page, 'wrong-password')
|
||||
@@ -751,6 +753,7 @@ try {
|
||||
(await chefRow.textContent().catch(() => '')).includes('Kitchen pass · Kitchen display'))
|
||||
await o.screenshot({ path: path.join(OUT, 'manager-owner-flow.png'), fullPage: true })
|
||||
|
||||
r.check('live: the manager connection carries no token in its address (4.0)', managerWs.some(u => u.includes('/api/ws/')) && managerWs.filter(u => u.includes('/api/')).every(u => !/token=/.test(u)), managerWs.filter(u => u.includes('/api/')).join(' ')) // (Vite's own dev socket has its token)
|
||||
r.check('no page errors', errors.length === 0, errors.slice(0, 3).join(' | '))
|
||||
} finally {
|
||||
await browser.close()
|
||||
|
||||
Reference in New Issue
Block a user