Skip to content

fix(query.deps): memoize provided labels rather than declared targets#3369

Merged
Tatskaari merged 1 commit intothought-machine:masterfrom
grantzvolsky:fix-query-deps
May 29, 2025
Merged

fix(query.deps): memoize provided labels rather than declared targets#3369
Tatskaari merged 1 commit intothought-machine:masterfrom
grantzvolsky:fix-query-deps

Conversation

@grantzvolsky
Copy link
Copy Markdown
Contributor

The plz query deps graph traversal previously memoized targets directly from DeclaredDependencies. This was problematic because a single declared dependency can provide different actual build labels (and therefore different actual dependencies) depending on the context of the target that requires it (via dep.ProvideFor(target)).

If a declared dependency target D was processed for a pareent P1, D would be marked as done. If another parent P2 also declared D as a dependency, and D.ProvideFor(P2) would have yielded additional build labels, these provisions for P2 would be skipped because D was already memoized.

The `plz query deps` graph traversal previously memoized targets directly from DeclaredDependencies. This was problematic because a single declared dependency can provide different actual build labels (and therefore different actual dependencies) depending on the context of the target that requires it (via `dep.ProvideFor(target)`).

If a declared dependency target `D` was processed for a pareent `P1`, `D` would be marked as done. If another parent `P2` also declared `D` as a dependency, and `D.ProvideFor(P2)` would have yielded additional build labels, these provisions for `P2` would be skipped because `D` was already memoized.
@toastwaffle toastwaffle requested a review from Tatskaari May 29, 2025 08:46
Copy link
Copy Markdown
Contributor

@Tatskaari Tatskaari left a comment

Choose a reason for hiding this comment

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

Ah yeah nice catch. I think this makes sense.

@Tatskaari Tatskaari merged commit 0e1002f into thought-machine:master May 29, 2025
13 checks passed
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.

2 participants