fix: duplicate optAutoRedact ID + hardcoded log limit + add test suite

Bug 1: popup.html had duplicate id="optAutoRedact" on both the
Auto Redact toggle and Auto-redact Detected PII toggle. The second
overwrote the first, making the Auto Redact setting uncontrollable.
Fixed by giving the second toggle id="optAutoRedactDetected".

Bug 2: injector.js hardcoded activity log trim to 100, ignoring the
user's maxLogEntries setting. Now reads the setting from storage.

Added test-suite.html with 35+ tests covering storage, encryption,
sync (encryption-mandatory flows), auto-redact (built-in + custom
patterns), substitution engine, smart patterns, and auto-detect.

https://claude.ai/code/session_01KF4i7Ra7zCEDskxDBaNtcT
This commit is contained in:
Claude
2026-03-28 16:36:57 +00:00
parent 5ce639f40f
commit ccf69a91a7
4 changed files with 513 additions and 5 deletions
+4 -2
View File
@@ -91,6 +91,8 @@
// Also log directly from the injector (content script world)
// in case the background worker is asleep
const replacements = event.data.replacements || [];
const settingsResult = await api.storage.local.get('ss_settings');
const maxLog = settingsResult.ss_settings?.maxLogEntries || 100;
for (const r of replacements) {
const log = (await api.storage.local.get('ss_activity_log')).ss_activity_log || [];
log.unshift({
@@ -104,8 +106,8 @@
pattern: r.pattern || '',
url: location.href,
});
// Trim
if (log.length > 100) log.length = 100;
// Trim to user-configured max
if (log.length > maxLog) log.length = maxLog;
await api.storage.local.set({ ss_activity_log: log });
}
}