Chunked extraction worker
Parent issue: #550
Blocker issue: #627, #628, #629
The extraction endpoints (#629) queue a job but leave the worker stubbed. This issue builds the real worker: take a queued extraction job and produce a validated contract and a draft incident.
The worker needs to break the input into chunks, run them through the model where a model call is needed and compute the rest directly, validate each result and retry once before marking a chunk failed, then stitch everything into one contract, create the draft incident, and mark the extraction completed. It also has to hold up when a chunk fails outright or Ollama is down.
Tests should run with the model mocked and cover the happy path, a per-chunk retry, and a failure path.
Contract reference
contracts/schemas/incident-contract.yaml
contracts/schemas/extraction-record.yaml
Chunked extraction worker
Parent issue: #550
Blocker issue: #627, #628, #629
The extraction endpoints (#629) queue a job but leave the worker stubbed. This issue builds the real worker: take a queued extraction job and produce a validated contract and a draft incident.
The worker needs to break the input into chunks, run them through the model where a model call is needed and compute the rest directly, validate each result and retry once before marking a chunk failed, then stitch everything into one contract, create the draft incident, and mark the extraction completed. It also has to hold up when a chunk fails outright or Ollama is down.
Tests should run with the model mocked and cover the happy path, a per-chunk retry, and a failure path.
Contract reference
contracts/schemas/incident-contract.yamlcontracts/schemas/extraction-record.yaml