-
Notifications
You must be signed in to change notification settings - Fork 415
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
fix: redirect deprecated libraries resolution to the public lib DB #10354
fix: redirect deprecated libraries resolution to the public lib DB #10354
Conversation
@@ -23,12 +23,12 @@ different folders. | |||
Without any consumers of the libraries | |||
|
|||
$ dune build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error becomes better: we now use the loc
for the (public_name ..)
field, which is the actual conflict.
7947efa
to
dc6ced7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid I don't fully understand what the change in redirection to parent is fixing (besides the better locations in errors mentioned). But otherwise lgtm.
src/dune_rules/scope.ml
Outdated
@@ -85,13 +85,13 @@ module DB = struct | |||
else Lib.DB.Resolve_result.not_found | |||
| Found lib -> Memo.return (Lib.DB.Resolve_result.found lib) | |||
| Deprecated_library_name lib -> | |||
Memo.return (Lib.DB.Resolve_result.redirect_in_the_same_db lib) | |||
Memo.return (Lib.DB.Resolve_result.redirect parent lib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change unlocks new possibilities? I can see that the behavior exercised in features.t
test suite isn't modified. Maybe there's some case with some deprecation of a library into a lib only available in the public lib db that would be affected by this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this change is just saving us 1 redirect, because the new public name will exist in the public libs DB. We'd redirect anyway at resolution time (following 2 redirects, now just 1)
I think this might be true. We may have to specify whether we're redirecting to a name or a library ID. |
Just to make sure we're on the same page, I think we need two constructors:
|
@rgrinberg I need to dig deeper into the redirect business, but we may have that already? EDIT: 🤦 except I changed that in this PR. I see what you mean. |
dc6ced7
to
3b1fea4
Compare
OK I added a new I also added |
@@ -18,7 +23,7 @@ module Local = struct | |||
| x -> x | |||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this from before, but this seems wrong. How is the comparison function ignoring the other elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought was that, since this refers to Local
library IDs, the loc
would be more than enough to distinguish different lib_ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only field we're not comparing is enabled_if
. We could, but I couldn't come up with a compare
function for Blang.t
-- there's only Blang.equal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought was that, since this refers to Local library IDs, the loc would be more than enough to distinguish different lib_ids.
In that case, I would drop the enabled_if
from the id as well.
src/dune_rules/lib_id.ml
Outdated
@@ -1,9 +1,14 @@ | |||
open Import | |||
|
|||
type visibility = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split this change into a separate PR? I think adding not strictly necessary fields to Lib_id isn't something we should do lightly.
src/dune_rules/scope.ml
Outdated
@@ -85,13 +85,13 @@ module DB = struct | |||
else Lib.DB.Resolve_result.not_found | |||
| Found lib -> Memo.return (Lib.DB.Resolve_result.found lib) | |||
| Deprecated_library_name lib -> | |||
Memo.return (Lib.DB.Resolve_result.redirect_in_the_same_db lib) | |||
Memo.return (Lib.DB.Resolve_result.redirect parent lib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is parent
always the public library database here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I'll move these functions more closely together and make that explicit in a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it adds a bit of whitespace diff noise, but I did the above in 3e73083
ec08819
to
6395ddd
Compare
src/dune_rules/scope.ml
Outdated
let create_db_from_stanzas = | ||
(* Here, [parent] is always the public_libs DB. Check the call to | ||
[create_db_from_stanzas] below. *) | ||
let resolve_found_or_redirect ~parent fr = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just rename ~parent
to ~public_db
then?
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
they're used Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
613e494
to
6303565
Compare
addresses this comment