feat(refinery): implement merge execution with config and retry logic
Implements gt-3x1.3: Merge execution (merge, test, push)
Changes:
- Add MergeConfig struct with run_tests, test_command, delete_merged_branches,
push_retry_count, and push_retry_delay_ms configuration options
- Add DefaultMergeConfig() with sensible defaults (tests enabled, go test ./...,
branch cleanup, 3 retries with 1s base delay)
- Update ProcessMR to use MergeConfig for all settings
- Add pushWithRetry() with exponential backoff for transient failures
- Add gitOutput() helper to get command stdout (for merge commit SHA)
- Return merge commit SHA in MergeResult on success
- Conditional branch deletion based on config.DeleteMergedBranches
Configuration (in .gastown/config.json):
{
"merge_queue": {
"run_tests": true,
"test_command": "go test ./...",
"delete_merged_branches": true,
"push_retry_count": 3,
"push_retry_delay_ms": 1000
}
}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,6 +111,41 @@ const (
|
||||
)
|
||||
|
||||
|
||||
// MergeConfig contains configuration for the merge process.
|
||||
type MergeConfig struct {
|
||||
// RunTests controls whether tests are run after merge.
|
||||
// Default: true
|
||||
RunTests bool `json:"run_tests"`
|
||||
|
||||
// TestCommand is the command to run for testing.
|
||||
// Default: "go test ./..."
|
||||
TestCommand string `json:"test_command"`
|
||||
|
||||
// DeleteMergedBranches controls whether merged branches are deleted.
|
||||
// Default: true
|
||||
DeleteMergedBranches bool `json:"delete_merged_branches"`
|
||||
|
||||
// PushRetryCount is the number of times to retry a failed push.
|
||||
// Default: 3
|
||||
PushRetryCount int `json:"push_retry_count"`
|
||||
|
||||
// PushRetryDelayMs is the base delay between push retries in milliseconds.
|
||||
// Each retry doubles the delay (exponential backoff).
|
||||
// Default: 1000
|
||||
PushRetryDelayMs int `json:"push_retry_delay_ms"`
|
||||
}
|
||||
|
||||
// DefaultMergeConfig returns the default merge configuration.
|
||||
func DefaultMergeConfig() MergeConfig {
|
||||
return MergeConfig{
|
||||
RunTests: true,
|
||||
TestCommand: "go test ./...",
|
||||
DeleteMergedBranches: true,
|
||||
PushRetryCount: 3,
|
||||
PushRetryDelayMs: 1000,
|
||||
}
|
||||
}
|
||||
|
||||
// RefineryStats contains cumulative refinery statistics.
|
||||
type RefineryStats struct {
|
||||
// TotalMerged is the total number of successful merges.
|
||||
|
||||
Reference in New Issue
Block a user