Skip to content
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 repl discarding --build-depends after allow-newer/older #8732

Merged
merged 5 commits into from
Feb 11, 2023

Conversation

wismill
Copy link
Collaborator

@wismill wismill commented Feb 3, 2023

Fix REPL discarding --build-depends when using allow-newer or allow-older.

Fixes #6859
Fixes #7081
Related issues: #8504, #5900.


Please also shortly describe how you tested your change. Bonus points for added tests!

@wismill
Copy link
Collaborator Author

wismill commented Feb 3, 2023

Note: this is currently hacky. It fixes my use case (namely run doctest), but I am not sure it fixes it in general.

The following points need review:

  • The combination of dependencies lists in mkCondNode: currently done naively.
  • The hack on condTreeConstraints field: we have a function g :: BuildInfo → f BuildInfo but we need to update [Dependency].

@wismill
Copy link
Collaborator Author

wismill commented Feb 3, 2023

New version, which hopefully is correct and much simplier.

@wismill wismill changed the title Fix HasBuildInfos instance of GenericPackageDescription Fix repl discarding --build-depends Feb 4, 2023
@wismill wismill requested a review from ulysses4ever February 4, 2023 06:31
@wismill wismill marked this pull request as ready for review February 4, 2023 06:31
@wismill wismill requested a review from grayjay February 5, 2023 08:03
@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Feb 5, 2023

I hope to attend to this PR ASAP. I really hope we can squeeze it into 3.10 @Mikolaj

Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Two requests (apart from minor inline comments):

  1. A changelog file
  2. A better commit sequence. Please, force-push your branch so that it doesn't have the previous attempt, and has the cleanup work in a separate commit: this will make reviewers' live resort

@Mikolaj
Copy link
Member

Mikolaj commented Feb 6, 2023

I hope to attend to this PR ASAP. I really hope we can squeeze it into 3.10 @Mikolaj

Yes, we are only in semi-freeze, so if there are good reasons, we should merge it into 3.10. E.g., improving CI is a good reason, because 3.10 is going to stay there longer, since we need some other changes before release.

@wismill
Copy link
Collaborator Author

wismill commented Feb 6, 2023

Fixed based on feedback, rebased and squashed.

@ulysses4ever
Copy link
Collaborator

@wismill amazing, thanks! One more thing: could you, please, explain in the commit message (1) what this change does, in plain English, as much as possible, and (2) why you think this fixes the issue?

@wismill
Copy link
Collaborator Author

wismill commented Feb 6, 2023

@ulysses4ever I added proper comment & commit message. Unfortunately there is an issue withe the recent release of happy.

Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splendid. I'm now doubly edified: from the code comment and commit comment.

@Mikolaj
Copy link
Member

Mikolaj commented Feb 6, 2023

Yes, our colleague has already reported the happy problem and we count on them fixing it ASAP so that we don't have to exclude the happy version ourselves. Happy times.

@wismill
Copy link
Collaborator Author

wismill commented Feb 6, 2023

Note that I am new to Cabal and although I think the patch is consistent, please double check it!

There might be more places where the pattern L.allCondTrees . traverseCondTreeC might be an issue, e.g. transformAllBuildDepends.

Copy link
Collaborator

@ulysses4ever ulysses4ever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the commit message: "manipuling". Other than that — terrific, thanks!

@Mikolaj
Copy link
Member

Mikolaj commented Feb 6, 2023

There might be more places where the pattern L.allCondTrees . traverseCondTreeC might be an issue, e.g. transformAllBuildDepends.

Please kindly open a ticket about that. We don't have to do everything in one go.

@Mikolaj
Copy link
Member

Mikolaj commented Feb 6, 2023

Note that I am new to Cabal and although I think the patch is consistent, please double check it!

Given we want to backport this into 3.10, let's ask our resident gurus @grayjay, @gbaz and @fgaz for a quick look.

@Mikolaj Mikolaj requested a review from fgaz February 9, 2023 18:27
@wismill wismill force-pushed the wip/fix6859 branch 2 times, most recently from 3c4f715 to b4a4f92 Compare February 9, 2023 18:40
@Mikolaj
Copy link
Member

Mikolaj commented Feb 9, 2023

@wismill: feel free to set a label (squash+merge_me I guess), which will still give @fgaz 2 days to ponder and grace us with a comment, if @fgaz so chooses.

BTW, let's not forget to open a ticket for the other occurrences of the same pattern in the codebase. Even if we later close the ticket with "nothing to do".

@wismill wismill added the squash+merge me Tell Mergify Bot to squash-merge label Feb 9, 2023
@Mikolaj
Copy link
Member

Mikolaj commented Feb 9, 2023

@mergify rebase

Previously the function `\f -> L.allCondTrees $ traverseCondTreeC f` was
used to add the dependencies, but manipulating `CondTree` this way does
not update the nested fields `targetBuildDepends` of the tree, only the
conditions. It worked merely by chance if one does not further process
these fields: this explains why options like `--allow-newer` or
`allow-older` were incompatible with `--build-depends`.

Using `L.traverseBuildInfos . L.targetBuildDepends` ensures
`targetBuildDepends` fields and conditions are all updated consistently.
@mergify
Copy link
Contributor

mergify bot commented Feb 9, 2023

⚠️ This pull request got rebased on behalf of a random user of the organization.
This behavior will change on the 1st February 2023, Mergify will pick the author of the pull request instead.

To get the future behavior now, you can configure bot_account options (e.g.: bot_account: { author } or update_bot_account: { author }.

Or you can create a dedicated github account for squash and rebase operations, and use it in different bot_account options.

@mergify
Copy link
Contributor

mergify bot commented Feb 9, 2023

rebase

✅ Branch has been successfully rebased

@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Feb 11, 2023
@mergify mergify bot merged commit e9b4744 into haskell:master Feb 11, 2023
@haskell haskell deleted a comment from mergify bot Feb 13, 2023
@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Feb 13, 2023

Regarding backport to 3.10: I'm of two minds here. On one hand, I truly believe this can make 3.10 release greater and brighter. On the other, I think it may break some stuff, perhaps — at least, I didn't see anyone on this thread pleading that it can't. So, perhaps, it's Mikolaj's call.

@Mikolaj
Copy link
Member

Mikolaj commented Feb 13, 2023

@ulysses4ever: I asked people at the last devs meeting to give this an extra scrutiny specifically due to the late semi-freeze backporting and we did get a lot of reviews in. However, I find your sudden lack of faith disturbing. :)

@Mikolaj
Copy link
Member

Mikolaj commented Feb 13, 2023

@wismill: do we have the ticket about "the other occurrences of the same wrong pattern in our codebase"? If so, it would be useful to link it here for cross-referencing.

@Mikolaj
Copy link
Member

Mikolaj commented Feb 13, 2023

@mergify backport 3.10

mergify bot pushed a commit that referenced this pull request Feb 13, 2023
* Fix repl discarding `build-depends` argument

Previously the function `\f -> L.allCondTrees $ traverseCondTreeC f` was
used to add the dependencies, but manipulating `CondTree` this way does
not update the nested fields `targetBuildDepends` of the tree, only the
conditions. It worked merely by chance if one does not further process
these fields: this explains why options like `--allow-newer` or
`allow-older` were incompatible with `--build-depends`.

Using `L.traverseBuildInfos . L.targetBuildDepends` ensures
`targetBuildDepends` fields and conditions are all updated consistently.

* Add test

* Add changelog

* Cleanup

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit e9b4744)
@mergify
Copy link
Contributor

mergify bot commented Feb 13, 2023

backport 3.10

✅ Backports have been created

mergify bot added a commit that referenced this pull request Feb 13, 2023
Fix repl discarding --build-depends (backport #8732)
@ulysses4ever ulysses4ever changed the title Fix repl discarding --build-depends Fix repl discarding --build-depends after allow-newer/older Apr 18, 2023
@philderbeast philderbeast mentioned this pull request Jan 18, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: needs-review cabal-install: cmd/repl merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days squash+merge me Tell Mergify Bot to squash-merge
Projects
None yet
5 participants