fleetd #551: record the delivery attempt before the irreversible send #569
Reference in New Issue
Block a user
Delete Branch "worker/551-record-before-send-7cbf56-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #551.
The Injector wrote the delivery outcome AFTER calling AgentControl.send(), so a HerdrException thrown from the response half of that call (herdr already replied, or may have) was recorded as a confident NOT_DELIVERED for text that may already be sitting in the worker's pane.
The entry is now polled off the queue and marked Pending.State.ATTEMPTED (new third state) BEFORE send() is called, not after. On success it is upgraded to DELIVERED; on an ordinary failure it stays ATTEMPTED (honest uncertainty); a herdr *_not_found error still writes NOT_DELIVERED, consistent with how the rest of the codebase already treats that error family as a confirmed absence.
cancellationOf gets a matching third answer (Cancellation.ATTEMPTED) instead of folding the new state into NOT_DELIVERED.
Out of scope, noticed while implementing: MessageService.send's timeout path (line ~973) checks injector.cancel(delivery) == Injector.Cancellation.DELIVERED only, collapsing the new ATTEMPTED (and CANCELLED/NOT_DELIVERED) into Outcome.TIMED_OUT_QUEUED, whose javadoc promises 'on every route it will not arrive later' -- which is no longer true for ATTEMPTED. Not fixed here; flagging for a follow-up ticket.
Build: mvn -o clean install, exit 0, Tests run: 1754, Failures: 0, Errors: 0 (baseline 1750 + 4 new tests), independent surefire sum agrees (1754), 130 report files (unchanged from baseline).