Skip to content

Engine: dead code — cancelModuleResultAwaiters=true path and ModuleCompletionSourceCanceller are unreachable #3795

Description

@thomhurst

IModuleScheduler.CancelPendingModules(bool cancelModuleResultAwaiters = true) defaults to true, but every production call site (three in ModuleExecutor, one in DistributedModuleExecutor) passes false — cancelled modules now get their typed completion sources completed with PipelineTerminated results via RegisterTerminatedResultsForCancelledModules instead of being cancelled. That leaves the entire true-branch machinery dead: ModuleCompletionSourceCanceller (a reflection/expression-compiling cache whose only caller is the unreachable branch at ModuleStateTracker.cs:293) and the public IGeneratedModuleRuntime.CancelCompletionSource member it dispatches to (GeneratedModuleMetadata.cs:211).

This is leftover scaffolding from the pre-fix cancellation strategy and a trap: any future caller using the default true would cancel typed awaiters that the result registrar expects to complete with results.

Fix: remove the parameter, the canceller class, and the generated-runtime hook (coordinate with the source generator since IGeneratedModuleRuntime is public).

Evidence: src/ModularPipelines/Engine/IModuleScheduler.cs:60, src/ModularPipelines/Engine/ModuleStateTracker.cs:288-295, src/ModularPipelines/Engine/ModuleCompletionSourceCanceller.cs:1-58, src/ModularPipelines/Engine/GeneratedModuleMetadata.cs:211, src/ModularPipelines/Engine/ModuleExecutor.cs:161,202,249, src/ModularPipelines/Distributed/Master/DistributedModuleExecutor.cs:185


Raised by the v4 scoping audit round 3 — umbrella #3239.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low: hygiene and nice-to-haves - wheneverenhancementNew feature or requestin-progressPicked up by an agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions