Repository navigation
Conversation
When two targets in one layer group provide the same tar, the normal planning path deduplicates it, but flatten_all did not. The plan then listed the tar twice, reported input_tar_count 2 while the group entry said 1, and double-counted known_input_size_bytes. The emitted layer was already correct because DefaultInfo uses a depset.
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.
When two targets in the same layer group provide the same tar (for example two
SizeHintInfowrappers around one file), the normal planning path deduplicates it, but theflatten_allpath built its file list from the rawgroup.files. The resultingoptimization_plan.jsonlisted the tar twice in the flattened layer, reportedsummary.input_tar_count: 2while the group entry said1, and double-countedknown_input_size_bytes. The emitted layer itself was already fine sinceDefaultInfogoes through a depset, so this only affects the plan.Repro on main, with
:heavy_aand:heavy_bboth wrapping the same 8 MiB tar in apackagesgroup andflatten_all = True:input_tar_count: 2known_input_size_bytes: 16777216input_tar_count: 1The fix applies the same
_deduplicatethe non-flatten path already uses. Cross-group duplicates still fail as before.Testing: added
flatten_all_plan_test, which reads the plan from the rule's write action. It fails on main ("Expected 1, but got 2") and passes with the change.bazel test //layers/tests:optimize_layers_test //inference/... //apt/...passes and buildifier format/lint is clean on the changed files. I couldn't run thepy_testtargets locally (they get killed in my sandbox on unmodified main too), and I didn't run the e2e modules, thoughe2e/rules_python/optimization_plan.jsonhas no duplicate inputs so its snapshot shouldn't change.