Skip to content

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Jan 8, 2026

This reverts commit 251bfef. See discussion at #27492 (comment)

@fmeum fmeum requested a review from a team as a code owner January 8, 2026 09:42
@fmeum fmeum requested a review from meteorcloudy January 8, 2026 09:42
@github-actions github-actions bot added team-Performance Issues for Performance teams team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Jan 8, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request reverts a previous commit that added support for multiple module interfaces per cc_library. The revert seems mostly correct and removes the feature-related code across the codebase, including logic for mandatoryInputsDigest in action caching, and related tests. However, I've found a critical issue in MetadataDigestUtils.java where the revert introduces non-determinism in action cache key generation. This could lead to incorrect caching behavior. I've left a detailed comment with a suggested fix.

*/
public static byte[] fromMetadata(Map<String, FileArtifactValue> mdMap) {
byte[] result = emptyDigest.clone();
byte[] result = new byte[1]; // reserve the empty string

Choose a reason for hiding this comment

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

critical

This change introduces non-determinism in action cache keys. DigestUtils.combineUnordered is only order-independent when all digests have the same length, which triggers an XOR-based combination. By initializing result to a 1-byte array, while getDigest returns a 16-byte MD5 digest, the first combination will use combineTwo. combineTwo is not commutative, so the final digest will depend on the iteration order of the input map, which is not guaranteed. This can lead to incorrect cache hits or misses.

To fix this, result should be initialized with a digest of the same length, for example, the digest of an empty string, to ensure the commutative XOR logic is always used.

Note: This change will require updating TreeArtifactMetadataTest.testEmptyTreeArtifacts to expect the correct digest for an empty tree artifact, instead of new byte[1].

Suggested change
byte[] result = new byte[1]; // reserve the empty string
byte[] result = new Fingerprint().digestAndReset();

Copy link
Member

@meteorcloudy meteorcloudy left a comment

Choose a reason for hiding this comment

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

Thanks!

@meteorcloudy meteorcloudy added this pull request to the merge queue Jan 8, 2026
Merged via the queue into bazelbuild:release-9.0.0 with commit c816098 Jan 8, 2026
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jan 8, 2026
@Wyverald
Copy link
Member

Wyverald commented Jan 8, 2026

For future reference, could you give some details on why this was reverted (ideally in the PR description pre-merge, but too late for that now)? I'm assuming some discussion took place somewhere; a link would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions team-Performance Issues for Performance teams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants