From 927f4e444ab57d7f8369b5b675b542f3e808fd18 Mon Sep 17 00:00:00 2001 From: heznpc Date: Sun, 26 Apr 2026 22:36:20 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20production=20hotfixes=20for=20v3.5.6=20?= =?UTF-8?q?=E2=80=94=206=20bugs=20surfaced=20as=20users=20grow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A deep production-readiness audit (and four direct re-reads to verify) found six bugs that get worse at scale. Two are user-visible right now; the rest amplify with traffic. 1. Bridge timeout silent fail (CRITICAL) `_injectPageBridge` resolved the readiness promise even on timeout, with `isReady` left false. Every later `_sendRequest` rejected "Bridge not ready" forever — tutor and Gemini block translation died until reload, no UI signal. Now flips a `bridgeFailed` flag and dispatches `skillbridge:bridgeunavailable`; content.js renders a persistent banner asking the user to refresh. 2. pushState/replaceState wrapper stacking (CRITICAL) The history monkey-patches had no idempotency guard, so an extension reload (auto-update, dev refresh) captured the previous wrapper as the "original" and stacked. Each reload doubled `onRouteChange` per nav, amplifying GT load. Guard with `__sb_wrapped__`. 3. Cache-cleanup alarm dead code (HIGH) Background sent `{ type: 'CACHE_CLEANUP' }` but the content-script handler keys on `request.action`. The 24h alarm reached the default "Unknown action" branch and silently no-op'd in long-pinned tabs. The page-load fallback still ran, so the bug was hidden — but the alarm itself is now unified on `{ action: 'cacheCleanup' }` with a real case. 4. GT rate-limit dropped translations (HIGH) `googleTranslateBatch` returned the original English text on rate-limit, which content.js silently skipped because `translated === source` looks like a no-op. On large lessons over 120 strings/min users got a half-translated page. Replaced with a polling `_rateLimiter.acquire()` that paces the batch instead. Failed items now return `null` for consistent skip-and-retry semantics. 5. Progress UI stuck on language switch (HIGH) Mid-batch `gtGeneration` mismatches early-returned past `hideTranslationProgress` and `pruneDetachedEntries`, leaving the progress bar and verify spinners on screen. Wrapped the loop in try/finally so cleanup always runs. Term-preview only fires when the generation is still current. 6. Chat history quota silently dropped messages (MEDIUM) `pruneOldHistory` deleted the oldest 20 entries on `QuotaExceededError` but never retried the failed `add()`, losing the conversation. Now `saveConversation` retries once after pruning, and `pruneOldHistory` resolves on `tx.oncomplete` so the retry sees the freed space. Plus one preventative cleanup: - Drop the `tabs` permission from manifest. Both `chrome.tabs.query` and `chrome.tabs.sendMessage` work via `host_permissions` matching the active tab. The broader `tabs` permission was unused and triggered the "read your browsing history" string in the CWS install prompt. Version 3.5.5 → 3.5.6. Tests 309/309 pass; lint, format, selector health, dicts, bg-sync, glossary, translate validate, firefox build, bundle build all green. Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGELOG.md | 13 ++ README.md | 2 +- docs/index.html | 4 +- eslint.config.mjs | 1 + manifest.json | 3 +- package.json | 2 +- src/background/background.js | 28 ++++- src/content/content.js | 233 ++++++++++++++++++++--------------- src/content/sidebar-chat.js | 47 ++++--- src/data/de.json | 2 +- src/data/es.json | 2 +- src/data/fr.json | 2 +- src/data/ja.json | 2 +- src/data/ko.json | 2 +- src/data/pt-BR.json | 2 +- src/data/ru.json | 2 +- src/data/vi.json | 2 +- src/data/zh-CN.json | 2 +- src/data/zh-TW.json | 2 +- src/lib/constants.js | 14 +++ src/lib/translator.js | 7 +- 21 files changed, 242 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6844db6..b8007cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +## [3.5.6] - 2026-04-26 + +### Fixed +- AI features no longer fail silently when the Puter.js bridge fails to confirm `BRIDGE_READY` within 20 s. The translator now flips a `bridgeFailed` flag and dispatches `skillbridge:bridgeunavailable`; content.js shows a persistent banner asking the user to refresh. +- `history.pushState` / `history.replaceState` wrappers are now idempotent. Extension reloads (auto-update, dev refresh) used to capture the previous wrapper as the "original" and stack handlers, doubling `onRouteChange` calls per SPA nav and amplifying GT load. +- Cache-cleanup alarm now actually runs in active tabs. Background sent `{ type: 'CACHE_CLEANUP' }` but the content-script handler keys on `request.action`, so the 24 h alarm was dead code. Unified on `{ action: 'cacheCleanup' }` with a matching switch case. +- Google Translate rate-limit overflow no longer leaves elements in English. `_rateLimiter` now exposes an `acquire()` method that paces the batch instead of returning the source text (which content.js silently skips); the GT batch-item failure path also returns `null` for consistency. +- Translation progress bar and verify spinners are no longer stuck when the user switches language mid-batch. `processGTQueue` is now wrapped in `try/finally` so `hideTranslationProgress`, `pruneDetachedEntries`, and the gemini-block flush always run. +- Chat history is no longer silently dropped on `QuotaExceededError`. `saveConversation` now retries the `add()` once after `pruneOldHistory` deletes the oldest 20 entries, and `pruneOldHistory` resolves on the transaction's `oncomplete` so the retry sees the freed space. + +### Changed +- Drop the `tabs` permission from `manifest.json`. Both `chrome.tabs.query` and `chrome.tabs.sendMessage` rely on `host_permissions` matching the active tab — the broader `tabs` permission was unused. Removes the "read your browsing history" warning string in the CWS install prompt. + ## [3.5.5] - 2026-04-19 ### Added diff --git a/README.md b/README.md index b535cb7..bd9b9e9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ SkillBridge -# SkillBridge for Anthropic Academy v3.5.5 +# SkillBridge for Anthropic Academy v3.5.6 > Available in multiple languages at the [project landing page](https://heznpc.github.io/skillBridge/). diff --git a/docs/index.html b/docs/index.html index 93805f7..ffd9664 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ SkillBridge — AI Course Translator for <!-- LANG_COUNT_START -->32+<!-- LANG_COUNT_END --> Languages - +