Skip to content

fix: stop source builds rebuilding from scratch on every run#6285

Open
baszalmstra wants to merge 1 commit into
prefix-dev:mainfrom
baszalmstra:claude/elegant-mayer-XAXQn
Open

fix: stop source builds rebuilding from scratch on every run#6285
baszalmstra wants to merge 1 commit into
prefix-dev:mainfrom
baszalmstra:claude/elegant-mayer-XAXQn

Conversation

@baszalmstra
Copy link
Copy Markdown
Contributor

Description

Source packages that keep their build variants in a separate variants.yaml, with the recipe shared from a parent directory, were rebuilt from scratch on every command even when nothing had changed.

The build cache decides whether a package needs rebuilding by checking the files that went into the previous build. It was not tracking the files that live outside the package's own directory (such as the shared recipe and build script), so on every run it saw them as newly added and threw the cached build away.

This change makes the cache record and re-check those files correctly, so a build is reused until its inputs actually change. The same handling is applied to both the source build cache and the build backend metadata cache, so the two stay consistent. The result matches the behaviour you already get when variants are declared inline with [workspace.build-variants].

Fixes #6232

How Has This Been Tested?

Added a regression test that reproduces the issue's project layout (a package whose recipe lives in a parent directory) and confirms the build is reused on the second run instead of rebuilt, plus unit tests for the file matching that the caches rely on. The full pixi_command_dispatcher test suite passes and the project builds cleanly.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

…dev#6232)

Source packages that keep their build variants in a separate `variants.yaml`,
with the recipe shared from a parent directory, were rebuilt on every command
even when nothing had changed.

The build cache was not tracking the files that live outside the package's own
directory (such as the shared recipe), so on every run it treated them as
newly added and discarded the cached build. Both the source-build artifact
cache and the build-backend metadata cache now record those files correctly,
so the cache is reused and a package is only rebuilt when its source actually
changes.

Fixes prefix-dev#6232

https://claude.ai/code/session_01PrTktKPKFCjBgUJcoXYGVn
@baszalmstra baszalmstra requested a review from Hofer-Julian June 4, 2026 15:18
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.

variants.yaml causes to rebuild from scratch on every task

2 participants