Follow one uploaded PDF from acceptance to searchability. Derive the asynchronous boundary from the user’s requirement, preserve accepted work through a crash, and explain why durable waiting still needs enough processing capacity.
Begin with the product requirement
The product may acknowledge a durable upload before the document becomes searchable.
A user uploads a PDF so that search and chat can reference it later. The product allows two visible states: the upload is accepted, then the document becomes searchable. That permission is the reason we can consider background processing. A slow operation alone would not establish it. If the user needed the complete searchable result in this response, we would have a different request contract.
Follow document doc-456 and ingestion job ing-123 throughout the guide. The document is the stored input. The job is our responsibility to process that input. The request is only the HTTP interaction used to submit it. Those three lifetimes need not end together: the connection may close while the document and unfinished job remain.
We choose to track the ingestion until it reaches READY or FAILED. We have not promised that every PDF will succeed: a corrupt document may be impossible to process. We have promised that acknowledging responsibility will not silently discard its work. That is the shared correctness requirement, including in this first explanation.
Start without a queue
The baseline keeps the upload request open through every required processing stage.
The simplest path validates and stores the PDF, performs OCR, runs required checks, creates embeddings, updates the search index, and then responds. It can be a sensible first implementation when volume is low and those steps reliably fit the user’s wait. Avoid treating the absence of a broker as an automatic design flaw.
Synchronous does not mean that the server handles only one request at a time. It may process many uploads concurrently. Each request still waits for its own slowest stage.