문제: 손상이 없는 LOGOUT·ACCOUNT_DELETION purge는 commit된 object 행과
참조 없는 chunk만 본다. 같은 partition의 끝나지 않은 journal 행
(PREPARING·FILES_READY)은 보지 않고, sweep은 staging receipt가 가리키는
chunk를 건너뛰면서도 COMPLETED를 돌려준다. 그래서
- 다른 탭이 put 중이면 purge가 "COMPLETED"를 보고한 뒤 그 객체가
그대로 읽힌다(X1, 실제 Chromium·Firefox에서도 같음).
- commit 직전에 멈춘 put(FILES_READY)은 purge 뒤 다음 reconcile이
commit해 계정 삭제한 사용자 파일이 객체로 다시 생긴다(X2).
- 업로드 중 멈춘 put(PREPARING)은 chunk가 grace 기간 동안 남고(X2b),
그 행이 손상됐으면 partition 삭제도 일어나지 않아 영원히 남는다(X3).
손상이 있을 때만 partition 삭제가 진행 중 put까지 기다렸다 지웠다.
고른 방법(리뷰 5.1절 (c)): LOGOUT·ACCOUNT_DELETION이 객체를 다 돈 뒤
그 partition 키를 가진 journal 행 수를 센다. 하나라도 있으면(읽을 수
있든 없든) sweep 대신 이미 있는 partition 삭제로 넘긴다. partition
삭제는 exclusive partition lock으로 진행 중 put·delete가 돌아오기를
기다린 뒤 디렉터리와 그 partition의 행을 모두 지운다(e5b7b3e).
OpfsJournalPort에 countPartitionTransactions(scope)를 더했다.
removePartition이 지우는 같은 LOGICAL_KEY_INDEX 범위를 세므로, 센 행은
삭제가 지운다.
버린 대안: (a) 문서에 "reconcile 먼저" 안내 — X1·X3을 막지 못한다.
(b) report에 수만 추가 — 지울 방법이 없다(X3). (d) 항상 partition
삭제 — 더 단순하지만 끝나지 않은 행이 없을 때의 예산 단위 진행과
removedObjects·releasedBytes 보고를 잃는다.
위험·한계:
- 공개 포트에 필수 메서드가 하나 는다. OpfsJournalPort를 직접 구현한
쪽은 추가해야 한다([계약]).
- 끝나지 않은 행이 하나라도 있으면 purge가 예산 없는 partition 삭제가
되고, 다른 탭의 진행 중 put이 끝날 때까지 기다린다. 그 put의 결과도
지운다(손상 경로와 같은 의미). purge가 행을 센 뒤 시작한 put은
남는다(point-in-time).
- 기존 테스트 "never sweeps the chunk of a put that runs while the purge
does"는 X1 동작을 기대값으로 고정하고 있었다. 새 의미로 바꿨다.
0929/05-02 테스트는 덮어쓰기가 purge의 목록과 remove 사이에 끝나도록
바꿔 CONFLICT 경로를 계속 본다.
- 소속을 알 수 없는(logicalKey가 깨진) 행은 여기서도 세지 못한다(05-03).
- WebKit은 기본 정책에서 OPFS 지원 판정을 통과하지 못해 browser spec이
일찍 끝난다. offline-indexeddb 번들 37,423 → 37,521 / 38,500 gzip B.
검증:
- RED: opfs-worker-runtime.test.ts 새 4건(X1, FILES_READY, PREPARING,
손상 행)이 partitionDeleted 없음으로 실패.
- GREEN: OPFS 단위 3파일 + optional-runtime-host + tests/recipes +
tests/contract 172건 통과. journal에 countPartitionTransactions 테스트
1건(손상 행 포함, 다른 partition 제외, 삭제 뒤 0).
- browser: opfs-runtime.spec.ts에 X1 2탭 판을 더했다. heavy lock 안에서
3엔진 9/9 통과(WebKit은 지원 판정에서 끝남).
- check:types, 바꾼 파일 eslint, check:optional-recipes:source PASS,
verify:documentation 통과.
Refs: docs/reviews/2026-11-03-maturity-review/05-adapters-storage-kernel.md 05-01
526 lines
17 KiB
TypeScript
526 lines
17 KiB
TypeScript
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
|
|
test("runs put, open, remove and reconcile through a native DedicatedWorker, OPFS and IndexedDB", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
const result = await page.evaluate(async () => {
|
|
const runtimeModulePath =
|
|
"/src/adapters/storage/opfs/browser-opfs-runtime.ts";
|
|
const policyModulePath =
|
|
"/src/adapters/storage/opfs/opfs-policy.ts";
|
|
const journalModulePath =
|
|
"/src/adapters/storage/opfs/indexeddb-opfs-journal.ts";
|
|
const {
|
|
createBrowserOpfsRuntime,
|
|
inspectBrowserOpfsSupport,
|
|
} = (await import(
|
|
/* @vite-ignore */ runtimeModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/browser-opfs-runtime.ts");
|
|
const {
|
|
DEFAULT_OPFS_RUNTIME_POLICY,
|
|
resolveOpfsRuntimePolicy,
|
|
} = (await import(
|
|
/* @vite-ignore */ policyModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/opfs-policy.ts");
|
|
const { opfsJournalDatabaseName } = (await import(
|
|
/* @vite-ignore */ journalModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/indexeddb-opfs-journal.ts");
|
|
const policy = resolveOpfsRuntimePolicy();
|
|
const support = inspectBrowserOpfsSupport(policy);
|
|
if (!support.ok) {
|
|
return {
|
|
nativeSupport: false as const,
|
|
capabilities: support,
|
|
};
|
|
}
|
|
|
|
const suffix = crypto.randomUUID().replaceAll("-", "");
|
|
const scope = {
|
|
namespace: "durable-objects",
|
|
authorityToken: `authority_${suffix}`,
|
|
namespaceToken: `namespace_${suffix}`,
|
|
partitionToken: `partition_${suffix}`,
|
|
} as const;
|
|
const storagePolicy = {
|
|
owner: "browser-capability",
|
|
namespace: scope.namespace,
|
|
classification: "PERSONAL",
|
|
authority: "LOCAL_FIRST",
|
|
accountScope: "OPAQUE_PARTITION",
|
|
retention: { kind: "EXPLICIT_DELETE" },
|
|
softBudgetBytes: 1024 * 1024,
|
|
hardBudgetBytes: 2 * 1024 * 1024,
|
|
evictionPriority: "USER_AUTHORED",
|
|
logoutAction: "EXPORT_THEN_PURGE",
|
|
accountDeletionAction: "PURGE_PARTITION",
|
|
pressureAction: "RETAIN",
|
|
unavailableFallback: "EXPORT_REQUIRED",
|
|
} as const;
|
|
const runtime = createBrowserOpfsRuntime({
|
|
workerUrl: new URL(
|
|
"/tests/browser-capabilities/opfs-test.worker.ts",
|
|
location.href,
|
|
),
|
|
workerName: `opfs-capability-${suffix}`,
|
|
scope,
|
|
storagePolicy,
|
|
policy,
|
|
});
|
|
const bytes = new Uint8Array([3, 1, 4, 1, 5, 9]);
|
|
let capabilities: unknown;
|
|
let put: unknown;
|
|
let opened:
|
|
| Awaited<ReturnType<typeof runtime.objects.open>>
|
|
| undefined;
|
|
let readBytes: number[] = [];
|
|
let removed: unknown;
|
|
let afterRemove: unknown;
|
|
let reconciled: unknown;
|
|
try {
|
|
capabilities = await runtime.objects.capabilities();
|
|
put = await runtime.objects.put({
|
|
objectId: "object_browser_12345678",
|
|
expectedGeneration: null,
|
|
mediaType: "application/octet-stream",
|
|
source: {
|
|
byteLength: bytes.byteLength,
|
|
async *stream(signal: AbortSignal) {
|
|
if (signal.aborted) {
|
|
yield {
|
|
ok: false as const,
|
|
error: {
|
|
code: "ABORTED" as const,
|
|
operation: "OBJECT_WRITE" as const,
|
|
retryable: false,
|
|
recovery: "NONE" as const,
|
|
},
|
|
};
|
|
return;
|
|
}
|
|
yield { ok: true as const, value: Uint8Array.from(bytes) };
|
|
},
|
|
},
|
|
});
|
|
opened = await runtime.objects.open({
|
|
objectId: "object_browser_12345678",
|
|
});
|
|
if (
|
|
opened &&
|
|
typeof opened === "object" &&
|
|
"ok" in opened &&
|
|
opened.ok
|
|
) {
|
|
for await (const chunk of opened.value.source.stream(
|
|
new AbortController().signal,
|
|
)) {
|
|
if (!chunk.ok) throw new Error(chunk.error.code);
|
|
readBytes.push(...chunk.value);
|
|
}
|
|
}
|
|
removed = await runtime.objects.remove({
|
|
objectId: "object_browser_12345678",
|
|
expectedGeneration: 1,
|
|
});
|
|
afterRemove = await runtime.objects.open({
|
|
objectId: "object_browser_12345678",
|
|
});
|
|
reconciled = await runtime.maintenance.reconcile({
|
|
budgetMs: 5_000,
|
|
maxTransactions: 100,
|
|
});
|
|
} finally {
|
|
runtime.close();
|
|
}
|
|
|
|
const deletion = await new Promise<string>((resolve) => {
|
|
const request = indexedDB.deleteDatabase(
|
|
opfsJournalDatabaseName(scope.authorityToken),
|
|
);
|
|
request.onsuccess = () => resolve("DELETED");
|
|
request.onerror = () =>
|
|
resolve(request.error?.name ?? "UNKNOWN_ERROR");
|
|
request.onblocked = () => resolve("BLOCKED");
|
|
});
|
|
let opfsCleanup = "ABSENT";
|
|
try {
|
|
const originRoot = await navigator.storage.getDirectory();
|
|
const runtimeRoot = await originRoot.getDirectoryHandle(
|
|
DEFAULT_OPFS_RUNTIME_POLICY.rootDirectoryName,
|
|
);
|
|
const authorities = await runtimeRoot.getDirectoryHandle(
|
|
"authorities",
|
|
);
|
|
await authorities.removeEntry(scope.authorityToken, {
|
|
recursive: true,
|
|
});
|
|
opfsCleanup = "DELETED";
|
|
} catch (error) {
|
|
if (!(error instanceof DOMException) || error.name !== "NotFoundError") {
|
|
throw error;
|
|
}
|
|
}
|
|
return {
|
|
nativeSupport: true as const,
|
|
capabilities,
|
|
put,
|
|
opened:
|
|
opened &&
|
|
typeof opened === "object" &&
|
|
"ok" in opened &&
|
|
opened.ok
|
|
? {
|
|
ok: true,
|
|
generation: opened.value.descriptor.generation,
|
|
}
|
|
: opened,
|
|
readBytes,
|
|
removed,
|
|
afterRemove,
|
|
reconciled,
|
|
deletion,
|
|
opfsCleanup,
|
|
};
|
|
});
|
|
|
|
if (!result.nativeSupport) {
|
|
expect(result.capabilities).toMatchObject({
|
|
ok: false,
|
|
error: { code: "UNSUPPORTED" },
|
|
});
|
|
return;
|
|
}
|
|
expect(result.capabilities).toMatchObject({
|
|
ok: true,
|
|
value: {
|
|
available: true,
|
|
dedicatedWorkerRequired: true,
|
|
crossContextMutationLockAvailable: true,
|
|
},
|
|
});
|
|
expect(result.put).toMatchObject({
|
|
ok: true,
|
|
value: { generation: 1, byteLength: 6 },
|
|
});
|
|
expect(result.opened).toEqual({ ok: true, generation: 1 });
|
|
expect(result.readBytes).toEqual([3, 1, 4, 1, 5, 9]);
|
|
expect(result.removed).toEqual({ ok: true });
|
|
expect(result.afterRemove).toMatchObject({
|
|
ok: false,
|
|
error: { code: "NOT_FOUND" },
|
|
});
|
|
expect(result.reconciled).toMatchObject({
|
|
ok: true,
|
|
value: {
|
|
inspectedTransactions: 0,
|
|
orphanGcStatus: "COMPLETED",
|
|
},
|
|
});
|
|
expect(result.deletion).toBe("DELETED");
|
|
expect(["DELETED", "ABSENT"]).toContain(result.opfsCleanup);
|
|
});
|
|
|
|
type OpfsTabScope = Readonly<{
|
|
namespace: string;
|
|
authorityToken: string;
|
|
namespaceToken: string;
|
|
partitionToken: string;
|
|
}>;
|
|
|
|
/**
|
|
* Installs an OPFS runtime for `scope` in this tab and keeps it on
|
|
* `globalThis.__opfsTab` for later evaluate calls. `approvePurges` stands in
|
|
* for an authority that approves every LOGOUT and ACCOUNT_DELETION.
|
|
*/
|
|
async function installOpfsTab(
|
|
page: import("@playwright/test").Page,
|
|
scope: OpfsTabScope,
|
|
approvePurges = false,
|
|
): Promise<boolean> {
|
|
return await page.evaluate(async ({ tabScope, approvePurges }) => {
|
|
const runtimeModulePath =
|
|
"/src/adapters/storage/opfs/browser-opfs-runtime.ts";
|
|
const policyModulePath = "/src/adapters/storage/opfs/opfs-policy.ts";
|
|
const { createBrowserOpfsRuntime, inspectBrowserOpfsSupport } =
|
|
(await import(
|
|
/* @vite-ignore */ runtimeModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/browser-opfs-runtime.ts");
|
|
const { resolveOpfsRuntimePolicy } = (await import(
|
|
/* @vite-ignore */ policyModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/opfs-policy.ts");
|
|
const policy = resolveOpfsRuntimePolicy();
|
|
if (!inspectBrowserOpfsSupport(policy).ok) return false;
|
|
(globalThis as unknown as { __opfsTab: unknown }).__opfsTab =
|
|
createBrowserOpfsRuntime({
|
|
workerUrl: new URL(
|
|
"/tests/browser-capabilities/opfs-test.worker.ts",
|
|
location.href,
|
|
),
|
|
workerName: `opfs-tab-${crypto.randomUUID()}`,
|
|
scope: tabScope,
|
|
storagePolicy: {
|
|
owner: "browser-capability",
|
|
namespace: tabScope.namespace,
|
|
classification: "PERSONAL",
|
|
authority: "LOCAL_FIRST",
|
|
accountScope: "OPAQUE_PARTITION",
|
|
retention: { kind: "EXPLICIT_DELETE" },
|
|
softBudgetBytes: 1024 * 1024,
|
|
hardBudgetBytes: 2 * 1024 * 1024,
|
|
evictionPriority: "USER_AUTHORED",
|
|
logoutAction: "EXPORT_THEN_PURGE",
|
|
accountDeletionAction: "PURGE_PARTITION",
|
|
pressureAction: "RETAIN",
|
|
unavailableFallback: "EXPORT_REQUIRED",
|
|
},
|
|
policy,
|
|
...(approvePurges
|
|
? {
|
|
requestMaintenanceAuthority: () => ({
|
|
authorized: true as const,
|
|
proofToken: `proof_${crypto.randomUUID().replaceAll("-", "")}`,
|
|
expiresAtEpochMs: Date.now() + 60_000,
|
|
}),
|
|
consumeMaintenanceAuthority: () => true,
|
|
}
|
|
: {}),
|
|
});
|
|
return true;
|
|
}, { tabScope: scope, approvePurges });
|
|
}
|
|
|
|
/** Deletes everything the OPFS runtime wrote for `scope`'s authority. */
|
|
async function removeOpfsAuthority(
|
|
page: import("@playwright/test").Page,
|
|
scope: OpfsTabScope,
|
|
): Promise<string> {
|
|
return await page.evaluate(async (tabScope) => {
|
|
const journalModulePath =
|
|
"/src/adapters/storage/opfs/indexeddb-opfs-journal.ts";
|
|
const policyModulePath = "/src/adapters/storage/opfs/opfs-policy.ts";
|
|
const { opfsJournalDatabaseName } = (await import(
|
|
/* @vite-ignore */ journalModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/indexeddb-opfs-journal.ts");
|
|
const { DEFAULT_OPFS_RUNTIME_POLICY } = (await import(
|
|
/* @vite-ignore */ policyModulePath
|
|
)) as typeof import("../../src/adapters/storage/opfs/opfs-policy.ts");
|
|
const deletion = await new Promise<string>((resolve) => {
|
|
const request = indexedDB.deleteDatabase(
|
|
opfsJournalDatabaseName(tabScope.authorityToken),
|
|
);
|
|
request.onsuccess = () => resolve("DELETED");
|
|
request.onerror = () => resolve(request.error?.name ?? "UNKNOWN");
|
|
request.onblocked = () => resolve("BLOCKED");
|
|
});
|
|
try {
|
|
const root = await (
|
|
await navigator.storage.getDirectory()
|
|
).getDirectoryHandle(DEFAULT_OPFS_RUNTIME_POLICY.rootDirectoryName);
|
|
await (
|
|
await root.getDirectoryHandle("authorities")
|
|
).removeEntry(tabScope.authorityToken, { recursive: true });
|
|
} catch {
|
|
// Nothing was written for this authority.
|
|
}
|
|
return deletion;
|
|
}, scope);
|
|
}
|
|
|
|
// 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.
|
|
test("05-01 an approved purge in another tab waits for a live put and takes it with the partition", async ({
|
|
page,
|
|
}) => {
|
|
const secondPage = await page.context().newPage();
|
|
const suffix = crypto.randomUUID().replaceAll("-", "");
|
|
const scope: OpfsTabScope = {
|
|
namespace: "durable-objects",
|
|
authorityToken: `authority_${suffix}`,
|
|
namespaceToken: `namespace_${suffix}`,
|
|
partitionToken: `partition_${suffix}`,
|
|
};
|
|
type Tab = import("../../src/adapters/storage/opfs/browser-opfs-runtime.ts").BrowserOpfsRuntime;
|
|
try {
|
|
await Promise.all([page.goto("/"), secondPage.goto("/")]);
|
|
if (!(await installOpfsTab(page, scope))) return;
|
|
expect(await installOpfsTab(secondPage, scope, true)).toBe(true);
|
|
|
|
await page.evaluate(async () => {
|
|
const state = globalThis as unknown as {
|
|
__opfsTab: Tab;
|
|
__release?: () => void;
|
|
__put?: Promise<unknown>;
|
|
};
|
|
let streaming!: () => void;
|
|
const started = new Promise<void>((resolve) => {
|
|
streaming = resolve;
|
|
});
|
|
const gate = new Promise<void>((resolve) => {
|
|
state.__release = resolve;
|
|
});
|
|
state.__put = state.__opfsTab.objects.put({
|
|
objectId: "object_tab_12345678",
|
|
expectedGeneration: null,
|
|
mediaType: "application/octet-stream",
|
|
source: {
|
|
byteLength: 4,
|
|
async *stream() {
|
|
streaming();
|
|
await gate;
|
|
yield { ok: true as const, value: new Uint8Array([2, 7, 1, 8]) };
|
|
},
|
|
},
|
|
});
|
|
await started;
|
|
});
|
|
await secondPage.evaluate(() => {
|
|
const state = globalThis as unknown as {
|
|
__opfsTab: Tab;
|
|
__purge?: Promise<unknown>;
|
|
};
|
|
state.__purge = state.__opfsTab.maintenance.enforcePolicies({
|
|
reason: "ACCOUNT_DELETION",
|
|
});
|
|
});
|
|
await page.waitForTimeout(250);
|
|
const put = await page.evaluate(async () => {
|
|
const state = globalThis as unknown as {
|
|
__release: () => void;
|
|
__put: Promise<unknown>;
|
|
};
|
|
state.__release();
|
|
return await state.__put;
|
|
});
|
|
const report = await secondPage.evaluate(
|
|
async () =>
|
|
await (globalThis as unknown as { __purge: Promise<unknown> }).__purge,
|
|
);
|
|
const opened = await secondPage.evaluate(async () => {
|
|
const runtime = (globalThis as unknown as { __opfsTab: Tab }).__opfsTab;
|
|
const result = await runtime.objects.open({
|
|
objectId: "object_tab_12345678",
|
|
});
|
|
return result.ok ? "OPENED" : result.error.code;
|
|
});
|
|
|
|
expect(put).toMatchObject({ ok: true, value: { generation: 1 } });
|
|
expect(report).toMatchObject({
|
|
ok: true,
|
|
value: { moreObjectsAvailable: false, partitionDeleted: true },
|
|
});
|
|
expect(opened).toBe("NOT_FOUND");
|
|
} finally {
|
|
for (const tab of [page, secondPage]) {
|
|
await tab.evaluate(() =>
|
|
(globalThis as unknown as { __opfsTab?: Tab }).__opfsTab?.close(),
|
|
);
|
|
}
|
|
expect(await removeOpfsAuthority(page, scope)).toBe("DELETED");
|
|
await secondPage.close();
|
|
}
|
|
});
|
|
|
|
test("05-01 a reconcile in another tab skips a live put and the put stays readable", async ({
|
|
page,
|
|
}) => {
|
|
const secondPage = await page.context().newPage();
|
|
const suffix = crypto.randomUUID().replaceAll("-", "");
|
|
const scope: OpfsTabScope = {
|
|
namespace: "durable-objects",
|
|
authorityToken: `authority_${suffix}`,
|
|
namespaceToken: `namespace_${suffix}`,
|
|
partitionToken: `partition_${suffix}`,
|
|
};
|
|
type Tab = import("../../src/adapters/storage/opfs/browser-opfs-runtime.ts").BrowserOpfsRuntime;
|
|
try {
|
|
await Promise.all([page.goto("/"), secondPage.goto("/")]);
|
|
if (!(await installOpfsTab(page, scope))) return;
|
|
expect(await installOpfsTab(secondPage, scope)).toBe(true);
|
|
|
|
// Tab A starts a put whose source stalls, so its journal row stays
|
|
// PREPARING and its worker holds the OPFS mutation lock.
|
|
await page.evaluate(async () => {
|
|
const state = globalThis as unknown as {
|
|
__opfsTab: Tab;
|
|
__release?: () => void;
|
|
__put?: Promise<unknown>;
|
|
};
|
|
let streaming!: () => void;
|
|
const started = new Promise<void>((resolve) => {
|
|
streaming = resolve;
|
|
});
|
|
const gate = new Promise<void>((resolve) => {
|
|
state.__release = resolve;
|
|
});
|
|
state.__put = state.__opfsTab.objects.put({
|
|
objectId: "object_tab_12345678",
|
|
expectedGeneration: null,
|
|
mediaType: "application/octet-stream",
|
|
source: {
|
|
byteLength: 4,
|
|
async *stream() {
|
|
streaming();
|
|
await gate;
|
|
yield { ok: true as const, value: new Uint8Array([2, 7, 1, 8]) };
|
|
},
|
|
},
|
|
});
|
|
await started;
|
|
});
|
|
|
|
// Tab B reconciles while tab A's put is in flight.
|
|
await secondPage.evaluate(() => {
|
|
const state = globalThis as unknown as {
|
|
__opfsTab: Tab;
|
|
__reconcile?: Promise<unknown>;
|
|
};
|
|
state.__reconcile = state.__opfsTab.maintenance.reconcile();
|
|
});
|
|
await page.waitForTimeout(250);
|
|
const put = await page.evaluate(async () => {
|
|
const state = globalThis as unknown as {
|
|
__release: () => void;
|
|
__put: Promise<unknown>;
|
|
};
|
|
state.__release();
|
|
return await state.__put;
|
|
});
|
|
const reconciled = await secondPage.evaluate(
|
|
async () =>
|
|
await (globalThis as unknown as { __reconcile: Promise<unknown> })
|
|
.__reconcile,
|
|
);
|
|
const opened = await page.evaluate(async () => {
|
|
const runtime = (globalThis as unknown as { __opfsTab: Tab }).__opfsTab;
|
|
const result = await runtime.objects.open({
|
|
objectId: "object_tab_12345678",
|
|
});
|
|
if (!result.ok) return result.error.code;
|
|
const bytes: number[] = [];
|
|
for await (const chunk of result.value.source.stream(
|
|
new AbortController().signal,
|
|
)) {
|
|
if (!chunk.ok) return chunk.error.code;
|
|
bytes.push(...chunk.value);
|
|
}
|
|
return bytes;
|
|
});
|
|
|
|
expect(put).toMatchObject({ ok: true, value: { generation: 1 } });
|
|
expect(reconciled).toMatchObject({
|
|
ok: true,
|
|
value: { skippedLiveTransactions: 1, rolledBackTransactions: 0 },
|
|
});
|
|
expect(opened).toEqual([2, 7, 1, 8]);
|
|
} finally {
|
|
for (const tab of [page, secondPage]) {
|
|
await tab.evaluate(() =>
|
|
(globalThis as unknown as { __opfsTab?: Tab }).__opfsTab?.close(),
|
|
);
|
|
}
|
|
expect(await removeOpfsAuthority(page, scope)).toBe("DELETED");
|
|
await secondPage.close();
|
|
}
|
|
});
|