Skip to content

Releases: brokenbots/criteria-go-adapter-sdk

v0.5.3 — log-stream heartbeat survives an early Log return

Choose a tag to compare

@brokenbot brokenbot released this 30 Jul 00:55
425071c

Hardening

An adapter whose Log implementation returns early can no longer disable its own liveness heartbeat.

Previously the heartbeat ticker was scoped to the lifetime of the adapter's Log call (defer cancel()), so the natural "nothing to log" implementation — return nil — stopped the heartbeat before a single beat was sent. The host feeds its stall detector solely from log-stream heartbeats and arms it as soon as the stream starts, so such an adapter's sessions were falsely declared crashed after the 90s stall threshold. Honouring the protocol depended on an unwritten rule ("your Log must block until its context is cancelled") that nothing in the signature, docs, or tests communicated.

The SDK now scopes the heartbeat to the stream context, runs impl.Log concurrently, and holds the stream open until the host cancels it.

  • Adapters that return early from Log stay healthy.
  • Adapters that block on <-ctx.Done() are unaffected.
  • A non-nil error from Log still propagates immediately.
  • Heartbeats stop on stream-context cancellation, so genuine stall detection is intact.

Covered by TestLogEarlyReturnKeepsHeartbeats, TestLogBlockingReturnUnchanged, TestLogErrorPropagated, and TestLogHeartbeatsStopOnCancel.

Principle

Protocol-level liveness and stream lifetime are the SDK's responsibility, not the adapter author's. An author writing the most obvious implementation of an interface must not be able to produce an adapter that breaks the host.

For adapter authors

Bump github.com/brokenbots/criteria-go-adapter-sdk to v0.5.3 to pick this up.