Skip to content

Commit 26d2b2d

Browse files
authored
Merge pull request #4 from baditaflorin/codex/ux-foundation-batch-02
feat(ux): rebuild shared shell foundations
2 parents da7a831 + d80bced commit 26d2b2d

12 files changed

Lines changed: 214 additions & 137 deletions

docs/404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
/>
1313
<meta name="theme-color" content="#db2777" />
1414
<title>mesh-caption-clash</title>
15-
<script type="module" crossorigin src="/mesh-caption-clash/assets/index-BwuRHtOe.js"></script>
16-
<link rel="stylesheet" crossorigin href="/mesh-caption-clash/assets/index-DNtGFfOK.css">
15+
<script type="module" crossorigin src="/mesh-caption-clash/assets/index-B-cyDPNQ.js"></script>
16+
<link rel="stylesheet" crossorigin href="/mesh-caption-clash/assets/index-BxjgV5uD.css">
1717
</head>
1818
<body>
1919
<div id="root"></div>

docs/assets/index-B-cyDPNQ.js

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/index-B-cyDPNQ.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/index-BwuRHtOe.js

Lines changed: 0 additions & 121 deletions
This file was deleted.

docs/assets/index-BwuRHtOe.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/index-BxjgV5uD.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/index-DNtGFfOK.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
/>
1313
<meta name="theme-color" content="#db2777" />
1414
<title>mesh-caption-clash</title>
15-
<script type="module" crossorigin src="/mesh-caption-clash/assets/index-BwuRHtOe.js"></script>
16-
<link rel="stylesheet" crossorigin href="/mesh-caption-clash/assets/index-DNtGFfOK.css">
15+
<script type="module" crossorigin src="/mesh-caption-clash/assets/index-B-cyDPNQ.js"></script>
16+
<link rel="stylesheet" crossorigin href="/mesh-caption-clash/assets/index-BxjgV5uD.css">
1717
</head>
1818
<body>
1919
<div id="root"></div>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"test:e2e:install": "playwright install chromium",
3131
"screenshot": "bash ../mesh-common/scripts/screenshot-app.sh",
3232
"demo": "bash ../mesh-common/scripts/record-demo.sh",
33-
"audit:security": "bash ../mesh-common/scripts/audit-app-security.sh"
33+
"audit:security": "bash ../mesh-common/scripts/audit-app-security.sh",
34+
"test:leak": "MESH_RUN_LEAK_TEST=1 playwright test tests/e2e/memory-leak.spec.ts"
3435
},
3536
"dependencies": {
3637
"@baditaflorin/mesh-common": "file:../mesh-common",

tests/e2e/memory-leak.spec.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { test, expect } from "@playwright/test";
1+
import { readFileSync } from "node:fs";
2+
import { expect, test } from "@playwright/test";
23

34
/**
45
* Long-running room leak detector. Boots two peers, runs the generic
@@ -22,10 +23,19 @@ import { test, expect } from "@playwright/test";
2223
const DURATION = Number(process.env.MESH_LEAK_DURATION_MS ?? 60_000);
2324
const BUDGET_MB = Number(process.env.MESH_LEAK_BUDGET_MB ?? 15);
2425
const NOISE_OPS = Number(process.env.MESH_LEAK_NOISE_OPS ?? 200);
26+
const ENABLED = process.env.MESH_RUN_LEAK_TEST === "1";
27+
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")) as {
28+
name: string;
29+
};
30+
const APP_NAME = pkg.name;
2531

2632
test("memory leak — heap growth stays under budget over a long-running room", async ({
2733
browser,
2834
}) => {
35+
// Keep the expensive detector opt-in. It is deliberately installed with
36+
// `test:e2e`, but only `npm run test:leak` enables its 60-second run.
37+
test.skip(!ENABLED, "run with `npm run test:leak`");
38+
test.setTimeout(Math.max(30_000, DURATION + 15_000));
2939
const ctx = await browser.newContext();
3040
await ctx.addInitScript(
3141
({ prefix, room }) => {
@@ -35,14 +45,14 @@ test("memory leak — heap growth stays under budget over a long-running room",
3545
/* private mode */
3646
}
3747
},
38-
{ prefix: "mesh-caption-clash", room: `leak-${Date.now()}` },
48+
{ prefix: APP_NAME, room: `leak-${Date.now()}` },
3949
);
4050

4151
const a = await ctx.newPage();
4252
const b = await ctx.newPage();
4353
await Promise.all([
44-
a.goto("/mesh-caption-clash/", { waitUntil: "domcontentloaded" }),
45-
b.goto("/mesh-caption-clash/", { waitUntil: "domcontentloaded" }),
54+
a.goto(`/${APP_NAME}/`, { waitUntil: "domcontentloaded" }),
55+
b.goto(`/${APP_NAME}/`, { waitUntil: "domcontentloaded" }),
4656
]);
4757

4858
// Settle the initial mount + first GC opportunity.
@@ -86,7 +96,7 @@ async function measureHeap(page: import("@playwright/test").Page): Promise<numbe
8696
}
8797

8898
async function clickAnything(page: import("@playwright/test").Page): Promise<void> {
89-
const btn = page.locator("button:visible").first();
99+
const btn = page.locator("button:not([disabled]):not([aria-disabled='true']):visible").first();
90100
if ((await btn.count()) === 0) return;
91101
await btn.click({ trial: false, timeout: 2000 }).catch(() => undefined);
92102
}

0 commit comments

Comments
 (0)