Repository navigation
fix: parse omitted hunk counts in find_line_number_of_relevant_line_in_file - #2699
Conversation
Code Review by Qodo
1.
|
…umber_of_relevant_line_in_file
…): covering omitted hunk counts
6ed79d5 to
3632876
Compare
|
Code review by qodo was updated up to the latest commit 3632876 |
…): using double quotes and imperative phrasing
|
Code review by qodo was updated up to the latest commit 08ee1e4 |
Closes #2698.
Description
Suggestions on files containing a single-line hunk silently lose their deep-link into the diff.
Root cause
find_line_number_of_relevant_line_in_fileparsed hunk headers withmap(int, match.groups()[:4])atpr_agent/algo/utils.py:1151,:1173and:1188, with noNonehandling. When a unified-diff count is omitted the group isNoneandint(None)raises.This is a separate defect from the one in
extract_hunk_headers: different function, and a hard exception rather than silently wrong numbers.The fix
Reuse the shared
extract_hunk_headershelper at all three sites, removing the duplicated parsing.Behaviour change
@@ -1 +1 @@→TypeError; suggestion link →''@@ -1 +1 @@→ parsed; link →https://github.com/acme/app/pull/7/files#diff-…R1The same helper is reached from
create_inline_comment/publish_inline_commentin the GitHub, Bitbucket, Bitbucket Server and Gitea providers, which have notry/except— this removes a latent crash there too.Files changed
Testing
pytest tests/unittest— 1748 passed, 1 skipped, 1 xfailed (unchanged frommain).github/workflows/build-and-test.yamlruns it:python:3.12.13-slimmain, no longer reproducible on this branchruff— no new findings vsmain;isort— cleanRisk / compatibility
Behaviour for headers with explicit counts is unchanged.
Checklist