P1.5: drop SuccessExitCodes field and exit-code flexibility
Remove the SuccessExitCodes field from domain.Job and every layer that read or wrote it: runner/exitcodes.go (deleted), runner.go runStateDetail simplified to 0=OK / non-zero=Failed, logfile.go, format.go, operations.go, store.go, job_dialog.go, and jobs_view.go. Tests updated accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,15 +50,6 @@ func DisplayArguments(arguments string) string {
|
||||
return strings.TrimSpace(arguments)
|
||||
}
|
||||
|
||||
// DisplaySuccessExitCodes formats a job's success exit codes for display:
|
||||
// "0" (the default) if empty, else the trimmed codes.
|
||||
func DisplaySuccessExitCodes(codes string) string {
|
||||
if strings.TrimSpace(codes) == "" {
|
||||
return "0"
|
||||
}
|
||||
return strings.TrimSpace(codes)
|
||||
}
|
||||
|
||||
// DisplayRunMode formats a job's execution mode: "Start only" or
|
||||
// "Wait for completion".
|
||||
func DisplayRunMode(job domain.Job) string {
|
||||
|
||||
@@ -68,15 +68,6 @@ func TestDisplayArguments(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisplaySuccessExitCodes(t *testing.T) {
|
||||
if got := DisplaySuccessExitCodes(" "); got != "0" {
|
||||
t.Errorf("empty codes = %q, want %q", got, "0")
|
||||
}
|
||||
if got := DisplaySuccessExitCodes(" 0,1 "); got != "0,1" {
|
||||
t.Errorf("codes = %q, want %q", got, "0,1")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisplayRunMode(t *testing.T) {
|
||||
if got := DisplayRunMode(domain.Job{StartOnly: true}); got != "Start only" {
|
||||
t.Errorf("start-only = %q, want %q", got, "Start only")
|
||||
|
||||
@@ -436,8 +436,6 @@ func runningOutput(job domain.Job, trigger string, started time.Time) string {
|
||||
builder.WriteString(job.Command + "\n\n")
|
||||
builder.WriteString("arguments:\n")
|
||||
builder.WriteString(runner.LogArguments(job.Arguments))
|
||||
builder.WriteString("\n\nsuccess_exit_codes:\n")
|
||||
builder.WriteString(runner.SuccessExitCodesText(job))
|
||||
builder.WriteString("\n\nstart_only:\n")
|
||||
builder.WriteString(fmt.Sprintf("%t", job.StartOnly))
|
||||
return builder.String()
|
||||
@@ -451,10 +449,6 @@ func normalizeJob(job *domain.Job) {
|
||||
job.Schedule = strings.TrimSpace(job.Schedule)
|
||||
job.Command = strings.TrimSpace(job.Command)
|
||||
job.Arguments = strings.TrimSpace(job.Arguments)
|
||||
job.SuccessExitCodes = strings.TrimSpace(job.SuccessExitCodes)
|
||||
if job.SuccessExitCodes == "" {
|
||||
job.SuccessExitCodes = "0"
|
||||
}
|
||||
}
|
||||
|
||||
// validateJob enforces the minimum executable definition: name, schedule, and
|
||||
|
||||
Reference in New Issue
Block a user