A review button is not enough to define an approval boundary. The application must also specify what the reviewer approved.
Here is a proposed acceptance-test scenario for a system that sends prepared messages.
The scenario
A fictional request contains:
- request_id: demo-01
- draft_version: 3
- approved_version: none
- state: NEEDS_REVIEW
Attempting to send it should fail. The system should preserve the draft and explain that approval is missing.
An authorized reviewer then approves version 3. A send attempt can proceed only if the current content is still version 3 and the other required checks pass.
The change case
Now edit the draft to version 4 before sending. The version-3 approval should not authorize the changed content.
Illustrative pseudocode, not production code:
if state != APPROVED:
block("Approval required")
elif approved_version != draft_version:
block("Draft changed; review required")
else:
continue_with_remaining_checks()
What this example leaves open
Authorization, concurrent updates, retries and duplicate sends require separate design. A production system needs an atomic way to apply its decision so the draft cannot change between checking and sending.
Start by writing the behavior you expect. Then choose an implementation that can preserve it.
What would invalidate approval in your workflow?
Juan Pablo Abadía Medina
Top comments (0)