Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
dash: plaintext guards ask isBodySealed(); neutral title while sealed (#783)
nyblnet9d5b777f0c87
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f901746c..1fe98f48 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -2748,12 +2748,19 @@ jobs:run: |npm ci --prefix dashnpm run build:single --prefix dash+ npm run build:sealtest --prefix dash- name: An encrypted or unopenable dash file opens to its gate# window.bento = { format, locked: true } before the password gate and# the refusal page, so the shell's loader counts the app as mounted# instead of re-running it and failing over the gate; unlocking# replaces it with the real workbook.run: node scripts/test-dash-gate-browser.mjs+ - name: A sealed dash workbook writes no plaintext of itself+ # bento/connect §E on the shared sealed TEST document: recovery snapshots,+ # the version timeline, the preview, recovery read-back and drop-open+ # all ask isBodySealed(); neutral title while sealed, matching the saved+ # file's title. Each row has an unsealed control that shows the leak.+ run: node scripts/test-dash-sealed-browser.mjshome-ios-swift:# The home/ios Swift rigs need CryptoKit, Security and LocalAuthentication,diff --git a/dash/CHANGELOG.md b/dash/CHANGELOG.mdindex f43a0f82..c6b33481 100644--- a/dash/CHANGELOG.md+++ b/dash/CHANGELOG.md@@ -12,6 +12,9 @@ There is no server, so a break here would be permanent.The release that came out of watching somebody use 0.2.0.+- **Neutral title while sealed, matching the saved file's title.**+- **A sealed workbook deletes this browser's earlier plaintext recovery copy and version history of itself** on open; other workbooks' copies are untouched.+- **Password-protected workbooks open again.** The file showed its passwordprompt and then failed with "This file could not start" over it, because thefile's loader took the prompt for an app that had not started. Dash now tellsdiff --git a/dash/src/about.ts b/dash/src/about.tsindex 4d0f86c7..56f7c62c 100644--- a/dash/src/about.ts+++ b/dash/src/about.ts@@ -47,7 +47,7 @@import { openDialog } from './dialog.ts'import { openSettings, updateWaiting, type SettingsHooks } from './settings.ts'import { APP_VERSION } from '../../kernel/src/update.ts'-import { canWriteInPlace, isEncryptionActive, openedFileName } from '../../kernel/src/save.ts'+import { canWriteInPlace, isBodySealed, openedFileName } from '../../kernel/src/save.ts'import { addVersion, listVersions } from '../../kernel/src/autosave.ts'// CIRCULAR, DELIBERATELY, and safe: recovery.ts imports `planReplace` from// here. Both directions are used only inside function bodies — nothing at@@ -188,7 +188,7 @@ let lastVersionAt = 0* remembers it for `putRecovery`; this is the second store and the same rule.*/export async function rememberVersion(doc: DashDoc): Promise<void> {- if (isEncryptionActive()) return+ if (isBodySealed()) returnif (Date.now() - lastVersionAt < VERSION_EVERY_MS) returnlastVersionAt = Date.now()await addVersion(doc)diff --git a/dash/src/dropopen.ts b/dash/src/dropopen.tsindex e9a520d6..c642cc91 100644--- a/dash/src/dropopen.ts+++ b/dash/src/dropopen.ts@@ -52,7 +52,7 @@import { importXlsx, installNames } from './xlsx.ts'import { parseDoc } from './model.ts'import { swapWorkbook, type WorkbookHost } from './recovery.ts'-import { adoptFileHandle, hasFileHandle, isEncryptionActive } from '../../kernel/src/save.ts'+import { adoptFileHandle, hasFileHandle, isBodySealed } from '../../kernel/src/save.ts'import { afterPendingWrites } from './saving.ts'import { toast, forkTemplate, applyDocLock } from './saveui.ts'import { t } from './i18n.ts'@@ -285,10 +285,11 @@ async function openXlsx(host: DropHost, file: File): Promise<void> {*/async function openWorkbook(host: DropHost, item: DataTransferItem | undefined, file: File): Promise<void> {const name = file.name- // The held password belongs to the workbook that is open, not to this one. A- // swap would leave it applied, and the first ⌘S would encrypt somebody else's- // workbook with a password they never chose for it.- if (isEncryptionActive()) {+ // The held seal — a password, or the identity seal's key, which is derived+ // from THIS document's key — belongs to the workbook that is open, not to this+ // one. A swap would leave it applied, and the first ⌘S would seal somebody+ // else's workbook under a key that is not theirs.+ if (isBodySealed()) {host.notice(t('This window has an encrypted workbook open. Open “{name}” in a new window instead.', { name }))return}diff --git a/dash/src/main.ts b/dash/src/main.tsindex 910d116e..829cdebd 100644--- a/dash/src/main.ts+++ b/dash/src/main.ts@@ -24,7 +24,7 @@ import './styles.css'import { configureApp, appConfig } from '../../kernel/src/app.ts'import {capturePristine, readEmbeddedDoc, serializeFile, serializeAuto, saveFile,- parseEnvelope, decryptEnvelope, setEncryptionPassword, isEncryptionActive,+ parseEnvelope, decryptEnvelope, setEncryptionPassword, isBodySealed,canWriteInPlace, downloadFile, suggestedFileName, openedFileName, registerPreview,currentFileName,} from '../../kernel/src/save.ts'@@ -214,6 +214,7 @@ function markMountedWithoutDoc(extra: Record<string, unknown> = {}): void {/** An encrypted workbook: ask, then take the same boot path. */async function passwordGate(raw: string): Promise<void> {+ document.title = appConfig().appName // neutral title while sealed, matching the saved file's titlemarkMountedWithoutDoc()dismissSplashNow()document.body.innerHTML =@@ -321,8 +322,13 @@ function refuse(res: Extract<ParseResult, { ok: false }>): void {* through that path. Defaulting to false means a new call site that forgets* this argument stays silent rather than phoning home.*/+/** The tab title: neutral title while sealed, matching the saved file's title. */+function tabTitle(title: string): string {+ return isBodySealed() ? appConfig().appName : `${title} — ${appConfig().appName}`+}+function boot(doc: DashDoc, repaired: number, frozen?: 'policy' | 'version', saved = false): void {- document.title = `${doc.title} — ${appConfig().appName}`+ document.title = tabTitle(doc.title)dismissSplash()const store = new Store(doc)@@ -1266,7 +1272,7 @@ function boot(doc: DashDoc, repaired: number, frozen?: 'policy' | 'version', sav// NEVER write an encrypted workbook's plaintext to IndexedDB. The kernel// states the rule in its own header and enforces it in neither place, so// every app has to remember — and the second one did not.- if (!isEncryptionActive()) {+ if (!isBodySealed()) {// THE RETURN VALUE IS THE POINT, and it was being thrown away.//// `putRecovery` resolves FALSE rather than throwing when there is no@@ -1293,7 +1299,7 @@ function boot(doc: DashDoc, repaired: number, frozen?: 'policy' | 'version', sav// it refuses an encrypted workbook for the same reason putRecovery doesvoid rememberVersion(store.doc)}- // …AND THE FILE ITSELF. Deliberately outside the `isEncryptionActive`+ // …AND THE FILE ITSELF. Deliberately outside the `isBodySealed`// guard above: that guard is about writing PLAINTEXT into IndexedDB,// and this writes the workbook's own file through the encryption-aware// `serializeAuto`. See writeback.ts's header — two channels, two rules.@@ -1458,7 +1464,7 @@ function boot(doc: DashDoc, repaired: number, frozen?: 'policy' | 'version', sav// the chrome nothing else refreshes: the title field is written once at// boot and thereafter only by its own input handlertitleEl.value = next.title- document.title = `${next.title} — ${appConfig().appName}`+ document.title = tabTitle(next.title)},}void mountRecovery(openHost)@@ -1472,7 +1478,7 @@ function boot(doc: DashDoc, repaired: number, frozen?: 'policy' | 'version', savtitleEl.addEventListener('input', () => {store.commit({ op: 'setTitle', title: titleEl.value })- document.title = `${titleEl.value} — ${appConfig().appName}`+ document.title = tabTitle(titleEl.value)})// --- the top-bar dropdowns.diff --git a/dash/src/preview.ts b/dash/src/preview.tsindex fd62547d..16226545 100644--- a/dash/src/preview.ts+++ b/dash/src/preview.ts@@ -48,7 +48,7 @@// `scripts/test-dash-preview.ts` exercises. The DOM appears once, in// `buildSheetPreview`, which is the only function the kernel calls.-import { isEncryptionActive } from '../../kernel/src/save.ts'+import { isBodySealed } from '../../kernel/src/save.ts'import { formatValue, alignFor, TYPE_LABEL } from './format.ts'import { readCell } from './store.ts'import { hiddenSet } from './rowcol.ts'@@ -500,7 +500,7 @@ function cardMarkup(doc: DashDoc, p: Palette): string {* password.*/export function previewMarkup(doc: DashDoc): string | null {- if (isEncryptionActive()) return null+ if (isBodySealed()) return nullconst sheet = doc.sheets?.[0]if (!sheet) return nullconst p = paletteOf(doc)diff --git a/dash/src/recovery.ts b/dash/src/recovery.tsindex 0e5f2bce..c93e6e54 100644--- a/dash/src/recovery.ts+++ b/dash/src/recovery.ts@@ -47,8 +47,8 @@// callers, so they cannot drift apart again.import './recovery.css'-import { getRecovery, clearRecovery, recoveryLooksOlder, type Snapshot } from '../../kernel/src/autosave.ts'-import { isEncryptionActive } from '../../kernel/src/save.ts'+import { getRecovery, clearRecovery, clearVersions, recoveryLooksOlder, type Snapshot } from '../../kernel/src/autosave.ts'+import { isBodySealed } from '../../kernel/src/save.ts'import { planReplace } from './about.ts'import { parseDoc, type DashDoc } from './model.ts'import type { Store } from './store.ts'@@ -134,7 +134,7 @@ export interface DecideInput {snapshot: Snapshot | null/** the workbook that actually loaded from the file */doc: DashDoc- /** a password is held this session — `isEncryptionActive()` at the call site */+ /** the body is sealed on disk, by a password or the identity seal — `isBodySealed()` at the call site */encrypted: boolean/** the store refuses commits (frozen doc, or a `readonly` copy) */readOnly: boolean@@ -285,9 +285,14 @@ export function recoveryOffNotice(store: Store, say: (message: string) => void):export async function mountRecovery(host: WorkbookHost): Promise<NoOfferReason | 'offered'> {const doc = host.store.doc- // Rule 2, enforced before the read as well as inside `decide`: an encrypted- // session has no business touching this store at all.- if (isEncryptionActive()) return 'encrypted'+ // Rule 2, enforced before the read as well as inside `decide`: a sealed+ // body never offers a plaintext copy, and never keeps one. Copies this+ // browser kept for THIS workbook in an earlier, unsealed session are+ // deleted; every other workbook's copies are untouched.+ if (isBodySealed()) {+ try { await Promise.all([clearRecovery(doc.docId), clearVersions(doc.docId)]) } catch { /* store unavailable: nothing kept there */ }+ return 'encrypted'+ }let snapshot: Snapshot | null = nulltry { snapshot = await getRecovery(doc.docId) } catch { return 'none' }const d = decide({ snapshot, doc, encrypted: false, readOnly: host.store.readOnly })diff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex 3a907d50..c6e0c09d 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -11201,6 +11201,26 @@ Rigs: `tests/recovery.rs`, where each of these mutations turns a test red: theold pepper labels, losing O→0 when reading a code, and skipping the rangecheck. Also `tests/secret_linux.rs` via `keyring-rig.sh`.+## 2026-10-18 — dash's plaintext guards ask isBodySealed()++Following kernel's K3 (`isBodySealed()` = a password OR the identity seal), dash+switches every guard that keeps a workbook's plaintext off the disk:++- the recovery snapshot and version timeline written on edit (main.ts), and+ `rememberVersion` behind it (about.ts);+- reading a recovery snapshot back (recovery.ts);+- the file-manager preview (preview.ts), behind kernel's own `previewAllowed`;+- drop-open (dropopen.ts): the seal's key is per document, so a window holding+ one refuses to adopt a dropped workbook, exactly as it does for a password.++The Save menu's "Set a password…" / "Remove password…" stays on+`isEncryptionActive()`: it is about a password being held.++Neutral title while sealed, matching the saved file's title.++Rigs: `scripts/test-dash-sealed-browser.mjs` on the shared sealed TEST document+(scripts/lib/sealed-boot.mjs), and the gate rows in+`scripts/test-dash-gate-browser.mjs`.## 2026-10-18 — slides: a sealed document never offers or keeps an unsealed snapshotdiff --git a/scripts/test-dash-gate-browser.mjs b/scripts/test-dash-gate-browser.mjsindex f095584f..ca1a957d 100644--- a/scripts/test-dash-gate-browser.mjs+++ b/scripts/test-dash-gate-browser.mjs@@ -23,6 +23,10 @@ const shell = readFileSync(shellPath, 'utf8')const BLOCK = /(<script type="application\/bento\+json" id="bento-doc">)([\s\S]*?)(<\/script>)/if (!BLOCK.test(shell)) throw new Error('#bento-doc not found in the built shell')const withBlock = (text) => shell.replace(BLOCK, (_, a, _b, c) => a + text.replace(/</g, '\\u003c') + c)+// a file saved by an older shell can carry its real title in <title>; the gate+// must not show it (neutral title while sealed, matching the saved file's title)+const REAL_TITLE = 'Q3 board pack — bento/dash'+const withTitle = (html) => html.replace(/<title>[^<]*<\/title>/, `<title>${REAL_TITLE}</title>`)// The kernel's envelope (kernel/src/save.ts encryptBody): PBKDF2-SHA-256 then// AES-GCM-256, standard base64. A low iteration count keeps the rig fast;@@ -51,7 +55,7 @@ try {await ctx.route(/^https?:/, (r) => r.abort())console.log('an encrypted workbook')- writeFileSync(tmp, withBlock(await envelope(WORKBOOK, 'hunter2')))+ writeFileSync(tmp, withTitle(withBlock(await envelope(WORKBOOK, 'hunter2')))){const p = await ctx.newPage(); const errors = []p.on('pageerror', (e) => errors.push(e.message))@@ -60,6 +64,7 @@ try {const b = await p.evaluate(() => ({ format: window.bento?.format, locked: window.bento?.locked, doc: !!window.bento?.doc }))ok(b.format === 'bento/dash' && b.locked === true && !b.doc, `at the gate, window.bento is { format: 'bento/dash', locked: true } with no doc — ${JSON.stringify(b)}`)ok(await p.evaluate(predicate), 'so the loader\'s mounted check (doc OR locked) is TRUE while the gate is up')+ ok(await p.evaluate(() => document.title) === 'bento/dash', `at the gate the tab says only "bento/dash", not the file's own <title> — got "${await p.evaluate(() => document.title)}"`)await p.fill('.dx-gate input[type="password"]', 'wrong')await p.click('.dx-unlock')await p.waitForFunction(() => /Wrong password/.test(document.querySelector('.dx-err')?.textContent ?? ''))@@ -69,6 +74,7 @@ try {await p.waitForFunction(() => window.bento?.doc, null, { timeout: 15000 })const after = await p.evaluate(() => ({ title: window.bento.doc.title, locked: window.bento.locked }))ok(after.title === 'Locked workbook' && after.locked === undefined, `the right password opens the workbook and replaces the locked marker — ${JSON.stringify(after)}`)+ ok(await p.evaluate(() => document.title) === 'bento/dash', `unlocked, the password still seals it: the tab still says only "bento/dash" — got "${await p.evaluate(() => document.title)}"`)ok(!errors.some((e) => /loader path/.test(e)), `no "every loader path was refused" error${errors.length ? ' — ' + errors.join('; ') : ''}`)await p.close()}@@ -92,6 +98,7 @@ try {await p.goto(tmp.href)await p.waitForFunction(() => window.bento?.doc, null, { timeout: 10000 })ok(await p.evaluate(() => window.bento.locked === undefined && window.bento.doc.title === 'Locked workbook'), 'a plain file boots straight to its doc, never locked')+ ok(await p.evaluate(() => document.title) === 'Locked workbook — bento/dash', `CONTROL: a plain file's tab shows its title — "${await p.evaluate(() => document.title)}"`)await p.close()}} finally {diff --git a/scripts/test-dash-sealed-browser.mjs b/scripts/test-dash-sealed-browser.mjsnew file mode 100644index 00000000..754c50a2--- /dev/null+++ b/scripts/test-dash-sealed-browser.mjs@@ -0,0 +1,140 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+// A SEALED dash workbook writes no plaintext of itself anywhere this page can+// reach, and shows the neutral title while sealed, matching the saved file's+// title.+//+// npm run build:sealtest --prefix dash && node scripts/test-dash-sealed-browser.mjs+//+// Uses the shared sealed TEST document (scripts/lib/sealed-boot.mjs): the+// identity seal is installed before dash's own boot and PROVEN before any row+// runs. Every guard dash keeps against plaintext asks `isBodySealed()` — true+// for a password OR the identity seal — and each row has an UNSEALED control+// that must show the very leak the sealed run must not, so a row can never pass+// because the path under it never ran.+//+// 1. recovery snapshot + version timeline (main.ts autosave, about.ts)+// 2. the saved file: no marker anywhere — no preview (preview.ts), and the+// shell title is neutral+// 3. the tab title (main.ts boot and the title field)+// 4. reading a plaintext recovery snapshot back (recovery.ts)+// 5. drop-open: a sealed window refuses to adopt a dropped workbook (dropopen.ts)+import { readFileSync } from 'node:fs'+import { openSealed, savedFile, scanIndexedDB, sealtestShell } from './lib/sealed-boot.mjs'+const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright')++let checks = 0, failures = 0+const ok = (c, m) => { checks++; if (!c) { failures++; console.log(` FAIL ${m}`) } else console.log(` ok ${m}`) }++const MARKER = 'SEALRIG-7f3a91'+const APP = 'bento/dash'+const settle = (page) => page.waitForTimeout(3600) // autosave debounce is 2.5s++async function retitle(page, text) {+ await page.locator('.dx-title').fill(text)+ await page.locator('.dx-title').dispatchEvent('input')+}++const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH, headless: true })+try {+ // ---- rows 1–3 on the shared test document, sealed and unsealed+ for (const sealed of [true, false]) {+ console.log(`\n${sealed ? 'SEALED' : 'unsealed control'}`)+ const { context, page, errors } = await openSealed(browser, 'dash', { sealed })+ const t0 = await page.evaluate(() => [document.title, window.bento.doc.title])+ if (sealed) ok(t0[0] === APP, `at boot the tab says only "${APP}" — got "${t0[0]}"`)+ else ok(t0[0] !== APP && t0[0].includes(t0[1]), `CONTROL: unsealed, the tab shows the workbook title at boot — "${t0[0]}"`)+ await retitle(page, MARKER)+ // and in a CELL, through the grid, so the preview (which draws cells) has it too+ await page.locator('.dg-cell').nth(12).click()+ await page.keyboard.type(MARKER + '-cell')+ await page.keyboard.press('Enter')+ await settle(page)+ const hits = await scanIndexedDB(page, MARKER)+ const inRecovery = hits.filter((h) => h.endsWith('/recovery')), inVersions = hits.filter((h) => h.endsWith('/versions'))+ if (sealed) {+ ok(inRecovery.length === 0, `no plaintext RECOVERY snapshot (${inRecovery.join(', ') || 'none'})`)+ ok(inVersions.length === 0, `no plaintext VERSION in the timeline (${inVersions.join(', ') || 'none'})`)+ ok(hits.length === 0, `nothing else in IndexedDB carries it either (${hits.join(', ') || 'none'})`)+ } else {+ ok(inRecovery.length >= 1, `CONTROL: unsealed, a recovery snapshot DOES carry the marker (${inRecovery.join(', ')})`)+ ok(inVersions.length >= 1, `CONTROL: unsealed, a version DOES carry the marker (${inVersions.join(', ')})`)+ }+ const title = await page.evaluate(() => document.title)+ if (sealed) ok(title === APP, `after a rename the tab still says only "${APP}" — got "${title}"`)+ else ok(title.includes(MARKER), `CONTROL: unsealed, the tab follows the rename — "${title}"`)+ if (sealed) {+ const f = await savedFile(page)+ ok(!f.file.includes(MARKER), 'the saved file carries the marker nowhere — not in the body, the preview or the <title>')+ ok(/<title>bento\/dash<\/title>/.test(f.file), 'and its <title> is the neutral app name')+ // the preview on its own: kernel's gate refuses it for a sealed body, and+ // dash's preview builder refuses too — this check sees dash's layer alone+ ok(!f.file.includes('data-bento-preview'), 'and it carries NO preview element at all')+ } else {+ const html = await page.evaluate(() => window.bento.serializeAuto())+ ok(html.includes(MARKER), 'CONTROL: unsealed, the saved file does carry it (preview, title, body)')+ const preview = (html.match(/<[^>]*data-bento-preview[\s\S]*?<script data-bento-preview/) || [''])[0]+ ok(preview.includes(MARKER + '-cell'), 'CONTROL: unsealed, the PREVIEW itself draws the marked cell — so the sealed row can see a preview leak')+ }+ ok(errors.length === 0, `no page errors${errors.length ? ' — ' + errors.join('; ') : ''}`)+ await context.close()+ }++ // ---- row 5: drop-open+ const dropped = readFileSync(sealtestShell('dash'), 'utf8').replace(+ /(<script type="application\/bento\+json" id="bento-doc">)[\s\S]*?(<\/script>)/,+ (_, a, c) => a + JSON.stringify({ format: 'bento/dash', version: 1, policy: 'bento-dash-1', docId: 'dropped-1', title: 'Dropped workbook',+ sheets: [{ id: 's', kind: 'table', name: 'D', rids: [[1, 1]], nextRid: 2, columns: [{ id: 'v', name: 'V', type: 'number' }], data: { v: { enc: 'raw', v: [1] } }, steps: [] }] }).replace(/</g, '\\u003c') + c)+ for (const sealed of [true, false]) {+ const { context, page } = await openSealed(browser, 'dash', { sealed })+ page.on('dialog', (d) => d.accept())+ await page.evaluate((html) => {+ const dt = new DataTransfer()+ dt.items.add(new File([html], 'dropped.bento.html', { type: 'text/html' }))+ document.dispatchEvent(new DragEvent('drop', { dataTransfer: dt, bubbles: true, cancelable: true }))+ }, dropped)+ await page.waitForTimeout(800)+ const title = await page.evaluate(() => window.bento.doc.title)+ const refused = await page.evaluate(() => document.body.innerText.includes('encrypted workbook open'))+ if (sealed) ok(refused && title !== 'Dropped workbook', `SEALED: a dropped workbook is refused, not adopted under this document's seal (title "${title}")`)+ else ok(!refused && title === 'Dropped workbook', `CONTROL: unsealed, the dropped workbook opens (title "${title}")`)+ await context.close()+ }++ // ---- row 4: reading a plaintext snapshot back, and purging it. Both seal+ // states on ONE storage, through the shared helper: an unsealed session+ // leaves a genuine plaintext snapshot of a fixed document; reopening it+ // unsealed offers it (the control); opening the SAME document sealed, in the+ // same context, must neither offer it nor keep it, while a SECOND workbook's+ // snapshot on that storage survives. The scans run from an unsealed page.+ {+ const sheet = { id: 's', kind: 'table', name: 'D', rids: [[1, 1]], nextRid: 2, columns: [{ id: 'v', name: 'V', type: 'number' }], data: { v: { enc: 'raw', v: [1] } }, steps: [] }+ const fixed = (docId, title) => ({ format: 'bento/dash', version: 1, policy: 'bento-dash-1', docId, title, sheets: [sheet] })+ const OTHER = 'OTHERWB-2c8d40' // must not contain MARKER: the scans match by substring+ const stores = (hits) => ['recovery', 'versions'].filter((s) => hits.some((h) => h.endsWith('/' + s)))+ const a = await openSealed(browser, 'dash', { sealed: false, doc: fixed('seal-rig-fixed', 'Fixed') })+ await retitle(a.page, MARKER)+ await settle(a.page)+ ok(stores(await scanIndexedDB(a.page, MARKER)).length === 2, 'CONTROL: an unsealed session leaves this workbook\'s plaintext in /recovery AND /versions')+ await a.reload()+ await a.page.waitForTimeout(600)+ ok(await a.page.locator('.dxr-bar').count() === 1, 'CONTROL: unsealed, reopening OFFERS it — the read-back path runs')+ await a.page.close()+ const c = await openSealed(browser, 'dash', { sealed: false, context: a.context, doc: fixed('seal-rig-other', 'Other') })+ await retitle(c.page, OTHER)+ await settle(c.page)+ ok(stores(await scanIndexedDB(c.page, OTHER)).length === 2, 'CONTROL: a second workbook\'s plaintext is in /recovery AND /versions on the same storage')+ const b = await openSealed(browser, 'dash', { context: a.context, url: a.url })+ await b.page.waitForTimeout(600)+ ok(await b.page.locator('.dxr-bar').count() === 0, 'SEALED: the same workbook on the same storage does NOT offer the plaintext snapshot')+ await b.page.close()+ const left = stores(await scanIndexedDB(c.page, MARKER))+ ok(left.length === 0, `SEALED: after the sealed boot, none of this workbook's plaintext is kept (found in: ${left.join(', ') || 'nothing'})`)+ ok(stores(await scanIndexedDB(c.page, OTHER)).length === 2, 'the second workbook\'s snapshot and versions survive the purge')+ await a.context.close()+ }+} finally {+ await browser.close()+}+console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)