Skip to content

fix: count every hunk of a WHOLE_FILE assignment in LOC estimates - #109

Closed
vitali87 wants to merge 1 commit into
fix/move-assignment-recompute-locfrom
fix/recompute-loc-whole-file
Closed

fix: count every hunk of a WHOLE_FILE assignment in LOC estimates#109
vitali87 wants to merge 1 commit into
fix/move-assignment-recompute-locfrom
fix/recompute-loc-whole-file

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Summary

recompute_estimated_loc summed only assignment.hunk_indices, while validate_coverage and the reconstructor treat a WHOLE_FILE assignment as covering every hunk of the file whatever its list says. The LLM path can emit WHOLE_FILE with an empty or partial list, so such a plan passed coverage but got a too-small estimated_loc and then failed validate_loc with LOC_MISMATCH.

recompute_estimated_loc now counts range(hunk_count) for every WHOLE_FILE assignment (the list itself is left untouched); PARTIAL_HUNKS is unchanged.

Stacked on #108 (fix/move-assignment-recompute-loc).

Test plan

  • test_chunker.py: WHOLE_FILE with [] and [0] on a two-hunk file now estimate 2 lines (both fail on the base with 0 / 1), full list matches an equivalent PARTIAL_HUNKS group, unknown path stays 0
  • 450 tests pass, ruff clean
  • Local review: 5/5

Follow-up noted by the review (not in this PR): assign_uncovered_hunks and validate_no_conflicts still read only hunk_indices.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 69e24778-488c-446e-a0a3-8a4c328a9f7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vitali87

Copy link
Copy Markdown
Owner Author

Closing as a duplicate: this was re-found by a bug hunt run against main, but #60 (recompute after move) and #58 (WHOLE_FILE expansion via covered_indices) already fix it. The non-duplicate follow-ups (#114, #129) have been restacked onto #60.

@vitali87 vitali87 closed this Aug 30, 2026
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.

1 participant