Skip to content

Handle malformed WarpGrep Windows results gracefully#8

Merged
DhruvBhatia0 merged 4 commits intomainfrom
claude/github-issue-description-xL4ck
Mar 30, 2026
Merged

Handle malformed WarpGrep Windows results gracefully#8
DhruvBhatia0 merged 4 commits intomainfrom
claude/github-issue-description-xL4ck

Conversation

@DhruvBhatia0
Copy link
Copy Markdown
Collaborator

@DhruvBhatia0 DhruvBhatia0 commented Mar 30, 2026

Summary

  • Validate that WarpGrep result file paths are plausible before rendering them
  • Reject contexts with implausible paths (bare tokens, empty strings) and surface a clear fallback error
  • Fix Search failed: undefined when the SDK omits an error string

Changes

index.ts

  • Added isValidContext() — checks that a file path contains a separator (/ or \) or a dot-extension, and that content is non-empty
  • formatWarpGrepResult() now filters contexts through validation; if none survive, returns an actionable error with the malformed file values
  • Falsy result.error values (undefined, null, "") no longer surface literally — a fallback message is used instead

index.test.ts

  • Two regression tests:
    1. Implausible paths ("C", "", " ", "noextension") are rejected; valid paths across all OS conventions (unix relative/absolute, Windows absolute/relative, ../, ./, dot-extension-only) render normally
    2. Falsy error fields never appear as literal undefined/null; explicit errors pass through exactly

Test plan

  • bun test — all new tests pass, no regressions

https://claude.ai/code/session_01G5qa1GyHGNwWu2ko6uZ53N

claude added 4 commits March 30, 2026 21:13
Fixes #7 — On Windows, upstream SDK path parsing truncates drive-letter
paths (e.g. C:/Users/.../auth.ts → file: 'C'), producing confusing
output. This adds detection for malformed contexts and surfaces an
actionable error with a workaround suggestion. Also fixes the
'Search failed: undefined' output when the SDK omits an error string.

https://claude.ai/code/session_01G5qa1GyHGNwWu2ko6uZ53N
Validate that search result file paths are plausible (contain a path
separator or dot-extension with non-empty content) rather than checking
for a specific truncation pattern. Tests cover paths from all major OS
conventions.

https://claude.ai/code/session_01G5qa1GyHGNwWu2ko6uZ53N
Includes upstream fix for Windows drive-letter path parsing in
parseFinishFiles.

https://claude.ai/code/session_01G5qa1GyHGNwWu2ko6uZ53N
@DhruvBhatia0 DhruvBhatia0 merged commit bf9c635 into main Mar 30, 2026
1 check passed
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