feat(config): add merge_queue section to rig config schema

Add MergeQueueConfig struct and RigConfig type with:
- All merge queue settings (enabled, target_branch, on_conflict, etc.)
- Default values via DefaultMergeQueueConfig()
- Validation for on_conflict strategy and poll_interval duration
- Load/Save/Validate functions following existing config patterns
- Comprehensive tests for round-trip, custom config, and validation

Implements gt-h5n.8.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 00:29:40 -08:00
parent e799fe5491
commit 3f924234ad
3 changed files with 360 additions and 0 deletions

View File

@@ -43,3 +43,68 @@ const CurrentTownVersion = 1
// CurrentRigsVersion is the current schema version for RigsConfig.
const CurrentRigsVersion = 1
// CurrentRigConfigVersion is the current schema version for RigConfig.
const CurrentRigConfigVersion = 1
// RigConfig represents the per-rig configuration (rig/config.json).
type RigConfig struct {
Type string `json:"type"` // "rig"
Version int `json:"version"` // schema version
MergeQueue *MergeQueueConfig `json:"merge_queue,omitempty"` // merge queue settings
}
// MergeQueueConfig represents merge queue settings for a rig.
type MergeQueueConfig struct {
// Enabled controls whether the merge queue is active.
Enabled bool `json:"enabled"`
// TargetBranch is the default branch to merge into (usually "main").
TargetBranch string `json:"target_branch"`
// IntegrationBranches enables integration branch workflow for epics.
IntegrationBranches bool `json:"integration_branches"`
// OnConflict specifies conflict resolution strategy: "assign_back" or "auto_rebase".
OnConflict string `json:"on_conflict"`
// RunTests controls whether to run tests before merging.
RunTests bool `json:"run_tests"`
// TestCommand is the command to run for tests.
TestCommand string `json:"test_command,omitempty"`
// DeleteMergedBranches controls whether to delete branches after merging.
DeleteMergedBranches bool `json:"delete_merged_branches"`
// RetryFlakyTests is the number of times to retry flaky tests.
RetryFlakyTests int `json:"retry_flaky_tests"`
// PollInterval is how often to poll for new merge requests (e.g., "30s").
PollInterval string `json:"poll_interval"`
// MaxConcurrent is the maximum number of concurrent merges.
MaxConcurrent int `json:"max_concurrent"`
}
// OnConflict strategy constants.
const (
OnConflictAssignBack = "assign_back"
OnConflictAutoRebase = "auto_rebase"
)
// DefaultMergeQueueConfig returns a MergeQueueConfig with sensible defaults.
func DefaultMergeQueueConfig() *MergeQueueConfig {
return &MergeQueueConfig{
Enabled: true,
TargetBranch: "main",
IntegrationBranches: true,
OnConflict: OnConflictAssignBack,
RunTests: true,
TestCommand: "go test ./...",
DeleteMergedBranches: true,
RetryFlakyTests: 1,
PollInterval: "30s",
MaxConcurrent: 1,
}
}