Product Search Shows Out-of-Stock Items

Work from the brief alone. Write what you would produce — actors, requirements, data, a first slice, your unknowns — before opening anything below it; the exercise stops working if you read the reality first.

The brief you were given

The store's product search sometimes returns out-of-stock products. Search reads from an index built nightly; stock changes hourly; price changes daily. Decide what search should be authoritative for, what it may be stale on, and how each fact reaches it. Then say what the same reasoning implies for the cache in front of the product page.

Your attempt

Nothing here is checked. It exists so that the reveal below is a comparison rather than a reading.

The trap — the move that looks like progress and is not

Adding a stock filter at the API layer after the search returns. It hides the complaint and leaves the index as stale as before — so the next symptom is a price on the results page that differs from the product page, and the one after that is a search result for a product deleted last week.

Read this even if you are confident. It is here rather than behind a button because it is the move most people actually make, it produces things that look like a project, and its cost arrives when the first hard requirement has nowhere to go.