Skip to content

Monitor imported cabal.project files#11884

Draft
philderbeast wants to merge 35 commits into
haskell:masterfrom
cabalism:wip/monitoring-proj-imports
Draft

Monitor imported cabal.project files#11884
philderbeast wants to merge 35 commits into
haskell:masterfrom
cabalism:wip/monitoring-proj-imports

Conversation

@philderbeast
Copy link
Copy Markdown
Collaborator

@philderbeast philderbeast commented May 25, 2026

I started with #11567 by @hasufell.

I then reverted a lot of changes not related to (or no longer needed for) monitoring before attempting a rebase. To make the rebase easier I also squashed those changes into one commit.

I then rebased over master once #10933 merged, so that we could match on whether an import was local file or a URI.

Important

This pull request avoids taking on this redesign:

- newtype ProjectConfigPath = ProjectConfigPath (NonEmpty FilePath)
+ data ProjectConfigPath = PCPWithImports PCPLeaf (NonEmpty FilePath)
+                       | PCPWithoutImports FilePath
+    deriving (Eq, Show, Generic)
+
+ data PCPLeaf = PCPFilePath FilePath
+             | PCPURI URI
+    deriving (Eq, Show, Generic)

I redesigned ProjectConfigPath, because I did not like how we stuff URIs into FilePaths
-- #11567 (comment)

That is not to say we shouldn't do this or something similar but it is not needed to fix project file monitoring. ProjectNode could maybe help in a future redesign?

-- | Isomorphic with 'ProjectConfigPath' but with separate constructors for the
-- root, imported file and imported URI.
data ProjectNode a where
ProjectRoot :: FilePath -> ProjectNode ProjectFilePath
ProjectFileImport :: FilePath -> ProjectConfigPath -> ProjectNode FilePath
ProjectUriImport :: URI -> ProjectConfigPath -> ProjectNode URI

Note

I changed these items after rebasing:

  • Fix the -Wunused-top-binds warning for lookupLocalPackageConfig by re-exporting deleting it
  • Avoid the many primes of lookupPerPkgOption'
  • Avoid duplicates when monitoring
  • Watch out for explicit imports of cabal.project.local and cabal.project.freeze

I'll squash commits before applying the merge label if this pull request is approved.


@philderbeast philderbeast marked this pull request as draft May 25, 2026 20:44
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from a8c983d to d18f91f Compare May 26, 2026 17:29
@philderbeast philderbeast marked this pull request as ready for review May 26, 2026 17:49
@philderbeast philderbeast requested a review from hasufell May 26, 2026 18:09
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from b91d469 to 49c2625 Compare May 27, 2026 02:10
@philderbeast
Copy link
Copy Markdown
Collaborator Author

Putting this back to draft. I've added some debug logging and found more things to test for and other issues to raise.

@philderbeast philderbeast marked this pull request as draft May 28, 2026 12:52
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch 2 times, most recently from 046b397 to 1578b11 Compare June 3, 2026 13:48
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch from 1578b11 to fb4ed0b Compare June 6, 2026 14:12
hasufell and others added 15 commits June 6, 2026 21:13
- Fixes haskell#10255
- Fix assertion failure wrt haskell#11568 'lookupLocalPackageConfig' would ignore --'projectConfigAllPackages'
(`package *`) and thus diverge from 'lookupPerPkgOption'. This would then cause further divergence between 'elabStanzasRequested'
and 'elabStanzasAvailable'.
- Add test for haskell#10255
- Add bootstrap-jsons-ghcup Makefile rule
- Be stricter about URI imports
- This behavior is documented, but not enforced. We
redesign the 'ProjectConfigPath' type to better
express the properties we expect.
- Revert Cabal-syntax network-uri
- Revert boostrap/*.json and Makefile
- Revert ProjectConfigPath
- Revert ParserTests
- Revert ProjectConfig/[Legacy|Parsec]
- Revert Compat/Orphans
- Revert TreeDiffInstances
- Revert deletion of ProjectFileParseError
- Revert Arbitrary ProjectConfigProvenance change
- Revert Errors/Parser prettyShow removal
- Get ProjectConfig compiling
@philderbeast philderbeast force-pushed the wip/monitoring-proj-imports branch from fb4ed0b to cc57ff1 Compare June 7, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing a file imported by cabal.project does not trigger recompilation

2 participants