INTERNAL ENGINEERING CASE · NOT A CLIENT PROJECT

Do not tell a user “received” until the write succeeds.

An enquiry API wrote both a project record and an aggregate event. We added explicit checks for both database batch results and tested success, partial failure, and rejected input. This is a bounded reliability improvement, not a claim that an older data discrepancy was fully explained or recovered.

THE PROBLEM

A success message needs evidence from the database.

The endpoint stores a project enquiry and increments a daily submission count in one batch. A historical mismatch between the count and current records prompted a review. Its original cause remains unverified, so the improvement focused on a behavior we could test: never acknowledge a batch if either reported result is unsuccessful.

01

Check both writes

The API inspects the result count and each result's success flag before returning an accepted response.

02

Exercise failure paths

Automated tests inject a database exception and a batch with one failed result. Neither path may report the enquiry as received.

03

Reject unsafe input early

Tests also verify invalid and honeypot submissions do not call the database batch at all.

VERIFIED BEHAVIOR

Clear outcomes for the cases we tested.

  • Two successful results: acknowledge with a reference.
  • Exception or one failed result: return an error, not a false success.
  • Invalid or honeypot input: no database write attempted.

A SIMILAR ISSUE IN YOUR CODEBASE?

Bring one observable failure, not your whole repository.

Share a redacted error, reproduction steps, and the expected result. We can agree on a small fix, a regression check, and payment terms before any private code is exchanged.

Request a scoped fix