Skip to content

Feat/directory filter tui integration#29

Merged
joshLong145 merged 2 commits into
mainfrom
feat/directory-filter-tui-integration
May 15, 2026
Merged

Feat/directory filter tui integration#29
joshLong145 merged 2 commits into
mainfrom
feat/directory-filter-tui-integration

Conversation

@joshLong145

Copy link
Copy Markdown
Owner

What changed

Honor the filter on TUI re-parse paths. Initial scans already filtered, but two paths could still inject excluded files mid-session:

  • notify file-watcher → TuiSession::handle_file_changed now reads app.filter and returns early on non-matching paths.
  • Serena cache rescan inside handle_tick now passes app.filter.as_deref() to scan_project_serena.

Both share a new App::filter: Option<Arc<PathFilter>> field, set in main() from the parsed CLI args. The event-source side needs no changes — tool calls targeting excluded files have no symbols to attribute against.

Surface the active filter in UI + reports. When a filter is set, the output is partial by construction; readers shouldn't have to guess.

  • TUI stats panel: Filter: <display> line under Session.
  • Coverage text formatter: Filter: <display> line under the report header.
  • Coverage JSON formatter: optional top-level filter field, omitted entirely when no filter (additive — schema_version stays at 2).
  • dump_tree: Filter: <display> line under the Project: header.

CoverageReport gains filter: Option<String> (display form). run_report and dump_tree gain Option<&PathFilter> parameters; main.rs threads through.

Test plan

  • 284 lib tests pass, including 4 new tests in coverage::tests:
    • text_formatter_renders_filter_line_when_present
    • text_formatter_omits_filter_line_when_absent
    • json_formatter_includes_filter_when_present
    • json_formatter_omits_filter_when_absent (asserts field is absent, not null)
  • 37 integration tests pass.

Compatibility

  • No new public types; App::filter defaults to None in App::new.
  • run_report / dump_tree signatures grew an Option<&PathFilter> param.
  • CoverageReport gained one field — existing callers using ::from_project are unaffected; direct struct literals need filter: None.
  • JSON output: filter field appears only when set; existing consumers see no change in the no-filter case.

joshLongBI and others added 2 commits May 15, 2026 09:12
Initial scans (both tree-sitter and Serena) already honor `--filter` /
`--filter-regex`, but two TUI re-parse paths previously passed `None`
and would inject excluded files back into the tree mid-session:

1. `handle_file_changed` — fires when `notify` reports a modified
   source file. Now reads `app.filter` and returns early if the
   changed file's project-relative path does not match.

2. The Serena cache rescan inside `handle_tick` — fires when a `.pkl`
   modification time changes. Now passes `app.filter.as_deref()` to
   `scan_project_serena` so the rebuilt tree stays filtered.

Both paths share the same filter via a new `App::filter:
Option<Arc<PathFilter>>` field, populated in `main()` from the parsed
CLI args immediately after `App::new`. The `Arc` is cheap to clone if
we ever need to share across threads (none today) and lets borrow
callers reach for `as_deref()` to produce `Option<&PathFilter>` to
match the existing scan_project signatures.

Event-source side needs no changes — agent tool calls targeting
excluded files simply have no symbols in the tree to attribute against,
so they naturally drop on the floor.

284 lib tests + 37 integration tests still pass. Smoke-tested locally
that `--filter src/filter.rs --coverage` still shows only that file.
Cargo.lock version bump is the normal regeneration after pulling the
0.16.0 bump from main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When `--filter` or `--filter-regex` is set, the result is partial by
construction. Surface that so readers don't mistake a filtered subset
for the whole project:

- `CoverageReport` gains an optional `filter: Option<String>` field
  storing the display form (`"src/parser"` or `"re:^src/.*\.rs$"`).
  `run_report` populates it from the new `filter` parameter; default
  is `None` for in-test construction and the existing
  `CoverageReport::from_project` constructor.

- Text formatter prints a `Filter: <display>` line directly after the
  `Coverage Report (...)` header when set, suppressed otherwise.

- JSON formatter adds an optional top-level `filter` field, gated by
  `skip_serializing_if = "Option::is_none"`. Schema-additive — readers
  of the existing format see an unchanged object when no filter is
  active; schema_version stays at 2.

- `dump_tree` prints a `Filter: <display>` line under the
  `Project: ...` header when set. New signature takes
  `Option<&PathFilter>`; main.rs threads the parsed filter through.

- TUI stats panel renders `  Filter: <display>` (muted accent color)
  immediately below the Session line when `app.filter` is set.

Four new tests cover the formatter cases:
- text_formatter_renders_filter_line_when_present
- text_formatter_omits_filter_line_when_absent
- json_formatter_includes_filter_when_present
- json_formatter_omits_filter_when_absent  (asserts field is absent,
  not `null`, preserving the additive-schema property)

The nine in-test `CoverageReport` struct literals also got
`filter: None,` to match the new field.

284 lib tests + 37 integration tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 71.73913% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.14%. Comparing base (7cf9a41) to head (23db1a8).

Files with missing lines Patch % Lines
src/coverage.rs 86.66% 10 Missing ⚠️
src/tui.rs 0.00% 7 Missing ⚠️
src/ui/stats.rs 0.00% 4 Missing and 2 partials ⚠️
src/main.rs 0.00% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #29   +/-   ##
=======================================
  Coverage   74.14%   74.14%           
=======================================
  Files          25       25           
  Lines        6965     7054   +89     
  Branches     6965     7054   +89     
=======================================
+ Hits         5164     5230   +66     
- Misses       1693     1714   +21     
- Partials      108      110    +2     

☔ View full report in Codecov by Sentry.
📢 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.

@joshLong145 joshLong145 merged commit 841b804 into main May 15, 2026
2 checks passed
@joshLong145 joshLong145 deleted the feat/directory-filter-tui-integration branch May 15, 2026 13:47
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