You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Selective Execution Invalidates resolvePublishDependency Task When Adding Modules To A Build #6871
When adding a new module to an existing Mill build that is independent of any other build modules, Mill invalidates the resolvePublishDependency Task. This can lead to many more tasks getting selectively resolved/run than you would like.
The below Bash script illustrates the issue and can be executed for reproduction:
From my perspective as a user, this is unexpected. As someone who is in the process of setting up Mill for a large monorepo, this is also quite problematic because it means that when I onboard another application module to the build, my selective CI workflows would publish all existing apps/libs, which is exactly what I would like to prevent by using selective execution.
@lihaoyi any assessment here? Is this expected? Am I doing something obviously wrong? For my monorepo use case described above this is quite the obstacle unfortunately.
@maxstreese I think it's an expected limitation. Selective execution in the presence of code changes is generally best-effort and conservative, so although we do our best to try and make it as precise as possible, we can't guarantee there won't be false positives causing things to run more than they need to be. The assumption is that it is used for CI workflows where some amount of over-testing is benign.
I can try to improve this particular scenario, but there will be definitely be other scenario causing unnecessary test selection in future, and we will never be able to fix all of them
This particular issue seems to be caused by our conservative treatment of virtual method calls, where we treat the as possibly dispatching to any known subclass. To be more precise would be an open research question of how we can improve the precision of our callgraph modelling without dramatically increasing the cost of computing the callgraph, so I wouldn't hold my breath on a fix
Ah ok, thanks for the detailed response! Curious to see if the fix you are attempting right now yield a result. In any case, feel free to close this issue then.
Activity
maxstreese commentedon Feb 24, 2026
@lihaoyi any assessment here? Is this expected? Am I doing something obviously wrong? For my monorepo use case described above this is quite the obstacle unfortunately.
lihaoyi commentedon Feb 24, 2026
@maxstreese I think it's an expected limitation. Selective execution in the presence of code changes is generally best-effort and conservative, so although we do our best to try and make it as precise as possible, we can't guarantee there won't be false positives causing things to run more than they need to be. The assumption is that it is used for CI workflows where some amount of over-testing is benign.
I can try to improve this particular scenario, but there will be definitely be other scenario causing unnecessary test selection in future, and we will never be able to fix all of them
lihaoyi commentedon Feb 24, 2026
This particular issue seems to be caused by our conservative treatment of virtual method calls, where we treat the as possibly dispatching to any known subclass. To be more precise would be an open research question of how we can improve the precision of our callgraph modelling without dramatically increasing the cost of computing the callgraph, so I wouldn't hold my breath on a fix
maxstreese commentedon Feb 24, 2026
Ah ok, thanks for the detailed response! Curious to see if the fix you are attempting right now yield a result. In any case, feel free to close this issue then.
Try to improve precision of codesig callgraph analysis (#6880)