Skip to content

refactor(task): remove unreachable disabled task check in tryResolveActiveFeatureSubgraph - #1016

Merged
kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-tlowkumplonv
Sep 16, 2026
Merged

kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-tlowkumplonv

Conversation

@kyasbal

@kyasbal kyasbal commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Removes an unreachable guard at the top of the tryResolveActiveFeatureSubgraph BFS loop. This is a pure cleanup with no behavior change.

// Fails if the current task is disabled.
if _, isDisabled := disabledRefIDSet[curr.UntypedID().ReferenceIDString()]; isDisabled {
    return nil, false
}

Why it can never fire

Only two kinds of tasks ever enter queue, and both pass a disabled check before they get there.

  1. The initial candidate. Both callers, expandActiveFeaturePointToPointDependencies and findAndConditionallyExpandActiveFeatureTasks, skip a disabled task before they call this function. These are the only two call sites, and no test calls the function directly.
  2. Every nextTask appended inside the loop. The check on disabledRefIDSet[depRefID] runs before the append and returns nil, false right away when the dependency is disabled, so a disabled task is never enqueued.

So the invariant "queue never holds a disabled task" holds, and the removed guard always evaluated to false. It also returned exactly the same nil, false as the pre-enqueue check, so removing it cannot change any result.

The remaining check now carries a comment that records this invariant, so the loop-head guard does not get added back.

Note on scope

This redundancy predates #1014. Adding the upstream propagation there does not make the guard reachable, because the newly disabled tasks are still caught by the pre-enqueue check. It was left untouched in #1014 to keep that diff focused on the bug fix.

Verification

make build-go, make lint-go (0 issues) and make test-go all pass. No test changes are included, since dead code removal is not observable from the outside.

…ctiveFeatureSubgraph

The loop-head check on disabledRefIDSet can never fire. Both callers skip disabled
candidates before calling this function, and the pre-enqueue check on each dependency
returns early with the same result, so the queue never holds a disabled task.
@kyasbal kyasbal added area:backend-core Core backend frameworks, DAG task runner, and server API type:refactor Code refactoring without behavioral change labels Sep 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors pkg/core/task/graphresolver.go by removing a redundant check for disabled tasks within the queue traversal loop, as disabled tasks are already prevented from being enqueued. A detailed comment has been added to clarify this logic. There are no review comments, and the changes look clean and correct.

@kyasbal
kyasbal enabled auto-merge September 16, 2026 10:10
@kyasbal
kyasbal added this pull request to the merge queue Sep 16, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 2fd3a2f Sep 16, 2026
17 checks passed
@kyasbal
kyasbal deleted the push-tlowkumplonv branch September 16, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend-core Core backend frameworks, DAG task runner, and server API type:refactor Code refactoring without behavioral change

1 participant