Skip to content

[9.1.0] Prevent template_ctx.run from using map_directory outputs as inputs.#29014

Closed
iancha1992 wants to merge 1 commit intobazelbuild:release-9.1.0from
iancha1992:cpe46bed702
Closed

[9.1.0] Prevent template_ctx.run from using map_directory outputs as inputs.#29014
iancha1992 wants to merge 1 commit intobazelbuild:release-9.1.0from
iancha1992:cpe46bed702

Conversation

@iancha1992
Copy link
Copy Markdown
Member

This has the following implications:

  • Internal actions (generated by template_ctx.run()) cannot take both subtrees and their parent tree artifacts as inputs, which might be problematic for remote execution as artifacts are "streamed" (potentially causing the same files from the subtree to be added twice).
  • Ensures encapsulation of the action graph generated by map_directory(). For example, internal actions generated within map_directory(implementation) themselves depending on the output directories of the same map_directory() breaks encapsulation.

PiperOrigin-RevId: 884538235
Change-Id: If6c8f4990dea353460de9bdde5f5abca61f8b5a8

Description

Motivation

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

Commit e46bed7

This has the following implications:
- Internal actions (generated by `template_ctx.run()`) cannot take both subtrees and their parent tree artifacts as inputs, which might be problematic for remote execution as artifacts are "streamed" (potentially causing the same files from the subtree to be added twice).
- Ensures encapsulation of the action graph generated by `map_directory()`. For example, internal actions generated within `map_directory(implementation)` themselves depending on the output directories of the same `map_directory()` breaks encapsulation.

PiperOrigin-RevId: 884538235
Change-Id: If6c8f4990dea353460de9bdde5f5abca61f8b5a8
@iancha1992 iancha1992 requested a review from a team as a code owner March 16, 2026 21:59
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Mar 16, 2026
@iancha1992 iancha1992 requested a review from tjgq March 16, 2026 22:00
@iancha1992 iancha1992 added team-Remote-Exec Issues and PRs for the Execution (Remote) team and removed team-Configurability platforms, toolchains, cquery, select(), config transitions labels Mar 16, 2026
@iancha1992 iancha1992 added this to the 9.1.0 release blockers milestone Mar 16, 2026
@iancha1992 iancha1992 enabled auto-merge March 16, 2026 22:00
iancha1992 referenced this pull request Mar 16, 2026
This has the following implications:
- Internal actions (generated by `template_ctx.run()`) cannot take both subtrees and their parent tree artifacts as inputs, which might be problematic for remote execution as artifacts are "streamed" (potentially causing the same files from the subtree to be added twice).
- Ensures encapsulation of the action graph generated by `map_directory()`. For example, internal actions generated within `map_directory(implementation)` themselves depending on the output directories of the same `map_directory()` breaks encapsulation.

PiperOrigin-RevId: 884538235
Change-Id: If6c8f4990dea353460de9bdde5f5abca61f8b5a8
@iancha1992
Copy link
Copy Markdown
Member Author

@tjgq @fmeum Could you please take a look at the CI errors?

@tjgq tjgq requested review from zhengwei143 and removed request for tjgq March 25, 2026 15:01
@zhengwei143 zhengwei143 self-assigned this Mar 25, 2026
@zhengwei143
Copy link
Copy Markdown
Contributor

I think we will need to cherrypick the following commits as well, notably (2) is a prior commit that this change is dependent on

  1. 195502f: Remove type restrictions for map_directory() arg additional_params
  2. 0c7a1bc: Add template_ctx.declare_subdirectory() API that allows template actions to declare output subdirectories within a parent output directory.

@tjgq
Copy link
Copy Markdown
Contributor

tjgq commented Mar 25, 2026

Let's not cherry-pick this, then. (I was under the impression that declare_subdirectory was already in 9.x; if it's not, then let's wait until someone requests a backport.)

@tjgq tjgq closed this Mar 25, 2026
auto-merge was automatically disabled March 25, 2026 16:11

Pull request was closed

@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 25, 2026
@iancha1992
Copy link
Copy Markdown
Member Author

@tjgq @zhengwei143 This one was actually requested by @fmeum. I've created #29097, which contains all three commits. Let's see if it passes.

@iancha1992 iancha1992 reopened this Mar 25, 2026
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Mar 25, 2026
@iancha1992 iancha1992 closed this Mar 25, 2026
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 25, 2026
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-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants