Skip to content

Add tests for active-repositories feature#11684

Merged
mergify[bot] merged 1 commit into
haskell:masterfrom
erikd:master
Apr 20, 2026
Merged

Add tests for active-repositories feature#11684
mergify[bot] merged 1 commit into
haskell:masterfrom
erikd:master

Conversation

@erikd
Copy link
Copy Markdown
Member

@erikd erikd commented Apr 1, 2026

This PR only contains tests, which were generated by Claude code, and then manually reviewed. Unfortunately I have not worked much on Cabal so my manual review may not be up-to-scratch.

This PR was submitted in preparation for taking over the work in #8997 and getting it merged. One of the things mentioned in that PR was that need for tests for the active-repositories feature.

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

@erikd
Copy link
Copy Markdown
Member Author

erikd commented Apr 1, 2026

I asked Claude to give me an idea of the test coverage. Its response:

The top commit (6898e42) captures the IndexUtils/ActiveRepos.hs and the index-combining
tests we added to IndexUtils.hs.

So the breakdown for what this commit actually adds vs the total feature:

Layer Coverage
Layer 1 ~80%
Layer 2 ~65%
Layer 3 ~58%
Layer 4 ~30%
Layer 5 ~0%

Where:

  • Layer 1 — pure logic (ActiveRepos.hs)
  • Layer 2 — project config parsing (pre-existing tests only, nothing new in this PR)
  • Layer 3 — index combining (IndexUtils.hs) (all 14 combining tests are in this PR)
  • Layer 4 — freeze file (filterSkippedActiveRepos unit tests in this PR)
  • Layer 5 — solver/planning wiring

@erikd erikd force-pushed the master branch 2 times, most recently from 8a79072 to 335c948 Compare April 2, 2026 01:08
Copy link
Copy Markdown
Collaborator

@andreabedini andreabedini left a comment

Choose a reason for hiding this comment

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

I left a couple of comments but otherwise LGTM.

Not a deal breaker but any chance you can add a simple test for this edge case behaviour?

-- Note: currently if 'ActiveRepoRest' is provided more than once,
-- rest-repositories will be multiple times in the output.

Comment thread cabal-install/tests/UnitTests/Distribution/Client/IndexUtils.hs
Comment thread cabal-install/tests/UnitTests/Distribution/Client/IndexUtils.hs Outdated
@mergify mergify Bot added the queued label Apr 2, 2026
@mergify

This comment was marked as outdated.

mergify Bot added a commit that referenced this pull request Apr 2, 2026
@mergify mergify Bot added the dequeued label Apr 2, 2026
@mergify

This comment was marked as outdated.

@mergify mergify Bot removed the dequeued label Apr 2, 2026
@andreabedini
Copy link
Copy Markdown
Collaborator

A changelog file is missing, here is a suggestion:

---
synopsis: Add unit tests for active-repositories feature
packages: [cabal-install]
prs: 11684
---

Add unit tests for the `active-repositories` cabal configuration field:

- `organizeByRepos`: ordering and strategy assignment with `:rest`, named repos, and error cases
- `filterSkippedActiveRepos`: filtering of skipped entries in the absence of `:rest`
- `CombineStrategy` index-combining logic (Skip/Merge/Override)
- Parse/pretty roundtrip for `ActiveRepos` (QuickCheck)

mergify Bot added a commit that referenced this pull request Apr 2, 2026
@mergify

This comment was marked as outdated.

@mergify mergify Bot removed the dequeued label Apr 2, 2026
mergify Bot added a commit that referenced this pull request Apr 2, 2026
@mergify

This comment was marked as outdated.

@mergify mergify Bot removed the dequeued label Apr 2, 2026
mergify Bot added a commit that referenced this pull request Apr 2, 2026
Copy link
Copy Markdown
Member

@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

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

I am afraid I do not even know what the active-repositories feature is, so I cannot judge this PR.
However, when it comes to tests: the more, the merrier!

@erikd
Copy link
Copy Markdown
Member Author

erikd commented Apr 11, 2026

The documentation for this feature is at: https://cabal.readthedocs.io/en/latest/cabal-project-description-file.html#cfg-field-active-repositories

@mergify mergify Bot added the queued label Apr 11, 2026
@mergify

This comment was marked as outdated.

mergify Bot added a commit that referenced this pull request Apr 11, 2026
@mergify mergify Bot added dequeued and removed queued labels Apr 11, 2026
@mergify mergify Bot removed the dequeued label Apr 12, 2026
@erikd erikd force-pushed the master branch 4 times, most recently from b951c21 to 39824b2 Compare April 17, 2026 00:30
Copy link
Copy Markdown
Collaborator

@angerman angerman left a comment

Choose a reason for hiding this comment

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

The applyStrategy refactor is much more readable imo, great!

Thank you @erikd for working on this!

These tests were generated by Claude code, but manually reviewed.
@angerman
Copy link
Copy Markdown
Collaborator

@Mergifyio queue

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 20, 2026

Merge Queue Status

  • Entered queue2026-04-20 06:53 UTC · Rule: default
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-20 07:03 UTC · at da8b314563feb15a3df7bc1baeef4b7aa08f7578 · merge

This pull request spent 10 minutes 33 seconds in the queue, including 1 second running CI.

Required conditions to merge
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Validate post job
    • check-neutral = Validate post job
    • check-skipped = Validate post job
  • any of [🛡 GitHub branch protection]:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of [🛡 GitHub branch protection]:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of [🛡 GitHub branch protection]:
    • check-success = Bootstrap post job
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
  • any of [🛡 GitHub branch protection]:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of [🛡 GitHub branch protection]:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of [🛡 GitHub branch protection]:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants