Skip to content

Migrate filter DSL to the filt-rs crate#590

Merged
notheotherben merged 3 commits into
mainfrom
copilot/migrate-src-filters-module
Jun 15, 2026
Merged

Migrate filter DSL to the filt-rs crate#590
notheotherben merged 3 commits into
mainfrom
copilot/migrate-src-filters-module

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Replaces the in-tree src/filter module with the extracted filt-rs crate. This is a near drop-in swap that also brings glob (like) and regex (matches) pattern matching, plus native datetime filtering.

Changes

  • Dependency: add filt-rs 1.1.0 with the chrono, regex, and serde features; re-export Filter/FilterValue/Filterable from filt_rs in main.rs.
  • Remove the entire src/filter/ module (lexer, parser, interpreter, value, etc.).
  • Lifetime parameter: FilterValueFilterValue<'_>. Metadata caches FilterValue<'static> (entries outlive the entity they derive from) and insert now accepts any Into<FilterValue<'a>>, so call sites keep passing &str rather than allocating Strings.
  • Native timestamps: expose chrono datetimes as filter fields — repo.pushed_at/created_at/updated_at, release.created_at/published_at, asset.created_at/updated_at, and gist.created_at/updated_at (gist fields changed from String to DateTime<Utc>).
  • Docs: document like/matches, the _cs case-sensitive variants, raw strings, duration literals and now()/trim(); add the new datetime fields to the repo/release/gist reference tables; correct the equality note to reflect Unicode case-folding.

New filtering capabilities

repo.name like "*-backup"                       # glob match (resolves #36's request)
repo.name matches r"^release/v\d+(\.\d+){2}$"   # regular expression match
repo.pushed_at > now() - 30d                    # native datetime comparison

Comment thread docs/advanced/filters.md Outdated

- `like` performs a case-insensitive [glob](https://en.wikipedia.org/wiki/Glob_(programming)) match, where `*` matches any
sequence of characters (including none), `?` matches exactly one character, and a backslash makes the following character
literal (`\*`, `\?`, `\\`). For example, `repo.name like "feat/*"` matches any repository whose name begins with `feat/`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot let's use repo.name like "*-rs" as an example instead; since the example provided here implies that repo names can include slashes (which is not the case).

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.

Updated the example to repo.name like "*-rs" in 2086f63.

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.

Correction: the change is in commit 4b10b94.

@notheotherben notheotherben marked this pull request as ready for review June 15, 2026 20:12
Comment thread docs/advanced/filters.md Outdated
literal (`\*`, `\?`, `\\`). For example, `repo.name like "*-rs"` matches any repository whose name ends with `-rs`.
- `matches` performs a [regular expression](https://docs.rs/regex/latest/regex/#syntax) match. Regular expressions are
case-sensitive (use `(?i)` to ignore case) and unanchored (use `^` and `$` to anchor the match). For example,
`repo.name matches r"^release/v\d+(\.\d+){2}$"` matches names like `release/v1.2.3`.

@notheotherben notheotherben Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Let's also update the field and example used here to be more realistic (for example, checking that the release.tag matches a semver version number).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot Let's also update the field and example used here to be more realistic (for example, checking that the release.tag matches a semver version number).

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.

Updated the example to release.tag matches r"^v\d+(\.\d+){2}$", matching semver tags like v1.2.3, in 3e76e6f.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.87%. Comparing base (f385e2a) to head (3e76e6f).

Files with missing lines Patch % Lines
src/entities/mod.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #590      +/-   ##
==========================================
- Coverage   72.64%   70.87%   -1.77%     
==========================================
  Files          36       28       -8     
  Lines        2709     1971     -738     
==========================================
- Hits         1968     1397     -571     
+ Misses        741      574     -167     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI requested a review from notheotherben June 15, 2026 20:32
@notheotherben notheotherben merged commit 8699599 into main Jun 15, 2026
15 of 16 checks passed
@notheotherben notheotherben deleted the copilot/migrate-src-filters-module branch June 15, 2026 21:10
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