fix(sql): throw on missing filepath in EnhancedCookieQueryService#433
Merged
Merged
Conversation
Replace the silent stub in discoverBrowserFiles() that unconditionally returned [] with a thrown Error that describes what is missing and how to fix it. Callers that omit filepath now receive an actionable error instead of silently empty results. - Remove TODO stub and silent [] return from discoverBrowserFiles() - Throw descriptive Error naming the browser and directing callers to provide an explicit filepath in EnhancedQueryOptions - Add EnhancedCookieQueryService.test.ts covering the error path for firefox, chrome, and edge, plus the happy path with a filepath Fixes #428
Closed
4 tasks
There was a problem hiding this comment.
PR Review: throw on missing filepath in EnhancedCookieQueryService
Overview
Replaces a silent stub (return []) with a descriptive thrown error, converting an invisible failure into an explicit contract violation. Clean, targeted fix for #428.
Findings
No critical or warning-level issues found.
🔵 Suggestions
- The three error-path tests check slightly different fragments of the same single error message (
/Auto-discovery.*not yet implemented/,/"chrome"/,/filepath/). Collapsing them into one test with all three assertions would reduce duplication — though the current form is fine and readable.
👍 What's Good
- The fix is minimal: 6 lines removed, 4 added, exactly addresses the root cause
getFilepathscall chain is clearly documented — the throw will surface correctly to all callers- Tests cover both the error path (3 browsers) and the happy path (with
filepathprovided), confirming no regression - Error message is actionable: tells the caller what to do (
Provide an explicit "filepath"), not just what went wrong
Summary
LGTM. The change is correct, well-tested, and strictly better than a silent empty result. Ready to merge.
This was referenced Feb 24, 2026
Merged
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
EnhancedCookieQueryService.queryCookies()silently returned{ data: [] }when nofilepathwas provided, becausediscoverBrowserFiles()was an unimplemented stub that unconditionally returned[]. Callers had no way to distinguish "no cookies matched" from "file discovery is broken".Solution
Replace the stub with a thrown
Errorthat clearly names the browser and directs callers to provide an explicitfilepathinEnhancedQueryOptions.Changes
src/core/browsers/sql/EnhancedCookieQueryService.ts: Remove the TODO stub andreturn []fromdiscoverBrowserFiles(). Throw a descriptiveErrorinstead.src/core/browsers/sql/__tests__/EnhancedCookieQueryService.test.ts: New test file with 5 tests covering the error path (firefox, chrome, edge without filepath) and the happy path (with filepath provided).Verification
queryCookies({ browser: "firefox", name: "%", domain: "%" })withoutfilepaththrows with message matching/Auto-discovery.*not yet implemented/Fixes #428