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

Detect duplicate non-cyclical project imports #9933

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

philderbeast
Copy link
Collaborator

@philderbeast philderbeast commented Apr 24, 2024

A follow on from #9578. Uses an IORef to better report on duplicates (including cycles) and to detect duplicates that are not cycles. This was originally included in #9578 but punted at review, #9578 (comment).

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • Manual QA notes have been included.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

@philderbeast philderbeast requested a review from grayjay April 24, 2024 18:34
@philderbeast philderbeast changed the title Detect duplicate but not cyclical project imports Detect duplicate non-cyclical project imports Apr 24, 2024
@grayjay
Copy link
Collaborator

grayjay commented Apr 30, 2024

@Mikolaj Do you know if there is someone else who could review this pull request? This followup change doesn't really affect the dependency solver, and I'm currently focusing on #9743.

@philderbeast philderbeast requested a review from TeofilC April 30, 2024 19:32
@philderbeast
Copy link
Collaborator Author

@TeofilC I'm inviting your review as cabal could perhaps be enhanced to output a list of files imported from a project in the future for use by other tools, input-output-hk/haskell.nix#2144 (comment).

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch from 45e6f73 to 62a67ca Compare April 30, 2024 19:43
@Mikolaj
Copy link
Member

Mikolaj commented Apr 30, 2024

@alt-romes: could you maybe have a look?

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch from 62a67ca to 1d189d5 Compare May 6, 2024 18:44
@Kleidukos
Copy link
Member

Looks like you may need to rebase on master so that the changes specific to #9578 don't appear anymore? At least the changelog entry for it is extraneous here. :)

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch 2 times, most recently from c5ab2b7 to b708112 Compare May 14, 2024 09:52
@philderbeast
Copy link
Collaborator Author

Thanks @Kleidukos for pointing out the stray changelog entry. Rebasing didn't clear it so I deleted it and then squashed related commits.

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch 2 times, most recently from 50ebe1d to 1d1b3e7 Compare May 15, 2024 10:08
@gbaz
Copy link
Collaborator

gbaz commented Oct 10, 2024

@grayjay do you have time to review this?

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch 4 times, most recently from c423f02 to 06065fb Compare October 22, 2024 17:02
@philderbeast
Copy link
Collaborator Author

@gbaz and @grayjay, I've rebased and squashed this. It is now ready for review.

@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch 2 times, most recently from 908ce01 to 6d1a639 Compare October 23, 2024 00:10
@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch from 6d1a639 to 0b668c0 Compare October 23, 2024 00:15
@grayjay
Copy link
Collaborator

grayjay commented Oct 24, 2024

This change was split from #9578. When I was reviewing #9578, I disagreed with the duplicate project imports error because it wasn't clear to me that it should be an error (I don't think that duplicate non-cyclic imports cause build problems, and it is possible that existing projects are using them intentionally.), and it didn't seem worth the complexity of an IORef. This new PR is mostly outside of the solver, so I'll defer to others who are more familiar with project files.

- A test for detecting when the same config is imported via many different paths
- Error on duplicate imports
- Do the filtering in duplicateImportMsg
- Use duplicateImportMsg for cycles too
- Add haddocks to IORef parameter
- Add changelog entry
- Use ordNub instead of nub
- Use NubList
- Share implement of duplicate and cyclical messages
- Update expectation for non-cyclical duplicate import
@philderbeast philderbeast force-pushed the fix/y-fork-project-import branch from 3461f3b to 505a04a Compare December 2, 2024 19:42
@Kleidukos
Copy link
Member

@philderbeast Great PR, I like that we are tackling this behaviour. I will join @grayjay in that introducing a breaking change in cabal-install is not desirable without proper communication. Could you please open a wiki page based on this template: https://github.com/haskell/cabal/wiki/Deprecation-Process to set the timeline for full deprecation of this behaviour. Please ask questions if you have them. In this case, since we do not intend to replace the feature but deprecate it, no replacement is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: needs-review re: project-file Concerning cabal.project files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants