Repository navigation
Fold Whitespace in pr_review.py reply --match - #1974
Conversation
`matching_threads()` compared `--match` against a thread's raw, uncollapsed body, while `describe()` prints that same body collapsed to single spaces before showing it as an `unresolved:` line. A pattern copied verbatim from that printed line could still return `NO_MATCH` whenever it spanned a line break, tab, or run of spaces the raw body still carried, the same shape of failure #1299 and #1878 fixed for a fix push moving the line and for typographic punctuation. `matching_threads()` now folds whitespace to a single space on both sides of the compare, the same collapse `describe()` applies, so a pattern copied from a printed `unresolved:` line matches the thread it was copied from. The 120-character display cutoff `describe()` applies stays as is, now documented on `describe()` as a display limit rather than a matching one. Closes on promotion: #1877 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1974 +/- ##
==========================================
Coverage ? 55.42%
==========================================
Files ? 16
Lines ? 7249
Branches ? 0
==========================================
Hits ? 4018
Misses ? 3231
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, behaviorally consistent with existing output (describe()), and includes a targeted regression test covering the reported failure mode.
Review effort: Lite
Findings: None
What changed in this PR
This PR aligns reply --match selection behavior with what pr_review.py prints for unresolved threads by folding all whitespace runs (including newlines/tabs) to single spaces on both the --match pattern and candidate thread bodies, preventing NO_MATCH when the pattern was copied directly from the printed unresolved: line.
Changes:
- Normalize whitespace in
matching_threads()via a shared fold function (whitespace collapse + typographic fold + case normalization) before substring comparison. - Clarify
describe()'s 120-character truncation as a display-only cutoff, not part of matching behavior. - Add a regression test ensuring a pattern copied from the printed unresolved line matches a body containing newlines and repeated spaces.
| File | Description |
|---|---|
| scripts/pr_review.py | Collapses whitespace during --match selection to match the describe() display form and updates docstring wording about truncation. |
| tests/test_pr_review.py | Adds a regression test that copies a describe()-rendered snippet and verifies reply --match selects the intended thread. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… and Setup Tooling (#2000) ## Summary Promotes develop to main, carrying the 16 pull requests merged to develop since #1943. - **Wait-loop guard (requirement 7):** [#1999](#1999) credits a comparison bound only inside a `[`, `[[`, or `test` invocation, and [#1996](#1996) reconciles the requirement's README count and diagram with its hook. - **Registry:** [#1994](#1994) and [#1976](#1976) record Vantage-Config's line endings and description. - **Scripts and tooling:** - [#1988](#1988) and [#1972](#1972) harden `ruleset_id()`. - [#1974](#1974) and [#1949](#1949) fix `pr_review.py` `reply --match` and `wait`. - [#1969](#1969), [#1964](#1964), [#1954](#1954) and [#1951](#1951) fix host-setup tool shadowing, shims, hook ownership and dpkg ownership checks. - **Gates and audit:** - [#1980](#1980) triages a path collision. - [#1967](#1967) and [#1962](#1962) tighten sha-pin and version-literal checks. - [#1956](#1956) keeps a folded `if:` visible to the interface audit. Closes #1636 Closes #1639 Closes #1948 Closes #1971 Closes #1718 Closes #1934 Closes #1877 Closes #1880 Closes #1865 Closes #1889 Closes #1966 Closes #1906 Closes #1935 Closes #1901 Closes #1905 Closes #1866 Closes #1897 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
matching_threads()compared--matchagainst a thread's raw, uncollapsed body, whiledescribe()prints that same body collapsed to single spaces before showing it as anunresolved:line in aNO_MATCHrefusal. A pattern copied verbatim from that printed line could still returnNO_MATCHwhenever it spanned a line break, tab, or run of spaces the raw body still carried, the same shape of failure #1299 and #1878 already fixed for a moved line and for typographic punctuation.matching_threads()now folds whitespace to a single space on both sides of the compare, the same collapsedescribe()applies, so a pattern copied from a printedunresolved:line matches the thread it was copied from.describe()applies is left as is, per the issue's own suggestion, and is now documented ondescribe()as a display limit rather than a matching concern.Closes on promotion: #1877
Test plan
python3 -m unittest tests.test_pr_review— 442 tests passuvx ruff format --check scripts/pr_review.py tests/test_pr_review.py/uvx ruff check scripts/pr_review.py tests/test_pr_review.pyuvx mypy(full configured file set) — no issuesdevelop— no findings🤖 Generated with Claude Code