Skip to content

Filter changed targets and edges by distance#88

Merged
justinwon777 merged 4 commits into
mainfrom
filter-changed-targets-and-edges-by-distance
May 27, 2026
Merged

Filter changed targets and edges by distance#88
justinwon777 merged 4 commits into
mainfrom
filter-changed-targets-and-edges-by-distance

Conversation

@justinwon777
Copy link
Copy Markdown
Contributor

@justinwon777 justinwon777 commented May 27, 2026

Why?

GetChangedTargetsAndEdges response doesn't filter with distance, which differs from GetChangedTargets. It should filter by distance to match behaviors.

What?

Adds func sendWithDistanceFilterForEdges
Factors out common logic to distance_filter.go

Test Plan

distance 2 returns 30 targets

bazel run //example/client -- --method=get-changed-targets-and-edges --remote=git@github.com:uber/tango.git --base-sha=5c829dfc654eef0efcf28b963ebe11be29c4fab7 --new-base-sha=d29f664af7e88ac441b8ae70710652b4e25b94ee --compute-distances=true --max-distance=2

distance 1 returns 27 targets. Verified in the response that distance 2 targets are removed.

bazel run //example/client -- --method=get-changed-targets-and-edges --remote=git@github.com:uber/tango.git --base-sha=5c829dfc654eef0efcf28b963ebe11be29c4fab7 --new-base-sha=d29f664af7e88ac441b8ae70710652b4e25b94ee --compute-distances=true --max-distance=1

Issue

justinwon777 and others added 3 commits May 26, 2026 12:03
GetChangedTargets filters changed_targets by output_config.max_distance
when compute_distances is set, but GetChangedTargetsAndEdges did not,
leaking distance=-1 targets and any target beyond the requested BFS
bound. Extract the filter into shared helpers in distance_filter.go
and apply it on both the cache-hit and compute paths of the edges
endpoint. Added/removed targets and edges pass through unchanged —
they represent graph topology deltas rather than BFS-ranked targets.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@justinwon777 justinwon777 requested review from a team as code owners May 27, 2026 00:03
@justinwon777 justinwon777 merged commit 6d98294 into main May 27, 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.

2 participants