packages feed

shibuya-core-0.7.0.0: CHANGELOG.md

# Changelog

## 0.7.0.0 — 2026-06-05

### Breaking Changes

- `Envelope` gained a `headers :: !(Maybe Headers)` field carrying every
  message header the source broker delivered, in order and including
  duplicates. Direct constructions of `Envelope` must add the field.
  `Nothing` means the adapter does not surface headers; `Just []` means
  it does and the message had none. The new `Headers` type alias
  (`[(ByteString, ByteString)]`) is exported from `Shibuya.Core` and
  `Shibuya.Core.Types`. The W3C trace headers continue to appear in
  `traceContext` as before; they now also appear verbatim in `headers`.

## 0.6.0.0 — 2026-05-31

### Breaking Changes

- OpenTelemetry messaging spans now emit `messaging.operation.type =
  "process"` instead of the deprecated `messaging.operation = "process"`
  wire key. The Haskell constant `attrMessagingOperation` keeps the same
  name and now resolves to the current semantic-conventions key, so source
  imports continue to compile. Dashboards, alerts, and trace queries that
  filter on `messaging.operation` must be updated to
  `messaging.operation.type`.

### Other Changes

- Upgrade OpenTelemetry dependencies to the 1.0 ecosystem:
  `hs-opentelemetry-api ^>= 1.0`,
  `hs-opentelemetry-propagator-w3c ^>= 1.0`, and test-only
  `hs-opentelemetry-exporter-in-memory ^>= 1.0`.
- Move `hs-opentelemetry-semantic-conventions` to the latest Haskell
  generated package available with the 1.0 release, `^>= 1.40`, and source
  Shibuya's generic messaging keys from its typed exports.

## 0.5.0.0 — 2026-05-05

### Breaking Changes

- `Envelope` gained an `attributes :: !(HashMap Text Attribute)` field
  carrying adapter-supplied OpenTelemetry attributes for the per-message
  processing span. Direct constructions of `Envelope` must add the
  field; pass `Data.HashMap.Strict.empty` when the adapter has nothing
  to contribute (the common case). `Envelope`'s `NFData` instance is
  now hand-written rather than derived (because `Attribute` from
  `hs-opentelemetry-api` does not ship `NFData`); the strictness shape
  is unchanged for every other field.

### New Features

- `Shibuya.Runner.Supervised`'s `processOne` now applies
  `envelope.attributes` to its Consumer-kind span after setting the
  framework-default `messaging.*` attributes, so adapter-supplied
  keys override framework defaults of the same name. This lets
  broker-aware adapters (Kafka in particular) emit typed attributes
  (`messaging.kafka.destination.partition`,
  `messaging.kafka.message.offset`) and override the
  `messaging.system` default — without opening a second span. The
  per-record `Shibuya.Adapter.Kafka.Tracing.traced` wrapper that
  previously bolted these on can now be removed; see the audit
  document `docs/plans/9-otel-audit-findings.md` (Finding F1, P0)
  for the full motivation.
- `Shibuya.Telemetry.Propagation.currentTraceHeaders ::
  (Tracing :> es, IOE :> es) => Eff es (Maybe TraceHeaders)` looks
  up the currently-active OTel span (via thread-local context) and
  encodes its trace context as W3C headers, ready for an adapter
  to attach to an outgoing message. Returns `Nothing` when tracing
  is disabled or there is no active span. The intended call sites
  are adapter-side DLQ writes (so the failing-consumer's trace
  links to the resulting DLQ message) and ad-hoc producer paths.
  See the audit document `docs/plans/9-otel-audit-findings.md`
  (Findings F3 and F5).

## 0.4.0.0 — 2026-04-29

### Breaking Changes

- `Envelope` gained an `attempt :: !(Maybe Attempt)` field carrying the
  adapter's delivery counter (zero-indexed; `Nothing` if unknown). Direct
  constructions of `Envelope` must add the field. The new `Attempt`
  newtype is exported from `Shibuya.Core` and `Shibuya.Core.Types`.

### New Features

- New module `Shibuya.Core.Retry` providing `BackoffPolicy`, `Jitter`
  (`NoJitter`, `FullJitter`, `EqualJitter`), `defaultBackoffPolicy`, the
  pure evaluator `exponentialBackoffPure`, the effectful
  `exponentialBackoff`, and the handler convenience `retryWithBackoff`.
  Handlers can now compute exponentially-growing, jittered retry delays
  with a single call: `retryWithBackoff defaultBackoffPolicy
  ingested.envelope`. Pulls in `random ^>=1.2` as a new build-depends
  (already a transitive dep — ships with GHC). See the module haddock and
  the new `RetrySpec` test for usage patterns.
- A runnable end-to-end demonstration of the new API lives in the
  sibling [`shibuya-pgmq-adapter`](https://github.com/shinzui/shibuya-pgmq-adapter)
  repo at `shibuya-pgmq-example/`, exposed via the `backoff-demo`
  subcommand of `shibuya-pgmq-consumer`. The plan
  `docs/plans/8-demonstrate-backoff-end-to-end.md` records setup
  instructions and captured transcripts.

## 0.3.0.0 — 2026-04-24

Version bumped to track the shared release version. No user-visible
changes to `shibuya-core` itself.

## 0.2.0.0 — 2026-04-22

### Breaking Changes

- `Shibuya.Telemetry.Semantic`: rename `processMessageSpanName :: Text` to
  `processSpanName :: Text -> Text`. The span name is now built from the
  destination (processor id), yielding e.g. `"shibuya-consumer process"`, in
  line with the OpenTelemetry messaging-spans recommendation.
- `Shibuya.Telemetry.Semantic`: remove `attrMessagingDestinationPartitionId`
  (replaced by the Shibuya-specific `attrShibuyaPartition`).
- `Shibuya.Telemetry.Semantic`: remove `eventHandlerException`.

### New Features

- `Shibuya.Telemetry.Semantic`: add `attrMessagingOperation` and
  `attrShibuyaPartition` attribute keys. Messaging attribute keys are now
  sourced from the typed `AttributeKey` values exported by
  `OpenTelemetry.SemanticConventions`, so upstream renames surface as
  compile errors rather than silent wire-format drift.
- `Shibuya.Core.Types`: add `NFData` instances for `MessageId`, `Cursor`,
  and `Envelope a` (when `a` itself has an `NFData` instance). Benchmark
  authors no longer need to declare these as orphans.

## 0.1.0.0 — 2026-02-24

Initial release.

### New Features

- Multi-queue processing with `runApp` and `QueueProcessor` API
- Backpressure via bounded inbox
- AckHalt support to stop processing on halt decision
- Serial, Ahead, and Async concurrent processing modes
- Policy validation enforcement (StrictInOrder requires Serial)
- Graceful shutdown with configurable drain timeout
- NQE-based supervision via Master/Supervisor
- OpenTelemetry tracing integration with W3C trace context propagation
- Mock adapter for testing

### Bug Fixes

- Fix race conditions and incomplete cleanup in runner
- Fix data races in concurrent test handlers using atomicModifyIORef'

### Other Changes

- Consolidate error handling with unified error types
- Define own SupervisionStrategy type to decouple from NQE
- Use registerDelay for cleaner timeout handling
- Replace polling with STM blocking in waitApp