fix(ext/sw): clear state.gitHost on session expiry (Plan C Phase 5)

DEV-C P2: expiry cleared manifest but left the cached git-host client.
The initializer rebuilds gitHost on demand, so clearing here is safe.

No new test: index.ts has top-level chrome.* side effects that make it
expensive to import in a unit test, and the change is a one-liner state
mutation in an inline callback. Manually verified by tracing call sites.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-05-30 21:43:50 -04:00
parent ba5d218841
commit 35444e02be

View File

@@ -53,6 +53,9 @@ sessionTimer.onExpired(() => {
console.log('[relicario sw] session expired — locking vault'); console.log('[relicario sw] session expired — locking vault');
clearCurrent(); clearCurrent();
state.manifest = null; state.manifest = null;
// Plan C Phase 5: don't leak the cached git-host client across a lock.
// The initializer rebuilds gitHost on demand, so clearing here is safe.
state.gitHost = null;
// Best-effort broadcast — receiver may not exist yet. // Best-effort broadcast — receiver may not exist yet.
chrome.runtime.sendMessage({ type: 'session_expired' }).catch(() => {}); chrome.runtime.sendMessage({ type: 'session_expired' }).catch(() => {});
}); });