Skip to content

fix(remote): deduplicate artifact names in remote-build success message - #1094

Open
kirtisingh05 wants to merge 7 commits into
canonical:mainfrom
kirtisingh05:main
Open

fix(remote): deduplicate artifact names in remote-build success message#1094
kirtisingh05 wants to merge 7 commits into
canonical:mainfrom
kirtisingh05:main

Conversation

@kirtisingh05

Copy link
Copy Markdown
  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?
  • Have you added an entry to the changelog (docs/reference/changelog.rst)?

Summary

When remote-build is run multiple times, Launchpad returns historical
builds with different URLs but the same output filenames. Since
artifact_downloads keys on URL, duplicates slip through into .values(),
causing the success message to list the same snap multiple times.

Fix

Deduplicate artifact names using a set comprehension before sorting:

artifact_names = sorted({path.name for path in artifacts})

Test

Added a regression test that mocks fetch_artifacts to return duplicate
filenames and asserts each artifact appears only once in the success message.

Fixes #1093
Related: canonical/snapcraft#6230

@kirtisingh05
kirtisingh05 requested a review from a team as a code owner June 16, 2026 20:40
@kirtisingh05
kirtisingh05 requested a review from lengau as a code owner June 23, 2026 16:25

@steinbro steinbro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change would fix the visual quirk of duplicate filenames, but I'm concerned that it's masking a root cause. Why would historical builds be included in the data that's being fetched? Is the client downloading a bunch of paths to the same target unnecessarily? If so, are we sure that the resulting file left on disk is the most recent build?

Maybe @mr-cal knows if we need to adjust our Launchpad API calls to only fetch the artifact that resulted from this specific remote-build invocation..

@steinbro
steinbro requested a review from mr-cal June 25, 2026 16:23
@kirtisingh05

Copy link
Copy Markdown
Author

Thanks for the review. you're right, this is masking the root cause rather than fixing it. The real issue is that get_builds() returns all historical builds for the recipe, not just the current invocation. I'm working on filtering by build request ID for fresh runs, with a fallback to newest-per-arch for resumed builds. Will update the PR once I've traced the right fix with @mr-cal's input on the Launchpad API.

@mr-cal mr-cal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @kirtisingh05,

Thanks for the PR. I agree with @steinbro that filtering at the output is indeed masking a deeper problem and not the direction we should go. I've put some of my thoughts into the original issue into how this could be solved.

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.

remote-build success message lists duplicate artifact names

3 participants