Reliably use modified repodata for get_new_repoclosure #14
No reviewers
Labels
No labels
ai-review-please
Backlog Status
Needs Review
Backlog Status
Ready
chore
documentation
points
01
points
02
points
03
points
05
points
08
points
13
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Sprint Status
Blocked
Sprint Status
Done
Sprint Status
In Progress
Sprint Status
Review
Sprint Status
To Do
Technical Debt
Work Item
Bug
Work Item
Epic
Work Item
Spike
Work Item
Task
Work Item
User Story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quality/rmdepcheck!14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-new-repoclosure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I noticed that https://openqa.fedoraproject.org/tests/4471016
passed when it should not have: it should have caught that the
new gstreamer1-plugins-good package had a dependency issue. I was
able to reproduce this locally. Some debugging indicated that,
in get_new_repoclosure, the base repository that should have been
modified was not behaving as if it was modified.
I think we've been relying on DNF's cache, here. We only actually
used the modified repodata directly in get_modified_repoclosure.
In get_new_repoclosure we were configuring the repo with the same
name, but with its original unmodified path. I think we expected
that DNF would cache the modified metadata and re-use it. This
obviously worked at some point (because we have had correct
failures in get_new_repoclosure), but it's obviously fragile.
Let's improve it by creating the temporary directory where we
store the modified repodata in main() and passing it to both
get_modified_repoclosure() and get_new_repoclosure(); this way
get_new_repoclosure() can access and use the actual modified
repodata. In my local testing, this fixes the bug and we now
correctly find the dependency error.
Signed-off-by: Adam Williamson awilliam@redhat.com
AI Code Review
📋 MR Summary
Fixes a bug where
get_new_repoclosurerelied on DNF caching to use modified repodata by explicitly sharing the temporary directory containing the modified metadata.main().get_modified_repoclosureto accept the shared temporary directory rather than creating its own.get_new_repoclosureto explicitly use the modified repository directory paths via--repofrompath.Detailed Code Review
The implementation correctly identifies and fixes the fragility of relying on DNF's cache. By hoisting the creation of the temporary directory up to
main(), bothget_modified_repoclosureandget_new_repoclosurecan reliably access the exact same modified repodata on disk. The refactoring is clean and correctly updates the respective CLI arguments for DNF.One minor concern regarding the unit tests: in
test_get_new_repoclosure, an empty temporary directory is passed. Sinceget_modified_repoclosureisn't called prior to populate it, DNF might receive a path to a directory that lacks actualrepodata, which could lead to unexpected behavior if DNF strictly validates the--repofrompathlocation. Ensure the test environment properly handles or mocks this scenario.📂 File Reviews
📄 `tests/test_rmdepcheck.py` - Updates test functions to pass a temporary directory to the modified functions.
test_get_new_repoclosure,tempdiris empty becauseget_modified_repoclosureis never called to populate it. Passing an unpopulated directory toget_new_repoclosuremight cause DNF to fail or emit warnings if it attempts to resolve--repofrompathand cannot find arepodatasubdirectory.tempdirbefore callingget_new_repoclosure.✅ Summary
test_get_new_repoclosuresuccessfully executes in CI without DNF failing due to missingrepodatainside the emptytempdir.🤖 AI Code Review | Generated with ai-code-review
Platform: Forgejo | AI Provider: gemini | Model: gemini-3-pro-preview
c2b6ce2a72373b91865dTweaked. I should probably make
test_get_new_repoclosureactually test this case properly, too, though.373b91865d30c5b6a8f730c5b6a8f74f8278c9384f8278c9383e75b7f1843e75b7f184b8b5612f50AI Code Review
📋 MR Summary
This MR fixes an issue where
get_new_repoclosurewas not using modified repodata by explicitly creating a temporary directory for the modified repodata inmain()and passing its path to bothget_modified_repoclosureandget_new_repoclosure.get_modified_repoclosureand moved it up to themain()function.get_modified_repoclosureto accept themreposdirargument and use it for storing modified repository metadata.get_new_repoclosureto accept themreposandmreposdirarguments and append them to thednf repoclosurecommand parameters.tempfile.TemporaryDirectorywith a context manager minimizes file descriptor and resource leaks.Detailed Code Review
The structural change of lifting the temporary directory creation to
main()is sensible. It establishes a clear, shared source of truth (the modified repodata) that prevents relying on unpredictable DNF caching behavior. The unit tests are properly updated to account for the new function signatures, and a new test package (222) ensures the new logic explicitly fails as intended when testing removed baseline dependencies. The use of a context manager (with tempfile.TemporaryDirectory() as mreposdir:) ensures appropriate teardown. The changes appear correct and align with the described intent.✅ Summary
--repofrompathgenerally overrides default configurations correctly.🤖 AI Code Review | Generated with ai-code-review
Platform: Forgejo | AI Provider: gemini | Model: gemini-3-pro-preview