Skip to content

Use filterliststore in filter package#45

Merged
anfragment merged 1 commit intomasterfrom
spellcascade/return-filterliststore
Feb 2, 2026
Merged

Use filterliststore in filter package#45
anfragment merged 1 commit intomasterfrom
spellcascade/return-filterliststore

Conversation

@spellcascade
Copy link
Member

What does this PR do?

Returns old behavior to get cached filter lists.

How did you verify your code works?

Manual testing.

What are the relevant issues?

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

The change replaces the HTTP client abstraction with a filterListStore abstraction for retrieving filter lists. The NewFilter constructor signature is updated to accept filterListStore instead of httpClient, the Filter struct's client field is replaced with filterListStore, and the AddURL method refactors to use the store interface instead of making HTTP calls.

Changes

Cohort / File(s) Summary
Filter Store Abstraction
filter/filter.go
Replaces httpClient with filterListStore interface in constructor and Filter struct. Refactors AddURL to fetch lists from store instead of HTTP, handling io.ReadCloser with defer close and using scanner. Updates error messages and logging to reflect store-based retrieval.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ZenPrivacy/zen-core#32: Modifies the same filter/filter.go file's constructor and Filter struct, involving complementary changes to filterListStore handling.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly reflects the main change: replacing the HTTP client with filterliststore abstraction in the filter package.
Description check ✅ Passed The description covers all required sections from the template: what the PR does, how it was verified, and issues. However, 'Manual testing' is vague without specific testing steps, and the description lacks detail about the implementation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch spellcascade/return-filterliststore

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83665b0 and a8cb171.

📒 Files selected for processing (1)
  • filter/filter.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-29T18:08:27.308Z
Learnt from: anfragment
Repo: ZenPrivacy/zen-core PR: 40
File: filter/filter.go:209-212
Timestamp: 2026-01-29T18:08:27.308Z
Learning: Filter list rules in ad-blocking filter lists (e.g., EasyList, uBlock Origin lists) are typically short and don't exceed 300 characters in length. The default bufio.Scanner buffer size (64KB) is sufficient for parsing these rules without needing to be increased.

Applied to files:

  • filter/filter.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Test Go (windows-latest)
  • GitHub Check: Lint Go (macos-latest)
  • GitHub Check: Lint Go (windows-latest)
🔇 Additional comments (4)
filter/filter.go (4)

27-29: LGTM — clean store abstraction.


55-59: Field swap is consistent with the new dependency.


68-90: Constructor update and nil checks look solid.


152-159: Verify filterListStore.Get is safe for concurrent use and returns independent readers.

AddURL spawns goroutines for !#include expansion, so Get may be called concurrently and each returned reader is closed by the caller. Please confirm the store implementation is concurrency-safe and returns a fresh reader per call (or document/guard it if not).

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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 and usage tips.

@anfragment anfragment merged commit e97be0b into master Feb 2, 2026
15 checks passed
@anfragment anfragment deleted the spellcascade/return-filterliststore branch February 2, 2026 10:02
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