Skip to content

Fix ripgrep output parsing on Windows drive-letter paths - #20

Closed
harshdotcom wants to merge 1 commit into
andrewyng:mainfrom
harshdotcom:fix/windows-ripgrep-parse
Closed

harshdotcom wants to merge 1 commit into
andrewyng:mainfrom
harshdotcom:fix/windows-ripgrep-parse

Conversation

@harshdotcom

Copy link
Copy Markdown

What

Fixes the grep tool returning corrupted results on Windows when ripgrep is installed.

_parse_rg split each ripgrep output line with line.split(":", 2). ripgrep is
invoked with an absolute search path, which on Windows starts with a drive
letter (C:\...) — that colon was mistaken for the path:line:text field
separator, so every match reported file "C", line 0, with the real line
number leaked into the text field.

Fix

Anchor the parse on the numeric :<line>: field with a regex
((.+?):(\d+):(.*)), so both the drive-letter colon and any colons inside the
matched text are preserved. A plain rsplit(":", 2) would not work — matched
text frequently contains colons (e.g. def hello():).

Testing

  • Added test_parse_rg_handles_windows_drive_letter_and_colons_in_text
    (platform-independent — hardcodes a Windows-style line). It fails on the old
    split(":", 2) and passes on the fix.
  • Full grep suite passes.

Closes #17

_parse_rg split each line on the first two colons, but ripgrep is invoked
with an absolute path — on Windows that starts with a drive letter (C:\...)
whose colon was mistaken for the path:line:text separator, so every match
reported file "C", line 0, with the line number leaked into the text.

Anchor the parse on the numeric :<line>: field with a regex so the
drive-letter colon and any colons in the matched text are preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rohitprasad15

Copy link
Copy Markdown
Collaborator

Thanks — you were the first to catch the Windows drive-letter parsing bug, and your fix was correct for the main case. We merged #123, which fixes the emission side instead (--with-filename --null), which also covers colons in filenames and the single-file case where rg omits the filename. Windows grep is now fixed on main, so I'm closing this one. Appreciate the report and fix!

@ysh145

ysh145 commented Nov 14, 2026

Copy link
Copy Markdown

M4-4 报告与 0.1.x 发版已完成。

  • 报告 enterprise-server/docs/ENTERPRISE_MVP_ACCEPTANCE_REPORT.md(179 行):8 条验收逐条 PASS、验收环境表、自动化证据、发版与打包、已知限制、v1.1 issue Fix two approval-safety bugs: shell allowlist bypass and reply-intent substring match #21–Add TrustedRouter model provider #25、复现步骤。commit 818c010 / 64009a9。
  • 客户端版本 0.2.2 -> 0.2.3(tauri.conf.json 与 package.json 同步,commit 93461ea,已 push feat/enterprise-m1)。
  • macOS 应用包构建成功(arm64,ad-hoc),sidecar 自检 PASS:selftest ok: cryptography 50.0.2, ed25519 sign/verify ok。DMG 封装(hdiutil)在执行沙箱内被拒绝,需普通终端补做,已在报告写明。
  • 多架构 CI:tag v0.1.1 触发 image.yml(run 43565096605)成功,产出 ghcr.io/ysh145/dp-enterprise/server:0.1.1,manifest list sha256:7f33112a...,含 linux/amd64 与 linux/arm64。
  • 个人版零回归:GUI 27 files/195 tests、i18n OK;客户端 pytest 1309 passed / 1 skipped / 4 failed(全部为沙箱 PermissionError 写 ~/DeepParserAgent,无断言失败)。回归中发现的 2 个真实缺陷(provider router _extra、errors.ts 企业错误码未同步)已修复并复跑通过(commit 8a0470d)。

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.

grep tool returns corrupted results on Windows — ripgrep output parser splits on the drive-letter colon

3 participants