refactor(conflict): take a batch of changes as analyzer input#202
Open
behinddwalls wants to merge 1 commit into
Open
refactor(conflict): take a batch of changes as analyzer input#202behinddwalls wants to merge 1 commit into
behinddwalls wants to merge 1 commit into
Conversation
b0be135 to
903c210
Compare
4ff3f88 to
3e09ea0
Compare
903c210 to
c98548e
Compare
3e09ea0 to
75b838e
Compare
c98548e to
742c208
Compare
75b838e to
eb71dbe
Compare
742c208 to
859382e
Compare
3deb3ff to
f377508
Compare
859382e to
3555f6a
Compare
This was referenced Jun 5, 2026
behinddwalls
added a commit
that referenced
this pull request
Jun 5, 2026
## Summary ### Why? The scorer took entity.Change (just URIs), so it could not score on real change size — the example heuristic counted URIs as a placeholder. With typed change details now persisted on change records, the scorer can score a batch on its actual lines/files changed. ### What? - Add entity.BatchChanges — the normalized, batch-level view of all changes in a batch (BatchID, Queue, []ChangeInfo) with aggregation helpers. - Scorer.Score now takes entity.BatchChanges; the heuristic ValueFunc and the composite scorer operate over it. - The score controller resolves each request's change records, flattens their details into BatchChanges, and scores the batch once — replacing the per-request multiplicative product over len(URIs). - Example wiring buckets by total lines changed. Consumes the typed details persisted by the change-details change. ## Test Plan - ✅ `make build`, `make test`, `make lint`, `make check-mocks/gazelle/tidy` - ✅ `make integration-test`, `make e2e-test` (start -> validate enrich -> score normalizes the batch and scores on real change size) ## Issues ## Stack 1. #195 1. @ #196 1. #197 1. #193 1. #202
## Summary ### Why? The conflict analyzer received entity.Batch values (request IDs only), so a real analyzer — eventually backed by uber/tango ChangedTargetsAndEdges — could not see the actual changes without storage lookups, which extensions must not do. The scorer already solved this by moving to entity.BatchChanges; mirror it here. ### What? - conflict.Analyzer.Analyze input changes from entity.Batch to entity.BatchChanges for both candidate and in-flight; the output ([]Conflict) is unchanged. No new entity types — a Tango-backed analyzer derives targets from the change URIs/files itself, with the target branch injected per queue at construction. - New submitqueue/core/batchchanges.Collect: shared assembler that resolves a batch's request IDs -> change records -> entity.BatchChanges. The score and batch controllers both use it (extracted from the score controller). - batch controller assembles candidate + in-flight BatchChanges before Analyze. - all/none updated to the new input; conflict/fake switched to the sq-fake=conflict-error URI marker (drops FailOn/FailAlways); mock regenerated. - example: conflictfake.New(all/none) without a predicate; removed the dedicated e2e-conflict-error-queue (the marker now reaches the analyzer on any queue). ## Test Plan - ✅ make test (45/45 unit), make e2e-test (1/1), make integration-test (7/7) - ✅ bazel build //...; check-gazelle / check-tidy / check-mocks clean once committed
3555f6a to
c1fccc7
Compare
f377508 to
fb39a16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why?
The conflict analyzer received entity.Batch values (request IDs only), so a real
analyzer — eventually backed by uber/tango ChangedTargetsAndEdges — could not see
the actual changes without storage lookups, which extensions must not do. The
scorer already solved this by moving to entity.BatchChanges; mirror it here.
What?
for both candidate and in-flight; the output ([]Conflict) is unchanged. No new
entity types — a Tango-backed analyzer derives targets from the change URIs/files
itself, with the target branch injected per queue at construction.
batch's request IDs -> change records -> entity.BatchChanges. The score and batch
controllers both use it (extracted from the score controller).
sq-fake=conflict-error URI marker (drops FailOn/FailAlways); mock regenerated.
e2e-conflict-error-queue (the marker now reaches the analyzer on any queue).
Test Plan
Issues
Stack