Skip to content

Fix non-deterministic placeholder resource ID assignment in Placehold…#482

Open
oliviernotteghem wants to merge 1 commit intobazelbuild:mainfrom
oliviernotteghem:determinism
Open

Fix non-deterministic placeholder resource ID assignment in Placehold…#482
oliviernotteghem wants to merge 1 commit intobazelbuild:mainfrom
oliviernotteghem:determinism

Conversation

@oliviernotteghem
Copy link
Copy Markdown
Contributor

…erIdFieldInitializerBuilder

Summary:
Intent:

  • Fix non-deterministic placeholder resource ID assignment in R.java generation that caused remote cache misses and non-reproducible outputs across incremental builds.

Changes:

  • Replace LinkedHashMap with TreeMap for styleableAttrs and per-styleable attr maps, ensuring deterministic sorted iteration regardless of resource merge order.
  • Simplify assignAttrIds() by removing the inline/non-inline partition, which was itself non-deterministic (a side effect of first-come-first-served ReferenceResolver.shouldInline/markInlined semantics). All attrs are now assigned IDs in sorted order.

Test Plan:
Verified repeated builds of //apps/presidio/uberlite:bin_debug with remote cache disabled produce identical resources.jar outputs across multiple clean builds with Claude. USE_LOCAL_BAZEL=1 ./bazelw build uberlite builds successfully end-to-end.

Revert Plan:
Revert this PR via git revert <commit_sha>.

Jira Issues:


Generated by the 🪄 pr-create skill in devexp-agent-marketplace

…erIdFieldInitializerBuilder

Summary:
Intent:
- Fix non-deterministic placeholder resource ID assignment in R.java generation that caused remote cache misses and non-reproducible outputs across incremental builds.

Changes:
- Replace LinkedHashMap with TreeMap for styleableAttrs and per-styleable attr maps, ensuring deterministic sorted iteration regardless of resource merge order.
- Simplify assignAttrIds() by removing the inline/non-inline partition, which was itself non-deterministic (a side effect of first-come-first-served ReferenceResolver.shouldInline/markInlined semantics). All attrs are now assigned IDs in sorted order.

Test Plan:
Verified repeated builds of //apps/presidio/uberlite:bin_debug with remote cache disabled produce identical resources.jar outputs across multiple clean builds with Claude.
USE_LOCAL_BAZEL=1 ./bazelw build uberlite builds successfully end-to-end.

Revert Plan:
Revert this PR via `git revert <commit_sha>`.

Jira Issues:

---

<sub>Generated by the 🪄 [pr-create](https://sg.uberinternal.com/code.uber.internal/uber-code/devexp-agent-marketplace/-/blob/claude-code/plugins/dev/uber-dev/skills/pr-create/SKILL.md) skill in devexp-agent-marketplace</sub>
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