fix(tool): preserve special paths in file_find - #863
Closed
RerankerGuo wants to merge 1 commit into
Closed
Conversation
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
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
file_findparsedgit ls-filesandgit ls-treeas newline-delimitedtext. Git C-quotes paths containing non-ASCII or special characters in that
mode, so the tool returned strings such as:
Those strings are display representations rather than real repository paths,
so a follow-up
file_readcannot 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_findresponse 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
How Has This Been Tested?
make checkmake testmake buildmake coverage- 90.2%, meeting the 90% thresholdBefore the fix, the new regression test failed because
listGitFilesreturnedGit'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/toolpackage also passes with the racedetector.
Self-review used OCR Delegation Mode with the host agent:
2/2changed files reviewed,0skipped,0findings.Checklist
go fmt,go vet)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_findpath-enumeration change was found.