Files
ScadaBridge/tests
Joseph Doherty 8267ab8ffc fix(store-and-forward): immediate delivery never overtakes buffered rows of its lane (SF-1 follow-up, decision B)
SF-1 kept the retry sweep per-(category,target) FIFO, but a NEW message could
still be delivered inline while older rows of the same lane were buffered and
backing off: EnqueueAsync's immediate attempt, and the first attempt that
ExternalSystem.CachedCall / Database.CachedWrite make themselves before handing
a transient failure to S&F. A recovered target then received B before A, and
A's later retry overwrote B.

Now each of those paths first probes the lane (StoreAndForwardService.
LaneHasPendingAsync: SELECT EXISTS seek on the covering idx_sf_messages_lane,
pinned by an EXPLAIN QUERY PLAN test; fails open to the old behaviour). An
occupied lane gets no inline attempt: the message is buffered due-immediately
(LastAttemptAt null, deferToSweep) behind the older rows and the sweep delivers
in order. Empty lanes (or parked-only) are unchanged. Notify.Send already
deferred to the sweep. Return contract unchanged: handle/TrackedOperationId at
once, WasBuffered=true, tracking reads Pending.

Regression tests (fail before, pass after): service, CachedCall, CachedWrite;
plus lane-probe + query-plan storage tests. Component-StoreAndForward.md and
Component-ExternalSystemGateway.md updated.
2026-12-03 12:22:31 -05:00
..