A small HTTP handler accepts a status confirmation request and stores the result in memory. The behavior needs to be fixed so that requests complete correctly when the context is canceled and do not leave extra background activity.
POST /status/ack handler accepts JSON of the form { "id": "A-1", "status": "done" }.id is empty, it must return 400 Bad Request and a JSON error.Store.Save(ctx, item) and must respect context cancellation.Store; access to shared state must be safe.id.id does not create a new record.Go 1.24; standard library; run go test ./...; assume a concurrent HTTP server and safe goroutine usage only with explicit synchronization
Use line comments to explain the problem, its impact, the fix and how to test it.