Skip to content

Commit 5318a41

Browse files
committed
config: remove fields not documented in config/README.md
Summary: Intent: - This branch builds on #190 (config: update fields, defaults, and required checks to match README), which aligned names/defaults/required-ness with config/README.md but left several fields that the README doesn't document at all. This removes them so the Go structs match the documented surface exactly. Changes: - Removed RepositoryConfig.FullHashRepos, ExcludedFiles, ExcludeExternalTargets, and StreamBazelLogs, and ServiceConfig.WorkerRootPath. - These fields drove real behavior, so this is a narrow behavior change, not just a doc cleanup: graphrunner/native.go now always includes external targets in the Bazel query and no longer applies a repo-level full-hash or excluded-file list (per-request excludes via RequestOptions still work), orchestrator/native_orchestrator.go no longer streams Bazel logs, and example/main.go derives the worker checkout path as workspaces_root/.workers instead of reading a separate config field. - Updated config/config_test.go and the YAML fixtures (example/tango-config.yaml, orchestrator/testdata/config.yaml, integration/testdata/tango-config.yaml.tmpl) to drop the removed keys. --- <sub>Generated by the 🪄 [pr-create](https://sg.uberinternal.com/code.uber.internal/uber-code/devexp-agent-marketplace/-/blob/claude-code/plugins/dev/uber-dev/skills/pr-create/SKILL.md) skill in devexp-agent-marketplace</sub>
1 parent 4c78c65 commit 5318a41

10 files changed

Lines changed: 8 additions & 58 deletions

File tree

config/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package config
1717
import (
1818
"fmt"
1919
"os"
20-
"path/filepath"
2120

2221
yaml "github.com/goccy/go-yaml"
2322
)
@@ -72,9 +71,6 @@ func Parse(configFilePath string) (*Config, error) {
7271
if config.Service.WorkspacesRoot == "" {
7372
return nil, fmt.Errorf("service.workspaces_root must be set")
7473
}
75-
if config.Service.WorkerRootPath == "" {
76-
config.Service.WorkerRootPath = filepath.Join(config.Service.WorkspacesRoot, ".workers")
77-
}
7874
if config.Service.MaxWorkerPoolSize <= 0 {
7975
return nil, fmt.Errorf("service.max_worker_pool_size must be > 0, got %d", config.Service.MaxWorkerPoolSize)
8076
}

config/config_test.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,16 @@ func TestParse_ServiceDefaults(t *testing.T) {
7474
tests := []struct {
7575
name string
7676
give string
77-
wantWorkerRootPath string
7877
wantMaxNumTargets int
7978
wantMaxNumChangedTargets int
8079
wantMaxNumMetadataEntries int
8180
}{
8281
{
83-
name: "worker_root_path and streaming default when unset",
82+
name: "streaming defaults when unset",
8483
give: _baseServiceYAML + `
8584
repository:
8685
- remote: "r1"
8786
`,
88-
wantWorkerRootPath: filepath.Join("/tmp/x", ".workers"),
89-
wantMaxNumTargets: _defaultMaxNumTargets,
90-
wantMaxNumChangedTargets: _defaultMaxNumChangedTargets,
91-
wantMaxNumMetadataEntries: _defaultMaxNumMetadataEntries,
92-
},
93-
{
94-
name: "worker_root_path explicit value preserved",
95-
give: `
96-
service:
97-
workspaces_root: "/tmp/x"
98-
worker_root_path: "/tmp/custom-workers"
99-
max_worker_pool_size: 1
100-
repository:
101-
- remote: "r1"
102-
`,
103-
wantWorkerRootPath: "/tmp/custom-workers",
10487
wantMaxNumTargets: _defaultMaxNumTargets,
10588
wantMaxNumChangedTargets: _defaultMaxNumChangedTargets,
10689
wantMaxNumMetadataEntries: _defaultMaxNumMetadataEntries,
@@ -115,7 +98,6 @@ repository:
11598
repository:
11699
- remote: "r1"
117100
`,
118-
wantWorkerRootPath: filepath.Join("/tmp/x", ".workers"),
119101
wantMaxNumTargets: 10,
120102
wantMaxNumChangedTargets: 20,
121103
wantMaxNumMetadataEntries: 30,
@@ -126,7 +108,6 @@ repository:
126108
t.Run(tt.name, func(t *testing.T) {
127109
cfg, err := Parse(writeConfig(t, tt.give))
128110
require.NoError(t, err)
129-
assert.Equal(t, tt.wantWorkerRootPath, cfg.Service.WorkerRootPath)
130111
assert.Equal(t, tt.wantMaxNumTargets, cfg.Service.Streaming.MaxNumTargets)
131112
assert.Equal(t, tt.wantMaxNumChangedTargets, cfg.Service.Streaming.MaxNumChangedTargets)
132113
assert.Equal(t, tt.wantMaxNumMetadataEntries, cfg.Service.Streaming.MaxNumMetadataEntries)

config/repository_config.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,19 @@ type RepositoryConfig struct {
2020
// this URL and uses it as the lookup key for per-repo settings. Must be
2121
// unique across all entries and match exactly what clients send in
2222
// BuildDescription.remote.
23-
Remote string `yaml:"remote"`
24-
FullHashRepos []string `yaml:"full_hash_repos"`
25-
ExcludedFiles []string `yaml:"excluded_files"`
26-
ExcludeExternalTargets bool `yaml:"exclude_external_targets"`
23+
Remote string `yaml:"remote"`
2724
// BzlmodEnabled indicates whether this repository uses Bzlmod for external
2825
// dependency management. Defaults to true if unset. Set to false only for
2926
// repositories still using WORKSPACE.
3027
BzlmodEnabled *bool `yaml:"bzlmod_enabled"`
3128
// BazelCommand overrides the Bazel binary path. When empty, Tango
3229
// automatically downloads and caches Bazelisk from GitHub.
3330
BazelCommand string `yaml:"bazel_command"`
34-
// QueryTimeoutSeconds is the Bazel query timeout in seconds. Defaults to 600.
35-
QueryTimeoutSeconds int64 `yaml:"query_timeout_seconds"`
3631
// BazelExtraArgs are extra arguments passed to `bazel query` invocations,
3732
// inserted between the `query` subcommand and the query expression.
38-
BazelExtraArgs []string `yaml:"bazel_extra_args"`
39-
StreamBazelLogs bool `yaml:"stream_bazel_logs"`
33+
BazelExtraArgs []string `yaml:"bazel_extra_args"`
34+
// QueryTimeoutSeconds is the Bazel query timeout in seconds. Defaults to 600.
35+
QueryTimeoutSeconds int64 `yaml:"query_timeout_seconds"`
4036
}
4137

4238
// RepositoryConfigProvider looks up per-repository configuration by remote.

config/service_config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ type ServiceConfig struct {
2525
// origin clones and <workspaces_root>/.workers/<repo>/worker-{1..N}/ for
2626
// worker checkouts.
2727
WorkspacesRoot string `yaml:"workspaces_root"`
28-
WorkerRootPath string `yaml:"worker_root_path"` // root directory for worker workspace checkouts; defaults to workspaces_root/.workers
29-
Streaming ChunkConfig `yaml:"streaming"` // streaming chunk sizes; zero values fall back to package defaults
28+
Streaming ChunkConfig `yaml:"streaming"` // streaming chunk sizes; zero values fall back to package defaults
3029
}
3130

3231
// ChunkConfig controls the number of entries per gRPC stream message.

example/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func run() error {
7272

7373
// Repo manager and orchestrator
7474
repoManagerClonePath := cfg.Service.WorkspacesRoot
75-
workerRootPath := cfg.Service.WorkerRootPath
75+
workerRootPath := filepath.Join(repoManagerClonePath, ".workers")
7676
if err := os.MkdirAll(repoManagerClonePath, 0o755); err != nil {
7777
return fmt.Errorf("failed to create repo manager clone path: %w", err)
7878
}

example/tango-config.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ storage:
99
# Repository configuration
1010
repository:
1111
- remote: "https://github.com/uber/tango.git"
12-
full_hash_repos:
13-
- ""
14-
excluded_files:
15-
- "^@@?bazel_tools/"
16-
exclude_external_targets: true
1712
bzlmod_enabled: true
1813
query_timeout_seconds: 300
1914

@@ -22,5 +17,3 @@ service:
2217
max_worker_pool_size: 5
2318
# root for origin clones; required
2419
workspaces_root: "/tmp/tango-repo-manager"
25-
# root for worker checkouts; defaults to workspaces_root/.workers
26-
worker_root_path: "/tmp/tango/workers"

graphrunner/native.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ func NewNativeGraphRunner(p NativeGraphRunnerParams) GraphRunner {
5959

6060
func (g *nativeGraphRunner) Compute(ctx context.Context, ws workspace.Workspace) (targethasher.Result, error) {
6161
query := "//external:all-targets + deps(//...:all-targets)"
62-
if g.config.ExcludeExternalTargets {
63-
query = "deps(//...:all-targets)"
64-
}
6562
additionalArgs := append(
6663
[]string{"--order_output=no", "--proto:locations", "--noproto:default_values"},
6764
g.config.BazelExtraArgs...,
@@ -92,8 +89,7 @@ func (g *nativeGraphRunner) Compute(ctx context.Context, ws workspace.Workspace)
9289

9390
hashConfig := targethasher.HashConfig{
9491
KnownSourceHashes: knownSourceHashes,
95-
FullHashRepos: g.config.FullHashRepos,
96-
ExcludedRegex: append(g.config.ExcludedFiles, g.extraExcludedFiles...),
92+
ExcludedRegex: g.extraExcludedFiles,
9793
UseBzlmod: g.config.BzlmodEnabled == nil || *g.config.BzlmodEnabled,
9894
}
9995

integration/testdata/tango-config.yaml.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ repository:
77
{{- if .BazelCommand}}
88
bazel_command: {{.BazelCommand}}
99
{{- end}}
10-
full_hash_repos: [""]
11-
excluded_files: ["^@@?bazel_tools/"]
12-
exclude_external_targets: true
1310
bzlmod_enabled: true
1411
query_timeout_seconds: 600
1512

1613
service:
1714
max_worker_pool_size: 2
1815
workspaces_root: {{.ClonePath}}
19-
worker_root_path: {{.WorkerPath}}

orchestrator/native_orchestrator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ func (b *nativeOrchestrator) GetTargetGraph(ctx context.Context, param GetTarget
188188
Logger: b.logger,
189189
BazelCommand: repoCfg.BazelCommand,
190190
QueryTimeout: time.Duration(repoCfg.QueryTimeoutSeconds) * time.Second,
191-
StreamLogs: repoCfg.StreamBazelLogs,
192191
})
193192
if err != nil {
194193
return nil, fmt.Errorf("create bazel client: %w", err)

orchestrator/testdata/config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
repository:
22
- remote: "git@github:uber/tango"
3-
full_hash_repos:
4-
- "//"
5-
- "//external"
6-
excluded_files:
7-
- "*.gen.go"
8-
exclude_external_targets: true
93
bzlmod_enabled: true
104
query_timeout_seconds: 15
115

0 commit comments

Comments
 (0)