Skip to content

fix(browser): bulk clear cookies during native import - #13966

Merged
brennanb2025 merged 6 commits into
mainfrom
brennanb2025/sta-3960-cookie-import-bulk-clear
Aug 12, 2026
Merged

brennanb2025 merged 6 commits into
mainfrom
brennanb2025/sta-3960-cookie-import-bulk-clear

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace the O(N) native Chromium cookie-removal loop introduced by fix(browser): exclude Google cookies from imports - direct sign-in is the only Google path (STA-3811) #13670 with one bulk cookie clear
  • snapshot the destination jar, restore preserved Google-family cookies, and best-effort restore the full snapshot before aborting if clear/preservation fails
  • keep file, Firefox, and Safari domain-replacement behavior unchanged
  • report excluded Google cookies explicitly and show sign-in guidance in a separate warning toast after an otherwise successful import

Performance

Real Electron cookie-store benchmark (old selective remove → new bulk clear + Google restore):

Destination cookies Before After Speedup
100 3.6 ms 1.0 ms 3.5×
1,000 195.2 ms 8.8 ms 22.1×
3,300 2,226.6 ms 35.8 ms 62.1×

The preserved Google cookie survived every benchmark case.

Validation

  • 110 focused tests across 8 files
  • full typecheck
  • focused standard, native-plugin, and type-aware oxlint
  • React Doctor changed-file checks
  • formatting, max-lines ratchet, localization catalog/extraction/coverage, and diff checks
  • independent Grok Electron/CDP QA of six distinct toast states; screenshots in follow-up comment

Fixes STA-3960.
Regression from #13670.

@brennanb2025

brennanb2025 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent Grok Electron/CDP QA passed all six user-visible notification states. Screenshots below use the real worktree-built emitBrowserCookieImportToast; no product defects were found.

Ordinary success — one success toast, no Google warning Google cookies excluded — success plus a separate sign-in warning
Ordinary success Google warning
Restart fallback unavailable — total failure warning Restart fallback unavailable — partial failure warning
Total fallback failure Partial fallback failure
Combined degraded import plus Google warning — two warnings, no success Generic skipped cookies — success only, no false Google warning
Combined warnings Generic skipped cookies

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c45b10c-e755-4cca-9906-e53462d929a7

📥 Commits

Reviewing files that changed from the base of the PR and between b65bfed and 4bcc9c2.

📒 Files selected for processing (2)
  • src/main/browser/browser-cookie-import-google-exclusion.test.ts
  • src/main/browser/browser-cookie-import.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/browser/browser-cookie-import-google-exclusion.test.ts

📝 Walkthrough

Walkthrough

Cookie imports now use snapshot-based bulk cookie clearing through clearStorageData. The policy restores excluded cookies after a successful clear and restores the full snapshot when clearing or preservation fails. Chromium imports count excluded Google cookies before decryption and include the count in import summaries. The renderer displays Google-cookie warnings and combines them with restart-fallback warnings. Tests cover success, failure, rollback, accounting, storage calls, and toast ordering.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the implementation, motivation, issue, performance, and validation, but it omits most required template sections and checklist details. Add the required ELI5, What Changed, Why, Visual Proof or N/A, Testing checklist, Review, Checklist, and Author sections.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: replacing native cookie removal with bulk clearing during browser import.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1648197-cfdf-412a-9933-a54929562838

📥 Commits

Reviewing files that changed from the base of the PR and between 7d441fc and b65bfed.

📒 Files selected for processing (2)
  • src/main/browser/browser-cookie-import-google-exclusion.test.ts
  • src/main/browser/browser-cookie-import.ts

@brennanb2025

brennanb2025 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent Grok Electron/CDP QA — final HEAD 4bcc9c2c55 (native screenshots)

Worktree identity verified via window.api.app.getIdentity():

  • name: Orca: brennanb2025/sta-3960-cookie-import-bulk-clear
  • devWorktreeName: sta-3960-cookie-import-bulk-clear
  • devRepoRoot: this worktree
  • isDev: true
  • Isolated ORCA_DEV_USER_DATA_PATH, CDP 9335, renderer 5175

Method: electron skill + Playwright CDP only. Invoked the real worktree-built emitBrowserCookieImportToast from /src/lib/browser-cookie-import-toast.ts (not a mock). No DOM style/attribute/CSS/position manipulation. Multi-toast shots used native Playwright pointer hover over Sonner toaster/front toast elements so product data-expanded=true stack expansion revealed both messages; screenshots taken only after verifying expanded state and non-overlapping rects.

Scenarios (all PASS — no product defects)

Scenario Result Multi-toast visibility
(1) Ordinary success, no Google skip 1× success only — “Imported 12 cookies from Chrome (Default) into Default.” n/a (single)
(2) Success + googleCookiesSkipped success + separate Google direct-sign-in warning (DOM order: Google front/newest, success behind) Native hover revealed both (data-expanded=true, both opacity 1)
(3) Restart-fallback degraded + Google 2× warning only (partial restart + Google); no false success Native hover revealed both
(4) Restart-fallback total failure 1× warning total-failure copy; no success n/a (single)

Console: no cookie-import errors (unrelated React DevTools / tooltip / React Grab warnings only).

Screenshots (native-rendered only)

Ordinary success Success + Google sign-in warning (hover-expanded)
Ordinary success Success + Google
Degraded restart + Google, no success (hover-expanded) Restart total failure
Combined warnings Total failure

Local artifacts (not committed): qa-artifacts/sta-3960-grok-final/

@brennanb2025
brennanb2025 merged commit 2249330 into main Aug 12, 2026
44 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(browser): bulk clear cookies during native import

* fix(browser): separate Google cookie import warning

* fix(browser): report encrypted Google cookie exclusions

* fix(browser): skip key lookup for excluded cookies

* test(browser): cover excluded-cookie key bypass

* perf(browser): keep plaintext key scan cheap
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