Skip to content

fix(sql): throw on missing filepath in EnhancedCookieQueryService#433

Merged
mherod merged 1 commit into
mainfrom
fix/issue-428-enhanced-cookie-query-silent-empty
Feb 20, 2026
Merged

fix(sql): throw on missing filepath in EnhancedCookieQueryService#433
mherod merged 1 commit into
mainfrom
fix/issue-428-enhanced-cookie-query-silent-empty

Conversation

@mherod
Copy link
Copy Markdown
Owner

@mherod mherod commented Feb 20, 2026

Problem

EnhancedCookieQueryService.queryCookies() silently returned { data: [] } when no filepath was provided, because discoverBrowserFiles() 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 Error that clearly names the browser and directs callers to provide an explicit filepath in EnhancedQueryOptions.

Changes

  • src/core/browsers/sql/EnhancedCookieQueryService.ts: Remove the TODO stub and return [] from discoverBrowserFiles(). Throw a descriptive Error instead.
  • 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: "%" }) without filepath throws with message matching /Auto-discovery.*not yet implemented/
  • TODO comment removed — confirmed via grep
  • Unit tests added and passing (5/5)
  • No regressions — 538 tests pass, 0 failures

Fixes #428

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
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

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
  • getFilepaths call 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 filepath provided), 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.

@mherod mherod merged commit 96fbd47 into main Feb 20, 2026
26 checks passed
@mherod mherod deleted the fix/issue-428-enhanced-cookie-query-silent-empty branch February 20, 2026 20:43
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.

bug(sql): EnhancedCookieQueryService silently returns empty results when no filepath provided

1 participant