Skip to content

fix(tool): parse special filenames in code search - #1517

Open
jxnclty wants to merge 1 commit into
alibaba:mainfrom
jxnclty:fix/code-search-special-paths
Open

jxnclty wants to merge 1 commit into
alibaba:mainfrom
jxnclty:fix/code-search-special-paths

Conversation

@jxnclty

@jxnclty jxnclty commented Sep 21, 2026

Copy link
Copy Markdown

Description

Fixes code_search parsing for filenames containing colons and other special characters.

git grep output was parsed using delimiter-sensitive text output, which could cause characters in filenames to be interpreted as part of the match metadata. Binary match notices could also interfere with result parsing and matching-file counts.

This change:

  • uses NUL-delimited git grep output so filenames can be parsed without relying on special characters as separators;
  • ignores binary files when collecting text search results, preventing binary match notices from corrupting the parsed records;
  • preserves support for non-ASCII paths;
  • adds regression tests for filenames containing colons and other special characters;
  • verifies the behavior across workspace, commit, and plain-directory search modes.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • go test ./internal/tool
  • make check
  • make test
  • make build

The regression tests cover special-path parsing and binary-result handling, including the result-limit case that previously produced an incorrect matching-file count.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I used AI/LLM assistance and disclose it below; I reviewed the output, did not attribute the commit to AI, and will answer maintainer questions and review comments myself.

AI Disclosure

I used ChatGPT with GPT-5.6 Sol to assist with debugging and language/writing support. I reviewed the suggested changes and the resulting code myself, and the commit contains no AI attribution trailer.

Related Issues

N/A

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

@CLAassistant

CLAassistant commented Sep 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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