Files
paulandClaude Opus 5 866bcfe238 Add the source-aligned CDC template, and key the canonical template's topics
The first template of the source-aligned family: one data product per source
system, capturing a database by CDC and turning what it emits into what a
canonical product accepts. It runs on the Integration Bus, not in a domain, and
is deployed with the `data-bus` CLI.

What it produces, and what its tests hold it to: raw topics in the source's own
shape; deterministic identity, so a re-snapshot upserts rather than duplicating;
validation against the canonical product's rules before publishing, with what
fails going to the product's own dead-letter topic with the reason; keying by the
canonical identifier; provenance in headers; and an archive in the bus object
store that can be replayed back onto the raw topic.

The worked example captures an ERP customer table and delivers into Canonical
Party in the digital-core domain: 12 smoke checks, 37 unit tests, including a
poison record that is quarantined while the next record still arrives.

The canonical template's topics now declare the key producers must set, which is
the other half of that contract.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 10:54:39 +12:00

6.9 KiB

semprini-data-product-templates

Data product templates for the semprini-data domain platform, one folder per class of data product, owned by the data product engineering teams.

A template is the answer to "what does a deployable product of this class look like on this platform": the directory layout, naming, type mapping, and every file the platform needs, as {{placeholders}} that a generation agent fills in from one MD-DDL data product declaration. The canonical template started in semprini-blog-dataproducts, where it shared a repository with its platform, model and products.

Catalogue

Template Product class MD-DDL class Status
canonical_data_product/ Canonical: a slice of the domain's canonical model, published as modelled through GraphQL, Kafka and Trino domain-aligned Available, with generic unit tests. Example verified 2026-09-18 on the domain platform (9 checks, 12 unit tests); Canonical Party generated from it passes 65 checks and 100 unit tests
source_aligned_cdc_data_product/ Source aligned, one product per source system: capture by CDC where there is database access, then the semantic and protocol transform into what a canonical product accepts source-aligned Available. Runs on the Integration Bus with the data-bus CLI. Example verified 2026-09-18: 12 smoke checks, 37 unit tests, ERP customers delivered into Canonical Party
source_aligned_file_data_product/ Source aligned: the source produces files, which become a stream; files land in the bus object store's files/ bucket source-aligned Planned, designed
source_aligned_api_data_product/, source_aligned_bus_data_product/ Source aligned: polling or webhooks; or a bridge from a bus the source already publishes to source-aligned Planned
experience_<class>_data_product/ Experience: shaped for an audience. Several classes, e.g. lake tables built by scheduled dbt models consumer-aligned Planned

A canonical product accepts records only on its inbound topics (registered schema, keyed by the entity's identifier) or through its GraphQL API, so a source-aligned product owns both the protocol and the semantic transform into that contract, and owns the dead-letter queue for what it cannot transform. It also archives every raw record to the bus object store, so the records outlive the topic and can be replayed. The design and the shared contract for the family are in semprini-data docs/source-aligned-products.md.

The two classes are deployed by different CLIs, because they run in different places: canonical products by data-domain, from the domain repository that runs them; source-aligned products by data-bus, from a semprini-data checkout.

Where templates sit between the teams

 modelling team                engineering teams                      data platform team
 ─────────────                 ─────────────────                      ──────────────────
 semprini-domain-<d>-datamodel  semprini-data-product-templates        semprini-data-domain
   data_products/*.md  ───────▶   <class>_data_product/  ◀── product contract ──  data-domain CLI
   handoffs/<slug>.md             .claude/agents/agent-<class>-product.md         compose.domain.yml
                    │                        │
                    └──────── generate ──────┴──▶ product repository (semprini-domain-cdp-<d>/<slug>/)
                                                          ── deploy, test, unit, register ──▶ domain stack + management zone
  • From the modelling team: a product declaration and the entities and enums it names, plus a handoff note for decisions the model cannot carry. The declaration's MD-DDL class picks the template.
  • To the data platform team: every template produces directories that meet the domain platform's product contract (semprini-data-domain README.md): the product.yaml manifest the data-domain CLI reads, and the SQL, schema, job and smoke-test files it applies. A template that needs something the contract does not offer asks the platform team first.
  • Products are generated into the domain engineering team's product repository (or the domain repository), and deployed, tested and registered from the domain repository that runs them.

All teams work on semprini-core, the enterprise landing zone: Keycloak for identity, and Gitea (git.semprini.me) for these repositories.

Generating a product

From a checkout of this repository, with the model repository and the domain repository at hand:

/agent-canonical-product Generate Canonical Party for the digital-core domain

The agent reads the declaration and any pending handoff, writes the product directory (including tests/expectations.yaml), runs uv run data-domain deploy, test, unit and register from the domain repository, and reports the model and template versions it generated from. Commit the product, in its product repository or the domain repository, with both versions in the message. Digital Core's canonical products live in semprini-domain-cdp-digital-core.

Versioning

  • Tag a release of this repository when a template changes (v0.1.0, ...). Domain repositories record the tag they generated from and regenerate deliberately, not on every commit here.
  • A template change that alters what a product directory contains may need a platform change first. Check the product contract, and agree the change with the data platform team.
  • Every template keeps a worked example/ that deploys and passes data-domain test and data-domain unit on the current domain platform. That example is the template's test, and the platform team's smoke test for the domain template.

Adding a template

  1. Create <class>_data_product/ with a README.md contract (what the product is, the mapping to platform interfaces, layout, naming, placeholders, type mapping, the generation input table, prerequisites and known gaps) and the template files.
  2. Add a worked example/, with a seed and tests/ (generic test modules plus expectations.yaml), and verify it on a domain stack with data-domain deploy, test and unit.
  3. Add its generation agent as .claude/agents/agent-<class>-product.md, with a command wrapper in .claude/commands/.
  4. Add it to the catalogue above.

Repository layout during setup

While the systems are being set up, this repository is a submodule of semprini-data, beside the domain platform and the Digital Core model, so all of it can be read and changed together. Most organisations keep these repositories apart, each owned and released by its own team, and link them only by version.