Skip to content

Fix/drive - #30

Merged
viseshrp merged 4 commits into
mainfrom
fix/drive
Mar 9, 2026
Merged

Fix/drive#30
viseshrp merged 4 commits into
mainfrom
fix/drive

Conversation

@viseshrp

@viseshrp viseshrp commented Mar 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

viseshrp added 3 commits March 8, 2026 20:48
Extract the saved-tab-group merge logic into a shared helper so both JSON import and Drive restore reuse the same duplicate-handling behavior without introducing a dependency from Drive code into list-page UI code.

Extend the Drive restore orchestration with an explicit restore mode options bag. The existing replace behavior remains the default for backward compatibility, while a new merge mode reads the current saved groups and duplicate policy, merges backup groups in linear time using a shared URL index, and then persists the merged result.

Update the options restore dialog to expose Merge as a separate row action next to the existing destructive Restore action. The UI messaging now makes the difference between the two actions explicit, and the restore status text reflects whether the user ran a merge or a full replace.

Add unit and integration coverage for the new merge flow. The new tests verify that existing groups are preserved, duplicate URLs are rejected when the current settings require it, new backup groups are appended, and the options page wires the new action through end-to-end.
Update the user and engineering docs to describe the new non-destructive Merge action alongside the existing destructive Restore action.

The README now tells users when to choose Merge versus Restore. The Drive spec and implementation plan now describe both restore paths so the documented behavior matches production. TESTING.md is updated so the expected backup/restore coverage explicitly includes merge restore.
Stop serializing installId into Drive backup JSON payloads.

The local install ID still exists for Drive folder isolation and local backup-index bookkeeping, but it no longer leaks into the exported backup file itself. That keeps a backup created on one install importable on any other install without carrying machine-specific identity data in the payload.

This change also updates restore-focused tests to assert the new portable payload shape and adds a backwards-compatibility test proving older backup files that still contain installId continue to restore successfully. Documentation for the Drive backup format was updated to match the new payload contract.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Google Drive backup and restore feature by providing users with more granular control over how backups are applied. Instead of only being able to overwrite existing data, users can now choose to merge backup content with their current tab groups, preserving their active workspace while integrating new data. This change improves flexibility and user experience, making the backup system more robust and adaptable to different user needs. The underlying backup format has also been made more portable, ensuring future compatibility and ease of use across multiple installations.

Highlights

  • New Merge Restore Option: Introduced a 'Merge' option for Google Drive backups, allowing users to append backup tab groups to their existing local tab lists without overwriting them. The original 'Restore' (overwrite) functionality is still available.
  • Backup Payload Portability: The backup file format has been updated to exclude the 'installId', making backups more portable and allowing a single exported backup to be restored on any installation.
  • Refactored Group Merge Logic: The logic for merging tab groups has been extracted into a new shared utility module (shared/group_merge.ts), centralizing duplicate handling behavior for both import and restore flows.
  • UI Enhancements: The options page UI has been updated to present both 'Restore' and 'Merge' actions for each listed backup, along with clearer descriptive text.
Changelog
  • README.md
    • Updated Drive backup instructions to include the new 'Merge' restore option.
  • TESTING.md
    • Updated testing notes to reflect the new 'merge restore' behavior for Drive backups.
  • docs/DRIVE_BACKUP_PLAN.md
    • Updated the implementation plan to detail the new merge restore functionality.
    • Modified the backup serialization description to reflect the removal of 'installId'.
  • docs/DRIVE_BACKUP_SPEC.md
    • Expanded the restore section to describe both 'Merge' and 'Restore' options.
    • Removed 'installId' from the example backup JSON shape and added a note on backup file portability.
  • entrypoints/drive/drive_backup.ts
    • Imported the new 'mergeGroups' utility for handling tab group merging.
    • Modified 'serializeBackup' to no longer include 'installId' in the backup payload.
    • Updated 'restoreFromBackup' to accept a 'mode' parameter ('replace' or 'merge') and integrated the 'mergeGroups' function for non-destructive restores.
    • Added new types 'RestoreFromBackupMode' and 'RestoreFromBackupOptions' to support different restore behaviors.
  • entrypoints/drive/types.ts
    • Updated the 'SerializedBackupPayload' type definition to remove 'installId' and added a comment explaining the portability.
  • entrypoints/nufftabs/list.ts
    • Removed the local implementations of 'cloneGroups' and 'mergeGroups'.
    • Exported 'cloneGroups' and 'mergeGroups' from the new shared 'group_merge' module.
  • entrypoints/options/index.html
    • Updated the help text for Drive restore to explain both 'Merge' and 'Restore' options.
    • Changed the 'Action' column header in the backup list to 'Actions' to accommodate multiple buttons.
  • entrypoints/options/settings_page.ts
    • Modified 'renderDriveBackups' to create both 'Restore' and 'Merge' buttons for each backup entry.
    • Updated the event listener in 'initDriveBackupSection' to differentiate between 'restore-backup' and 'merge-backup' actions and pass the correct mode to 'restoreFromBackup'.
  • entrypoints/shared/group_merge.ts
    • Added a new file to centralize 'cloneGroups' and 'mergeGroups' logic, making it reusable across different features.
  • tests/integration/drive_backup.test.ts
    • Added a new integration test case to verify the functionality of merging a Drive backup into existing tab lists.
  • tests/unit/drive_backup_utils.test.ts
    • Updated unit tests for 'serializeBackup' to confirm that 'installId' is no longer included in the payload.
    • Added a new unit test to verify that legacy 'installId' values in older backup payloads are ignored during restore.
    • Added a new unit test to confirm the correct merging of restored backup groups into existing ones without replacement.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable "merge" option for restoring from Google Drive backups, enhancing the existing restore functionality. It also improves backup portability by removing the installId from the payload and refactors shared logic into a new module. The changes are well-supported by documentation and test updates. However, a significant issue has been identified where the new merge functionality unexpectedly overwrites user settings, which contradicts the behavior described in the UI and could lead to a poor user experience.

Comment thread entrypoints/drive/drive_backup.ts Outdated
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.48052% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.0%. Comparing base (5d8eb49) to head (20937b6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
entrypoints/drive/drive_backup.ts 93.7% 16 Missing ⚠️
entrypoints/options/settings_page.ts 92.3% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main     #30     +/-   ##
=======================================
+ Coverage   94.8%   95.0%   +0.1%     
=======================================
  Files         18      19      +1     
  Lines       2132    2204     +72     
  Branches     556     563      +7     
=======================================
+ Hits        2023    2094     +71     
- Misses        97      99      +2     
+ Partials      12      11      -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Stop including settings in Google Drive backup payloads and stop applying settings during Google Drive restore.

This makes the Drive backup feature operate only on saved tab groups. Local extension settings remain sourced from extension storage, which avoids overwriting install-specific preferences during cross-device or cross-profile Drive restores.

Implementation details:
- remove  from the serialized Drive backup payload type
- stop reading settings during Drive backup serialization
- stop normalizing and writing settings during Drive restore
- keep merge restore behavior unchanged for tab groups by continuing to read the current duplicate policy from local settings storage
- update Drive-specific documentation and README wording to reflect tab-only backup/restore semantics
- update unit and integration tests to assert that Drive restores leave existing settings untouched, while still tolerating legacy backup files that may contain extra fields

Validation run locally after the change:
- pnpm compile
- pnpm lint
- pnpm test
- pnpm build
- pnpm test:e2e
@viseshrp
viseshrp merged commit cc04702 into main Mar 9, 2026
5 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.

1 participant