Skip to content

feat: export and import sites and categories (#895) - #897

Merged
sheepzh merged 1 commit into
mainfrom
migrate
Sep 3, 2026
Merged

feat: export and import sites and categories (#895)#897
sheepzh merged 1 commit into
mainfrom
migrate

Conversation

@sheepzh

@sheepzh sheepzh commented Sep 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings September 3, 2026 14:24
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.74%. Comparing base (254428c) to head (8059c3c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/background/database/merge-rule-database.ts 80.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/background/service/site-service/index.ts
@sheepzh
sheepzh merged commit b673edf into main Sep 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants