Task · OPN-0072

Drain in-flight Zenarmor bulk handlers before pipeline shutdown

Description

Zenarmor Run returns after a fixed five-second graceful-shutdown timeout even though a bulk handler may still be running under the receiver 120-second request window. The pipeline then closes its queue; a late handler emit is accepted by the source wrapper, advances last_received and is silently discarded by the closed queue.

Acceptance Criteria

Definition of Done

Implementation Plan

Add a barrier-controlled handler regression, make graceful shutdown failure explicitly close active connections and wait for handlers to exit before Source.Run returns, and propagate an attributable shutdown error so the pipeline cannot report successful admission after queue closure.

Implementation Notes

Implemented at 2389ac3b. The barrier regression failed before the fix; the Zenarmor race suite and final just check passed.

Final Summary

Fixed at 2389ac3b. Shutdown gates new bulk-handler admission, force-closes active connections when grace expires, joins all admitted handlers, and returns an attributable deadline error without advancing freshness after closure. Focused race tests and final just check passed.

View the source file on GitHub