Skip to content

Add ignore_path option to exclude Zotero papers by collection path#219

Merged
TideDra merged 5 commits into
mainfrom
copilot/add-ignore-path-option
Apr 1, 2026
Merged

Add ignore_path option to exclude Zotero papers by collection path#219
TideDra merged 5 commits into
mainfrom
copilot/add-ignore-path-option

Conversation

Copilot AI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Adds ignore_path as the inverse counterpart to include_path — allows filtering out papers from specified Zotero collection paths using glob patterns.

Changes

  • config/base.yaml: New ignore_path: null field alongside include_path
  • executor.py: normalize_ignore_path_patterns() for config validation; filter_corpus() applies ignore_path exclusion after include_path inclusion, so ignore_path takes precedence when both are set
  • tests/test_include_path.py: Tests for normalization, exclusion logic, precedence over include_path, and empty-list behavior

Example

zotero:
  include_path: ["2026/**"]
  ignore_path: ["2026/archive/**", "2026/misc/**"]

Papers in 2026/archive/ or 2026/misc/ are excluded even though they match include_path.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pyenv.run
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add ignore_path option to filter specified paths Add ignore_path option to exclude Zotero papers by collection path Mar 31, 2026
Copilot AI requested a review from TideDra March 31, 2026 14:07
Comment thread src/zotero_arxiv_daily/executor.py Outdated
return list(include_path)


def normalize_ignore_path_patterns(ignore_path: list[str] | ListConfig | None) -> list[str] | None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This method can be merged with normalize_include_path_patterns because their code is almost the same.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f84f10c. Introduced a shared normalize_path_patterns(patterns, config_key) helper; normalize_include_path_patterns and normalize_ignore_path_patterns are now thin one-line wrappers that pass the appropriate config key name for error messages.

Copilot AI requested a review from TideDra March 31, 2026 15:45
Comment thread src/zotero_arxiv_daily/executor.py Outdated
return list(patterns)


def normalize_include_path_patterns(include_path: list[str] | ListConfig | None) -> list[str] | None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

There is no need to define normalize_include_path_patterns and normalize_ignore_path_patterns. Just normalize_path_patterns is enough

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 64f381f. Removed both wrapper functions — all call sites in executor.py and the tests now call normalize_path_patterns directly with the appropriate config_key argument.

Copilot AI 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.

Pull request overview

Adds a new Zotero config option (ignore_path) to exclude papers by collection path (glob patterns), acting as an inverse/override to include_path.

Changes:

  • Extend config with zotero.ignore_path (default null) alongside include_path.
  • Generalize path-pattern normalization into normalize_path_patterns(...) and apply ignore_path filtering after include_path (so ignore wins).
  • Add tests covering ignore-path normalization, exclusion behavior, and precedence.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
config/base.yaml Adds ignore_path: null with inline documentation/example.
src/zotero_arxiv_daily/executor.py Introduces generic pattern normalization and applies ignore_path exclusion logic in filter_corpus().
tests/test_include_path.py Adds normalization and filtering tests for ignore_path and precedence behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_include_path.py Outdated
Comment on lines 11 to 17
def test_normalize_include_path_patterns_rejects_single_string():
with pytest.raises(TypeError, match="config.zotero.include_path must be a list of glob patterns or null"):
normalize_include_path_patterns("2026/survey/**")
normalize_path_patterns("2026/survey/**", "include_path")


def test_normalize_include_path_patterns_accepts_list_config():
include_path = OmegaConf.create(["2026/survey/**", "2026/reading-group/**"])

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

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

The test function names still reference normalize_include_path_patterns, but the implementation under test was renamed to the generic normalize_path_patterns(...). Renaming these test functions to match the current API will make failures easier to interpret and avoid confusion while scanning the test output.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot check this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 768c98b. All five test functions that referenced the old wrapper names have been renamed to reflect the current normalize_path_patterns API (e.g. test_normalize_path_patterns_rejects_single_string_for_include_path, test_normalize_path_patterns_accepts_list_config_for_ignore_path, etc.).

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TideDra TideDra marked this pull request as ready for review April 1, 2026 06:31
@TideDra TideDra merged commit 91632d7 into main Apr 1, 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.

3 participants