From 6be6edbfd05090c7f13ea68aa20bd83672e3bd5a Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 13 Oct 2026 15:10:35 -0500 Subject: [PATCH] fix(speko): serialize browser qualification report saves Co-Authored-By: Paperclip --- .../2026-09-11-speko-storybook-inventory.md | 6 ++-- .../2026-10-09-speko-pr-qualification.md | 2 ++ tests/speko-voice-proof/browser-client.mjs | 5 ++-- tests/speko-voice-proof/cleanup.mjs | 11 +++++++ tests/speko-voice-proof/cleanup.test.mjs | 29 ++++++++++++++++++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/doc/plans/2026-09-11-speko-storybook-inventory.md b/doc/plans/2026-09-11-speko-storybook-inventory.md index 0aefd7768db..465ad61ea7d 100644 --- a/doc/plans/2026-09-11-speko-storybook-inventory.md +++ b/doc/plans/2026-09-11-speko-storybook-inventory.md @@ -1,6 +1,6 @@ # Speko component-to-story coverage inventory -Updated: 2026-10-09. Speko remains experimental. The source inventory contains **155 production-component stories**. The prior 148-story build passed 592 interaction/accessibility checks during PR preparation; 188 affected history/page checks passed, including the two secondary-error stories. The final 153-story build passed, and all 220 affected page, provider-setup, task-launcher and incoming-call interaction/accessibility checks passed (`/tmp/speko-pr-storybook-all-review-checks.log`). The narrow-light and desktop-dark ConfigureProvider captures were inspected after the footer change; canonical Linux baseline publication is still outstanding. Setup now selects existing agents without an installer. `ChooseAgent`, `ChooseAgentLongName`, and `ChooseAgentEmpty` cover selection, keyboard use, disabled Continue, empty inventory and focus restoration. The changed setup subset passed **20 interaction/accessibility checks** across light/dark themes and 390/1200-pixel viewports with reduced motion (`/tmp/speko-existing-agent-stories.log`). The October 7 full-suite results below are historical; removed installer stories no longer apply. Fixtures block external requests and real microphone access. +Updated: 2026-10-13. Speko remains experimental. The source inventory contains **156 production-component stories**. The prior 148-story build passed 592 interaction/accessibility checks during PR preparation; 188 affected history/page checks passed, including the two secondary-error stories. The final 153-story build passed, and all 220 affected page, provider-setup, task-launcher and incoming-call interaction/accessibility checks passed (`/tmp/speko-pr-storybook-all-review-checks.log`). The narrow-light and desktop-dark ConfigureProvider captures were inspected after the footer change; canonical Linux baseline publication is still outstanding. Setup now selects existing agents without an installer. `ChooseAgent`, `ChooseAgentLongName`, and `ChooseAgentEmpty` cover selection, keyboard use, disabled Continue, empty inventory and focus restoration. The changed setup subset passed **20 interaction/accessibility checks** across light/dark themes and 390/1200-pixel viewports with reduced motion (`/tmp/speko-existing-agent-stories.log`). The October 7 full-suite results below are historical; removed installer stories no longer apply. Fixtures block external requests and real microphone access. | Story module | Story IDs | | --- | --- | @@ -10,7 +10,7 @@ Updated: 2026-10-09. Speko remains experimental. The source inventory contains * | `./storybook/stories/chat-channels/speko/speko-pages.stories.tsx` | `connections-speko-pages--catalog`, `connections-speko-pages--choose-agent`, `connections-speko-pages--choose-agent-long-name`, `connections-speko-pages--choose-agent-empty`, `connections-speko-pages--configure-provider`, `connections-speko-pages--test-conversation`, `connections-speko-pages--active`, `connections-speko-pages--paused`, `connections-speko-pages--attention`, `connections-speko-pages--revoked`, `connections-speko-pages--removed`, `connections-speko-pages--loading-failure`, `connections-speko-pages--private-access`, `connections-speko-pages--conversations`, `connections-speko-pages--conversations-empty`, `connections-speko-pages--activity-empty`, `connections-speko-pages--identity-provider-label`, `connections-speko-pages--setup-keeps-resume-link`, `connections-speko-pages--pending-incoming`, `connections-speko-pages--guest-intake`, `connections-speko-pages--with-call-history`, `connections-speko-pages--settings-without-call-history`, `connections-speko-pages--activity-with-mixed-entries`, `connections-speko-pages--activity-unapproved-call`, `connections-speko-pages--activity-call-history-failure`, `connections-speko-pages--paused-call-history`, `connections-speko-pages--long-agent-header` | | `./storybook/stories/chat-channels/speko/speko-phone-callback.stories.tsx` | `connections-speko-phone-callback--initial`, `connections-speko-phone-callback--loading`, `connections-speko-phone-callback--enabled`, `connections-speko-phone-callback--disabled`, `connections-speko-phone-callback--saving`, `connections-speko-phone-callback--saved`, `connections-speko-phone-callback--provider-failure`, `connections-speko-phone-callback--validation-and-keyboard-save` | | `./storybook/stories/chat-channels/speko/speko-provider-setup.stories.tsx` | `connections-speko-provider-setup--initial`, `connections-speko-provider-setup--credentials-entered`, `connections-speko-provider-setup--missing-https`, `connections-speko-provider-setup--verification-loading`, `connections-speko-provider-setup--resumable-setup`, `connections-speko-provider-setup--long-agent-name`, `connections-speko-provider-setup--keyboard-validation-and-connect`, `connections-speko-provider-setup--interrupted-before-credentials` | -| `./storybook/stories/chat-channels/speko/speko-task-launcher.stories.tsx` | `connections-speko-task-launcher--existing-agent`, `connections-speko-task-launcher--multiple-personas`, `connections-speko-task-launcher--unavailable-agent`, `connections-speko-task-launcher--agent-channels`, `connections-speko-task-launcher--connection-lifecycle`, `connections-speko-task-launcher--bound-task-banner`, `connections-speko-task-launcher--keyboard-open`, `connections-speko-task-launcher--connection-load-failure`, `connections-speko-task-launcher--bound-connection-recovery` | +| `./storybook/stories/chat-channels/speko/speko-task-launcher.stories.tsx` | `connections-speko-task-launcher--existing-agent`, `connections-speko-task-launcher--multiple-personas`, `connections-speko-task-launcher--unavailable-agent`, `connections-speko-task-launcher--agent-channels`, `connections-speko-task-launcher--connection-lifecycle`, `connections-speko-task-launcher--bound-task-banner`, `connections-speko-task-launcher--keyboard-open`, `connections-speko-task-launcher--connection-load-failure`, `connections-speko-task-launcher--bound-connection-recovery`, `connections-speko-task-launcher--persona-after-panel-close` | | `./storybook/stories/chat-channels/speko/call-history.stories.tsx` | `connections-speko-call-history--empty`, `connections-speko-call-history--loading`, `connections-speko-call-history--failure`, `connections-speko-call-history--completed`, `connections-speko-call-history--active`, `connections-speko-call-history--failed`, `connections-speko-call-history--missed`, `connections-speko-call-history--transcript-unavailable`, `connections-speko-call-history--partial-cost`, `connections-speko-call-history--interrupted-answer`, `connections-speko-call-history--long-conversation`, `connections-speko-call-history--keyboard-disclosure`, `connections-speko-call-history--end-call-focus`, `connections-speko-call-history--unapproved-incoming`, `connections-speko-call-history--revoked-history`, `connections-speko-call-history--activity-entry`, `connections-speko-call-history--activity-unapproved-entry`, `connections-speko-call-history--activity-end-call-focus`, `connections-speko-call-history--incoming-failure-preserves-history`, `connections-speko-call-history--end-failure-preserves-history` | | `./storybook/stories/chat-channels/speko/incoming-call.stories.tsx` | `connections-speko-live-phone-approval--awaiting-approval`, `connections-speko-live-phone-approval--existing-task`, `connections-speko-live-phone-approval--confirming`, `connections-speko-live-phone-approval--approved`, `connections-speko-live-phone-approval--denied`, `connections-speko-live-phone-approval--expired`, `connections-speko-live-phone-approval--hung-up`, `connections-speko-live-phone-approval--failure`, `connections-speko-live-phone-approval--keyboard-approval-and-focus`, `connections-speko-live-phone-approval--guest-intake`, `connections-speko-live-phone-approval--public-keyboard-end`, `connections-speko-live-phone-approval--task-list-failure-and-recovery`, `connections-speko-live-phone-approval--approval-confirmation-expires` | | `./storybook/stories/chat-channels/speko/phone-line.stories.tsx` | `connections-speko-incoming-phone-line--initial`, `connections-speko-incoming-phone-line--loading`, `connections-speko-incoming-phone-line--empty-inventory`, `connections-speko-incoming-phone-line--selected`, `connections-speko-incoming-phone-line--verification-required`, `connections-speko-incoming-phone-line--insufficient-credits`, `connections-speko-incoming-phone-line--provider-failure`, `connections-speko-incoming-phone-line--long-labels`, `connections-speko-incoming-phone-line--keyboard-save`, `connections-speko-incoming-phone-line--guest-intake`, `connections-speko-incoming-phone-line--private-task-approval`, `connections-speko-incoming-phone-line--selected-sandbox` | @@ -83,3 +83,5 @@ Historical development run: all 50 affected production-component stories passed Final merge preparation adds a bounded approval-confirmation story using the production incoming-call component. Its play function approves the call, verifies focus, and waits for the five-second receipt to clear. The prior 220-check result remains historical; all 108 final affected approval/conversation checks passed and are recorded in the qualification report. Latest interrupted-setup repair: the 155-story build and all 32 provider-setup interaction/accessibility checks passed across both themes and 390/1200-pixel widths with reduced motion. The production story verifies generation of a missing signing secret during interrupted setup; existing reconnect stories preserve saved secrets. No real microphone or external provider requests were used. + +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. diff --git a/doc/plans/2026-10-09-speko-pr-qualification.md b/doc/plans/2026-10-09-speko-pr-qualification.md index 4ecc4047d3d..55c53e588cf 100644 --- a/doc/plans/2026-10-09-speko-pr-qualification.md +++ b/doc/plans/2026-10-09-speko-pr-qualification.md @@ -87,3 +87,5 @@ Interrupted setup qualification: safe secret-presence serialization and producti Callback rotation review repair: ownership receipts now bind the provider identity and exact old callback independently from the replacement secret. Legacy receipts use the previous vaulted key and are upgraded before provider changes. Five focused real-database ownership/rotation/uncertain-creation tests and server typecheck passed; current and legacy simultaneous URL/key rotation and foreign callback rejection are covered. Qualification provenance and media repair: the live browser report reads the assigned agent’s actual adapter type instead of inferring Claude from the scenario name. Synthetic media pump failures are observed immediately, release blocked input, and enter the hangup/evidence finally path. Ten focused cleanup/media/redaction tests pass; this repair placed no live calls. + +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. diff --git a/tests/speko-voice-proof/browser-client.mjs b/tests/speko-voice-proof/browser-client.mjs index aba560b5f97..a58f34b1acb 100644 --- a/tests/speko-voice-proof/browser-client.mjs +++ b/tests/speko-voice-proof/browser-client.mjs @@ -1,5 +1,5 @@ import { VoiceConversation } from '@spekoai/client'; -import { createCleanup, createAudioSave } from './cleanup.mjs'; +import { createCleanup, createAudioSave, createReportSaver } from './cleanup.mjs'; const config = JSON.parse(document.querySelector('#config').textContent); const $ = (id) => document.getElementById(id); const events = []; @@ -81,11 +81,12 @@ function renderTranscript(list) { const item = document.createElement('li'); item.textContent = `${m.source}: ${m.text}`; return item; })); } +const saveQueuedReport = createReportSaver(report => api("/report", report)); async function saveReport() { const report = { sessionId, sdkVersion: '0.0.13', syntheticMicrophone: true, events, transcripts, cleanupFailures, sdkOpen: conversation?.isOpen() ?? false, audioElements: document.querySelectorAll('audio').length, inputTrackStates: tracks.map((t) => ({ enabled: t.enabled, readyState: t.readyState })) }; - await api('/report', report); + await saveQueuedReport(report); $('evidence').textContent = JSON.stringify({ ...report, transcripts: `${transcripts.length} reconciled segments` }, null, 2); } const cleanup = createCleanup({ diff --git a/tests/speko-voice-proof/cleanup.mjs b/tests/speko-voice-proof/cleanup.mjs index 7acde221dee..24661012804 100644 --- a/tests/speko-voice-proof/cleanup.mjs +++ b/tests/speko-voice-proof/cleanup.mjs @@ -52,3 +52,14 @@ export function createAudioSave({stop, upload}) { }, }; } + +/** Older writes must finish before final cleanup evidence can be stored. */ +export function createReportSaver(write) { + let pending = Promise.resolve(); + return report => { + const snapshot = structuredClone(report); + const saved = pending.then(() => write(snapshot)); + pending = saved.catch(() => {}); + return saved; + }; +} diff --git a/tests/speko-voice-proof/cleanup.test.mjs b/tests/speko-voice-proof/cleanup.test.mjs index bd94665b7b5..d189900c96a 100644 --- a/tests/speko-voice-proof/cleanup.test.mjs +++ b/tests/speko-voice-proof/cleanup.test.mjs @@ -1,6 +1,6 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { createCleanup, createAudioSave } from './cleanup.mjs'; +import { createCleanup, createAudioSave, createReportSaver } from './cleanup.mjs'; test('failed hangup preserves evidence and retries only the unconfirmed provider operation', async () => { let locals = 0, ends = 0; @@ -96,3 +96,30 @@ test('audio evidence waits for final recording data before upload and coalesces await first; await evidence.save(); assert.equal(uploads, 1); }); + +test('final report waits for an older write and preserves its cleanup failures', async () => { + let release; + const writes = [], stored = []; + const save = createReportSaver(async report => { + writes.push(report); + if (writes.length === 1) await new Promise(resolve => { release = resolve; }); + stored.push(report); + }); + const earlier = {events: ['working'], cleanupFailures: []}; + const oldSave = save(earlier); + await Promise.resolve(); + earlier.events.push('mutated after enqueue'); + const finalSave = save({events: ['ended'], cleanupFailures: ['session.end']}); + await Promise.resolve(); + assert.equal(writes.length, 1); + release(); + await Promise.all([oldSave, finalSave]); + assert.deepEqual(stored, [{events: ['working'], cleanupFailures: []}, {events: ['ended'], cleanupFailures: ['session.end']}]); +}); + +test('a failed periodic write does not prevent storing final cleanup evidence', async () => { + let writes = 0; + const save = createReportSaver(async report => { if (++writes === 1) throw new Error('failed'); return report; }); + await assert.rejects(save({events: []})); + assert.deepEqual(await save({events: ['ended']}), {events: ['ended']}); +});