Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #897 +/- ##
==========================================
- Coverage 61.77% 61.74% -0.04%
==========================================
Files 52 52
Lines 2114 2112 -2
Branches 504 506 +2
==========================================
- Hits 1306 1304 -2
Misses 638 638
Partials 170 170 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The refactored saveSite currently overwrites existing site records with partial updates (causing data loss) and the updated .d.ts removes the tt4b.merge namespace while still referencing merge.Rule elsewhere.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds backup export/import support for site data (sites + categories) and refactors site/merge-rule typing and migration wiring in the background service.
Changes:
- Introduce a site migrator (
__site__) to export/import categories and sites as part of backup data. - Refactor site persistence (
saveSite) and update call sites to match the new behavior. - Align merge-rule types/usages and clean up legacy storage/migrators (remove classic site/whitelist databases and old version migrator).
File summaries
| File | Description |
|---|---|
| types/tt4b.d.ts | Adds site.ExportData / site.MergeRule and updates backup shape to include __site__. |
| test/setup.ts | Extends chrome runtime mock to include getManifest. |
| test/mock/storage.ts | Preserves existing global.chrome fields when mocking storage. |
| src/background/service/stat-service/merge/host.ts | Minor typing adjustment when loading merge rules. |
| src/background/service/site-service/migrator.ts | New site export/import migrator for categories + sites. |
| src/background/service/site-service/index.ts | Refactors saveSite to accept varargs and persist changes. |
| src/background/service/components/immigration.ts | Switches browser-migratables to a registry and registers __site__. |
| src/background/service/components/host-merge-ruler.ts | Updates merge-rule type used by the ruler. |
| src/background/message-dispatcher.ts | Routes site.modify to updated saveSite signature. |
| src/background/install-handler/version/whitelist-initializer.ts | Updates whitelist initialization to the new saveSite call style. |
| src/background/install-handler/version/site-migrator.ts | Removes legacy version migrator for classic site/whitelist migration. |
| src/background/install-handler/version/local-file-initializer.ts | Updates local-file site initialization to the new saveSite call style. |
| src/background/install-handler/version/index.ts | Removes registration of the deleted legacy site migrator. |
| src/background/database/whitelist-database.ts | Removes deprecated whitelist database. |
| src/background/database/site-database/classic.ts | Removes deprecated classic site database. |
| src/background/database/site-database.ts | Fixes indexed-storage import path. |
| src/background/database/merge-rule-database.ts | Updates merge-rule typing and export shape. |
| src/background/database/common/constant.ts | Removes deprecated whitelist storage key constant. |
| src/background/database/cate-database.ts | Minor formatting change. |
| src/background/content-script-handler.ts | Updates favicon/alias persistence logic to use getSite + saveSite. |
| src/api/sw/merge.ts | Updates merge-rule API typing to the new merge-rule type. |
Review details
- Files reviewed: 19/21 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
No description provided.