From 7fd596176b984dd4e4e2f4b612c7047f0f7d697c Mon Sep 17 00:00:00 2001 From: Kevin Goedecke Date: Sat, 21 Nov 2026 01:14:19 -0800 Subject: [PATCH 1/2] test: DEBUG clipboard flake, 6x shard 3 with pick logging (do not merge) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 5 +++-- tests/canvasClipboardBrowser.test.ts | 11 ++++++++++- tests/fixtures/canvasClipboard.html | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ada3e1462..5b2508654 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,8 @@ jobs: strategy: fail-fast: false matrix: - shard: [1, 2, 3, 4] + # DEBUG (throwaway): six copies of shard 3 to catch the clipboard flake + copy: [1, 2, 3, 4, 5, 6] steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 @@ -87,7 +88,7 @@ jobs: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns >/dev/null # `bun run test`, not `bun test`: the suite is vitest, and `bun test` # would run Bun's own runner against the same files - - run: bun run test -- --shard=${{ matrix.shard }}/${{ strategy.job-total }} + - run: bun run test -- --shard=3/4 # One status that stands for every shard, so a required check or a merge # queue names "tests" rather than each "test (N)"; renumbering the matrix diff --git a/tests/canvasClipboardBrowser.test.ts b/tests/canvasClipboardBrowser.test.ts index 3dff6f541..0d7683fd3 100644 --- a/tests/canvasClipboardBrowser.test.ts +++ b/tests/canvasClipboardBrowser.test.ts @@ -251,7 +251,16 @@ describe.skipIf(!findBrowserPath() || !CLIPBOARD_IS_RELIABLE)('canvas clipboard await chord('c') await chord('v') await expect.poll(() => count('section, p')).toBe(4) - expect(await page.evaluate(() => window.canvasClipboardHarness.picked())).toHaveLength(2) + const picked = await page.evaluate(() => window.canvasClipboardHarness.picked()) + if (picked.length !== 2) { + /* DEBUG (throwaway) */ + const log = await page.evaluate(() => (window as unknown as { __pickLog: unknown[] }).__pickLog) + const later = await new Promise((r) => setTimeout(r, 500)).then(() => + page.evaluate(() => window.canvasClipboardHarness.picked()), + ) + console.log('PICKLOG ' + JSON.stringify({ picked, later, log }, null, 1)) + } + expect(picked).toHaveLength(2) }) it('copies through the element menu and pastes with the keyboard', async () => { diff --git a/tests/fixtures/canvasClipboard.html b/tests/fixtures/canvasClipboard.html index 8ba273a88..5c3b0ca7c 100644 --- a/tests/fixtures/canvasClipboard.html +++ b/tests/fixtures/canvasClipboard.html @@ -14,6 +14,20 @@ import { clearHistory, undo } from '/src/lib/history.ts' import '/src/styles.css' + /* DEBUG (throwaway): every change to the picked elements, with who made it */ + window.__pickLog = [] + useStore.subscribe((state, prev) => { + const now = JSON.stringify(pickedSelectors(state)) + const before = JSON.stringify(pickedSelectors(prev)) + if (now === before) return + window.__pickLog.push({ + t: Math.round(performance.now()), + from: before, + to: now, + html: state.canvas?.frames[0]?.html.length, + stack: (new Error().stack || '').split('\n').slice(2, 14).join(' | '), + }) + }) window.canvasClipboardHarness = { seed: (frames, role = 'edit') => { clearHistory() From eeb8b7a873f4ca4f306a94055f48977ea464d8fe Mon Sep 17 00:00:00 2001 From: Kevin Goedecke Date: Sat, 21 Nov 2026 01:14:37 -0800 Subject: [PATCH 2/2] test: DEBUG run CI on pushes to the debug branch (do not merge) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b2508654..a2bbf3855 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [main] + branches: [main, debug/clipboard-flake-matrix] pull_request: # A new push to the same PR supersedes the run in flight; main is never cancelled.