write-results Specification
Purpose
Every create and every write of the api and the WorkManager answers the same way: success with the created id, or a gRPC failure with machine-readable details, so no caller can mistake a failure for success.
Requirements
Requirement: Creates Answer With the Id
A successful create SHALL answer with the item's id, generated or given: CreateWorker, ScheduleTrigger and CreateGroup SHALL each return {id}.
Scenario: Scheduling a trigger
- WHEN
ScheduleTriggersucceeds without a given id - THEN the answer SHALL carry the generated id, and
GetTriggerwith it SHALL return the trigger
Requirement: Failures Are gRPC Statuses With Details
A failed create or write SHALL answer with a non-OK gRPC status code, a message, and a google.rpc.ErrorInfo detail with a stable reason and, where it applies, the field or the resource concerned. A response message SHALL NOT carry a success flag or a status of its own; an OK status SHALL mean the call succeeded.
Scenario: A duplicate id
- WHEN
CreateWorkeris given an id that exists - THEN the call SHALL fail with
ALREADY_EXISTSand anErrorInfowith reasonID_EXISTSand the id
Scenario: A save the state store refuses
- WHEN
SaveStatefails in the state store - THEN the call SHALL fail with a non-OK status and an
ErrorInfo, and SHALL NOT answer OK withsuccess = false
Requirement: The api's Writes Follow the Rule
Publish, PublishEvents, SaveState, DeleteState, DeleteBulkState, ScheduleTrigger and DeleteTrigger SHALL drop StatusResponse from their responses and follow Failures Are gRPC Statuses With Details. The gateway's Invoke and InvokeJson SHALL keep their envelope, which reports the proxied call's outcome, and SHALL carry the backend's status and details in it.
Scenario: A publish without a topic
- WHEN
Publishis called without a topic - THEN the call SHALL fail with
INVALID_ARGUMENTand anErrorInfonaming the fieldtopic
Requirement: Partial Outcomes
A call that acts on several items SHALL answer OK only when every item succeeded. When some did not, it SHALL fail (ABORTED for a group deletion that remains deleting) and carry the per-item outcomes in its error details, so an incomplete result cannot be read as success.
Scenario: A group deletion with one failed member
- WHEN one member of a group cannot be deleted
- THEN
DeleteGroupSHALL fail withABORTED, and its details SHALL list every member as deleted, kept or failed with the reason