fix: add batch failure recovery to ContentService #55

Merged
Snider merged 1 commit from fix/batch-failure-recovery into main 2026-02-23 11:39:31 +00:00
Member

Summary

  • Adds per-batch JSON state file that persists progress after each article, enabling recovery from mid-run crashes
  • Adds maxRetries parameter to generateBatch() with per-article retry loop (default: 1 extra attempt)
  • Adds resumeBatch() method to re-process only failed/pending articles, skipping those already successfully generated
  • Adds loadBatchProgress() public method for inspecting saved state

Test plan

  • loadBatchProgress() returns null when no state file exists
  • State file is created and contains correct article statuses after generateBatch()
  • Second call to generateBatch() skips previously generated articles (no duplicate API calls)
  • resumeBatch() returns error when no prior state exists
  • resumeBatch() skips generated articles, retries failed/pending ones
  • maxRetries=2 calls provider up to 3 times before marking article failed

Closes #27

🤖 Generated with Claude Code

## Summary - Adds per-batch JSON state file that persists progress after each article, enabling recovery from mid-run crashes - Adds `maxRetries` parameter to `generateBatch()` with per-article retry loop (default: 1 extra attempt) - Adds `resumeBatch()` method to re-process only failed/pending articles, skipping those already successfully generated - Adds `loadBatchProgress()` public method for inspecting saved state ## Test plan - [ ] `loadBatchProgress()` returns null when no state file exists - [ ] State file is created and contains correct article statuses after `generateBatch()` - [ ] Second call to `generateBatch()` skips previously generated articles (no duplicate API calls) - [ ] `resumeBatch()` returns error when no prior state exists - [ ] `resumeBatch()` skips generated articles, retries failed/pending ones - [ ] `maxRetries=2` calls provider up to 3 times before marking article failed Closes #27 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Clotho added 1 commit 2026-02-23 11:20:17 +00:00
fix: add batch failure recovery to ContentService (#27)
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 1m24s
CI / PHP 8.4 (pull_request) Failing after 1m27s
78bdebcaaa
- Track progress in a per-batch JSON state file after each article so
  a mid-run crash leaves a recoverable checkpoint
- Add `maxRetries` parameter to generateBatch() with per-article retry
  loop (default: 1 extra attempt)
- Add `resumeBatch()` to re-process only failed/pending articles,
  skipping those already successfully generated in a prior run
- Add `loadBatchProgress()` public method for inspecting state
- State stores per-article status, attempt counts, error messages,
  and timestamps for full observability

Tests: 6 new scenarios covering state persistence, resume capability,
retry logic, and the no-state error case

Closes #27

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Snider merged commit 968cbcdd63 into main 2026-02-23 11:39:31 +00:00
Snider deleted branch fix/batch-failure-recovery 2026-02-23 11:39:31 +00:00
Sign in to join this conversation.
No description provided.