Skip to content

fix(cli): normalize whitespace-only search filters#55

Merged
luca-ctx merged 2 commits into
ctxrs:mainfrom
atharva-patill:fix/search-filter-normalization
Jul 5, 2026
Merged

fix(cli): normalize whitespace-only search filters#55
luca-ctx merged 2 commits into
ctxrs:mainfrom
atharva-patill:fix/search-filter-normalization

Conversation

@atharva-patill

Copy link
Copy Markdown
Contributor

Summary

While looking at the search filters, I noticed that whitespace-only values passed to --file and --workspace were being ignored by the search pipeline, but they still appeared in the JSON filters output.

This normalizes both fields when building SearchFilters, so the JSON output reflects the filters that are actually applied.

Reproduction

./target/debug/ctx search foo --file " " --json | jq '.filters'

Before:

{
  "file": " ",
  "include_subagents": false
}

After:

Whitespace-only values are normalized away, so the file filter is no longer included in the JSON output. The same behavior now applies to --workspace.
Screenshot 2026-07-05 at 6 42 57 PM

Testing

  • Added a regression test covering both --file and --workspace.
  • Verified the updated JSON output manually.

@luca-ctx luca-ctx merged commit 05bb859 into ctxrs:main Jul 5, 2026
@luca-ctx

luca-ctx commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Added fmt, thanks for this!

@atharva-patill

Copy link
Copy Markdown
Contributor Author

Added fmt, thanks for this!

Thanks! I missed the cargo fmt. I’ll make sure to run it first next time.

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