fix(cmd): include backslash in path detection for @ file references - #38
fix(cmd): include backslash in path detection for @ file references#38hsusul wants to merge 1 commit into
Conversation
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Reviewed the backslash path heuristic and both embedding modes; no blocking issues found. Focused TestEmbedFiles tests, go vet ./pkg/..., gofmt, and git diff --check passed. Full package tests require the repository mock server on localhost:4010, which was not running.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Observed Behavior
When passing an
@file reference containing backslash path separators (such as@subfolder\\unreadablefileor Windows paths without a file extension) that fails to open,embedFilesValueinpkg/cmd/flagoptions.godid not recognize\\as a path separator. As a result,probablyFile/expectsFileevaluated tofalse, silently falling back to treating the unreadable file path as a raw string literal ("@subfolder\\\\unreadablefile") instead of surfacing a file read error.Root Cause
probablyFileandexpectsFilechecks inpkg/cmd/flagoptions.go(lines 237 and 265) checked for.and/(strings.Contains(filename, ".") || strings.Contains(filename, "/")), but omitted\\(strings.Contains(filename, "\\\\")).Implementation
Updated path detection in
embedFilesValue(pkg/cmd/flagoptions.go) to also check for\\(strings.Contains(filename, "\\\\")), ensuring paths using backslashes are recognized as file references when handling unreadable file errors.Regression Coverage
Added unit test case
"non-existent file with backslash path @ prefix (error)"inpkg/cmd/flagoptions_test.goto assert that unreadable backslash path references properly return a file reading error instead of falling back to a raw string literal.Exact Validation Commands & Results
go test ./pkg/cmd -run TestEmbedFiles-> Passedgo test ./internal/...-> Passedgo vet ./internal/... ./pkg/...-> Passed (clean)git diff --check-> Passed (clean)Limitations or Untested Platforms
None.
Unrelated Changes
No unrelated changes were included.