Skip to content

Detect and error on duplicate artifact NVRAs#4564

Merged
happz merged 6 commits intomainfrom
avinay--fix-duplicate-artifact-handling
Mar 3, 2026
Merged

Detect and error on duplicate artifact NVRAs#4564
happz merged 6 commits intomainfrom
avinay--fix-duplicate-artifact-handling

Conversation

@AthreyVinay
Copy link
Copy Markdown
Member

@AthreyVinay AthreyVinay commented Feb 10, 2026

from sync...
Specific example:
User provides two scratch builds of curl
Two koji tasks with the same nvr (content is different, e.g. two ways / patches how to fix the bug)
Raise an error (as we cannot decide/check what should be installed)

NOTE: This pr also renamed raw_provider_id -> raw_id.

  • extend tests

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AthreyVinay, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the artifact preparation step by introducing validation for artifact NVRAs. It ensures that if multiple artifact providers attempt to supply artifacts with identical NVRAs, an explicit error is raised. This prevents potential conflicts and ensures a clear, deterministic source for each artifact, thereby improving the overall reliability and predictability of the artifact management process.

Highlights

  • Duplicate NVRA Detection: Implemented a mechanism to detect and error on duplicate artifact NVRAs (Name-Version-Release-Architecture) provided by different sources, preventing ambiguous artifact installations.
  • Error Handling: Introduced a PrepareError to be raised when duplicate NVRAs are found, ensuring that the process halts and notifies the user of the conflict.
  • Code Refactoring: Refactored the artifact metadata collection and duplicate checking logic into a new dedicated private method, _collect_artifacts_metadata, improving modularity and readability.
Changelog
  • tmt/steps/prepare/artifact/init.py
    • Updated specific type imports from the typing module for Any, ClassVar, and Optional.
    • Introduced seen_nvras and providers_data variables within the go method to track artifact NVRAs and collected metadata.
    • Extracted artifact metadata collection and duplicate NVRA detection into a new private method _collect_artifacts_metadata.
    • Modified the _persist_artifact_metadata method to accept pre-collected artifact data, streamlining its responsibility.
    • Integrated the new _collect_artifacts_metadata method into the artifact processing loop to perform duplicate checks and gather data.
Activity
  • No specific activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AthreyVinay AthreyVinay added step | prepare Stuff related to the prepare step plugin | artifact Related to the `prepare/artifact` plugin. labels Feb 10, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses the requirement to detect and error on duplicate artifact NVRAs by introducing the _collect_artifacts_metadata method and refactoring _persist_artifact_metadata. No security vulnerabilities were found, and the changes are well-implemented, directly fulfilling the stated objective.

@AthreyVinay AthreyVinay force-pushed the avinay-report-installable-artifacts branch from caebeef to 21bc23b Compare February 10, 2026 16:43
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from 735c673 to db2e674 Compare February 10, 2026 16:50
@happz happz added this to planning Feb 11, 2026
@github-project-automation github-project-automation Bot moved this to backlog in planning Feb 11, 2026
@happz happz moved this from backlog to review in planning Feb 11, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-report-installable-artifacts branch 3 times, most recently from 119fbab to b2cc461 Compare February 13, 2026 12:45
@psss psss added this to the 1.68 milestone Feb 13, 2026
@AthreyVinay AthreyVinay force-pushed the avinay-report-installable-artifacts branch from b2cc461 to 25fe254 Compare February 18, 2026 09:21
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from db2e674 to 009507b Compare February 18, 2026 09:45
@AthreyVinay AthreyVinay force-pushed the avinay-report-installable-artifacts branch from 25fe254 to 2da0be6 Compare February 19, 2026 15:41
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from 009507b to f53144c Compare February 23, 2026 14:02
@AthreyVinay AthreyVinay force-pushed the avinay-report-installable-artifacts branch 3 times, most recently from 7b2ffc5 to fa0809e Compare February 24, 2026 09:42
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from f53144c to e4ede58 Compare February 24, 2026 12:32
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
@happz happz force-pushed the avinay-report-installable-artifacts branch from fa0809e to c786fd8 Compare February 24, 2026 19:19
@tcornell-bus
Copy link
Copy Markdown
Contributor

Hi @AthreyVinay looks like there are some conflicts. Could you take a look please?

@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from 70f4ad0 to f9b61f2 Compare February 24, 2026 21:10
@AthreyVinay
Copy link
Copy Markdown
Member Author

Could you take a look please?

Thanks @tcornell-bus , done.

Base automatically changed from avinay-report-installable-artifacts to main February 24, 2026 21:18
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch 3 times, most recently from 7250451 to bed007c Compare February 25, 2026 10:08
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
@AthreyVinay
Copy link
Copy Markdown
Member Author

AthreyVinay commented Feb 25, 2026

I think the user would prefer it to fail quickly, rather than halfway down the download list.

Thank you @tcornell-bus, makes sense to me too.
Addressed here: Move duplicate NVRA detection into a separate pass that runs...

@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from d00f947 to f3e26c5 Compare February 25, 2026 19:07
@tcornell-bus
Copy link
Copy Markdown
Contributor

Should this also handle when there are two different repository-files that provide the same package NVRA? Or is this only to detect when koji:<task-id-1> and koji:<task-id-2> point to the same NVRA?

@therazix therazix modified the milestones: 1.68, 1.69 Feb 27, 2026
Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
@happz
Copy link
Copy Markdown
Contributor

happz commented Feb 27, 2026

Should this also handle when there are two different repository-files that provide the same package NVRA? Or is this only to detect when koji:<task-id-1> and koji:<task-id-2> point to the same NVRA?

As of now, I'd focus on non-repository providers like koji and brew. Providers contributing their payload to the shared repository. Repositories brought by repository-like providers may be disabled except in one particular test, or mapped into VMs, plenty of ways for a potential NVR conflict to never materialize; on the other hand, package-like providers contributing same NVR to the same repository is broken already.

Copy link
Copy Markdown
Member

@LecrisUT LecrisUT left a comment

Choose a reason for hiding this comment

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

Fine overall, just some minor code style comments

Comment thread tmt/steps/prepare/artifact/__init__.py Outdated
Comment thread tmt/steps/prepare/artifact/__init__.py
Comment thread tmt/steps/prepare/artifact/__init__.py
@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from f3e26c5 to 03135bb Compare March 2, 2026 10:28
@AthreyVinay
Copy link
Copy Markdown
Member Author

As of now, I'd focus on non-repository providers like koji and brew. Providers contributing their payload to the shared repository

Maybe an explicit check before we detect duplcates? .... something along the lines of:

if provider.contribute_to_shared_repo();
    self._detect_duplicate_nvras()

@LecrisUT
Copy link
Copy Markdown
Member

LecrisUT commented Mar 2, 2026

As of now, I'd focus on non-repository providers like koji and brew. Providers contributing their payload to the shared repository

Maybe an explicit check before we detect duplcates? .... something along the lines of:

if provider.contribute_to_shared_repo();
    self._detect_duplicate_nvras()

Fine either way. If there are no .artifacts provided then we do not have anything to use the duplicate nvr check for. Although the plain name of .artifacts for that makes things increasingly confusing, since we are converging to using that property to mean installable_artifacts more explicitly (we do not query or populate that for repo file, and I don't think we should start to do either)

@AthreyVinay
Copy link
Copy Markdown
Member Author

Although the plain name of .artifacts for that makes things increasingly confusing, since we are converging to using that property to mean installable_artifacts more explicitly

Agree - there was some discussion around it in a pr here: #4526 (comment)

@AthreyVinay AthreyVinay force-pushed the avinay--fix-duplicate-artifact-handling branch from 40e7121 to cda4a1d Compare March 3, 2026 09:30
@AthreyVinay AthreyVinay added the ci | full test Pull request is ready for the full test execution label Mar 3, 2026
@happz happz force-pushed the avinay--fix-duplicate-artifact-handling branch from cda4a1d to 6848567 Compare March 3, 2026 15:25
@happz happz merged commit 60773b1 into main Mar 3, 2026
30 checks passed
@happz happz deleted the avinay--fix-duplicate-artifact-handling branch March 3, 2026 17:30
@github-project-automation github-project-automation Bot moved this from review to done in planning Mar 3, 2026
@thrix thrix mentioned this pull request Mar 11, 2026
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci | full test Pull request is ready for the full test execution plugin | artifact Related to the `prepare/artifact` plugin. step | prepare Stuff related to the prepare step

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

6 participants