Repository navigation
test(harness): open the scaffolded Workbench in a real browser (SP4, step 1) - #750
Merged
Merged
Conversation
Promotes the README capture journey into a required CI assertion: a seventh web check inside the generated-app activation harness drives the scaffolded Workbench in headless Chromium against aimock, reusing the exported helpers from docs/brand/demo/capture.mjs. No new job, runner, or test-id contract. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… step 1) Six tasks: capture.mjs type declarations, an injected-browser journey helper with five unit tests, W7 wired into the activation test, the harness-verify Chromium step, a local acceptance run with two mutations proving the gate binds and fails closed, and the PR. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The activation harness will drive the scaffolded Workbench through the same journey the README recording uses. test/tsconfig.json has no allowJs, so the .mjs helpers need a declaration file to be importable from TypeScript. Named the file capture.d.mts, not capture.d.ts: TypeScript only resolves a declaration for an .mjs module from a matching .d.mts sibling under moduleResolution Bundler, confirmed by rerunning typecheck against each name. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…wser Open the scaffolded Workbench, send a prompt, wait for the run to settle, read the persisted thread id, reload and restore the thread, and fail on any console or page error. The browser is a dependency so the ordering, the fail-closed paths, and the screenshot-on-failure are unit-tested without Chromium. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Task 1 found that a .d.ts sibling does not type a .mjs import under moduleResolution Bundler; only .d.mts does. Update the plan and spec so Task 3's scenario declaration is created with the right extension. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…s constants
- Attach collected console/page errors to the failure that triggered the
screenshot (cause chain), instead of dropping them when restoration or any
other step throws.
- Match the persisted thread's title against the Workbench's own
normalisation (trim + MAX_TITLE_LENGTH truncation from thread-source.ts)
instead of the raw prompt, and make a missing-id failure diagnosable: which
case happened (absent key / invalid JSON / non-array / no match / non-string
id) and, when relevant, the titles that were actually found.
- Extract findPersistedThreadId as a pure, exported, unit-tested function;
the page.evaluate callback is now a thin localStorage.getItem wrapper with
no closures, and JSON.parse is guarded so malformed storage never throws.
- Stop casting the fake chromium to `never` in the test: type it against
WorkbenchBrowserDeps["chromium"] so a new required member on the deps
interface fails the fake at typecheck, not silently.
- Fix capture.d.mts: restoreWorkbenchThread resolves { stateUrl }, not void;
note that nothing type-checks this file against the .mjs, so signature
changes there must be mirrored here by hand.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…sation thread-source.ts stores threads newest-first, so the loop's last-match-wins reassignment resolved the OLDEST thread with the prompt's title. Take the first match instead, and cover the title normalisation (trim + 80-char truncation) with a prompt long enough for it not to be an identity. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…mium The seventh web assertion opens the generated web client in a real browser, sends the README demo prompt through the CopilotKit runtime to the B4 server, waits for the run to settle, and restores the thread after a reload. Fails closed on a missing browser, a missing persisted thread, or any console error. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t live run aimock matches userMessage as a substring, so the demo prompt (a prefix of SAFE_PROMPT) is replaced by a dedicated gate prompt with a collision guard; the designed 404 hydrate probes are allowlisted; the screenshot moves to the uploaded artifacts tree; the wrapper error carries the cause chain; the missing-browser check runs before the scaffold. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…bes, aborts, prompts, and CI artifacts The gate now tolerates exactly the two hydrate probes' 404s on a new thread (a 500 on them or a 404 elsewhere still fails), honours the harness lifecycle signal, rejects a prompt the thread rail could never round-trip, and writes its screenshot where harness-verify uploads from. W7 stops borrowing the README demo scenario — aimock matches userMessage as a substring, so DEMO_PROMPT being a prefix of SAFE_PROMPT was a latent collision that only registration order hid; W7 now has its own prompt, and a guard fails fast on the next such pair. The wrapper flattens its cause chain into the message so the JSON reporter carries the real failure into CI. Co-Authored-By: Claude Fable 5.1 <[email protected]>
… review nits Co-Authored-By: Claude Fable 5.1 <[email protected]>
Adds the Playwright Chromium install before the harness lanes and re-audits the two workflow-entrypoint fixtures for the new step. Co-Authored-By: Claude Fable 5.1 <[email protected]>
aimock matches userMessage as a substring, so an appended prompt still matches its fixture and the appended-prompt mutation passes. The binding mutation is a wrong answer, which the restore step must fail to find. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 19, 2026 17:15 — with
GitHub Actions
Inactive
The spec's journey step and its mutation still named DEMO_PROMPT and the inert wrong-prompt mutation; the plan's self-review claimed a scenario.d.mts that Task 3 removed. Record the executed design. Co-Authored-By: Claude Fable 5.1 <[email protected]>
blove
marked this pull request as ready for review
September 19, 2026 17:20
blove
temporarily deployed
to
vercel-preview
September 19, 2026 17:20 — with
GitHub Actions
Inactive
This was referenced Sep 20, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last open item of the Workbench arc: a seventh web assertion (W7) in the generated-app activation harness opens the scaffolded Workbench in headless Chromium — through the real CopilotKit runtime to the real B4 server, aimock behind it — sends a prompt, waits for the run to settle, and restores the thread after a reload. It reuses the journey helpers
docs/brand/demo/capture.mjsalready exports for the README recording, so the gate and the recording share one journey.Spec:
docs/superpowers/specs/2026-09-19-workbench-browser-gate-design.md· Plan:docs/superpowers/plans/2026-09-19-workbench-browser-gate.md.Why now
npm create b4-app@latestis the advertised activation everywhere, and nothing in CI rendered the scaffolded Workbench: the harness's six web assertions are HTTP-only and the only research e2e runs against the example, asserting transport selection. The three historical "green tests, dead UI" defects (StrictModeuseReflatch, connect predicate on the wrong server, array-form content hydrating blank) were all only visible on a rendered page; since then the template took CopilotKit 1.68→1.70 and 0.8.32–0.8.33 changed what the Workbench renders, with PRs merging on bot auto-approval while review credits are out.Shape
harness-verifygains oneplaywright install --with-deps chromiumstep and is alreadyLANE_3of the requiredvalidateaggregate.test/harness/workbench-browser.ts) has 21 unit tests with a fake browser; the two audited workflow fixtures are regenerated for the new step (churn limited toharness-verify).artifacts/testing/tree — the only pathharness-verifyuploads — and the activation test's wrapper error now carries the flattened cause chain, because vitest's JSON reporter drops{ cause }(the first live failure showed only file paths).Found by running it live, not by review
userMessageas a substring (@copilotkit/aimockrouter.js:217, norequestTransform) and breaks ties by registration order. The README'sDEMO_PROMPTis a prefix of the harness'sSAFE_PROMPT, so the gate uses its ownBROWSER_PROMPTand asserts at registration that no registered prompt is a proper substring of another. Corollary recorded in the plan: a mutation that appends to a prompt still matches and proves nothing — mutate the evidence./api/b4/threads/:id/state,/pending_interrupts— W2 asserts that same 404) and Chromium logs them as console errors. The console-error check tolerates exactly a 404 on those two pathnames; a 500 there or a 404 anywhere else still fails.restoreWorkbenchThreaduses one string for both the rail row (the truncated 80-char title) and the transcript text, so gate prompts must be trimmed and ≤80 chars — checked before launch.Verified
pnpm verify:harness:framework)caused by: locator.waitFor: Timeout 120000ms … getByText('… (mutated)'); screenshot present at the uploaded pathPLAYWRIGHT_BROWSERS_PATHChromium is not installed … run: pnpm exec playwright install chromium— no skipworkbench-browser.test.ts21/21;flattenCause7/7workflow-contracts.test.mjs166/166 ·test:release-integrity0 · check-docs 0Conscious choice:
--with-depsputs anapt-getinvalidate's required path for the first time. Kept for consistency with the three sibling browser lanes; the alternative (a missing shared library after a Playwright bump) fails deterministically with a worse message.Risk register (first ten CI runs)
--with-depsis new exposure forvalidate— the three pre-existingplaywright install --with-depssteps all live in jobs outside the required lanes; an apt mirror hiccup can now redvalidate.+3journal delta has no tolerance. A CopilotKit reconnect, a StrictMode remount that re-issues, or a Next dev Fast Refresh mid-run changes the count and fails. That strictness is the point (it is what catches a double-run), and it is the most likely source of an early red.next devcompile of the shell route underopenReadyWorkbench's 60 s budget on a 2-core runner; W1–W6 warm the API routes in the same session, not the page.harness-verifyheadroom — first CI run onubuntu-latest: 13.2 min againsttimeout-minutes: 30(~12 min baseline; Chromium install + W7 cost ≈ 1 min).docs/brand/demo/capture.mjs's module graph; a breaking edit to the README-recording scenario redsharness-verify, not justmedia:readme:capture.capture.d.mtsvscapture.mjs, andTHREADS_STORAGE_KEY/MAX_THREAD_TITLE_LENGTHvsthread-source.ts— both verified against source in review.Not covered (step 2)
The gated journey ("Trigger a permission prompt" →
Allow once), the memory panel, and plan/subagent card assertions. Those are the spec's original list and may justify atest-idscontract; this lands first so the lane's CI cost is measured before widening it.🤖 Generated with Claude Code