Event contracts for the Labor Performance bounded context, in three directions:
warehouse.fulfillment.events) — the integration
contract this service consumes. Documented below in full; this is what
the original v1 of this file covered.warehouse.labor-performance.analytics) — the
ANALYTICS stream this service publishes its own domain events to,
feeding its own analytical data product's projector (ADR 0007). It is
consumed today only by this repo's own cmd/labor-projector; no other
service subscribes. Publishing is not optional: events are written to
a transactional outbox and drained onto Kafka by the relay inside
cmd/labor; EVENT_PUBLISHER=log is rejected at boot.warehouse.labor-performance.events) — this
service's Open-Host-Service topic for OTHER bounded contexts
(ADR 0013, widened by ADR 0038). Before this topic existed,
labor-performance was the fleet's only pure event sink: it consumed
TaskCompleted from fulfillment-execution but published nothing any
sibling service could subscribe to. TaskPerformanceRecorded is
published here so workforce-management (the first consumer) can build
an event-fed local cache instead of calling this service synchronously
over REST, and LaborStandardDefined / LaborStandardRevised (ADRThe three are deliberately separate topics so the integration contracts (inbound and outbound) and the analytical stream all evolve independently.
Unlike every other apis/asyncapi.yaml in this fleet (which document
only what a service PUBLISHES), this section describes what this
service SUBSCRIBES TO: it is a pure Kafka consumer of
fulfillment-execution's already-published TaskCompleted integration
event. This service has no REST or Go-import dependency on
fulfillment-execution — everything it needs (associate_id, task_id,
duration_seconds) already travels on the Kafka event (see the
bounded-context-boundary decision in ADR
0003-kafka-choreography-consumer-of-fulfillment-execution.md).
Every message on every channel below — inbound and outbound,
integration and analytics — is a CloudEvents 1.0 event in
structured content mode (Kafka message value =
application/cloudevents+json, Kafka header
content-type: application/cloudevents+json; charset=UTF-8). There is
no other envelope: the retired flat envelope is rejected by every
consumer (dead-lettered on warehouse.fulfillment.events, skipped with
a WARN on the analytics topic).
{
"specversion": "1.0",
"id": "4f1c2a7e-9d31-4a6b-8f0e-6b2c1d5e7a90",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.task.TaskCompleted",
"subject": "task-10231",
"time": "2026-08-29T22:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:TaskCompleted:v1",
"data": { ... }
}
All attributes are required. id is the de-duplication key this
service uses (the ProcessedEvents idempotency gate) — NOT task_id.
Consumers dispatch on the FULL type string and ignore unknown types.
dataschema distinguishes the integration (:events:) payload from
the analytics (:analytics:) payload of the same occurrence, which
share one type.
warehouse.fulfillment.events is the SAME topic wes-work-planning
already consumes from, under its own consumer group. This service uses
its own consumer group id (KAFKA_CONSUMER_GROUP env, REQUIRED:
the service refuses to boot without it), so both consumers see every message
independently. Only type == "com.warehouse.wes.fulfillment-execution.task.TaskCompleted" is acted on — every
other event type on this shared topic (there are none from
fulfillment-execution today, but the topic is shared/fan-out by
convention) is silently skipped, not an error.
task_type on the inbound wirefulfillment-execution's TaskCompleted carries task_type (its
ADR-0023). An unrecognized or absent value resolves to ""
(unclassified) via shared.ParseTaskTypeLenient, never a rejection.
associate_id and duration_seconds are the two fields added by
fulfillment-execution's feature/labor-performance-hooks change. Both
are optional on the wire (omitempty on the publisher's own struct):
an older payload that predates that enrichment simply omits them, and
this service's JSON unmarshaling already degrades those absent fields
to their Go zero values ("" / 0) — exactly the "no checked-in
occupant" / "unmeasurable duration" business facts this service's own
aggregate invariants already model, not an error.
Shared Kafka broker for warehouse-systems integration events. Locally, docker compose up -d --wait kafka in this repository provides one at localhost:9092.
The shared, fan-out topic owned by fulfillment-execution (its kafka.Topic constant). This service subscribes to it under its own consumer group and acts only on TaskCompleted messages.
Consume TaskCompleted events from fulfillment-execution.
Feeds each TaskCompleted message into the RecordTaskPerformance use case, which is idempotent on the CloudEvents id and resolves whichever LaborStandard was active for the task's type AS OF the CloudEvents time attribute (not "active right now"), so a possibly out-of-order or replayed message is scored against the standard genuinely in force when the task completed. Every other event type on this topic is silently skipped. A message that is not a valid CloudEvent, or whose handling still fails after 3 attempts (exponential backoff), is copied to warehouse.fulfillment.events.dlq (headers x-dlq-source-topic, x-dlq-error, x-dlq-failed-at added) and committed past. The consumer group is KAFKA_CONSUMER_GROUP (required, no default).
Available only on servers:
Accepts the following message:
A station finished a claimed task; fulfillment-execution's fact.
Raised by fulfillment-execution's Task aggregate when a station completes a claimed task. This service consumes it to record a TaskPerformance row scored against whatever LaborStandard was active for the task's type at completion time.
A PICK task completed by a checked-in associate, with a measurable duration.
{
"specversion": "1.0",
"id": "4f1c2a7e-9d31-4a6b-8f0e-6b2c1d5e7a90",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.task.TaskCompleted",
"subject": "task-10231",
"time": "2026-08-29T22:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:TaskCompleted:v1",
"data": {
"task_id": "task-10231",
"station_id": "station-7",
"work_unit_id": "order-88421-line-3",
"associate_id": "assoc-4471",
"duration_seconds": 52
}
}
A task completed at a station with no checked-in occupant (for example, a robot station). associate_id is omitted from the wire, not sent as an empty string.
{
"specversion": "1.0",
"id": "8a3d6c11-52b7-4f0d-9c14-3e7a5b8d2f46",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.task.TaskCompleted",
"subject": "task-10232",
"time": "2026-08-29T22:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:TaskCompleted:v1",
"data": {
"task_id": "task-10232",
"station_id": "station-robot-1",
"work_unit_id": "order-88422-line-1",
"duration_seconds": 40
}
}
A task claimed before fulfillment-execution's claim-timestamp migration, so no duration could be computed. duration_seconds is omitted from the wire, not sent as 0 — though this service treats an explicit 0 identically.
{
"specversion": "1.0",
"id": "c25b9f83-7e64-4a19-b8d2-0f5a3c6e1b47",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.task.TaskCompleted",
"subject": "task-10233",
"time": "2026-08-29T22:10:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:TaskCompleted:v1",
"data": {
"task_id": "task-10233",
"station_id": "station-3",
"work_unit_id": "order-88423-line-1",
"associate_id": "assoc-4472"
}
}
A CASE handle carrying the OPTIONAL handling_unit and weight_g (ADR 0035). fulfillment-execution's TaskCompleted v1 does not publish these fields today; this example shows what the consumer reads when a producer adds them.
{
"specversion": "1.0",
"id": "5b8e2d70-14c9-4a36-9d2f-7e0a4c6b1f83",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.task.TaskCompleted",
"subject": "task-10234",
"time": "2026-10-24T22:15:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:TaskCompleted:v1",
"data": {
"task_id": "task-10234",
"station_id": "station-3",
"work_unit_id": "order-88424-line-1",
"associate_id": "assoc-4472",
"duration_seconds": 75,
"task_type": "PICK",
"handling_unit": "CASE",
"weight_g": 20000
}
}
The dedicated ANALYTICS topic this service owns and publishes to, feeding its own analytical data product's projector (cmd/labor-projector). Separate from any integration topic so the analytical stream and the integration contract evolve independently (ADR 0007). Published through the transactional outbox relay; the log publisher is rejected at boot (EVENT_PUBLISHER=log).
Publish this service's own domain events for its analytical read model.
Emits LaborStandardDefined, LaborStandardRevised and TaskPerformanceRecorded onto the analytics topic as CloudEvents 1.0 events whose dataschema is urn:warehouse:labor-performance:analytics:<EventName>:v1. The message key is the TaskType, so every event folding into one report dimension lands on a single partition and is applied in publish order. The CloudEvents id is the projector's de-duplication key. This topic is consumed only by this repo's own projector; the standard events and TaskPerformanceRecorded are ALSO published on the integration topic warehouse.labor-performance.events for other contexts (ADR 0013, ADR 0038).
Available only on servers:
Accepts one of the following messages:
A TaskType had no active standard, and one was just defined.
Raised when DefineStandard creates the first engineered standard for a TaskType. The projector counts it into the (task_type, hour-of- effective_from) rollup row. The same occurrence is also published on the integration topic with the same data (LaborStandardDefinedIntegration, ADR 0038), under its own CloudEvents id.
The first PICK standard, 45 seconds.
{
"specversion": "1.0",
"id": "1b9e4c02-73a5-4d18-9e6f-2c8b0a4d7e35",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0001",
"time": "2026-09-05T09:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0001",
"task_type": "PICK",
"expected_seconds": 45,
"effective_from": "2026-09-05T09:00:00Z"
}
}
A first PICK standard declaring a 15s travel component.
{
"specversion": "1.0",
"id": "2c0f5d13-84b6-5e29-af70-3d9c1b5e8f46",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0003",
"time": "2026-09-05T09:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0003",
"task_type": "PICK",
"expected_seconds": 45,
"travel_component_seconds": 15,
"effective_from": "2026-09-05T09:05:00Z"
}
}
A CASE pick standard (ADR 0035) declaring a heavy-case team lift.
{
"specversion": "1.0",
"id": "3d1a6e24-95c7-4f3a-b081-4e0d2c6f9a57",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0004",
"time": "2026-10-24T08:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0004",
"task_type": "PICK",
"expected_seconds": 30,
"effective_from": "2026-10-24T08:00:00Z",
"handling_unit": "CASE",
"team_lift_threshold_g": 18000,
"team_lift_expected_seconds": 75
}
}
An active standard was closed and a new one started in its place.
Raised when DefineStandard is called for a TaskType that already has an active standard. History is append-only — the prior standard is closed, never overwritten (ADR 0004). A bucket with a non-zero revision count is one whose efficiency figures span two different yardsticks and are not directly comparable across the boundary. The same occurrence is also published on the integration topic with the same data (LaborStandardRevisedIntegration, ADR 0038).
The PICK standard tightened from 45s to 40s.
{
"specversion": "1.0",
"id": "6d2f81ba-4e07-4b93-a1c5-9f3e7d0b2648",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardRevised",
"subject": "std-0002",
"time": "2026-09-05T10:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardRevised:v1",
"data": {
"standard_id": "std-0002",
"task_type": "PICK",
"previous_expected_seconds": 45,
"expected_seconds": 40,
"effective_from": "2026-09-05T10:00:00Z"
}
}
One completed task was scored against the standard active at completion time.
Raised by RecordTaskPerformance for every consumed TaskCompleted.
efficiency_pct is NULLABLE and null is a real, expected value, not a missing field: it is null whenever the task could not be scored — no active standard for its TaskType at completion time, or a non-positive duration. Consumers MUST NOT coerce null to 0; doing so would report an unmeasurable task as a 0%-efficient one. The projector counts such an event toward its bucket's task count while excluding it from the mean.
completed_at is the BUSINESS time and is what the projector buckets on — distinct from the CloudEvents time attribute, which is the domain occurred-at and feeds only the freshness watermark. The two differ for any replayed or late-ingested event.
A task scored at 86.5% of standard, with a 90s idle gap before it.
{
"specversion": "1.0",
"id": "9c47e3d5-08b2-41fa-bd76-5a1e2c9f4830",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "assoc-4471",
"time": "2026-09-05T11:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10231",
"associate_id": "assoc-4471",
"task_type": "PICK",
"efficiency_pct": 86.5,
"actual_seconds": 52,
"idle_seconds_before": 90,
"completed_at": "2026-09-05T09:30:00Z"
}
}
A real, counted task that could not be scored: no task_type on the inbound wire (so no standard could be resolved) and no measurable duration. efficiency_pct is explicitly null.
{
"specversion": "1.0",
"id": "3e8a1f66-b204-47c9-8d51-7b0c6e2a9d14",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "task-10233",
"time": "2026-09-05T11:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10233",
"associate_id": "",
"task_type": "",
"efficiency_pct": null,
"actual_seconds": 0,
"idle_seconds_before": null,
"completed_at": "2026-09-05T09:45:00Z"
}
}
The dedicated ANALYTICS topic this service owns and publishes to, feeding its own analytical data product's projector (cmd/labor-projector). Separate from any integration topic so the analytical stream and the integration contract evolve independently (ADR 0007). Published through the transactional outbox relay; the log publisher is rejected at boot (EVENT_PUBLISHER=log).
Consumed by this repo's own cmd/labor-projector (the only subscriber).
Consumer group labor-performance-analytics, starting from the first offset. Dispatches on the full CloudEvents type and ignores unknown types. A message that is not a valid CloudEvent, or whose data cannot be decoded, is skipped with a WARN (no DLQ). Each event is de-duplicated on the CloudEvents id and applied in one unit of work with the de-duplication mark; any other failure is retried with exponential backoff (200ms up to 5s) without committing past the message.
Available only on servers:
Accepts one of the following messages:
A TaskType had no active standard, and one was just defined.
Raised when DefineStandard creates the first engineered standard for a TaskType. The projector counts it into the (task_type, hour-of- effective_from) rollup row. The same occurrence is also published on the integration topic with the same data (LaborStandardDefinedIntegration, ADR 0038), under its own CloudEvents id.
The first PICK standard, 45 seconds.
{
"specversion": "1.0",
"id": "1b9e4c02-73a5-4d18-9e6f-2c8b0a4d7e35",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0001",
"time": "2026-09-05T09:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0001",
"task_type": "PICK",
"expected_seconds": 45,
"effective_from": "2026-09-05T09:00:00Z"
}
}
A first PICK standard declaring a 15s travel component.
{
"specversion": "1.0",
"id": "2c0f5d13-84b6-5e29-af70-3d9c1b5e8f46",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0003",
"time": "2026-09-05T09:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0003",
"task_type": "PICK",
"expected_seconds": 45,
"travel_component_seconds": 15,
"effective_from": "2026-09-05T09:05:00Z"
}
}
A CASE pick standard (ADR 0035) declaring a heavy-case team lift.
{
"specversion": "1.0",
"id": "3d1a6e24-95c7-4f3a-b081-4e0d2c6f9a57",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0004",
"time": "2026-10-24T08:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0004",
"task_type": "PICK",
"expected_seconds": 30,
"effective_from": "2026-10-24T08:00:00Z",
"handling_unit": "CASE",
"team_lift_threshold_g": 18000,
"team_lift_expected_seconds": 75
}
}
An active standard was closed and a new one started in its place.
Raised when DefineStandard is called for a TaskType that already has an active standard. History is append-only — the prior standard is closed, never overwritten (ADR 0004). A bucket with a non-zero revision count is one whose efficiency figures span two different yardsticks and are not directly comparable across the boundary. The same occurrence is also published on the integration topic with the same data (LaborStandardRevisedIntegration, ADR 0038).
The PICK standard tightened from 45s to 40s.
{
"specversion": "1.0",
"id": "6d2f81ba-4e07-4b93-a1c5-9f3e7d0b2648",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardRevised",
"subject": "std-0002",
"time": "2026-09-05T10:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:LaborStandardRevised:v1",
"data": {
"standard_id": "std-0002",
"task_type": "PICK",
"previous_expected_seconds": 45,
"expected_seconds": 40,
"effective_from": "2026-09-05T10:00:00Z"
}
}
One completed task was scored against the standard active at completion time.
Raised by RecordTaskPerformance for every consumed TaskCompleted.
efficiency_pct is NULLABLE and null is a real, expected value, not a missing field: it is null whenever the task could not be scored — no active standard for its TaskType at completion time, or a non-positive duration. Consumers MUST NOT coerce null to 0; doing so would report an unmeasurable task as a 0%-efficient one. The projector counts such an event toward its bucket's task count while excluding it from the mean.
completed_at is the BUSINESS time and is what the projector buckets on — distinct from the CloudEvents time attribute, which is the domain occurred-at and feeds only the freshness watermark. The two differ for any replayed or late-ingested event.
A task scored at 86.5% of standard, with a 90s idle gap before it.
{
"specversion": "1.0",
"id": "9c47e3d5-08b2-41fa-bd76-5a1e2c9f4830",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "assoc-4471",
"time": "2026-09-05T11:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10231",
"associate_id": "assoc-4471",
"task_type": "PICK",
"efficiency_pct": 86.5,
"actual_seconds": 52,
"idle_seconds_before": 90,
"completed_at": "2026-09-05T09:30:00Z"
}
}
A real, counted task that could not be scored: no task_type on the inbound wire (so no standard could be resolved) and no measurable duration. efficiency_pct is explicitly null.
{
"specversion": "1.0",
"id": "3e8a1f66-b204-47c9-8d51-7b0c6e2a9d14",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "task-10233",
"time": "2026-09-05T11:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:analytics:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10233",
"associate_id": "",
"task_type": "",
"efficiency_pct": null,
"actual_seconds": 0,
"idle_seconds_before": null,
"completed_at": "2026-09-05T09:45:00Z"
}
}
The dedicated INTEGRATION topic this service owns and publishes to (ADR 0013) — its first Open-Host-Service Published Language for OTHER bounded contexts to consume. Separate from the analytics topic above (which feeds only this repo's own projector) so the two streams evolve independently. Before this topic existed, labor-performance was the fleet's only pure event sink: it consumed TaskCompleted from fulfillment-execution but published nothing any sibling service could subscribe to. Published through the transactional outbox relay; the log publisher is rejected at boot. The first consumer is workforce-management, whose event-fed local cache (laborperformancecache) already consumes this topic in place of a synchronous HTTP call; warehouse-planning (its ADR 0022) keeps a local copy of the standards from the two standard events (ADR 0038).
Publish TaskPerformanceRecorded and the standard events for other bounded contexts to consume.
Emits three types onto the integration topic as CloudEvents 1.0 events whose dataschema is urn:warehouse:labor-performance:events:<EventName>:v1. The CloudEvents id is the consumer's de-duplication key; consumers dispatch on the full type and ignore unknown types.
TaskPerformanceRecorded (ADR 0013): type com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded, subject = the associate id (the task id when there is no associate, since subject is never empty). The message key is the AssociateId — NOT the TaskType the analytics topic keys on — so every event for one associate lands on a single partition and is applied in publish order, which is what a per-associate read-cache consumer needs. A task with no checked-in associate (e.g. a robot station) is keyed on the empty string.
LaborStandardDefined / LaborStandardRevised (ADR 0038): the same type as on the analytics topic and the SAME data (field names and types unchanged), subject = the standard id, message key = the TaskType, so every revision of one task type stays in order. A consumer keeping a local copy applies them in publish order per task type.
Available only on servers:
Accepts one of the following messages:
One completed task was scored against the standard active at completion time — published for other bounded contexts (ADR 0013).
Raised by RecordTaskPerformance for every consumed TaskCompleted, the SAME domain event as the analytics stream's TaskPerformanceRecorded message, on a different topic and with the :events: dataschema. Partition key is AssociateId, not TaskType.
efficiency_pct is NULLABLE and null is a real, expected value: null whenever the task could not be scored — no active standard for its TaskType at completion time, or a non-positive duration. Consumers MUST NOT coerce null to 0.
completed_at is the BUSINESS time; the CloudEvents time attribute is the domain occurred-at (scoring) instant. The two differ for any replayed or late-ingested event.
A task scored at 91.2% of standard, with a 90s idle gap before it, published for a downstream consumer.
{
"specversion": "1.0",
"id": "7a2d5e91-3f04-4c8b-9e12-8b4a6d1c5f30",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "assoc-4471",
"time": "2026-09-05T11:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10231",
"associate_id": "assoc-4471",
"task_type": "PICK",
"efficiency_pct": 91.2,
"actual_seconds": 41,
"idle_seconds_before": 90,
"completed_at": "2026-09-05T09:30:00Z"
}
}
A real, counted task that could not be scored, on the integration topic. efficiency_pct is explicitly null.
{
"specversion": "1.0",
"id": "1c9f4b82-6e35-4a07-bd91-2f8e5c3a7d64",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "task-10233",
"time": "2026-09-05T11:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-10233",
"associate_id": "",
"task_type": "",
"efficiency_pct": null,
"actual_seconds": 0,
"idle_seconds_before": null,
"completed_at": "2026-09-05T09:45:00Z"
}
}
A CASE pick scored against the team-lift standard (ADR 0035): handling_unit and team_lift are present because the completion carried a handling unit.
{
"specversion": "1.0",
"id": "9e4b7c15-2a68-4d03-8f51-6c0a3b9d2e78",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded",
"subject": "assoc-4471",
"time": "2026-10-24T11:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:TaskPerformanceRecorded:v1",
"data": {
"task_id": "task-20877",
"associate_id": "assoc-4471",
"task_type": "PICK",
"efficiency_pct": 100,
"actual_seconds": 75,
"idle_seconds_before": null,
"completed_at": "2026-10-24T09:30:00Z",
"handling_unit": "CASE",
"team_lift": true
}
}
A standard was defined where none was open for its scope — published for other bounded contexts (ADR 0038).
The SAME domain event as the analytics stream's LaborStandardDefined message, with the SAME data (field names and types unchanged), on the integration topic and with the :events: dataschema. Subject is the standard id; the partition key is the TaskType, so every revision of one task type stays in order. A consumer (e.g. warehouse-planning, which keeps a local copy of the standards) treats the optional fields as optional: messages produced before an additive field existed simply do not carry it.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardDefinedCloudEvent; only the dataschema stream segment differs.
The first PICK standard, 45 seconds, on the integration topic.
{
"specversion": "1.0",
"id": "4e2b7f35-a6d8-4c19-8b0e-5f1c3d7a9b62",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0001",
"time": "2026-09-05T09:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0001",
"task_type": "PICK",
"expected_seconds": 45,
"effective_from": "2026-09-05T09:00:00Z"
}
}
A CASE pick standard (ADR 0035) declaring a heavy-case team lift, on the integration topic.
{
"specversion": "1.0",
"id": "5f3c8a46-b7e9-4d2a-9c1f-6a2d4e8b0c73",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardDefined",
"subject": "std-0004",
"time": "2026-10-24T08:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:LaborStandardDefined:v1",
"data": {
"standard_id": "std-0004",
"task_type": "PICK",
"expected_seconds": 30,
"effective_from": "2026-10-24T08:00:00Z",
"handling_unit": "CASE",
"team_lift_threshold_g": 18000,
"team_lift_expected_seconds": 75
}
}
An open standard was closed and a new one started in its place — published for other bounded contexts (ADR 0038).
The SAME domain event as the analytics stream's LaborStandardRevised message, with the SAME data, on the integration topic and with the :events: dataschema. standard_id is the NEW record; the closed one is never overwritten (append-only history, ADR 0004). Subject is the new standard id; the partition key is the TaskType.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardRevisedCloudEvent; only the dataschema stream segment differs.
The PICK standard tightened from 45s to 40s, on the integration topic.
{
"specversion": "1.0",
"id": "6a4d9b57-c8fa-4e3b-8d20-7b3e5f9c1d84",
"source": "/warehouse/labor-performance",
"type": "com.warehouse.wes.labor-performance.standard.LaborStandardRevised",
"subject": "std-0002",
"time": "2026-09-05T10:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:labor-performance:events:LaborStandardRevised:v1",
"data": {
"standard_id": "std-0002",
"task_type": "PICK",
"previous_expected_seconds": 45,
"expected_seconds": 40,
"effective_from": "2026-09-05T10:00:00Z"
}
}
A TaskType had no active standard, and one was just defined.
Raised when DefineStandard creates the first engineered standard for a TaskType. The projector counts it into the (task_type, hour-of- effective_from) rollup row. The same occurrence is also published on the integration topic with the same data (LaborStandardDefinedIntegration, ADR 0038), under its own CloudEvents id.
An active standard was closed and a new one started in its place.
Raised when DefineStandard is called for a TaskType that already has an active standard. History is append-only — the prior standard is closed, never overwritten (ADR 0004). A bucket with a non-zero revision count is one whose efficiency figures span two different yardsticks and are not directly comparable across the boundary. The same occurrence is also published on the integration topic with the same data (LaborStandardRevisedIntegration, ADR 0038).
One completed task was scored against the standard active at completion time.
Raised by RecordTaskPerformance for every consumed TaskCompleted.
efficiency_pct is NULLABLE and null is a real, expected value, not a missing field: it is null whenever the task could not be scored — no active standard for its TaskType at completion time, or a non-positive duration. Consumers MUST NOT coerce null to 0; doing so would report an unmeasurable task as a 0%-efficient one. The projector counts such an event toward its bucket's task count while excluding it from the mean.
completed_at is the BUSINESS time and is what the projector buckets on — distinct from the CloudEvents time attribute, which is the domain occurred-at and feeds only the freshness watermark. The two differ for any replayed or late-ingested event.
One completed task was scored against the standard active at completion time — published for other bounded contexts (ADR 0013).
Raised by RecordTaskPerformance for every consumed TaskCompleted, the SAME domain event as the analytics stream's TaskPerformanceRecorded message, on a different topic and with the :events: dataschema. Partition key is AssociateId, not TaskType.
efficiency_pct is NULLABLE and null is a real, expected value: null whenever the task could not be scored — no active standard for its TaskType at completion time, or a non-positive duration. Consumers MUST NOT coerce null to 0.
completed_at is the BUSINESS time; the CloudEvents time attribute is the domain occurred-at (scoring) instant. The two differ for any replayed or late-ingested event.
A standard was defined where none was open for its scope — published for other bounded contexts (ADR 0038).
The SAME domain event as the analytics stream's LaborStandardDefined message, with the SAME data (field names and types unchanged), on the integration topic and with the :events: dataschema. Subject is the standard id; the partition key is the TaskType, so every revision of one task type stays in order. A consumer (e.g. warehouse-planning, which keeps a local copy of the standards) treats the optional fields as optional: messages produced before an additive field existed simply do not carry it.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardDefinedCloudEvent; only the dataschema stream segment differs.
An open standard was closed and a new one started in its place — published for other bounded contexts (ADR 0038).
The SAME domain event as the analytics stream's LaborStandardRevised message, with the SAME data, on the integration topic and with the :events: dataschema. standard_id is the NEW record; the closed one is never overwritten (append-only history, ADR 0004). Subject is the new standard id; the partition key is the TaskType.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardRevisedCloudEvent; only the dataschema stream segment differs.
A station finished a claimed task; fulfillment-execution's fact.
Raised by fulfillment-execution's Task aggregate when a station completes a claimed task. This service consumes it to record a TaskPerformance row scored against whatever LaborStandard was active for the task's type at completion time.
The ONLY envelope on every topic this service produces or consumes. Every attribute is REQUIRED in this fleet. Kafka header content-type: application/cloudevents+json; charset=UTF-8. W3C trace context travels in the traceparent/tracestate Kafka headers, never as extension attributes.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardDefinedCloudEvent; only the dataschema stream segment differs.
ADR 0038. Same type and same data schema as the analytics stream's LaborStandardRevisedCloudEvent; only the dataschema stream segment differs.
Only task_id is required by this consumer (an empty one fails handling and is dead-lettered); station_id and work_unit_id are published by fulfillment-execution but never read here. Unknown fields are ignored.