Derived from model/model.yaml. The product-content service is built on develop (IQVO/product-content at 2f09dc0, checked 2026-10-27) and not deployed (no warehouse-infra entry). Every Err... name, REST route and CloudEvents type of this context named on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.
One section per command of contexts[product-content].aggregates[*].commands.
They are application services in internal/application/usecases (as built). The
step-by-step diagrams are on Sequence Diagrams;
the payloads are on Domain Events;
the REST contract is apis/product-content/openapi.yaml.
Reads are not use cases here: GET /product-contents (paged, for
product-discovery's bootstrap), GET /product-contents/{catalogItemId}
and GET /categories read the stores directly. The projection of
CatalogItemCreated and CatalogItemDiscontinued into CatalogItemView is
not a use case either: it is the projector behind the
ErrUnknownCatalogItem check. (CatalogItemDiscontinued additionally
triggers the RetireOnDiscontinue policy, which is a use case below.)
Every use case that changes an aggregate loads it with its version, calls
the aggregate, then saves it inside one Postgres transaction. The save is
conditional on the version it loaded (UPDATE ... WHERE version = ?). If an
event is raised, the outbox row (outbox_events) is written in the same
transaction. A consumer-driven use case also inserts the CloudEvents id
into processed_events in that transaction. A relay publishes outbox rows
to Kafka after the commit. This context makes no synchronous calls
(sync_calls is empty), so no use case waits on another context.
Error responses use application/problem+json (RFC 9457) with type/problems/<slug> (a relative URI reference). Shared slugs
(conventions.integration_rules): not-found 404, illegal-transition 409,
concurrent-update 409, validation-failed 422, plus one kebab-case slug per
Err below. Every write route takes an Idempotency-Key header; a repeated
key returns the stored response of the first call.
Inbound adapter: REST POST /product-contents, header
Idempotency-Key required; body catalogItemId, description,
bullets[], attributes[], media[], primaryCategoryId.
Preconditions: the item exists in CatalogItemView and is not
DISCONTINUED; the content does not exist yet.
Main flow:
Look up the Idempotency-Key. On a hit with the same request body,
return the stored response.
Check the catalogItemId against CatalogItemView
(ErrUnknownCatalogItem) and that the item is not DISCONTINUED
(ErrItemDiscontinued).
Check primaryCategoryId, when given, against the current tree
(ErrUnknownCategory).
ProductContent.CreateProductContent(...): state DRAFT, revision 1. A
DRAFT may be incomplete (every body field is optional); it is edited
later through ReviseContent (DRAFT → DRAFT) and must be complete only
to publish.
In one transaction, insert the content and store the response under
the Idempotency-Key.
Answer 201 with the content.
Errors:
Error
HTTP
Problem type slug
Note
ErrUnknownCatalogItem
422
unknown-catalog-item
The item is not in CatalogItemView: never created, or the projection lags.
ErrItemDiscontinued
422
item-discontinued
The item is DISCONTINUED in CatalogItemView: content is neither created nor published for a discontinued item.
ErrUnknownCategory
422
unknown-category
The primaryCategoryId is not in the current tree.
validation
422
validation-failed
Schema rules, including the collection bounds (bullets at most 10, attributes at most 50, media at most 12), which have no Err names.
duplicate content for the item
409
concurrent-update
The API maps a second create to 409 (as built too); the model names no Err for it.
Events emitted: none.
Idempotency:Idempotency-Key; the primary key on catalogItemId is
the last guard.
Discontinued items: content for a discontinued item is not created:
the aggregate's invariant (see the
Aggregate Design Canvas)
refuses it with ErrItemDiscontinued, the same check as on publish.
Inbound adapter: REST POST /product-contents/{catalogItemId}/revisions,
header Idempotency-Key required; same body as create.
Preconditions: the content exists and is DRAFT or PUBLISHED (RETIRED
never changes again); the named category exists.
Main flow:
Look up the Idempotency-Key; replay on a hit.
Load ProductContent with its version (404 if absent).
One route, two commands picked by the state: ReviseDraft(...) for a
DRAFT (DRAFT → DRAFT) and ReviseContent(...) for PUBLISHED
(PUBLISHED → PUBLISHED). Each replaces description, bullets,
attributes, media and primary category with the body and takes the next
revision; the state does not change. They check ErrContentRetired
and ErrUnknownCategory; revised PUBLISHED content must stay complete
(ErrIncompleteContent).
Save (version checked) and store the key response in one transaction.
Answer 200 with the revised content.
Errors:
Error
HTTP
Problem type slug
Note
content not found
404
not-found
No content for the item.
ErrContentRetired
409
content-retired
RETIRED content never changes again.
ErrUnknownCategory
422
unknown-category
The new primary category is not in the current tree.
ErrIncompleteContent
422
incomplete-content
PUBLISHED content would be left without a description, exactly one PRIMARY medium or a category.
validation
422
validation-failed
Schema rules and collection bounds.
version conflict
409
concurrent-update
Retried once inside the use case before it is returned.
Events emitted: none. Shoppers see the new revision only after a
publish: PublishContent is DRAFT → PUBLISHED and PUBLISHED → PUBLISHED (the re-publication path), carrying the new revision in
ProductContentPublished, which product-discovery orders by.
Inbound adapter: REST POST /product-contents/{catalogItemId}/publications,
header Idempotency-Key required.
Preconditions: the content exists and is DRAFT or PUBLISHED; the item
is known and not DISCONTINUED; the publish gate passes.
Main flow:
Look up the Idempotency-Key; replay on a hit.
Load ProductContent with its version (404 if absent).
PublishContent(...): checks ErrContentRetired, ErrItemDiscontinued,
ErrUnknownCategory and the publish gate ErrIncompleteContent (a
description, exactly one PRIMARY medium and a category). State
PUBLISHED, publishedRevision set to the current revision.
In one transaction, save (version checked), write
ProductContentPublished to the outbox, store the key response.
Answer 200 with the published content.
Errors:
Error
HTTP
Problem type slug
Note
content not found
404
not-found
No content for the item.
ErrIncompleteContent
422
incomplete-content
Missing description, not exactly one PRIMARY medium, or no category.
ErrItemDiscontinued
422
item-discontinued
The item is DISCONTINUED: a discontinued item can never publish.
ErrUnknownCategory
422
unknown-category
The primary category left the current tree.
ErrContentRetired
409
content-retired
RETIRED never publishes again.
version conflict
409
concurrent-update
Retried once inside the use case.
Events emitted:ProductContentPublished with the full content and
the new revision.
Idempotency:Idempotency-Key; publishing PUBLISHED content whose
publishedRevision already equals its revision has nothing new to
publish: the call succeeds, saves nothing and raises nothing (ADR 0002 A1).
A revision made after the last publish is published again by the next call.
Actor / trigger:offer-availability discontinued the item.
Inbound adapter: Kafka consumer on
retailnetwork.offer-availability.events, type
com.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemDiscontinued.
Preconditions: the item has content that is not yet RETIRED: PUBLISHED
content retires with an event, a DRAFT retires silently.
Main flow:
Inbox check on the CloudEvents id; a duplicate is acknowledged.
Mark the item discontinued in CatalogItemView.
Load the item's ProductContent. If none, or already RETIRED, stop.
RetireOnDiscontinue(...): PUBLISHED or DRAFT becomes RETIRED, reason
DISCONTINUED. A discontinued item can never publish again
(ErrItemDiscontinued).
Save, outbox ProductContentRetired (PUBLISHED content only), inbox
row, one transaction.
Errors: none expected. An anomaly is logged and acknowledged.
Events emitted:ProductContentRetired for PUBLISHED content only; a
DRAFT retires silently, because nothing was ever published.
Idempotency: inbox on the CloudEvents id; the state check makes a
replayed effect a no-op.
Inbound adapter: REST POST /categories, header Idempotency-Key
required; body parentId (optional), name.
Preconditions: the parent exists in the working tree; the structural
invariants hold after the insert.
Main flow:
Look up the Idempotency-Key; replay on a hit.
Load the CategoryTree with its version.
CreateCategory(parentId, name): checks ErrMaxDepth (the tree is at
most four levels deep), ErrCategoryCycle and
ErrDuplicateSiblingName; computes the new node's path.
Save (version checked) and store the key response in one transaction.
Answer 201 with the category.
Errors:
Error
HTTP
Problem type slug
Note
ErrMaxDepth
422
max-depth
The new node would sit below level four.
ErrCategoryCycle
422
category-cycle
The design-time API listed it on create; a brand-new node cannot close a cycle. As built the API lists it only on :move.
ErrDuplicateSiblingName
422
duplicate-sibling-name
A sibling already has this name.
validation
422
validation-failed
An empty name or a missing parent id shape.
Events emitted: none; the tree reaches product-discovery only at
publication.
Inbound adapter: REST PUT /categories/{categoryId}/parent, header
Idempotency-Key required; body parentId (nullable: move to the root).
Preconditions: the category and the new parent exist; the structural
invariants hold after the move.
Main flow:
Look up the Idempotency-Key; replay on a hit.
Load the CategoryTree (404 if the category is unknown).
MoveCategory(categoryId, parentId): checks ErrCategoryCycle (a node
never moves under its own subtree), ErrMaxDepth and
ErrDuplicateSiblingName; recomputes the path of the moved subtree.
Save (version checked) and store the key response.
Answer 200 with the moved category.
Errors:
Error
HTTP
Problem type slug
Note
category not found
404
not-found
Unknown categoryId or parentId.
ErrCategoryCycle
422
category-cycle
The new parent is inside the moved subtree.
ErrMaxDepth
422
max-depth
The moved subtree would reach below level four.
ErrDuplicateSiblingName
422
duplicate-sibling-name
The new siblings already have this name.
ErrCategoryInUse
409
category-in-use
The design-time API mapped it to :move, although the invariant guards removal and the model has no remove command (model gap). As built no route answers category-in-use.
Actor / trigger:not named in the model: no inbound row carries
the command and no route in rest publishes the tree (model gap). These
pages read it as a deliberate content-manager action whose route the model
has not named yet.
Inbound adapter: unknown; drawn as a content-manager action.
Preconditions: the working tree differs from the last publication
(otherwise the publication is a no-op with a bumped version; the model
allows PUBLISHED → PUBLISHED).
Main flow:
Load the CategoryTree with its optimistic-concurrency guard.
PublishCategoryTree(...): state PUBLISHED, tree version bumped.
In one transaction, save and write CategoryTreePublished (the whole
tree under the new version) to the outbox.
Answer with the published tree.
Errors: none named in the model. The structural invariants hold for
the working tree at all times, so publication needs no re-check.
Events emitted:CategoryTreePublished.
Idempotency: the trigger is unknown, so no Idempotency-Key handling
is specified; the event's version is the consumer's guard.