nx affected should recompute affected set when dependentTasksOutputFiles change during execution #34828
Hoffs
started this conversation in
Feature Requests
Replies: 1 comment
-
|
Thanks for the detailed proposal! We use GitHub Discussions for feature requests so they can be upvoted and discussed by the community. This has been moved to a discussion where it can be tracked and voted on. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Current Behavior
When using
dependentTasksOutputFilesas task inputs,nx affectedcomputes the affected project set upfront based on the current state of output files on disk. Tasks that depend on outputs produced by other tasks in the same run are not included in the affected set, even though their input hashes will differ once upstream tasks complete.This means that for a dependency chain like:
You need N+1 invocations of
nx affectedto fully converge:bootstrap.ziptfoutputs.sha1Expected Behavior
nx affectedshould be able to recompute the affected set after tasks complete and their outputs change, within a single invocation. Since task hashes are already computed lazily (right before execution, per #22623), the remaining gap is that the affected set itself is not re-evaluated whendependentTasksOutputFileson disk change during the run.Example Configuration
Workarounds
Add
^productionto inputs — propagates affectedness via source files, making everything affected in a single pass. But this is imprecise: downstream tasks re-run even when upstream outputs are identical (e.g., a comment change in Go source triggers TF apply).Loop
nx affectedin a shell script until no tasks remain — works but is fragile and slow (repeated graph computation, cache lookups, etc.).Suggested Solution
When
nx affectedruns tasks that produce outputs listed in other tasks'dependentTasksOutputFiles, re-evaluate the affected set for remaining (not-yet-executed) tasks. This could be:outputscompletes, check if pending tasks'dependentTasksOutputFilesinputs have changed and add them to the affected set.nx affected -t apply --recompute-affectedto enable this behavior.This would make
dependentTasksOutputFilesa complete replacement for^productionin dependency chains, without sacrificing cache precision.Beta Was this translation helpful? Give feedback.
All reactions