mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
Allow configured Storybook origin in Speko qualification
Keep provider requests blocked and verify hosted navigation and assets with a deterministic browser fixture. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a06e049ab1
commit
905bc5da5d
2 files changed
+37
-6
No files matched your search
@@ -95,3 +95,5 @@ October 13 master reconciliation: all 76 affected Storybook checks passed and na
|
||||
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.
|
||||
|
||||
October 13 merge handoff: UI #15728 merged at 22d05644f4888ff75c344c471524acf993087338 after 55 passing checks and a fresh 5/5 review with no unresolved findings. Its final source b5684d9a42 passed all 152 affected page/launcher Storybook checks across both themes and narrow/desktop widths; the final build contains 157 Speko stories. Qualification is refreshed against merged master. The visual runner preserves both configurable local ports and the upstream external Storybook base URL override. No provider calls or lockfiles were added.
|
||||
|
||||
Hosted Storybook review repair: the Speko request guard permits only the configured Storybook origin, including hosted URLs, and continues to reject unrelated provider requests. A deterministic browser regression serves a synthetic hosted origin without external traffic and verifies navigation/assets succeed while Speko requests are blocked. Hosted-origin isolation and representative local narrow-screen stories pass. Two CI jobs on the prior head were interrupted by runner shutdown signals, without assertion failures; the repair requires fresh current-head CI and review.
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { resolve } from "node:path";
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { test, expect, type Page } from "@playwright/test";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const root = resolve(import.meta.dirname, "../..");
|
||||
@@ -9,15 +9,44 @@ const addon = require.resolve("@storybook/addon-a11y/package.json", { paths: [re
|
||||
const axePath = require.resolve("axe-core/axe.min.js", { paths: [addon] });
|
||||
const index = JSON.parse(readFileSync(resolve(root, "ui/storybook-static/index.json"), "utf8"));
|
||||
const stories = (Object.values(index.entries) as { id: string; type: string }[]).filter((entry) => entry.type === "story" && entry.id.startsWith("connections-speko-"));
|
||||
async function protectStoryOrigin(page: Page, baseURL: string, external: string[]) {
|
||||
const storyOrigin = new URL(baseURL).origin;
|
||||
await page.route(/^https?:\/\//, (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.origin !== storyOrigin) {
|
||||
external.push(url.hostname);
|
||||
return route.abort();
|
||||
}
|
||||
return route.fallback();
|
||||
});
|
||||
}
|
||||
|
||||
test("Speko network isolation permits hosted Storybook and blocks providers", async ({ page }) => {
|
||||
const baseURL = "https://storybook.example.invalid";
|
||||
const external: string[] = [];
|
||||
const served: string[] = [];
|
||||
await page.route(/^https?:\/\//, (route) => {
|
||||
served.push(route.request().url());
|
||||
return route.fulfill({ contentType: "text/html", body: "<!doctype html><title>Hosted fixture</title>" });
|
||||
});
|
||||
await protectStoryOrigin(page, baseURL, external);
|
||||
await page.goto(`${baseURL}/iframe.html`);
|
||||
await expect(page).toHaveTitle("Hosted fixture");
|
||||
expect(external).toEqual([]);
|
||||
expect(await page.evaluate(async (origin) => (await fetch(`${origin}/asset`)).ok, baseURL)).toBe(true);
|
||||
expect(await page.evaluate(async () => {
|
||||
try { await fetch("https://api.speko.dev/v1/calls"); return false; }
|
||||
catch { return true; }
|
||||
})).toBe(true);
|
||||
expect(external).toEqual(["api.speko.dev"]);
|
||||
expect(served).toEqual([`${baseURL}/iframe.html`, `${baseURL}/asset`]);
|
||||
});
|
||||
|
||||
for (const story of stories) for (const theme of ["light", "dark"]) for (const width of [390, 1200]) {
|
||||
test(`Speko accessibility ${story.id} ${theme} ${width}`, async ({ page }, info) => {
|
||||
const errors: string[] = [], external: string[] = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.route(/^https?:\/\//, (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (!["localhost", "127.0.0.1"].includes(url.hostname)) { external.push(url.hostname); return route.abort(); }
|
||||
return route.continue();
|
||||
});
|
||||
await protectStoryOrigin(page, info.project.use.baseURL!, external);
|
||||
await page.addInitScript(() => {
|
||||
Object.defineProperty(navigator.mediaDevices, "getUserMedia", { value: () => { throw new Error("Story attempted real microphone access"); } });
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user