diff --git a/doc/plans/2026-09-11-speko-storybook-inventory.md b/doc/plans/2026-09-11-speko-storybook-inventory.md index 6883b2eeb3c..022b10d370d 100644 --- a/doc/plans/2026-09-11-speko-storybook-inventory.md +++ b/doc/plans/2026-09-11-speko-storybook-inventory.md @@ -89,3 +89,5 @@ Latest interrupted-setup repair: the 155-story build and all 32 provider-setup i October 13 review repair: the task launcher restores persona selection and keyboard focus after the hosted voice panel closes. PersonaAfterPanelClose exercises the production launcher without opening media. OverlappingUpdates verifies that interrupted transcript fragments are labeled Interrupted and no longer Speaking. The Team Catalog data helper is explicitly excluded from the Storybook index. October 13 verification: the 156-story build and all 76 affected launcher/transcript interaction and accessibility checks passed across both themes and 390/1200 widths with reduced motion. Narrow-screen captures were inspected. After master adopted generated indexes, Speko source annotations retained stable story IDs and explicit fixture/provider limits; all 28 catalog/map structural tests passed. Structural checks do not establish runtime or provider acceptance. + +The complete generated-catalog Storybook run passed all 624 checks for the 156 Speko stories (UI source 249cbc616a). These are fixture interaction/accessibility results and viewport captures, not provider or spoken-playback acceptance. diff --git a/doc/plans/2026-10-09-speko-pr-qualification.md b/doc/plans/2026-10-09-speko-pr-qualification.md index 4bbddf2f198..911e04a73c7 100644 --- a/doc/plans/2026-10-09-speko-pr-qualification.md +++ b/doc/plans/2026-10-09-speko-pr-qualification.md @@ -91,3 +91,5 @@ Qualification provenance and media repair: the live browser report reads the ass October 13 review repair: browser evidence saves are serialized, with each report snapshotted when enqueued. Final cleanup evidence waits for any prior save, and a failed periodic write does not prevent the final report. All 20 standalone proof tests passed, including the local HTTP surface; browser-client syntax check passed. No real calls were placed. The UI repairs passed 26 focused controller/launcher tests, UI typecheck, and token gates. Fresh CI and exact-head review are required before merging the repaired heads. October 13 master reconciliation: all 76 affected Storybook checks passed and narrow-screen captures were inspected. UI master integration retains the generated-catalog policy and adds source-owned Speko capability annotations; 28 map structural tests, 26 focused UI tests, UI typecheck and token gates pass. An unchanged skill-audit deadline test failed once in UI CI, passed on the identical qualification backend and locally, and its single failed-job retry passed. No assertions or deadlines were weakened. + +Final October 13 fixture evidence: all 624 Speko Storybook interaction/accessibility checks passed across 156 stories, both themes, 390/1200 widths and reduced motion on UI source 249cbc616a. The subsequent merge adds GitHub server guidance and documentation without changing Speko UI source. Narrow captures were inspected. Report requests now have ten-second abort deadlines, periodic saves cannot build a backlog, and server disk writes remain serialized after an aborted client request. All 21 proof tests passed, including stalled transport followed by a late server write and final evidence preservation. Browser client/server syntax checks passed. Live-call acceptance remains unproven. diff --git a/tests/speko-voice-proof/browser-client.mjs b/tests/speko-voice-proof/browser-client.mjs index a58f34b1acb..2dfd02b7098 100644 --- a/tests/speko-voice-proof/browser-client.mjs +++ b/tests/speko-voice-proof/browser-client.mjs @@ -11,8 +11,8 @@ let conversation, context, destination, muted = false, running = false, ended = let speaking = false, notificationSent = false, sessionId, interval, recorder, audioEvidence; const event = (kind, fields = {}) => { events.push({ kind, elapsedMs: Math.round(performance.now() - began), ...fields }); }; const status = (text) => { $('status').textContent = text; }; -async function api(path, body = {}) { - const response = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json', 'x-proof-csrf': config.csrf }, body: JSON.stringify(body) }); +async function api(path, body = {}, signal) { + const response = await fetch(path, { method: 'POST', headers: { 'content-type': 'application/json', 'x-proof-csrf': config.csrf }, body: JSON.stringify(body), signal }); const data = await response.json(); if (!response.ok) throw new Error(data.error ?? `Request failed (${response.status})`); return data; @@ -81,7 +81,7 @@ function renderTranscript(list) { const item = document.createElement('li'); item.textContent = `${m.source}: ${m.text}`; return item; })); } -const saveQueuedReport = createReportSaver(report => api("/report", report)); +const saveQueuedReport = createReportSaver((report, signal) => api("/report", report, signal), {timeoutMs: 10_000}); async function saveReport() { const report = { sessionId, sdkVersion: '0.0.13', syntheticMicrophone: true, events, transcripts, cleanupFailures, sdkOpen: conversation?.isOpen() ?? false, audioElements: document.querySelectorAll('audio').length, @@ -126,7 +126,13 @@ $('connect').onclick = async () => { }); $('scenario').disabled = $('mute').disabled = $('end').disabled = false; await conversation.startAudioPlayback(); - interval = setInterval(async () => { try { await saveReport(); } catch { /* latest evidence remains visible */ } }, 3000); + let periodicReportPending = false; + interval = setInterval(async () => { + if (periodicReportPending) return; + periodicReportPending = true; + try { await saveReport(); } catch { /* latest evidence remains visible */ } + finally { periodicReportPending = false; } + }, 3000); status('Connected. Wait for the greeting, then run the speech scenario.'); } catch (error) { status(error.message); event('connect_failed'); await end(); } }; diff --git a/tests/speko-voice-proof/browser-server.mjs b/tests/speko-voice-proof/browser-server.mjs index 2c9a4ea38e1..36fd8a2f12c 100644 --- a/tests/speko-voice-proof/browser-server.mjs +++ b/tests/speko-voice-proof/browser-server.mjs @@ -6,6 +6,7 @@ import { randomBytes, createHash } from 'node:crypto'; import { homedir } from 'node:os'; import { resolve, dirname } from 'node:path'; import { build } from 'esbuild'; +import { createReportSaver } from './cleanup.mjs'; import { createProof, createProofServer, DELAY_MS } from './proof.mjs'; const key = process.env.SPEKO_MCP_API_KEY; if (!key) throw new Error('Credential required in environment'); @@ -16,6 +17,11 @@ const sourceDigests = {}; for (const file of ['browser-server.mjs', 'browser-client.mjs', 'cleanup.mjs', 'browser.html', 'proof.mjs', 'application-notification.txt']) sourceDigests[file] = createHash('sha256').update(await readFile(new URL(file, import.meta.url))).digest('hex'); await writeFile(resolve(out, 'source.json'), JSON.stringify({ startedAt: new Date().toISOString(), sourceDigests }), { mode: 0o600 }); const bundle = await build({ entryPoints: [new URL('./browser-client.mjs', import.meta.url).pathname], bundle: true, write: false, platform: 'browser', format: 'esm' }); +// Disk writes stay serialized even when a browser request times out. +const saveReport = createReportSaver(async body => { + await writeFile(resolve(out, 'browser-report.json'), JSON.stringify(body, null, 2), {mode: 0o600}); + await writeFile(resolve(out, 'proof.json'), JSON.stringify(proof.evidence(), null, 2), {mode: 0o600}); +}); const inputs = new Map(); for (const name of ['start', 'followup']) { const data = await readFile(new URL(`../../.paperclip-local/speko-proof-audio/${name}.pcm`, import.meta.url)); @@ -73,7 +79,7 @@ const server = createServer(async (req, res) => { return reply(200, { acceptedRequests: evidence.acceptedRequests, resultReturned: evidence.resultReturned, notificationReady: startTime !== undefined && Date.now() >= startTime + DELAY_MS + 1000, expectedNumber: evidence.expectedSyntheticResult?.match(/Verification number (\d+)/)?.[1] ?? null }); } - if (req.url === '/report') { await writeFile(resolve(out, 'browser-report.json'), JSON.stringify(body, null, 2), { mode: 0o600 }); await writeFile(resolve(out, 'proof.json'), JSON.stringify(proof.evidence(), null, 2), { mode: 0o600 }); return reply(200, { saved: true }); } + if (req.url === '/report') { await saveReport(body); return reply(200, { saved: true }); } if (req.url === '/end') { await endSession(); return reply(200, { ended: true }); } return reply(404, { error: 'Not found' }); } catch { return reply(502, { error: 'Probe request failed; inspect private evidence. Do not retry session creation.' }); } diff --git a/tests/speko-voice-proof/cleanup.mjs b/tests/speko-voice-proof/cleanup.mjs index 24661012804..b9aae102666 100644 --- a/tests/speko-voice-proof/cleanup.mjs +++ b/tests/speko-voice-proof/cleanup.mjs @@ -54,11 +54,17 @@ export function createAudioSave({stop, upload}) { } /** Older writes must finish before final cleanup evidence can be stored. */ -export function createReportSaver(write) { +export function createReportSaver(write, { timeoutMs } = {}) { let pending = Promise.resolve(); return report => { const snapshot = structuredClone(report); - const saved = pending.then(() => write(snapshot)); + const saved = pending.then(async () => { + if (timeoutMs === undefined) return write(snapshot); + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(new Error('Report save timed out')), timeoutMs); + try { return await write(snapshot, controller.signal); } + finally { clearTimeout(timer); } + }); pending = saved.catch(() => {}); return saved; }; diff --git a/tests/speko-voice-proof/cleanup.test.mjs b/tests/speko-voice-proof/cleanup.test.mjs index d189900c96a..24345ca2901 100644 --- a/tests/speko-voice-proof/cleanup.test.mjs +++ b/tests/speko-voice-proof/cleanup.test.mjs @@ -123,3 +123,27 @@ test('a failed periodic write does not prevent storing final cleanup evidence', await assert.rejects(save({events: []})); assert.deepEqual(await save({events: ['ended']}), {events: ['ended']}); }); + + +test('stalled periodic transport is aborted and final evidence advances behind its late server write', async () => { + let release, calls = 0; + const stored = []; + const serverSave = createReportSaver(async report => { + if (!stored.length && report.phase === 'periodic') await new Promise(resolve => { release = resolve; }); + stored.push(report); + return report; + }); + const clientSave = createReportSaver((report, signal) => { + const response = serverSave(report); + if (++calls !== 1) { release(); return response; } + return new Promise((resolve, reject) => { + signal.addEventListener('abort', () => reject(signal.reason), {once: true}); + response.then(resolve, reject); + }); + }, {timeoutMs: 20}); + const first = clientSave({phase: 'periodic'}); + const final = clientSave({phase: 'ended', cleanupFailures: ['session.end']}); + await assert.rejects(first, /Report save timed out/); + assert.deepEqual(await final, {phase: 'ended', cleanupFailures: ['session.end']}); + assert.deepEqual(stored, [{phase: 'periodic'}, {phase: 'ended', cleanupFailures: ['session.end']}]); +});