This repository was archived by the owner on Oct 15, 2026. It is now read-only.
Repository navigation
refactor: introduce browser.* adapter for chrome.* - #9
Merged
Merged
Conversation
Add src/shared/browser.ts as a thin alias over the WebExtensions API namespaces Raft uses (tabs, tabGroups, windows, storage, alarms, runtime, commands, contextMenus, action, identity), and replace every chrome.* call in src/ with browser.*. This is preparation for the Firefox/Edge port: once a Phase 2 polyfill replaces this single seam, no call site needs to change. On Chromium the adapter is a pure pass-through. Live property getters are used so that namespace lookups always reflect the current chrome.* binding (e.g. test mocks installed after module load). No behavior change. Pure mechanical rewrite.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preparation for the Firefox/Edge port (Phase 2 #1) — no functional change.
src/shared/browser.ts, a thin adapter that re-exports the WebExtensions namespaces Raft uses (tabs,tabGroups,windows,storage,alarms,runtime,commands,contextMenus,action,identity). On Chromium it's a pure pass-through; live property getters back each namespace so lookups always reflect the currentchrome.*binding (important so existing test mocks keep working without touchingtests/mocks/chrome.ts).chrome.Xruntime call andchrome.X.Ytype reference insrc/withbrowser.X/browser.X.Y, plus a singleimport { browser }per file.git grep 'chrome\.' src/returns only the adapter file itself.The diff is almost entirely
s/chrome\./browser\./gplus the new adapter file and import additions across ~26 files. Once Phase 2 swaps the adapter implementation, no call site needs to change.Non-goals (deliberately out of scope, deferred to Phase 2):
browser.tabs.discardfallback).tests/mocks/chrome.tsis untouched.Test plan
pnpm typecheck— cleanpnpm lint— 0 problemspnpm test:coverage— 745/745 passing (including the 9 oauth tests that mutatechrome.identityafter module load — handled by the live-getter design)pnpm test:safety— 55/55 passingpnpm build— cleangit grep 'chrome\.' src/— returns onlysrc/shared/browser.tshttps://claude.ai/code/session_012JBpkTyfaoEBvDdixKFX7W
Generated by Claude Code