Skip to content

hotfix: canonicalize paths before applying filter in search tool#16

Merged
AstraBert merged 2 commits into
mainfrom
hotfix/search-tool
Jun 15, 2026
Merged

hotfix: canonicalize paths before applying filter in search tool#16
AstraBert merged 2 commits into
mainfrom
hotfix/search-tool

Conversation

@AstraBert

@AstraBert AstraBert commented Jun 15, 2026

Copy link
Copy Markdown
Owner

As per title

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of file path handling when adding documents by canonicalizing provided paths before searching (with a fallback to the original input if canonicalization fails).
  • Chores

    • Patch version release (0.3.0 → 0.3.1) for the CLI tool.
    • Updated the search-evals crate to use the new CLI tool version.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b9d0601-a1a3-42f4-9412-552a3a7d3fae

📥 Commits

Reviewing files that changed from the base of the PR and between f622667 and 0ca1050.

📒 Files selected for processing (1)
  • microagents-cli/src/tools.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • microagents-cli/src/tools.rs

📝 Walkthrough

Walkthrough

SearchTool in microagents-cli now canonicalizes each document_paths entry via std::fs::canonicalize, falling back to the original string on failure. The crate version is bumped from 0.3.0 to 0.3.1, and search-evals updates its dependency version to match.

Changes

SearchTool Canonicalization and v0.3.1 Release

Layer / File(s) Summary
SearchTool path canonicalization and version bump
microagents-cli/src/tools.rs, microagents-cli/Cargo.toml
Each entry in document_paths is now resolved through std::fs::canonicalize before being passed to vector_search; the crate version is bumped to 0.3.1.
search-evals dependency update
search-evals/Cargo.toml
The microagents-cli path dependency version is updated from 0.3.0 to 0.3.1.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hopping through the file paths with care,
Canonicalizing each one with flair,
No broken links, no relative woe,
Just clean, resolved paths where searches go!
A tiny bump, a cleaner trail — 0.3.1 hops beyond the pale! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: canonicalizing paths before applying filter in the search tool, which aligns with the primary modification in microagents-cli/src/tools.rs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hotfix/search-tool

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@microagents-cli/src/tools.rs`:
- Around line 179-181: The canonicalized paths returned by std::fs::canonicalize
in tools.rs (lines 179-181) use Windows-specific format with backslashes and the
\\?\ verbatim prefix, but indexed documents in init_env.rs store paths with
forward-slash normalization via .replace('\\', "/"). This format mismatch causes
exact string matching in search.rs to fail on Windows. After canonicalizing the
path and converting it to a string using to_string_lossy().to_string(),
normalize the result by replacing backslashes with forward slashes (just like
init_env.rs does) to ensure consistency with the indexed path format, allowing
successful matching in search.rs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cbd0c4a8-bbce-4846-9592-fe544508b575

📥 Commits

Reviewing files that changed from the base of the PR and between 33ab15a and f622667.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • microagents-cli/Cargo.toml
  • microagents-cli/src/tools.rs
  • search-evals/Cargo.toml

Comment thread microagents-cli/src/tools.rs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@AstraBert AstraBert merged commit 4203491 into main Jun 15, 2026
6 checks passed
@AstraBert AstraBert deleted the hotfix/search-tool branch June 15, 2026 10:50
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.

1 participant