Skip to content

fix(tool): preserve special paths in file_find - #863

Closed
RerankerGuo wants to merge 1 commit into
alibaba:mainfrom
RerankerGuo:fix/file-find-special-paths
Closed

fix(tool): preserve special paths in file_find#863
RerankerGuo wants to merge 1 commit into
alibaba:mainfrom
RerankerGuo:fix/file-find-special-paths

Conversation

@RerankerGuo

Copy link
Copy Markdown
Contributor

Description

file_find parsed git ls-files and git ls-tree as newline-delimited
text. Git C-quotes paths containing non-ASCII or special characters in that
mode, so the tool returned strings such as:

"unicode-\346\265\213\350\257\225.go"

Those strings are display representations rather than real repository paths,
so a follow-up file_read cannot open the selected file.

This change requests NUL-delimited output from both Git commands and parses the
raw paths by NUL. Workspace and commit-mode discovery now preserve Unicode,
tabs, quotes, and other Git-valid path bytes without changing the existing
newline-delimited file_find response contract.

Paths containing literal newlines are covered at the enumeration layer only;
representing those unambiguously in the final text response is outside this
PR's scope.

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?

  • make check
  • make test
  • make build
  • make coverage - 90.2%, meeting the 90% threshold
  • Real temporary Git repositories in workspace and commit modes

Before the fix, the new regression test failed because listGitFiles returned
Git's C-quoted display strings instead of the original paths. After the fix,
the same test passes for Unicode, tab, quote, and newline path cases in both
enumeration modes. The full internal/tool package also passes with the race
detector.

Self-review used OCR Delegation Mode with the host agent:
2/2 changed files reviewed, 0 skipped, 0 findings.

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 or my feature works
  • New and existing unit tests pass locally with my changes
  • Documentation is not required for this internal path enumeration fix
  • I have signed the CLA

Related Issues

No existing issue found. All open issues, pull request text, and open pull
request changed files were checked before implementation; no competing
file_find path-enumeration change was found.

Use NUL-delimited Git output so Unicode and special-character paths are not C-quoted or split during file discovery. Add workspace and commit-mode regression coverage.

Test: make check && make test && make build && make coverage
@github-actions

Copy link
Copy Markdown
Contributor

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

@RerankerGuo RerankerGuo closed this by deleting the head repository Aug 17, 2026
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