Skip to content
Draft
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
10 changes: 10 additions & 0 deletions stovepipe/entity/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ go_library(
name = "go_default_library",
srcs = [
"build.go",
"build_analysis_config.go",
"build_issue.go",
"build_signal_config.go",
"get_issues_by_request_id.go",
"ingest.go",
"issue_log.go",
"issue_repair.go",
"issue_state.go",
"issue_summary.go",
"issue_track_config.go",
"issue_tracking_state.go",
"list.go",
"list_open_issues.go",
"open_issue.go",
"process_config.go",
"project_fact_by_degree.go",
"project_issue_attribution.go",
"project_issues.go",
Expand All @@ -32,6 +36,7 @@ go_library(
"request_issue_summary.go",
"request_log.go",
"request_summary.go",
"stage_config.go",
"validation_fact.go",
],
importpath = "github.com/uber/submitqueue/stovepipe/entity",
Expand All @@ -42,18 +47,23 @@ go_library(
go_test(
name = "go_default_test",
srcs = [
"build_analysis_config_test.go",
"build_signal_config_test.go",
"build_test.go",
"issue_log_test.go",
"issue_state_test.go",
"issue_summary_test.go",
"issue_track_config_test.go",
"issue_tracking_state_test.go",
"process_config_test.go",
"project_fact_by_degree_test.go",
"project_issue_attribution_test.go",
"queue_state_test.go",
"request_id_test.go",
"request_issue_summary_test.go",
"request_log_test.go",
"request_test.go",
"stage_config_test.go",
"validation_fact_test.go",
],
embed = [":go_default_library"],
Expand Down
32 changes: 32 additions & 0 deletions stovepipe/entity/build_analysis_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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 entity

import "fmt"

// BuildAnalysisConfig contains configuration for the build-analysis stage.
type BuildAnalysisConfig struct {
// PollDelayMs is the positive interval between successful analysis passes, in milliseconds.
PollDelayMs int64 `json:"poll_delay_ms" yaml:"poll_delay_ms"`
}

// Validate checks the build-analysis stage's configuration constraints.
func (c BuildAnalysisConfig) Validate() error {
if c.PollDelayMs <= 0 {
return fmt.Errorf("PollDelayMs must be positive, got %d", c.PollDelayMs)
}

return nil
}
39 changes: 39 additions & 0 deletions stovepipe/entity/build_analysis_config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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 entity

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestBuildAnalysisConfigValidate(t *testing.T) {
valid := BuildAnalysisConfig{
PollDelayMs: 10,
}

require.NoError(t, valid.Validate())

t.Run("PollDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.PollDelayMs = value

require.Error(t, cfg.Validate())
}
})

}
39 changes: 39 additions & 0 deletions stovepipe/entity/build_signal_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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 entity

import "fmt"

// BuildSignalConfig contains configuration for the build-signal stage.
type BuildSignalConfig struct {
// AcceptedPollDelayMs is the positive polling interval for accepted builds, in milliseconds.
AcceptedPollDelayMs int64 `json:"accepted_poll_delay_ms" yaml:"accepted_poll_delay_ms"`

// RunningPollDelayMs is the positive polling interval for running builds, in milliseconds.
RunningPollDelayMs int64 `json:"running_poll_delay_ms" yaml:"running_poll_delay_ms"`
}

// Validate checks the build-signal stage's configuration constraints.
func (c BuildSignalConfig) Validate() error {
if c.AcceptedPollDelayMs <= 0 {
return fmt.Errorf("AcceptedPollDelayMs must be positive, got %d", c.AcceptedPollDelayMs)
}

if c.RunningPollDelayMs <= 0 {
return fmt.Errorf("RunningPollDelayMs must be positive, got %d", c.RunningPollDelayMs)
}

return nil
}
49 changes: 49 additions & 0 deletions stovepipe/entity/build_signal_config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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 entity

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestBuildSignalConfigValidate(t *testing.T) {
valid := BuildSignalConfig{
AcceptedPollDelayMs: 10,
RunningPollDelayMs: 11,
}

require.NoError(t, valid.Validate())

t.Run("AcceptedPollDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.AcceptedPollDelayMs = value

require.Error(t, cfg.Validate())
}
})

t.Run("RunningPollDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.RunningPollDelayMs = value

require.Error(t, cfg.Validate())
}
})

}
39 changes: 39 additions & 0 deletions stovepipe/entity/issue_track_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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 entity

import "fmt"

// IssueTrackConfig contains configuration for the issue-tracking stage.
type IssueTrackConfig struct {
// RefreshDelayMs is the positive interval between refreshes, in milliseconds.
RefreshDelayMs int64 `json:"refresh_delay_ms" yaml:"refresh_delay_ms"`

// RecoveryWaitDelayMs is the positive wait during recovery, in milliseconds.
RecoveryWaitDelayMs int64 `json:"recovery_wait_delay_ms" yaml:"recovery_wait_delay_ms"`
}

// Validate checks the issue-tracking stage's configuration constraints.
func (c IssueTrackConfig) Validate() error {
if c.RefreshDelayMs <= 0 {
return fmt.Errorf("RefreshDelayMs must be positive, got %d", c.RefreshDelayMs)
}

if c.RecoveryWaitDelayMs <= 0 {
return fmt.Errorf("RecoveryWaitDelayMs must be positive, got %d", c.RecoveryWaitDelayMs)
}

return nil
}
49 changes: 49 additions & 0 deletions stovepipe/entity/issue_track_config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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 entity

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestIssueTrackConfigValidate(t *testing.T) {
valid := IssueTrackConfig{
RefreshDelayMs: 10,
RecoveryWaitDelayMs: 11,
}

require.NoError(t, valid.Validate())

t.Run("RefreshDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.RefreshDelayMs = value

require.Error(t, cfg.Validate())
}
})

t.Run("RecoveryWaitDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.RecoveryWaitDelayMs = value

require.Error(t, cfg.Validate())
}
})

}
39 changes: 39 additions & 0 deletions stovepipe/entity/process_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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 entity

import "fmt"

// ProcessConfig contains configuration for the process stage.
type ProcessConfig struct {
// MaxConcurrent is the positive concurrent validation limit.
MaxConcurrent int32 `json:"max_concurrent" yaml:"max_concurrent"`

// GateWaitDelayMs is the positive wait for admission, in milliseconds.
GateWaitDelayMs int64 `json:"gate_wait_delay_ms" yaml:"gate_wait_delay_ms"`
}

// Validate checks the process stage's configuration constraints.
func (c ProcessConfig) Validate() error {
if c.MaxConcurrent <= 0 {
return fmt.Errorf("MaxConcurrent must be positive, got %d", c.MaxConcurrent)
}

if c.GateWaitDelayMs <= 0 {
return fmt.Errorf("GateWaitDelayMs must be positive, got %d", c.GateWaitDelayMs)
}

return nil
}
49 changes: 49 additions & 0 deletions stovepipe/entity/process_config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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 entity

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestProcessConfigValidate(t *testing.T) {
valid := ProcessConfig{
MaxConcurrent: 10,
GateWaitDelayMs: 11,
}

require.NoError(t, valid.Validate())

t.Run("MaxConcurrent", func(t *testing.T) {
for _, value := range []int32{0, -1} {
cfg := valid
cfg.MaxConcurrent = value

require.Error(t, cfg.Validate())
}
})

t.Run("GateWaitDelayMs", func(t *testing.T) {
for _, value := range []int64{0, -1} {
cfg := valid
cfg.GateWaitDelayMs = value

require.Error(t, cfg.Validate())
}
})

}
Loading