fix: accept zero retention limits, retire Store() for typed accessors
Phase 8 (PROJECT_REVIEW_PLAN.md 8.1): 0 in MaxLogFiles/MaxLogAgeDays now means "keep everything" end to end. runner.CleanupLogs already treated <= 0 as disabled; validateConfig, the Settings form, and loadOrCreateConfig's backfill were the only things making that state unreachable. Phase 9 (1.1, rolling up 1.2, 1.3, 7.3): added Service.Config() and Service.Paths(), copying under mu, and converted every UI site that read Service state through the raw *storage.Store returned by Store() (now removed). jobs_view's pause control is now driven by refreshView reading svc.Config().Paused on every event instead of only mirroring its own tap handler, which makes it an actual consumer of SchedulerStateChanged. mainwindow's event listener is a real type switch, and events.go's doc comment no longer claims a compiler exhaustiveness check Go doesn't have. Unexported the redundant SetAutostart/AutostartStatus package functions in platform/autostart now that only the Manager methods are used outside the package. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -503,11 +503,13 @@ func validateConfig(config domain.Config) error {
|
||||
if strings.TrimSpace(config.LogsDir) == "" {
|
||||
return errors.New("logs directory is required")
|
||||
}
|
||||
if config.MaxLogFiles <= 0 {
|
||||
return errors.New("max log files must be a positive number")
|
||||
// 0 means "keep everything" (see runner.CleanupLogs); only a negative count
|
||||
// is rejected, the same three-state shape as DefaultTimeoutSeconds below.
|
||||
if config.MaxLogFiles < 0 {
|
||||
return errors.New("max log files must be zero (unlimited) or a positive number")
|
||||
}
|
||||
if config.MaxLogAgeDays <= 0 {
|
||||
return errors.New("max log age days must be a positive number")
|
||||
if config.MaxLogAgeDays < 0 {
|
||||
return errors.New("max log age days must be zero (unlimited) or a positive number")
|
||||
}
|
||||
if config.ExecutionMode != domain.ExecutionModeParallel && config.ExecutionMode != domain.ExecutionModeSequential {
|
||||
return errors.New("execution mode must be 'parallel' or 'sequential'")
|
||||
|
||||
Reference in New Issue
Block a user