From 2fdf0039c6c9943644301d99c367d7a6973fb265 Mon Sep 17 00:00:00 2001 From: Bryan Matthew Simonson <7519963+bryanmatthewsimonson@users.noreply.github.com> Date: Fri, 17 Jul 2026 18:03:29 -0700 Subject: [PATCH] =?UTF-8?q?feat(reader):=20delete=20the=20local=20archived?= =?UTF-8?q?=20copy=20=E2=80=94=20deleteArticle=20gets=20a=20caller=20(S4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deleteArticle(url) existed in archive-cache.js with ZERO callers — no delete affordance anywhere (archive-integrity review, 2026-07-17). And the Options "Clear all X-Ray storage" confirm promised to erase "entities, the keypair registry" while actually clearing only the LEGACY userscript keys — the modern workspace stores were never touched. Reader: a 🗑 header button (hidden on read-only opens) deletes the local archived row for the open capture, finding it the way the load path does (primary URL, then the alias-resolved original, both forms deleted). The confirm is an honest account, with counts: DELETED — the archived copy + its prior versions; it leaves case membership, the corpus, and the archive banner. KEPT — N claims and M audit runs (they key to URL/hash, not the copy); anything already published (relays cannot be forced to delete — NIP-09 is advisory and pretending otherwise would lie); archived source bytes, collected later by the age-gated pruner. Options: the Clear-all confirm now promises exactly what storageClearExtension delivers — settings, signing key, LLM key, legacy stores — and points at "Start fresh workspace" for content. Tests: delete takes the row together with its priorVersions snapshot (a dangling prior would resurrect "deleted" content); absent-row delete is a no-op; delete joins through the same URL normalizer as save (a tracking-param variant deletes the canonical row). SMOKE 7.3a-7.3c cover the hand walk. 1721 tests green; build clean; lint 0 errors. Co-Authored-By: Claude Fable 5 --- docs/SMOKE_TEST.md | 3 ++ src/options/index.js | 12 +++++- src/reader/index.html | 1 + src/reader/index.js | 82 ++++++++++++++++++++++++++++++++++++ tests/archive-cache.test.mjs | 26 ++++++++++++ 5 files changed, 123 insertions(+), 1 deletion(-) diff --git a/docs/SMOKE_TEST.md b/docs/SMOKE_TEST.md index 757bb4b..ddc3f6d 100644 --- a/docs/SMOKE_TEST.md +++ b/docs/SMOKE_TEST.md @@ -1048,6 +1048,9 @@ and at least one entity tagged on Device A. | 7.1 | Open any article via the toolbar icon → reader opens, capture is cached | ✅ | | 7.2 | Close the reader, navigate away, then re-capture the original URL | ✅ the reader's archive banner offers the cached copy | | 7.3 | DevTools → Application → IndexedDB → `xray-archive` → `articles` | ✅ entry exists for the URL hash | +| 7.3a | On an open capture with claims, click the 🗑 header button (S4) | ✅ the confirm names the article, counts prior versions, and states what is KEPT (claims/audits by count, published relay events, source bytes) — never a bare "are you sure" | +| 7.3b | Confirm 7.3a's delete, then re-run 7.3 and re-capture the URL | ✅ the IndexedDB row is gone; claims still list in the reader for the URL; the fresh re-capture starts a NEW row with no prior versions | +| 7.3c | Options → Advanced → "Clear all X-Ray storage" | ✅ the confirm says SETTINGS only and points at "Start fresh workspace" for content — after confirming, entities/claims/archives are intact, relays/signing key are gone | ### Paywall fallback diff --git a/src/options/index.js b/src/options/index.js index e91f1f0..9b55b0c 100644 --- a/src/options/index.js +++ b/src/options/index.js @@ -941,7 +941,17 @@ async function clearLlmKey() { } async function clearAll() { - if (!confirm('Erase all X-Ray settings, entities, the keypair registry, and the local signing key? This cannot be undone.')) return; + // The confirm must promise exactly what storageClearExtension + // delivers. The old text claimed "entities, the keypair registry" + // — but those keys (publications/people/organizations/ + // keypair_registry) are the LEGACY userscript stores; the modern + // workspace (entities, local_keys, claims, the archives) lives + // elsewhere and is untouched here. That is what "Start fresh + // workspace" (above, Advanced) is for — say so. + if (!confirm('Erase X-Ray SETTINGS: relays, preferences, the local signing key, ' + + 'the LLM API key, feature flags, and legacy userscript-era stores. ' + + 'Your workspace CONTENT (entities, claims, captured articles, archives) is NOT touched — ' + + 'use "Start fresh workspace" for that. This cannot be undone. Continue?')) return; await storageClearExtension(); // Reset experimental flags too — otherwise a wipe leaves the // public judgment-publishing path enabled. diff --git a/src/reader/index.html b/src/reader/index.html index 8a9d288..c1fc8ff 100644 --- a/src/reader/index.html +++ b/src/reader/index.html @@ -33,6 +33,7 @@ +