-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove incorrect validation step for dir targets #10331
Remove incorrect validation step for dir targets #10331
Conversation
The validation in question was comparing directory targets discovered in the project from directories that are the target of enabled rules (rules which lack an `enabled_if` field, or whose `enabled_if` condition is false). This was incorrect as it doesn't account for directory targets which are the target of disabled rules so the validation fails if any rule with a directory target is disabled. The validation step was introduced in 1fd19d7 but there aren't any clues to why it was necessary. Fixes ocaml#10310 Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
@jeremiedimino tagging you since you wrote the original version of this validation step. Please let me know if I've misunderstood something. |
Hi Stephen,
This was a consistency check to ensure that an informed guess Dune made
prior to reaching this point was correct. If you simply remove the check,
it might lead to some soundness issues. If this code triggered an error,
it’s likely that the code that makes the informed guess needs updating.
It’s also possible that things have changed in the last two years and this
check is no longer necessary. That I wouldn’t know as I stopped working on
Dune a bit more than two years ago.
I hope that helps clarify things. If that would be useful, I can go more in
details of why we changed Dune to make this informed guess. I’m just a bit
busy today, so I would have to do that another time.
…On Fri, 29 Mar 2024 at 08:47, Stephen Sherratt ***@***.***> wrote:
@jeremiedimino <https://github.com/jeremiedimino> tagging you since you
wrote the original version of this validation step. Please let me know if
I've misunderstood something.
—
Reply to this email directly, view it on GitHub
<#10331 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5J564IPNXRNAJWME7JNETDY2UTCBAVCNFSM6AAAAABFOEDOR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRWHA4TGMBTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi Jeremie! 👋🏻 I agree, this check is here for a reason. Before removing it we would need a solid case. @rgrinberg will have the most up to date idea of the state of this. |
I suspect the correct fix is to check in function |
The validation step is indeed correct. Jerome has the right idea. |
Thanks for the explanation @jeremiedimino! I will dig deeper. |
@gridbugs | Rule { targets = Static { targets = l; _ }; enabled_if; loc = rule_loc; _ } ->
let* available = (Expander.eval_blang expander enabled_if) in
if not available then Memo.return acc else
[...] where let* sctx = sctx in
let* expander =
let+ expander = Super_context.expander sctx ~dir in
Dir_contents.add_sources_to_expander sctx expander
in
[...] replicating what is done in |
The validation in question was comparing directory targets discovered in the project from directories that are the target of enabled rules (rules which lack an
enabled_if
field, or whoseenabled_if
condition is false). This was incorrect as it doesn't account for directory targets which are the target of disabled rules so the validation fails if any rule with a directory target is disabled. The validation step was introduced in 1fd19d7 but there aren't any clues to why it was necessary.Fixes #10310