Skip to content

Conversation

@realrajaryan
Copy link
Contributor

Changes BuildImageResolver to use fetch() instead of pull().

fetch() checks the cache first and only pulls if needed, preventing incorrect progress events (e.g., "1/1 KB" metadata checks) on cached images that caused the progress bar width calculation to produce negative/weird padding counts, triggering "Fatal error: Negative count not allowed" crashes during rebuilds.

@realrajaryan realrajaryan requested a review from jglogan November 17, 2025 21:20
}
return img
// Use fetch() which checks cache first, then pulls if needed
return try await ClientImage.fetch(reference: ref, platform: platform, progressUpdate: progress.handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

fetch() only retrieves the manifest if needed, doesn't it?

I don't see how this actually pulls content. The code before the original progress bar changed looked like:

           guard let img = try? await ClientImage.pull(reference: ref, platform: platform) else {
                return try await ClientImage.fetch(reference: ref, platform: platform)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original code was backwards. fetch() tries to get the image from the local cache first, and if not found, it calls pull().

@realrajaryan realrajaryan merged commit 88a473e into apple:main Nov 17, 2025
3 of 4 checks passed
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.

[Bug]: Image download progress bar breaks rebuilds.

2 participants