feat(confidence-engine): persist canonical investigation state

This commit is contained in:
2026-08-27 16:21:41 +01:00
parent bc35e05253
commit 166ee91698
3 changed files with 293 additions and 1 deletions
+7 -1
View File
@@ -83,11 +83,17 @@ export function saveInvestigation(snapshot) {
// ── clearInvestigation ───────────────────────────────────────────────
/** Removes only the canonical investigation key. */
/** Removes the canonical investigation key and the legacy session key. */
export function clearInvestigation() {
const storage = _getTargetStorage();
if (!storage) return;
try { storage.removeItem(CANONICAL_KEY); } catch (_) {}
// Also remove the legacy sessionStorage key so it cannot resurrect stale
// state after loadInvestigation falls through from missing canonical key.
const legacyStorage = _getLegacyStorage();
if (!legacyStorage) return;
try { legacyStorage.removeItem(LEGACY_KEY); } catch (_) {}
}
// ── internals ────────────────────────────────────────────────────────