diff --git a/CHANGELOG.md b/CHANGELOG.md index 15b38c79..1d4b0c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -239,6 +239,7 @@ Gitea runner에서 merge 단계를 초록으로 만들고, worker를 늘리지 | `check:ci`의 계약 검사(`scripts/check-ci-contract.ts`)가 보고서 폴더 `artifacts/quality`를 직접 만든다. 전에는 새 checkout·worktree에서 `check:ci`만 따로 돌리면 계약 검사가 끝난 뒤 `ENOENT`로 실패해 실패 목록이 가려졌다. CI 판정은 바뀌지 않는다 (CI-FE-0006) | `scripts/check-ci-contract.ts`, `tests/unit/ci-workflow-generation.test.ts` | `fa4c6e6d` | | Service Worker e2e 두 spec의 대기가 자기 숫자(60 s·30 s, 기본 시험 timeout 30 s 이상이라 쓰일 수 없었다) 대신 시험 timeout을 받는다. 복구 spec의 `expect.poll`은 `timeout: 0`으로 시험 기한까지 보고, `toBeVisible`은 기본 expect timeout(5 s)을 받는다. 빌드를 포함하는 Playwright `webServer` 넷(e2e·Storybook·visual 둘)이 desktop에서 잰 시작 시간으로 `childProcessTimeout`의 timeout을 받는다(앱 60 s, Storybook 150 s, test:a11y는 e2e 설정을 물려받음). 빌드가 더 느린 프로젝트는 `docs/work/reference/testing.md` 2절대로 자기 값을 다시 잰다 (REV-FE-0012, REV-FE-0015) | `tests/e2e/service-worker-update.spec.ts`, `tests/e2e/service-worker-recovery.spec.ts`, `playwright.config.ts`, `playwright.storybook.config.ts`, `playwright.visual.config.ts`, `tests/helpers/child-process-timeout.ts`, `docs/work/reference/testing.md` | `ec95cde5`, `bf21611b` | | Service Worker 사전 캐시 목록이 dist 파일 가운데 `public/`에 같은 경로로 있는 사본을 뺀다. `collectStaticAssets`와 `countPrecachedAssets`가 같은 목록을 읽는다. 전에는 `public/assets/`에 hash 같은 이름으로 둔 파일이 immutable로 사전 캐시됐다. 빌드는 `public/assets/`를 Vite 전에 거절한다. 위 "먼저 할 일" (REV-FE-0043, REV-FE-0044) | `scripts/generate-service-worker-assets.ts`, `scripts/build-frontend.ts`, `scripts/lib/public-asset-directory.ts`, `tests/unit/public-asset-directory.test.ts`, `tests/unit/service-worker-asset-bounds.test.ts` | `3b3396ea` | +| OPFS 다른 탭 시험 둘(purge·reconcile)이 고정 250 ms 대기 대신 Web Locks 대기열(`navigator.locks.query()`)에 B 탭의 요청 하나만 보일 때까지 기다린 뒤 A 탭의 put을 푼다(B를 시작하기 전에는 같은 잠금의 대기가 0이어야 한다). 전에는 B 탭이 250 ms 안에 대기 지점에 못 오면 put이 먼저 끝나 시험이 떨어졌다. preload 지연 시험이 지연한 chunk가 `modulepreload`였는지와 route가 그 요청을 실제로 늦췄는지 단언한다. 전에는 fixture build가 preload를 끄거나 route 경로가 어긋나도 지연 없는 방문으로 통과했다 (REV-FE-0017, REV-FE-0018) | `tests/browser-capabilities/opfs-runtime.spec.ts`, `tests/e2e/preload-use.spec.ts` | `af5b8e1f`, `73bad4c9`, `ffa48725` | ## 미출시 — `8327e221` → 하네스와 작업 매뉴얼 diff --git a/tests/browser-capabilities/opfs-runtime.spec.ts b/tests/browser-capabilities/opfs-runtime.spec.ts index 3a4849f9..3ff51157 100644 --- a/tests/browser-capabilities/opfs-runtime.spec.ts +++ b/tests/browser-capabilities/opfs-runtime.spec.ts @@ -326,6 +326,46 @@ async function removeOpfsAuthority( }, scope); } +/** + * How many Web Locks requests are still queued for one lock of the OPFS + * runtime of `scope` in `mode`: the workers' origin lease, or this partition's + * lock. Every tab and worker of a context shares one lock manager, so either + * tab sees what the other tab's maintenance waits for. + * + * 2026-11-23. The two-tab tests below waited a fixed 250 ms for tab B to get + * there before letting tab A's put finish. When tab B was slower, the put + * finished first and the test failed on an outcome it never set up. They now + * wait for tab B's request in this queue. The lease has one name for the whole + * origin, so another tab or worker waiting for it looked just like tab B. The + * queue must be empty before tab B starts and then hold exactly one request; + * another waiter fails the test instead of standing in for tab B. + */ +async function queuedOpfsLocks( + page: import("@playwright/test").Page, + scope: OpfsTabScope, + lock: "origin lease" | "partition", + mode: LockMode, +): Promise { + return await page.evaluate( + async ({ tabScope, lock, mode }) => { + const policyModulePath = "/src/adapters/storage/opfs/opfs-policy.ts"; + const { DEFAULT_OPFS_RUNTIME_POLICY } = (await import( + /* @vite-ignore */ policyModulePath + )) as typeof import("../../src/adapters/storage/opfs/opfs-policy.ts"); + const lease = DEFAULT_OPFS_RUNTIME_POLICY.mutationLockName; + const name = + lock === "origin lease" + ? lease + : `${lease}:partition:${tabScope.authorityToken}:${tabScope.namespaceToken}:${tabScope.partitionToken}`; + const { pending = [] } = await navigator.locks.query(); + return pending.filter( + (request) => request.name === name && request.mode === mode, + ).length; + }, + { tabScope: scope, lock, mode }, + ); +} + // 2026-11-03 05-01 X1. The purge used to report a completed sweep while the // other tab's put landed, and the object stayed readable after the account // deletion. It now waits for that put and takes it with the partition. @@ -413,6 +453,11 @@ for (const committedObjects of [0, 3]) { }); await started; }); + const waitedLock = committedObjects === 0 ? "partition" : "origin lease"; + expect( + await queuedOpfsLocks(secondPage, scope, waitedLock, "exclusive"), + `nothing waits for the ${waitedLock} before tab B's purge`, + ).toBe(0); await secondPage.evaluate(() => { const state = globalThis as unknown as { __opfsTab: Tab; @@ -422,7 +467,15 @@ for (const committedObjects of [0, 3]) { reason: "ACCOUNT_DELETION", }); }); - await page.waitForTimeout(250); + // Tab B's purge has listed the partition and waits for what tab A's put + // holds: the partition lock it takes exclusive when nothing is left to + // remove, or the origin lease its first remove needs. + await expect + .poll( + () => queuedOpfsLocks(secondPage, scope, waitedLock, "exclusive"), + { message: "tab B's purge, and nothing else, waits for tab A's put" }, + ) + .toBe(1); const put = await page.evaluate(async () => { const state = globalThis as unknown as { __release: () => void; @@ -519,6 +572,10 @@ test("05-01 a reconcile in another tab skips a live put and the put stays readab }); await started; }); + expect( + await queuedOpfsLocks(page, scope, "origin lease", "exclusive"), + "nothing waits for the origin lease before tab B's reconcile", + ).toBe(0); // Tab B reconciles while tab A's put is in flight. await secondPage.evaluate(() => { @@ -528,7 +585,14 @@ test("05-01 a reconcile in another tab skips a live put and the put stays readab }; state.__reconcile = state.__opfsTab.maintenance.reconcile(); }); - await page.waitForTimeout(250); + // Tab B's reconcile has tried the row's lock and gone on to the orphan + // sweep, which waits for the origin lease tab A's put holds. So its + // result cannot be awaited before the put is released: it comes after. + await expect + .poll(() => queuedOpfsLocks(page, scope, "origin lease", "exclusive"), { + message: "tab B's reconcile, and nothing else, waits for tab A's put", + }) + .toBe(1); const put = await page.evaluate(async () => { const state = globalThis as unknown as { __release: () => void; diff --git a/tests/e2e/preload-use.spec.ts b/tests/e2e/preload-use.spec.ts index d748b098..3d26d6c8 100644 --- a/tests/e2e/preload-use.spec.ts +++ b/tests/e2e/preload-use.spec.ts @@ -192,10 +192,12 @@ strictTest.describe("with a feature installed", () => { try { await page.goto(`${server.origin}/`); const file = `/${manifest[parent ?? ""]?.file}`; + let delayed = 0; await page.route( (url) => url.pathname === file, async (route) => { await new Promise((resolve) => setTimeout(resolve, 3_500)); + delayed += 1; await route.fallback(); }, ); @@ -206,6 +208,15 @@ strictTest.describe("with a feature installed", () => { await expect( page.getByRole("table", { name: "설치된 HTTP 오퍼레이션" }), ).toBeVisible({ timeout: 15_000 }); + // 2026-11-23. The table alone also came up when the build stopped + // preloading that chunk or the route missed its path: a plain visit + // with nothing delayed. The chunk was a modulepreload, and its one + // request waited the 3.5 s. + await expect( + page.locator(`link[rel="modulepreload"][href$="${file}"]`), + "the delayed chunk was preloaded", + ).toHaveCount(1); + expect(delayed, "the route delayed that chunk's request").toBe(1); } finally { await server.close(); }