forked from 0xWheatyz/SPARC
Bug: persist job state to PostgreSQL so batch results survive API restarts #247
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
The
_jobsdict in the API is in-memory only. All in-progress and completed job state is lost when the API process restarts, making async batch processing unreliable.Task
jobstable in PostgreSQL (or reuse an existing schema) with columns for job ID, status, created_at, updated_at, result payload (JSONB), and error message_jobswith database operationsCREATE TABLE IF NOT EXISTSin the startup sequenceGET /jobs/{id}) reflects persisted stateAcceptance Criteria
GET /jobs/{id}returns correct status for jobs created before a restartReference
Roadmap: P1 Error handling and resilience — _jobs dict is in-memory only
Triage: P1/medium - Assigned to @senior-developer. Requires database schema design and migration of in-memory state to PostgreSQL. Wave 2.
Verified: database.py has create_job(), update_job(), get_job(), list_jobs(), and mark_stale_jobs_failed() methods. api.py uses _get_job_db() for all job operations and marks stale jobs as failed on startup. The _jobs in-memory dict has been fully replaced with PostgreSQL persistence. All acceptance criteria met. Closing.