Merge phase-c-5-p2-cluster: Plan C Phase 5 (P2 cluster — 5 small fixes)

5 commits landing 5 independent P2 fixes:
- ba5d218 inactivity timer resets on all non-passive messages (READ_ONLY_CONTENT_CALLABLE exclusion set in session-timer.ts; index.ts inverts the gate)
- 35444e0 state.gitHost cleared on session expiry (alongside state.manifest)
- e43f121 teardownSettingsCommon extracted; both settings.ts + settings-vault.ts call it (parameterized over each file's own activeKeyHandler module variable)
- 39fac68 Promise.allSettled with per-slot fallback in devices.ts (list_devices+list_revoked + sshFingerprint map). trash.ts is a no-op on this branch — it doesn't have a Promise.all to migrate (single list_trashed call); plan was written against a different snapshot.
- fce1962 MutationObserver scan() debounced to 200ms in content/detector.ts (no test harness on this branch — manual verification per plan note)

377/377 vitest tests pass (baseline 371 + 6 new tests in session-timer + devices). Zero regressions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-05-30 21:49:17 -04:00
8 changed files with 157 additions and 28 deletions

View File

@@ -1,5 +1,6 @@
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
import * as timer from '../session-timer';
import { READ_ONLY_CONTENT_CALLABLE } from '../session-timer';
describe('session-timer', () => {
beforeEach(() => {
@@ -97,3 +98,29 @@ describe('session-timer', () => {
expect(cb).not.toHaveBeenCalled();
});
});
describe('READ_ONLY_CONTENT_CALLABLE — inversion exclusion set', () => {
// The SW handler invokes resetTimer() on every message whose type is NOT
// in this set. These cases encode the documented inversion contract from
// Plan C Phase 5: popup-only messages reset, content-callable writes
// reset, only passive content reads (currently just get_autofill_candidates)
// do NOT reset.
it('popup-only message would reset the timer (not in exclusion set)', () => {
// e.g. list_items — popup interaction is unambiguously active use
expect(READ_ONLY_CONTENT_CALLABLE.has('list_items')).toBe(false);
});
it('content-callable get_autofill_candidates does NOT reset (in exclusion set)', () => {
expect(READ_ONLY_CONTENT_CALLABLE.has('get_autofill_candidates')).toBe(true);
});
it('content-callable capture_save_login DOES reset (write op = active use)', () => {
expect(READ_ONLY_CONTENT_CALLABLE.has('capture_save_login')).toBe(false);
});
it('content-callable check_credential DOES reset', () => {
// Asking "is this credential already saved" is user-initiated.
expect(READ_ONLY_CONTENT_CALLABLE.has('check_credential')).toBe(false);
});
});