Repository navigation
fix(task): prevent disabled feature pipelines from leaking into the active graph - #1014
Merged
Merged
Conversation
…ctive graph ResolveGraph only marks downstream feature sink tasks as disabled, but tryResolveActiveFeatureSubgraph walks upstream, so it never encounters the disabled marker. Propagate disabled reference IDs upstream through mandatory point-to-point dependencies right after the mandatory closure phase, and add a task graph conformance check asserting that enabling one feature never pulls in tasks exclusively owned by a disabled feature.
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
September 16, 2026 09:23
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new phase to the task graph resolution algorithm, 'Disabled Feature Closure Expansion', which identifies and disables upstream tasks that exclusively serve disabled features. It includes corresponding unit tests in graphresolver_test.go and conformance tests in task_graph_conformance.go to verify disabled feature isolation. There are no review comments, so I have no feedback to provide.
Merged
via the queue into
GoogleCloudPlatform:main
with commit Sep 16, 2026
bd83494
17 checks passed
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
ResolveGraphpulled query pipelines of disabled features into the active graph, so KHI ran Cloud Logging queries for features the user had unchecked.Fixes #1013
Root cause
disabledTasksonly contains the feature flag tasks themselves. Those are sinks at the downstream end of the DAG, whiletryResolveActiveFeatureSubgraphwalks upstream from a candidate. The marker and the traversal point in opposite directions, so the resolver never learns that an upstream producer belongs to a disabled feature.Concretely, when Kubernetes container logs are unchecked,
k8scontainer/queryis still reached through the autocomplete/form chain that fans in viaScopeActiveFeatures, because every branch of that chain merges intoAutocompleteMetricsK8sContainerTask, which is already in the graph throughAutocompleteClusterIdentityTask.Fix
Add a new Phase 2 to
ResolveGraph,expandDisabledClosure, that runs right after the mandatory closure. It walks upstream from the disabled sinks over mandatory point-to-point dependencies and adds every task it reaches todisabledRefIDSet.The safety argument is that once
resolveMandatoryClosurereturns,graphTaskMapholds the complete mandatory closure of every enabled feature plus every system required task. Therefore a task reachable from a disabled sink and absent fromgraphTaskMapserves disabled features only. Traversal stops as soon as it reaches a task insidegraphTaskMap, so shared upstreams and required tasks are never disabled.The real blast radius is wider than the issue describes
A regression test over the real registered DAG, run against the pre-fix code, showed the leak was not limited to container logs:
Notably
k8s-node/queryleaked when serialport was enabled, contradicting the issue's claim that the k8snode branch is safely rejected by the!hasMandatoryDepsguard. Whether that guard rejected a branch depended on candidate evaluation order, so the protection was accidental.Tests
TestResolveGraph_DisabledFeatureClosureingraphresolver_test.go: four table-driven cases covering the multi-hop leak, no over-disabling of shared upstreams, protection of required tasks, and an upstream shared by two disabled features.DisabledFeatureIsolationin the task graph conformance harness: enables exactly one feature at a time over the real DAG and asserts that no other feature's exclusive tasks appear in the resolved graph.The conformance check derives "feature-exclusive" purely from declared dependencies:
Defining it by differencing
ResolveGraphoutputs does not work, because the bug contaminates every baseline the resolver produces and the leak cancels out in the subtraction.Behavior changes to be aware of
DryRunsharesResolveTaskGraph, so form metadata follows the resolved graph. Form fields belonging to a disabled feature, such asNamespaces(Container logs)andPod names(Container logs), now correctly disappear when the feature is unchecked. This is a visible UI change.ScopeActiveFeatureseither. This is intended, since running it means running work the user turned off. No production code currently uses point-to-pointScopeActiveFeatures, only the tag fan-in inNewInventoryTask.