Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions stovepipe/controller/projectanalysis/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = ["projectanalysis.go"],
importpath = "github.com/uber/submitqueue/stovepipe/controller/projectanalysis",
visibility = ["//visibility:public"],
deps = [
"//platform/consumer:go_default_library",
"//stovepipe/core/projectissues:go_default_library",
"//stovepipe/core/requestlog:go_default_library",
"//stovepipe/extension/projectissues:go_default_library",
"//stovepipe/extension/projectstatus:go_default_library",
"//stovepipe/extension/storage:go_default_library",
"@com_github_uber_go_tally//:go_default_library",
"@org_uber_go_zap//:go_default_library",
],
)
69 changes: 69 additions & 0 deletions stovepipe/controller/projectanalysis/projectanalysis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) 2026 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package projectanalysis owns terminal project processing.
package projectanalysis

import (
"github.com/uber-go/tally"
"github.com/uber/submitqueue/platform/consumer"
projectissuescore "github.com/uber/submitqueue/stovepipe/core/projectissues"
"github.com/uber/submitqueue/stovepipe/core/requestlog"
"github.com/uber/submitqueue/stovepipe/extension/projectissues"
"github.com/uber/submitqueue/stovepipe/extension/projectstatus"
"github.com/uber/submitqueue/stovepipe/extension/storage"
"go.uber.org/zap"
)

type Controller struct {
logger *zap.SugaredLogger
scope tally.Scope
stores storage.Factory
requestLogMaterializer requestlog.Materializer
projectIssueMaterializer projectissuescore.Materializer
resolvers projectstatus.ResolverFactory
attributers projectissues.AttributerFactory
registry consumer.TopicRegistry
topicKey consumer.TopicKey
consumerGroup string
}

func NewController(
logger *zap.SugaredLogger,
scope tally.Scope,
stores storage.Factory,
requestLogMaterializer requestlog.Materializer,
resolvers projectstatus.ResolverFactory,
attributers projectissues.AttributerFactory,
registry consumer.TopicRegistry,
topicKey consumer.TopicKey,
consumerGroup string,
) *Controller {
return &Controller{
logger: logger.Named("projectanalysis_controller"),
scope: scope.SubScope("projectanalysis_controller"),
stores: stores,
requestLogMaterializer: requestLogMaterializer,
projectIssueMaterializer: projectissuescore.NewMaterializer(scope),
resolvers: resolvers,
attributers: attributers,
registry: registry,
topicKey: topicKey,
consumerGroup: consumerGroup,
}
}

func (c *Controller) Name() string { return "projectanalysis" }
func (c *Controller) TopicKey() consumer.TopicKey { return c.topicKey }
func (c *Controller) ConsumerGroup() string { return c.consumerGroup }
3 changes: 3 additions & 0 deletions stovepipe/core/messagequeue/messagequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ type (
// FixRequest identifies the build whose issues should be considered for repair.
FixRequest = protopb.FixRequest

// ProjectAnalysis requests project-status resolution and issue attribution.
ProjectAnalysis = protopb.ProjectAnalysis

// Record is the payload buildsignal publishes to the record stage once a
// build reaches a terminal status: the build id to record.
Record = protopb.Record
Expand Down
15 changes: 14 additions & 1 deletion stovepipe/core/messagequeue/messagequeue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestWireFormat(t *testing.T) {
// no topic_keys option names an unknown key.
func TestTopicKeysBindEveryTopicKey(t *testing.T) {
bound := map[string]int{}
for _, m := range []proto.Message{&ProcessRequest{}, &BuildRequest{}, &BuildSignal{}, &BuildAnalysis{}, &IssueTrack{}, &FixRequest{}, &Record{}} {
for _, m := range []proto.Message{&ProcessRequest{}, &BuildRequest{}, &BuildSignal{}, &BuildAnalysis{}, &IssueTrack{}, &FixRequest{}, &ProjectAnalysis{}, &Record{}} {
keys := TopicKeys(m)
require.NotEmpty(t, keys, "message must declare a non-empty topic_keys option")
for _, key := range keys {
Expand All @@ -95,6 +95,7 @@ func TestTopicKeysBindEveryTopicKey(t *testing.T) {
TopicKeyBuildAnalysis,
TopicKeyIssueTrack,
TopicKeyFix,
TopicKeyProjectAnalysis,
TopicKeyRecord,
}

Expand All @@ -108,6 +109,18 @@ func TestTopicKeysBindEveryTopicKey(t *testing.T) {
}
}

func TestProjectAnalysisRoundTrip(t *testing.T) {
request := &ProjectAnalysis{Id: "42", QueueName: "validation/main"}
data, err := Marshal(request)
require.NoError(t, err)

got := &ProjectAnalysis{}
require.NoError(t, Unmarshal(data, got))

assert.True(t, proto.Equal(request, got))
assert.JSONEq(t, `{"id":"42","queue_name":"validation/main"}`, string(data))
}

func TestBuildAnalysisRoundTrip(t *testing.T) {
analysis := &BuildAnalysis{Id: "build/42", QueueName: "validation/main"}
data, err := Marshal(analysis)
Expand Down
1 change: 1 addition & 0 deletions stovepipe/core/messagequeue/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports_files(
"fix.proto",
"issuetrack.proto",
"process.proto",
"projectanalysis.proto",
"record.proto",
],
visibility = ["//tool/proto:__pkg__"],
Expand Down
35 changes: 35 additions & 0 deletions stovepipe/core/messagequeue/proto/projectanalysis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) 2026 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package uber.stovepipe.messagequeue;

import "api/base/messagequeue/proto/messagequeue.proto";

option go_package = "github.com/uber/submitqueue/stovepipe/core/messagequeue/protopb";
option java_multiple_files = true;
option java_outer_classname = "ProjectAnalysisProto";
option java_package = "com.uber.submitqueue.stovepipe.messagequeue";

// ProjectAnalysis requests project-status resolution and issue attribution.
// Partitioned by request ID.
message ProjectAnalysis {
option (uber.base.messagequeue.topic_keys) = "projectanalysis";

// id is the canonical positive decimal request ID within the queue.
string id = 1;
// queue_name identifies the configured validation queue.
string queue_name = 2;
}
1 change: 1 addition & 0 deletions stovepipe/core/messagequeue/protopb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_library(
"fix.pb.go",
"issuetrack.pb.go",
"process.pb.go",
"projectanalysis.pb.go",
"record.pb.go",
],
importpath = "github.com/uber/submitqueue/stovepipe/core/messagequeue/protopb",
Expand Down
153 changes: 153 additions & 0 deletions stovepipe/core/messagequeue/protopb/projectanalysis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions stovepipe/core/messagequeue/topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const (
// TopicKeyFix carries build IDs for repair submission, partitioned by build ID.
TopicKeyFix TopicKey = "fix"

// TopicKeyProjectAnalysis queues requests for project-status resolution and issue attribution.
TopicKeyProjectAnalysis TopicKey = "projectanalysis"

// TopicKeyRecord carries a request whose build reached a terminal status from
// buildsignal to the record stage. The buildsignal controller publishes a
// Record (the request id) here once, and only once, a build reaches a
Expand Down
1 change: 1 addition & 0 deletions tool/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ go_proto_generated_files(
"//stovepipe/core/messagequeue/proto:fix.proto",
"//stovepipe/core/messagequeue/proto:issuetrack.proto",
"//stovepipe/core/messagequeue/proto:process.proto",
"//stovepipe/core/messagequeue/proto:projectanalysis.proto",
"//stovepipe/core/messagequeue/proto:record.proto",
],
gen_services = False,
Expand Down
Loading