Repository navigation
fix(inspection): deduplicate feature tasks by SelectionPriority in SetInspectionType - #884
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces task deduplication by priority in the inspection runner and optimizes task resolution in the graph resolver by pre-sorting available tasks and using binary search. The reviewer feedback highlights that the deduplication logic contains non-determinism due to map iteration and suggests a deterministic O(N) alternative. Additionally, the reviewer advises against the binary search optimization in the graph resolver, as it is a premature optimization that breaks the resolver's ability to handle multiple task implementations and select the highest priority one, which also led to the unauthorized removal of existing test cases in violation of the repository style guide.
…tInspectionType Previously, when multiple compatible tasks shared the same TaskRef (e.g. generic vs. platform-specialized implementations), all implementations were exposed in FeatureList() and availableTasks during inspection setup. However, the task graph resolver would ultimately only select the single highest-priority implementation via SelectionPriority, making the presence of duplicate implementations in feature selection misleading and ineffective. This fix: - Deduplicates compatible tasks in SetInspectionType by selecting the implementation with the highest SelectionPriority per TaskRef. - Simplifies GraphResolver to find tasks via binary search over pre-sorted availableTasks, since deduplication is now guaranteed upfront. - Adds unit tests to verify feature list deduplication and GraphResolver dependency resolution.
kyasbal
force-pushed
the
push-szvukwllvzpl
branch
from
August 13, 2026 10:12
7c21301 to
a4059cf
Compare
kyasbal
marked this pull request as ready for review
August 13, 2026 13:50
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
August 13, 2026 13:50
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.
Problem
When multiple compatible task implementations share the same
TaskRef(e.g. a generic parser task vs. a platform-specialized parser task), the final task graph only ever selects a single implementation based onSelectionPriority.However, during inspection creation (
SetInspectionType), all compatible implementations were registered intoavailableTasksand exposed inFeatureList(). This caused tasks that would never actually be included in the final task graph to appear in the feature selection UI, making feature toggling for those tasks confusing and ineffective.Solution
SetInspectionType(pkg/core/inspection/runner.go) by selecting only the implementation with the highestcoretask.LabelKeyTaskSelectionPriorityperTaskRef(tie-breaking deterministically by implementation ID string).availableTasksis now guaranteed to have uniqueTaskRefs upfront, removed the redundant runtime priority sorting inGraphResolver(pkg/core/task/graphresolver.go) and optimized task lookup viaslices.BinarySearchFuncover pre-sorted tasks.Key Changes
pkg/core/inspection/runner.go: AddeddeduplicateTasksByPriorityand invoked it inSetInspectionTypeimmediately after compatibility filtering.pkg/core/task/graphresolver.go: Pre-sortedavailableTasksinGraphResolver.Resolveand replacedfindHighestPriorityUntypedTaskForTaskReferencewith binary search infindUntypedTaskForTaskReference.pkg/core/inspection/runner_test.go: AddedTestDeduplicateTasksByPriorityandTestSetInspectionType_SelectionPriorityto verify feature list and task deduplication behavior.pkg/core/task/graphresolver_test.go: Updated unit tests to match binary search lookup.Verification
make build-gopassed.make test-gopassed.make lint-gopassed.make pre-commitpassed.