bazelbuild / bazelbuild/remote-apis

Add "primary output" to RequestMetadata

Open
#349 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
445
Forks
141
PR merge metrics
No merged PRs in 30d

Description

In Bazel, there are many cases where a combination of ` + - ` is not sufficient to identify an action.

For example, given a cc_library target with a lot of source files

```python
cc_library(
name = "foo",
srcs = [
"foo1.cc",
"foo2.cc",
"foo3.cc",
],
hdrs = ["foo.h"],
)
```

Then there will be 3 separate CcCompile actions with the identical combination above.
This is unfortunate because our `RequestMetadata` message is mapping to that exact combination and therefore, makes it challenging for servers to differentiate `ByteStream.Write` requests that were made for `CcCompile(foo1.cc)` and `CcCompile(foo2.cc)`.

The solution for this, unfortunately, is to add another field to RequestMetadata:

```protobuf
--- a/proto/remote_execution.proto
+++ b/proto/remote_execution.proto
@@ -2486,6 +2486,10 @@ message RequestMetadata {
// or equality across invocations, though some client tools may offer these guarantees.
string configuration_id = 7;

+ // An identifier for the expected set of outputs which are produced by this action.
+ // e.g. the first entry among the [Command][build.bazel.remote.execution.v2.Command]'s output_paths.
+ string primary_output = 8;
+
```

This way, we can avoid breaking server/client relying on existing fields.

Contributor guide

Open the contributing guide

Research direction

Start in proto/remote_execution.proto at the RequestMetadata message and review the existing fields and compatibility comments. Add the proposed primary_output field with its documented meaning, then confirm the schema change preserves existing fields and numbering.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.