Repository navigation
Conversation
Summary: Restore resource-level local compilation avoidance without reusing bytecode containing stale final Android resource IDs. - Read generated R field metadata from the actual input jar without loading classes or running initializers. - Include descriptors, finality, and ConstantValue data for inlined IDs and styleable indexes; ignore runtime-only non-final values and array contents. - Preserve owner-class shape and other used classes, scope metadata keys to each jar, and use symmetric conservative fallback for incomplete/unsupported provenance. - Preserve independent dependency-level proof that a resource jar is unused. Missing usage information still keeps the jar required. This builds on the already merged KSP metadata-context fix (PR #49) and targets uber/android/8.8.0. Android must not enable the resource-level policy until both this change and the companion rules_kotlin field-provenance change are available. Test Plan: - ActionCacheCheckerTest: 87 cases, zero failures, including final-ID renumbering, styleable arrays/indexes, same-mtime replacements, missing metadata, mixed packages, unused jars, and tool-input invalidation controls. - Real Android/Robolectric replay on jbarr-j2k using locally built Bazel 8.8.0 and a local rules_kotlin release archive: the old Bazel reproduces stale string-ID and styleable-index failures. The candidate passes ten mutation/restore/no-op phases (20 real test executions); runtime-only array and unused-R-jar changes avoid Kotlin compilation. - Repeat all ten fixed phases with Java dependency reports materialized: 20/20 test executions pass. - Full-Helix incremental unused-string addition: class policy 1773.137s versus resource policy 1431.238s (19.282% faster); Kotlin workers 658 to 5 and KSP workers 477 to 4. This is one affected incremental build, not a clean-build/fleet estimate. Native binaries differ only by a resource-mode guard unreachable in class mode; the rules archive is identical. - Full-Helix combined configuration (resource-level tracking plus materialized Java jdeps): 1773.137s to 803.213s, saving 969.924s (54.701% of baseline wall time). Java workers 5659 to 6, Kotlin 658 to 5, and KSP 477 to 4. Restore 752.845s; no-op 24.685s with zero compiler workers. All phases and source/configuration/artifact/restoration audits pass. This is one first resource edit after a cache-restored seed on j2k, not a fleet/clean-build estimate; the KSP fix is held constant. Revert Plan: Return Android consumers to class-level invalidation before reverting this PR. Revert this PR, leaving the separate KSP context fix intact. No cache expunge or data migration is required.
Summary: - Use the same conservative class/full-jar representation on local cache PUT and GET when the global resource list includes fields absent from this input jar. - Avoid perpetual misses caused by storing class hashes but validating a partial field map. - Add repeated-hit controls for mixed resource packages and cache coverage for runtime arrays paired with inlined final indexes. Test Plan: - New mixed-package regression fails at the initial healthy-hit assertion in both UNUSED_RESOURCES and UNUSED_CLASSES_AND_RESOURCES before the fix. - Full ActionCacheCheckerTest class passes all 82 cases with symmetric fallback, including used-field removal, final-ID renumbering, same-mtime jar replacement and KSP tool invalidation. - Rebuilding the native Bazel candidate and rerunning the real Android/Robolectric ID-shift replay before the full-app recovery measurement. Revert Plan: Revert this change and keep resource-level avoidance disabled; the prior asymmetric fallback can repeatedly invalidate unchanged mixed-package consumers.
Summary: - Let successful dependency-path provenance keep truly unused R jars out of resource-mode fingerprints, without dropping explicit or unknown inputs. - Cover all three policies and preserve conservative no-usage-info behavior. Test Plan: The regression fails in both resource modes before the guard removal and passes in class-only mode. The corrected ActionCacheCheckerTest suite executes 87 cases with no failures on the isolated j2k bootstrap base. Revert Plan: Revert this commit; unused R jars will conservatively re-enter resource-mode fingerprints, reducing compilation avoidance without enabling stale IDs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restore resource-level compilation avoidance without reusing bytecode containing stale final Android resource IDs.
This targets
uber/android/8.8.0and builds on the already merged KSP metadata-context fix (#49).Rollout requirement: Android must select both this Bazel fix and the companion rules_kotlin field-provenance fix before enabling resource-level invalidation.
Test Plan
Completed local validation:
ActionCacheCheckerTest: 87/87 cases pass, covering final-ID renumbering, styleable arrays/indexes, same-mtime replacements, incomplete metadata, mixed packages, unused jars, and tool-input invalidation.jbarr-j2k: the old Bazel reproduces stale final string-ID and styleable-index failures. Fixed Bazel plus the local rules_kotlin archive passes ten mutation/restore/no-op phases, totaling 20 real test executions.--noexperimental_inmemory_jdeps_files: 803.213s; Javac workers 5659 → 6.The 54.7% result requires both fork fixes and the consumer Java-jdeps setting; it is not attributable to this PR alone. This is one affected incremental edit, not a clean-build or fleet-wide estimate. The KSP fix was held constant.
Revert Plan
Return Android consumers to class-level invalidation before reverting this PR.
Revert this resource-tracking change while retaining the separate KSP metadata-context fix. No cache expunge or data migration is required.