Skip to content

Fix NEW targets getting distance -1 when max_distance is set#99

Merged
xytan0056 merged 1 commit into
mainfrom
fix-new-target-distance-with-max-dist
Jun 3, 2026
Merged

Fix NEW targets getting distance -1 when max_distance is set#99
xytan0056 merged 1 commit into
mainfrom
fix-new-target-distance-with-max-dist

Conversation

@xytan0056
Copy link
Copy Markdown
Contributor

@xytan0056 xytan0056 commented Jun 3, 2026

computeDistances() was resetting all non-DIRECT targets to -1, overwriting the distance 0 that getDefaultDistance correctly assigned to NEW targets. The BFS only seeded DIRECT targets, so NEW targets stayed at -1 and were dropped by filterChangedTargetsByDistance.

Treat CHANGE_TYPE_NEW the same as CHANGE_TYPE_DIRECT in the BFS initialization: seed them at distance 0 so they survive distance filtering and propagate through reverse deps.

Test Plan

unit test

Issue

computeDistances() was resetting all non-DIRECT targets to -1,
overwriting the distance 0 that getDefaultDistance correctly assigned
to NEW targets. The BFS only seeded DIRECT targets, so NEW targets
stayed at -1 and were dropped by filterChangedTargetsByDistance.

Treat CHANGE_TYPE_NEW the same as CHANGE_TYPE_DIRECT in the BFS
initialization: seed them at distance 0 so they survive distance
filtering and propagate through reverse deps.
@xytan0056 xytan0056 requested review from a team as code owners June 3, 2026 19:33
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@xytan0056 xytan0056 merged commit 784210c into main Jun 3, 2026
6 checks passed
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.

3 participants