Skip to content

splicing: keep the package hash of automatically spliced specs - #52862

Open
haampie wants to merge 3 commits into
spack:developfrom
haampie:hs/fix/splice-keeps-package-hash
Open

splicing: keep the package hash of automatically spliced specs#52862
haampie wants to merge 3 commits into
spack:developfrom
haampie:hs/fix/splice-keeps-package-hash

Conversation

@haampie

@haampie haampie commented Aug 7, 2026

Copy link
Copy Markdown
Member

Spec.clear_caches matches its ignore argument against hash attribute names, which for the package hash is _package_hash. The call in _resolve_collected_splices passed package_hash without the leading underscore, so the ignore never matched and the package hash was cleared along with everything else. Compare Spec._splice_detach_and_add_dependents, which passes ht.package_hash.attr.

The spliced node stays concrete from the copy, and _finalize_concretization assigns package hashes only to non-concrete nodes, so the cleared hash was never restored. Its dag hash is then computed from a node dict that has no package_hash key at all.

This changes the dag hash of automatically spliced specs.

The first commit adds a failing test that demonstrates the bug. The second commit fixes the ignore value. The third commit makes clear_caches validate its ignore values to catch future typos.

@haampie
haampie force-pushed the hs/fix/splice-keeps-package-hash branch 2 times, most recently from 561227f to 33f70f6 Compare August 7, 2026 13:05
@JohnGouwar

Copy link
Copy Markdown
Contributor

This all looks good to me.

@haampie
haampie requested a review from becker33 August 7, 2026 14:15
A spliced node ends up concrete without a package hash, so its dag hash
is computed without the package_hash field. Besides checking the package
hash directly, the test compares the dag hash against a from-scratch
recomputation that re-derives package hashes from the repo.

Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
The intent of `clear_caches(ignore=("package_hash",))` was to preserve
the package hash of a spliced node, but the cached attribute is named
`_package_hash`, so the ignore tuple matched nothing and the hash was
cleared.

The spliced node stays concrete from the copy, and
`_finalize_concretization` assigns package hashes only to non-concrete
nodes, so the cleared hash was never restored. The node dict then lacks
the `package_hash` field, which changes the dag hash.

Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
A typo in the ignore tuple silently cleared the hash it meant to
preserve; now it fails loudly.

Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
@haampie
haampie force-pushed the hs/fix/splice-keeps-package-hash branch from 33f70f6 to 9689403 Compare August 18, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants