Skip to content

Emit a hint when caching immutable precompiled build with --force-dirty#6948

Closed
ulidtko wants to merge 1 commit into
commercialhaskell:masterfrom
ulidtko:hint-forceDirty-precompiled
Closed

Emit a hint when caching immutable precompiled build with --force-dirty#6948
ulidtko wants to merge 1 commit into
commercialhaskell:masterfrom
ulidtko:hint-forceDirty-precompiled

Conversation

@ulidtko

@ulidtko ulidtko commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This is a tiny UX-level addition regarding #6944 & #1476. No behavioral change, just an added log:

Screenshot 2026-07-10 at 18 23 35

The Note is guarded to appear only when:

  • using precompiled package,
  • that package is in the explicitly passed targets list,
  • and --force-dirty is supplied.

@ulidtko

ulidtko commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@mpilgrem please review, I hope it's an easy merge. I'll promptly address feedback, if any.

I gave it a round of tests locally, seems to be conservative and uncontroversial.

@mpilgrem

mpilgrem commented Jul 10, 2026

Copy link
Copy Markdown
Member

@ulidtko, you want Stack to remind a user that flag --force-dirty has no effect if the targets of build do not include any that can, in principle, be dirty. I think that is fine, but my preference would be a message like:

--force-dirty is specified but no build targets or dependencies are capable of being dirty.
If you wish Stack to rebuild an installed package, first unregister it from the package database
by commanding:

stack exec -- ghc-pkg unregister --force

I'm not sure that warning is required during the build: can't Stack work it out, upfront, once it has parsed the build targets? (I need to think about that...)

EDIT1: With the currently implementation, a user only gets a warning if a build target happens to be a reusable installed package, installed in a different package database - and so only sees it once (after the resuable package is installed in the current package database, it no longer meets the criteria). If we aim to warn on the redundant use of --force-dirty, I think we should aim to warn whenever is has been mis-specified.

EDIT2: I think Stack knows whether any build targets or dependencies are capable of being dirty once it has made the context (ctx) in Stack.Build.ConstructPlan.constructPlan.

EDIT3: When Stack is reusing a pre-compiled package, I think to get Stack to rebuid it you have to unregister it from the package database it is coming from. If you unregister it from the package datbase it has been copied to, I think Stack will just bring over another copy on the next build.

EDIT4: @ulidtko, I have an alternative to this pull request at #6949, which includes your hint but at the start of the build and is triggered more frequently.

@mpilgrem mpilgrem self-requested a review July 10, 2026 18:06
@mpilgrem

Copy link
Copy Markdown
Member

Closed, as overtaken by:

@mpilgrem mpilgrem closed this Jul 13, 2026
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.

2 participants