Repository navigation
Conversation
mroncode
marked this pull request as ready for review
November 24, 2026 12:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12637.
index-statecan be set incabal.projectand its imports,cabal.project.freeze,cabal.project.localand on the command line. The value read last wins, which wassilent. This PR warns when the values from more than one place resolve to different
entries of the package index, and names the source of the winning value in the
-v2message.
What changed
ProjectConfigSharedhas a new field,projectConfigIndexStateSources, a list ofevery
index-statethat was set together with where it came from. Lists append whenconfigs are merged, so nothing is dropped. The parsec and legacy project file parsers
tag values with the file they were read from;
--index-stateis tagged as thecommand line.
warnOnConflictingIndexStates(IndexUtils) resolves each candidate against theindex cache (
filterCache/isiMaxTime) and warns only if they land on differententries. If all values are equal it does not read the cache at all.
getSourcePackagesinProjectPlanning.getSourcePackagesAtIndexStateFromis a variant ofgetSourcePackagesAtIndexStatethat takes a description of where the value was set, so the
-v2message can saye.g. "(from cabal.project.local)". The original function is a wrapper, so other
callers are unchanged.
Manual QA notes
With
cabal.projectsettingindex-state: 2025-01-01T00:00:00Z,cabal.project.localsetting2025-03-01T00:00:00Zand--index-state=2025-06-15T12:00:00Zon the command line,cabal buildprints:At
-v2:Using historical state as of 2025-06-15T12:00:00Z as explicitly requested (from the command line).Two different timestamps that resolve to the same index entry (e.g.
2025-06-15T10:00:00Zand
2025-06-15T12:00:00Z) produce no warning, and a singleindex-stateproduces nowarning.
Limitations / questions for reviewers
index-state:lines within one file are not compared (the parser keeps onlythe last one), and
~/.cabal/configis not tracked as a source.check the source tagging, and the unit test generators are updated. I'd appreciate
guidance on whether a
cabal-testsuitegolden test is the right place for it.Configuretests (file locked)and
parallel.concurrent jobs.if you'd prefer a different approach.