Skip to content

Commit 965a1b3

Browse files
committed
feat(stovepipe): define the repair executor extension
Summary: Add RepairExecutor.Submit accepting an existing Build. Define queue-scoped factory resolution and submission acceptance/error semantics, with generated mocks and Bazel targets. Extract this independently landable contract from the broader design in #893 so provider adapters can implement it before the controller is enabled. Revert Plan: Revert this commit.
1 parent 210f9d1 commit 965a1b3

6 files changed

Lines changed: 174 additions & 0 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ GO_GENERATE_PACKAGES := \
629629
./stovepipe/core/requestlog/... \
630630
./stovepipe/extension/buildissue/... \
631631
./stovepipe/extension/buildrunner/... \
632+
./stovepipe/extension/fixer/... \
632633
./stovepipe/extension/projectstatus/... \
633634
./stovepipe/extension/queueconfig/... \
634635
./stovepipe/extension/sourcecontrol/... \
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["fixer.go"],
6+
importpath = "github.com/uber/submitqueue/stovepipe/extension/fixer",
7+
visibility = ["//visibility:public"],
8+
deps = ["//stovepipe/entity:go_default_library"],
9+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Repair execution
2+
3+
[`RepairExecutor`](fixer.go) submits repair work for an existing [`Build`](../../entity/build.go). The executor selects which issues to repair and can invoke an in-process implementation or wrap an external provider.
4+
5+
`Submit` returns promptly with an opaque provider attempt ID, or an empty ID if no repair is needed. Acceptance does not establish recovery.
6+
7+
Each call may start an attempt. The caller owns first-failure selection and duplicate suppression. An error, including a timeout or cancellation, can occur after the provider accepted the work, so it must not cause an automatic resubmission. Implementations return plain dependency errors and must support concurrent calls.
8+
9+
`Factory.For` resolves an executor bound to `Config.QueueName`. Generated mocks are available in [`mock`](mock/fixer_mock.go).

‎stovepipe/extension/fixer/fixer.go‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright (c) 2026 Uber Technologies, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package fixer defines repair submission for a build.
16+
package fixer
17+
18+
//go:generate mockgen -source=fixer.go -destination=mock/fixer_mock.go -package=mock
19+
20+
import (
21+
"context"
22+
23+
"github.com/uber/submitqueue/stovepipe/entity"
24+
)
25+
26+
// RepairExecutor submits repair work for a build within a configured queue.
27+
// Implementations must be concurrency-safe and return promptly after submission.
28+
type RepairExecutor interface {
29+
// Submit returns an opaque provider attempt ID on acceptance, or empty if no repair
30+
// is needed. Acceptance does not establish recovery.
31+
// Repeated calls may start additional attempts. A plain error can follow acceptance,
32+
// including on context cancellation; callers must not automatically repeat Submit.
33+
Submit(context.Context, entity.Build) (string, error)
34+
}
35+
36+
// Config identifies the queue whose repair executor is requested.
37+
type Config struct {
38+
// QueueName identifies the validation queue.
39+
QueueName string
40+
}
41+
42+
// Factory resolves queue-bound executors; routing belongs to service wiring.
43+
type Factory interface {
44+
For(Config) (RepairExecutor, error)
45+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["fixer_mock.go"],
6+
importpath = "github.com/uber/submitqueue/stovepipe/extension/fixer/mock",
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//stovepipe/entity:go_default_library",
10+
"//stovepipe/extension/fixer:go_default_library",
11+
"@org_uber_go_mock//gomock:go_default_library",
12+
],
13+
)

‎stovepipe/extension/fixer/mock/fixer_mock.go‎

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

0 commit comments

Comments
 (0)