fix: keep data-shape grep paths color-stable#860
Conversation
|
✅ Health: 7.5 (unchanged) 📋 At a glance Files & modules (2)
🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (1 with dependents)"]
f_packages_server_src_repowise_server_mcp_server_tool_answer_data_shape_py[".../tool_answer/data_shape.py 🔥"]:::changed
end
f_packages_server_src_repowise_server_mcp_server_tool_answer_answer_py[".../tool_answer/answer.py"]
f_packages_server_src_repowise_server_mcp_server_tool_answer_data_shape_py --> f_packages_server_src_repowise_server_mcp_server_tool_answer_answer_py
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (1 direct dependent, from the last indexed snapshot). Dashed: history/tests. 🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔎 More signals (1)🔥 Hotspots touched (2)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-20 12:58 UTC |
|
Thanks for this, and good catch on the two ruff errors while you were in here. The Yoda flip and the import sort look like unrelated drive-bys but they're pre-existing violations that came in with #856, so this PR is currently the only thing standing between main and a clean I verified the fix reverts cleanly: with the One ask before I merge. Could you add the comment from #825 alongside the flag? # --no-color: this output is parsed, so a user's
# ``color.ui=always`` git config must not wrap paths in ANSI
# escapes (which would corrupt the path split below).
"--no-color",The reason I'm fussy about it: this flag is load-bearing for the #856 exclusion filter, and when it's missing the failure is silent rather than loud. A comment-free Push that up and I'll merge. Thanks again. |
| "git", | ||
| "--no-pager", | ||
| "grep", | ||
| "--no-color", |
There was a problem hiding this comment.
The fix itself is correct, and I verified by hand that this flag suppresses the escape codes both for color.ui = always and for the narrower color.grep = always, and that it also covers the --no-index fallback on line 198, because both paths run through this same helper.
Could you add a short comment explaining why the flag is here, in the same style as the surrounding code? The comment on lines 152 to 154 explains why --no-pager and the stdin redirect are load-bearing, and the sibling call site in _code_rationale.py explains its own --no-color on lines 390 to 392. Something like the following would match both:
# --no-color: this output is parsed, so a user's
# ``color.ui=always`` git config must not wrap paths in ANSI
# escapes (which would corrupt exclusion filtering and reads).
"--no-color",Without it there is nothing stopping a future clean-up from deleting the flag and silently reintroducing this bug, which is more or less how we ended up with issue #858 in the first place.
|
Your branch is currently eighty-two commits behind Also, a small note for the description: alongside the fix, this pull request adds an |
8cbe465 to
c956e98
Compare
|
@swati510 @RaghavChamadiya thank you |
Summary
--no-colorto the parsedgit grep -lcall used by data-shape mining, with a comment explaining why the flag is load-bearingcolor.ui=alwaysimport subprocess, movebuild_exclude_specabove therepowise.serverimport to satisfy isort, and rewrite one existing assertion into the conventional left-hand actual formWhy
_grep_identifier_filesparsesgit grep -loutput as repo-relative paths. When a user hascolor.ui=always, Git can wrap those paths in ANSI escape codes, which prevents exclusion checks and file reads from matching the real paths.Fixes #858.
Validation
.venv/bin/python -m pytest tests/unit/server/mcp/test_answer_data_shape.py.venv/bin/python -m ruff check packages/server/src/repowise/server/mcp_server/tool_answer/data_shape.py tests/unit/server/mcp/test_answer_data_shape.pygit diff --check