Skip to content

Commit 4c78ae2

Browse files
authored
Merge branch 'main' into preetam/speculation-entities
2 parents e178f70 + e00c689 commit 4c78ae2

44 files changed

Lines changed: 437 additions & 284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,21 @@ common --repository_cache=~/.cache/bazel-repo-cache
44
# Resolve protoc from a registered toolchain (toolchains_protoc provides a
55
# prebuilt binary) instead of compiling protoc from source. Introduced in Bazel 7.
66
common --incompatible_enable_proto_toolchain_resolution
7+
8+
# Hermetic execution: actions and tests run with a static environment instead
9+
# of inheriting the client's, so results are reproducible and cache correctly
10+
# across shells and machines.
11+
common --incompatible_strict_action_env
12+
13+
# Stricter sandbox: sandboxed actions get no network access by default (each
14+
# runs in its own network namespace with only a private loopback). Tests that
15+
# talk to the Docker daemon and connect to its published host ports opt back
16+
# in with tags = ["requires-network"].
17+
common --sandbox_default_allow_network=false
18+
19+
# Docker-based tests are hermetic (all inputs are declared Bazel data deps),
20+
# but a few environment knobs are deliberately passed through when set:
21+
# DOCKER_HOST selects a non-default Docker daemon; SKIP_CLEANUP=true keeps
22+
# containers running after a failure for inspection.
23+
test --test_env=DOCKER_HOST
24+
test --test_env=SKIP_CLEANUP

.github/workflows/rebase-stack.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ permissions:
8282
jobs:
8383
rebase-stack:
8484
name: Rebase Stack
85-
if: github.event.pull_request.merged == true
85+
# DISABLED: this workflow is turned off in favor of GitHub's native stacked
86+
# PR support. The file is kept (not removed) so it can be re-enabled by
87+
# restoring the condition below to `github.event.pull_request.merged == true`.
88+
if: false && github.event.pull_request.merged == true
8689
runs-on: ubuntu-latest
8790
# Scope the privileged PAT to a protected Environment restricted to `main`
8891
# so the secret cannot be used from any other ref/context.

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,12 @@ deps = [
304304
- **Avoid asserting on error messages** — assert on error type or check the error with `require.Error`, do not `assert.Contains(t, err.Error(), message)`
305305
- **No change detector tests** — don't assert on default values, internal structure, or implementation details that can change without affecting behavior. Test what the code *does*, not how it's constructed.
306306
- **No `time.Sleep` for synchronization** — use channels, callbacks, condition variables.
307+
- **No hardcoded test timeouts** — do not add timeouts to tests or synchronization helpers; rely on the upstream test runner's timeout (for example, Bazel's test timeout).
307308
- **Use testify**`assert`/`require` instead of `t.Fatal()`.
308309

309310
**Integration tests** use Docker Compose via `testutil.ComposeStack`:
310311
- Package naming: folder name as package (NOT `*_test` suffix)
311-
- Bazel: add `tags = ["integration"]` and `data = [...]` for compose/schema files
312+
- Bazel: add `tags = ["integration", "requires-network"]` and `data = [...]` for every input the test reads (compose file, schema dirs, Dockerfiles, Bazel-built `*_linux` service binaries). Tests are hermetic: never resolve the repo root — resolve inputs from runfiles via `testutil.Runfile` and stage docker build contexts with `testutil.WithBuildContext`.
312313
- Use `testutil.NewComposeStack()` with meaningful context (e.g., `"ext-storage-mysql"`)
313314

314315
See [doc/howto/TESTING.md](doc/howto/TESTING.md) for full testing guide.

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ build: ## Build all services and examples
6060
@$(BAZEL) build //...
6161
@echo "Build complete!"
6262

63-
# Build Linux binaries required for Docker containers
63+
# Build Linux binaries required for the local docker-compose flows (local-*).
64+
# Bazel-run integration/e2e tests do NOT need these: they build the service
65+
# binaries hermetically as data dependencies.
6466
build-all-linux: build-submitqueue-gateway-linux build-submitqueue-orchestrator-linux build-stovepipe-linux build-runway-linux ## Build all Linux binaries for Docker
6567
@echo "All Linux binaries ready for Docker"
6668

@@ -132,7 +134,7 @@ clean-proto: ## Clean generated proto files
132134
deps: tidy-go ## Download and tidy Go dependencies
133135
@echo "Dependencies installed!"
134136

135-
e2e-test: build-all-linux ## Run end-to-end tests (hermetic, auto-builds binaries; runs in parallel)
137+
e2e-test: ## Run end-to-end tests (hermetic; Bazel builds all inputs; runs in parallel)
136138
@echo "Running end-to-end tests (parallel)..."
137139
@$(BAZEL) test //test/e2e/... --test_output=errors
138140

@@ -147,7 +149,7 @@ gazelle: ## Update BUILD.bazel files
147149
@echo "Running Gazelle to update BUILD files..."
148150
@$(BAZEL) run //:gazelle
149151

150-
integration-test: build-all-linux ## Run all integration tests (auto-builds binaries; runs in parallel)
152+
integration-test: ## Run all integration tests (hermetic; Bazel builds all inputs; runs in parallel)
151153
@echo "Running all integration tests (parallel)..."
152154
@$(BAZEL) test //test/integration/... --test_output=errors
153155

@@ -159,11 +161,11 @@ integration-test-extensions: ## Run extension integration tests (runs in paralle
159161
@echo "Running extension integration tests (parallel)..."
160162
@$(BAZEL) test //test/integration/submitqueue/extension/... //test/integration/extension/... --test_output=errors
161163

162-
integration-test-submitqueue-gateway: build-submitqueue-gateway-linux ## Run Gateway integration tests (auto-builds binary)
164+
integration-test-submitqueue-gateway: ## Run Gateway integration tests
163165
@echo "Running Gateway integration tests..."
164166
@$(BAZEL) test //test/integration/submitqueue/gateway:go_default_test --test_output=streamed
165167

166-
integration-test-submitqueue-orchestrator: build-submitqueue-orchestrator-linux ## Run Orchestrator integration tests (auto-builds binary)
168+
integration-test-submitqueue-orchestrator: ## Run Orchestrator integration tests
167169
@echo "Running Orchestrator integration tests..."
168170
@$(BAZEL) test //test/integration/submitqueue/orchestrator:go_default_test --test_output=streamed
169171

api/runway/messagequeue/merge_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ func TestMergeRequestRoundTrip(t *testing.T) {
3333
Steps: []*MergeStep{
3434
{
3535
StepId: "queue-a/1",
36-
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/1/0123456789abcdef0123456789abcdef01234567"}}},
36+
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/1/0123456789abcdef0123456789abcdef01234567"}},
3737
Strategy: strategypb.Strategy_REBASE,
3838
},
3939
{
4040
StepId: "queue-a/2",
41-
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}}},
41+
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}},
4242
Strategy: strategypb.Strategy_MERGE,
4343
},
4444
},

api/runway/messagequeue/proto/merge.proto

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ option java_multiple_files = true;
2525
option java_outer_classname = "MergeProto";
2626
option java_package = "com.uber.submitqueue.runway.messagequeue";
2727

28-
// MergeStep is one step of an ordered merge: a single set of change(s) applied
29-
// with a strategy. Runway applies the steps of a request in order on top of the
30-
// merge target; the ordering encodes the base-layering (earlier steps are the
31-
// in-flight base, the last step is the candidate).
28+
// MergeStep is one step of an ordered merge: a single change applied with a
29+
// strategy. Runway applies the steps of a request in order on top of the merge
30+
// target; the ordering encodes the base-layering (earlier steps are the
31+
// in-flight base, the last step is the candidate). A change may contain
32+
// multiple URIs (e.g. stacked PRs that land together).
3233
message MergeStep {
3334
// step_id is an opaque, caller-assigned identifier for this step. Runway
3435
// treats it as an attribution token only -- it echoes it back per-step in
3536
// StepResult so a multi-step result is attributable -- and never interprets
3637
// its contents.
3738
string step_id = 1;
38-
// changes are the code change(s) to apply for this step.
39-
repeated uber.base.change.Change changes = 2;
40-
// strategy is how this step's changes are integrated into the merge target.
39+
// change is the code change to apply for this step. A change may carry
40+
// multiple URIs when the step represents stacked or grouped changes.
41+
uber.base.change.Change change = 2;
42+
// strategy is how this step's change is integrated into the merge target.
4143
uber.base.mergestrategy.Strategy strategy = 3;
4244
}
4345

api/runway/messagequeue/protopb/merge.pb.go

Lines changed: 15 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/howto/TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ make e2e-test
6262

6363
# Build
6464
make build # Build all targets
65-
make build-all-linux # Build Linux binaries for Docker
65+
make build-all-linux # Build Linux binaries for the local docker-compose flows (tests build their own)
6666
```
6767

6868
### Testing Levels

runway/extension/merger/noop/noop_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ func testRequest() *runwaymq.MergeRequest {
3333
Steps: []*runwaymq.MergeStep{
3434
{
3535
StepId: "queue-a/1",
36-
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/1/abcdef0123456789abcdef0123456789abcdef01"}}},
36+
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/1/abcdef0123456789abcdef0123456789abcdef01"}},
3737
Strategy: strategypb.Strategy_REBASE,
3838
},
3939
{
4040
StepId: "queue-a/2",
41-
Changes: []*changepb.Change{{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}}},
41+
Change: &changepb.Change{Uris: []string{"github://github.example.com/uber/repo/pull/2/89abcdef0123456789abcdef0123456789abcdef"}},
4242
Strategy: strategypb.Strategy_MERGE,
4343
},
4444
},

service/runway/server/BUILD.bazel

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
load("@rules_go//go:def.bzl", "go_binary", "go_library")
1+
load("@rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library")
2+
3+
exports_files(
4+
[
5+
"Dockerfile",
6+
"docker-compose.yml",
7+
],
8+
visibility = ["//visibility:public"],
9+
)
210

311
go_library(
412
name = "go_default_library",
@@ -32,3 +40,13 @@ go_binary(
3240
embed = [":go_default_library"],
3341
visibility = ["//visibility:public"],
3442
)
43+
44+
# Linux binary consumed by the Docker image build. Docker-based tests depend on
45+
# this target as data so Bazel builds the exact binary that ends up in the
46+
# container image — no pre-built .docker-bin artifacts required.
47+
go_cross_binary(
48+
name = "runway_linux",
49+
platform = "@rules_go//go/toolchain:linux_amd64",
50+
target = ":runway",
51+
visibility = ["//visibility:public"],
52+
)

0 commit comments

Comments
 (0)