harden article generation reliability
Deployment Config CI / Deployment Config (push) Successful in 24s
Backend CI / Backend (push) Successful in 14m12s

This commit is contained in:
2026-05-05 23:43:10 +08:00
parent 3c912949e4
commit 65e9b7e293
24 changed files with 1259 additions and 52 deletions
@@ -31,6 +31,20 @@ func TestNormalizeGenerationTaskRecoveryConfigUsesGenerationDefaults(t *testing.
if cfg.MaxAttempts != 3 {
t.Fatalf("expected max attempts 3, got %d", cfg.MaxAttempts)
}
stateCheck := normalizeGenerationTaskStateCheckConfig(config.GenerationConfig{})
if stateCheck.Interval != 5*time.Minute {
t.Fatalf("expected state check interval 5m, got %s", stateCheck.Interval)
}
if stateCheck.Timeout != 10*time.Second {
t.Fatalf("expected state check timeout 10s, got %s", stateCheck.Timeout)
}
if stateCheck.BatchSize != 100 {
t.Fatalf("expected state check batch size 100, got %d", stateCheck.BatchSize)
}
if stateCheck.Lookback != 24*time.Hour {
t.Fatalf("expected state check lookback 24h, got %s", stateCheck.Lookback)
}
}
func TestNormalizeGenerationTaskRecoveryConfigKeepsOverrides(t *testing.T) {
@@ -52,6 +66,19 @@ func TestNormalizeGenerationTaskRecoveryConfigKeepsOverrides(t *testing.T) {
cfg.MaxAttempts != 5 {
t.Fatalf("unexpected recovery config: %#v", cfg)
}
stateCheck := normalizeGenerationTaskStateCheckConfig(config.GenerationConfig{
TaskStateCheckInterval: 9 * time.Minute,
TaskStateCheckTimeout: 11 * time.Second,
TaskStateCheckBatchSize: 13,
TaskStateCheckLookback: 2 * time.Hour,
})
if stateCheck.Interval != 9*time.Minute ||
stateCheck.Timeout != 11*time.Second ||
stateCheck.BatchSize != 13 ||
stateCheck.Lookback != 2*time.Hour {
t.Fatalf("unexpected state check config: %#v", stateCheck)
}
}
func TestGenerationWorkerOwnerIsBounded(t *testing.T) {