Skip to content

fix(build): invalidate artifact and workspace caches on build config changes - #7069

Open
aoright wants to merge 1 commit into
prefix-dev:mainfrom
aoright:fix-build-config-artifact-cache
Open

aoright wants to merge 1 commit into
prefix-dev:mainfrom
aoright:fix-build-config-artifact-cache

Conversation

@aoright

@aoright aoright commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Description

Modifications to [package.build.config] (such as backend-specific compiler flags, ignore flags, or custom mappings) previously invalidated the backend metadata cache, but ArtifactCacheKey and WorkspaceKey omitted the build configuration hash. Consequently, running pixi install after editing [package.build.config] reused stale built packages from the artifact cache without triggering a rebuild.

This PR:

  1. Derives Hash on ConfigurationHash so it can be hashed into cache keys.
  2. Returns configuration_hash from resolve_backend_identity alongside the backend identifier string.
  3. Incorporates configuration_hash into compute_artifact_cache_key and compute_workspace_key, ensuring changes to [package.build.config] invalidate cached artifacts and workspace scratch directories.

How Has This Been Tested?

  • Added integration test test_package_rebuilt_across_sessions_when_build_config_modified in crates/pixi_command_dispatcher/tests/integration/main.rs:
    • Simulates a multi-package workspace across two CLI sessions.
    • Modifies [package.build.config] in one package without altering source files.
    • Verifies that only the package with modified build configuration is queued for rebuild, leaving unchanged packages intact.
  • Ran cargo test -p pixi_command_dispatcher test_package_rebuilt_across_sessions_when_build_config_modified.

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.

…changes

Modifications to `[package.build.config]` previously invalidated backend
metadata cache but left `ArtifactCacheKey` and `WorkspaceKey` unchanged,
causing pixi to install stale built packages from the artifact cache without
rebuilding.

Now, `ConfigurationHash` is derived with `Hash` and included in both
`compute_artifact_cache_key` and `compute_workspace_key`, properly
invalidating build artifacts and workspaces when build configuration changes.

Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
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.

1 participant