Skip to content

Commit 2808e9a

Browse files
committed
SLA checks, diagram variants per exercise, CLAUDE.md for maintainers
- Contract chapter: retention SLA with element becomes a check; a freshness step shows a failing check on the static data - Scenario diagram: arrows point from consumer to provider; a variant per exercise 1 to 6 shows what is built - Re-recorded the contract (with SLA scene) and evolution videos - CLAUDE.md captures architecture, versions, writing rules, and the verification checklist
1 parent 78fc95b commit 2808e9a

29 files changed

Lines changed: 503 additions & 171 deletions

‎CLAUDE.md‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,71 @@
11
@AGENTS.md
2+
3+
# Maintaining this repository
4+
5+
Everything below is for maintainers changing the workshop or the online tutorial. When helping a workshop participant, the rule in AGENTS.md applies: do not read or quote `solutions/`.
6+
7+
## What lives here
8+
9+
- **Online tutorial** at https://learn.datacontract.com: `tutorial/`, a self-paced SPA in English and German. Deployed by `.github/workflows/tutorial.yml` to GitHub Pages on every push to `main` (only in `datacontract/learn.datacontract.com`). The custom domain is configured in the GitHub Pages settings; DNS is a proxied CNAME at Cloudflare.
10+
- **On-site workshop**: `README.md`, `exercises/part-*/`, used with slides (intro and retro are on the slides, not in the repo).
11+
- **Shared**: `solutions/` (reference solutions, also embedded in the tutorial), `initdb/` + `data/` (PostgreSQL sample data), `scripts/` (install and Community Edition setup), `schemas/` (official JSON schemas), `entropy-data-ce/`.
12+
- **Walkthrough videos**: `video/` records one video per tutorial chapter (see `video/README.md`).
13+
- The old Data Mesh Live 2026 version lives in a separate repo, `simonharrer/odcs-odps-workshop` (no SPA). Do not mention Data Mesh Live here.
14+
15+
Exercise numbering differs: online, CI/CD is exercise 7, publish 8, semantics 9. On-site, publish is 7, semantics 8, and CI/CD is exercise 9 (Part D). Solution folders follow the on-site numbers.
16+
17+
## Versions (keep in sync everywhere)
18+
19+
- datacontract-cli `1.2.2`, dataproduct-cli `0.2.0`, entropy-data `0.3.13`: pinned in `scripts/install.sh`, `install.ps1`, `install.bat`, and in `solutions/exercise9/datacontract.yml`.
20+
- ODCS `v3.2.0` and ODPS `v1.1.0` in all solutions, examples, and `schemas/` (mapped in `.vscode/settings.json`).
21+
- GitHub Actions: `actions/checkout@v7`, `astral-sh/setup-uv@v10.2.0` (setup-uv has no floating major tags).
22+
- When bumping a CLI, re-capture the terminal outputs in the tutorial and re-record the affected videos.
23+
24+
## Writing rules
25+
26+
- No em dashes anywhere. Keep text concise.
27+
- English and German versions must stay equivalent. German uses informal "du"; CLI flags, YAML keys, and UI labels stay English.
28+
- Screenshots are WebP (`cwebp -q 85`) in `tutorial/public/screenshots/`. Only the social image `tutorial/public/og-image.png` is PNG.
29+
- The Entropy Data Community Edition organization is `acme` (`workshop` and `tutorial` are reserved names). Never put API keys into the tracked `.env`; the tutorial tells participants to `export` them.
30+
- Online tutorial: no "ask the trainer", no shared cloud database credentials, no GitHub Codespaces.
31+
32+
## Tutorial architecture
33+
34+
- Vite, React 19, TypeScript, Tailwind 4, MDX. Content in `tutorial/src/content/{en,de}/<slug>.mdx`; chapters, parts, durations, and the `video` flag in `tutorial/src/chapters.ts`; UI strings in `tutorial/src/i18n.ts`.
35+
- Real URLs: `/en/` (welcome), `/en/<slug>/`, same for `/de/`. Old `#/...` links are redirected in `src/main.tsx`.
36+
- `npm run build` typechecks, builds the client, builds `src/entry-server.tsx` for SSR, and runs `scripts/prerender.mjs`. That script prerenders every page to static HTML (hydrated in the browser) with title, description, canonical, hreflang, Open Graph, and JSON-LD (Course, HowTo, VideoObject, BreadcrumbList), and writes `sitemap.xml`, `robots.txt`, `llms.txt`, `llms-full.txt`, and a Markdown version of every page (`scripts/mdx-to-md.mjs`). Components must be SSR-safe: no `window`, `document`, `localStorage`, or `navigator` during render; read browser state in effects.
37+
- Progress, theme, and OS choice are stored in localStorage. Progress is keyed by chapter slug and step id.
38+
- Umami analytics is loaded in `tutorial/index.html`; it tracks page changes via `history.pushState` itself.
39+
40+
## Authoring MDX chapters
41+
42+
- No leading H1 (title and summary come from `chapters.ts`). Structure: intro, `<Goals>`, `##` sections with `<Step id title>`, concept callouts, solution, one quiz, bonus.
43+
- `<Step id="...">` ids are literal, unique per chapter, and identical in EN and DE. Changing an id resets participants' progress for that step.
44+
- Every terminal command is a ```` ```bash ```` block directly followed by a ```` ```powershell ```` block (Windows = native PowerShell, not Git Bash); the build fails otherwise (`plugins/remark-terminal.ts`). An optional ```` ```output ```` block right after the pair shows the example output in the terminal window.
45+
- Outputs must be real: run the commands with the pinned CLIs against the workshop database, strip ANSI codes, and trim long output with a `…` line.
46+
- Include reference solutions instead of copying them: ```` ```yaml file=../../../../solutions/exercise1/orders_v1.odcs.yaml ````.
47+
- Components: `<Callout type="note|tip|warning|concept" title>`, `<OsTabs><Os name="unix|windows">` (only for prose that differs per OS), `<Solution title>`, `<Quiz question options answer feedback>` (`feedback` has one explanation per option, shown when that wrong option is picked), `<ScenarioDiagram variant="all|contract|evolution|data-product|contract-first|implement|consumer-driven" />` (drawn like the Entropy Data map; arrows point from consumer to provider; each of exercises 1 to 6 shows its variant after the intro), markdown images.
48+
- Links between chapters: `/en/<slug>/` (absolute). Images: `![Caption](/screenshots/name.webp)`; the alt text is the caption.
49+
50+
## Facts the content relies on
51+
52+
- Workshop database: PostgreSQL on `localhost:5433`, database `workshop`, user and password `workshop`, schemas `orders_v1` and `orders_v2`. The data is a static snapshot from 2020-01-01 to 2025-09-13, so a `freshness` SLA check always fails (the contract chapter shows this on purpose); `retention` with `element: orders.order_timestamp` and 10 years passes.
53+
- Only `freshness` and `retention` SLA properties with an `element` become checks; `frequency` and `latency` are documentation.
54+
- Verified statement answers used in the content: 876 orders in 2023; top SKUs by units in 2024: D3KT74L5EV46T (146), IWMJ3ZX164 (62), TFH11HYOR (46).
55+
- `datacontract breaking` exits 1 on ERROR (removed field, type change, added `required`); adding a column is INFO. `datacontract ci` writes GitHub annotations and the step summary.
56+
- Semantics: one ontology file (`solutions/exercise8/semantics.yaml`, prefix `ecom: https://learn.datacontract.com/ontology/ecommerce#`) uploaded with `PUT /api/semantics/experimental/namespaces/{ns}/ontology.yaml`; the entropy-data CLI has no command for it.
57+
- The hosted Data Contract Editor (editor.datacontract.com) runs tests via `api.datacontract.com`, which has credentials for the public Supabase copy (host `aws-1-eu-central-2.pooler.supabase.com`, port `6543`, database `postgres`, schemas `orders_v1`, `orders_v2`).
58+
- Participants remove the last `.gitignore` block (`# files created during the exercises`) in their fork before committing for the CI/CD exercise.
59+
60+
## Videos
61+
62+
- `cd video && npm install && node record.mjs <slug>` writes `tutorial/public/videos/<slug>.{mp4,webp,en.vtt,de.vtt}` and updates `videos.json` (durations for the structured data). Scenes are in `video/scenes/<slug>.mjs`; terminal scenes read commands and outputs from the English MDX (`lib/mdx.mjs`), so re-record after changing commands or outputs.
63+
- Live browser scenes start the Data Contract Editor with the pinned CLI (`lib/browser.mjs`); Part D scenes need a local Community Edition. CI screenshots come from the private demo repo `simonharrer/learn-ci-demo`.
64+
65+
## Before committing
66+
67+
- `cd tutorial && npm run build` (typecheck, build, prerender) passes.
68+
- `grep -r "—" tutorial/src exercises solutions` finds nothing new.
69+
- Step ids match between EN and DE.
70+
- `./solutions/test_all.sh` passes with the pinned CLIs and the database running (`docker compose up -d`).
71+
- Commit to `main`; push only when the maintainer asks.

‎exercises/part-a/exercise1-put-your-data-under-contract.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,24 @@ AI agents, LLM chat tools, and BI assistants increasingly query data on their ow
341341
# ... (other top-level keys) ...
342342
slaProperties:
343343
- property: retention
344-
value: 1
344+
value: 10
345345
unit: y
346-
description: Order data retained for 1 year
346+
element: orders.order_timestamp
347+
description: Orders are deleted after 10 years
347348
- property: frequency
348349
value: 1
349350
unit: d
350351
description: Data updated daily
351352
```
352353

354+
The CLI tests `retention` and `freshness` when `element` names a timestamp column (`frequency` is documentation only). Run only the service level checks:
355+
356+
```bash
357+
datacontract test --checks slaProperties orders_v1.odcs.yaml
358+
```
359+
360+
Optional: add a `freshness` property (`value: 24`, `unit: h`, `element: orders.order_timestamp`) and run the checks again. It fails, because the workshop data is a static snapshot. In production, this check alerts you when a pipeline stops loading. Remove it again afterwards. Documentation: https://docs.datacontract.com/service-levels
361+
353362

354363
## Set to Active
355364

‎solutions/exercise1/orders_v1.odcs.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,10 @@ support:
173173
tool: slack
174174
slaProperties:
175175
- property: retention
176-
value: 1
176+
value: 10
177177
unit: y
178-
description: Order data retained for 1 year
178+
element: orders.order_timestamp
179+
description: Orders are deleted after 10 years
179180
- property: frequency
180181
value: 1
181182
unit: d

‎solutions/exercise2/orders_v2.odcs.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ support:
184184
tool: slack
185185
slaProperties:
186186
- property: retention
187-
value: 1
187+
value: 10
188188
unit: y
189-
description: Order data retained for 1 year
189+
element: orders.order_timestamp
190+
description: Orders are deleted after 10 years
190191
- property: frequency
191192
value: 1
192193
unit: d

‎solutions/exercise8/orders_v1.with-semantics.odcs.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ support:
184184
tool: slack
185185
slaProperties:
186186
- property: retention
187-
value: 1
187+
value: 10
188188
unit: y
189-
description: Order data retained for 1 year
189+
element: orders.order_timestamp
190+
description: Orders are deleted after 10 years
190191
- property: frequency
191192
value: 1
192193
unit: d

‎solutions/exercise8/orders_v2.with-semantics.odcs.yaml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ support:
195195
tool: slack
196196
slaProperties:
197197
- property: retention
198-
value: 1
198+
value: 10
199199
unit: y
200-
description: Order data retained for 1 year
200+
element: orders.order_timestamp
201+
description: Orders are deleted after 10 years
201202
- property: frequency
202203
value: 1
203204
unit: d

‎tutorial/public/videos/contract.de.vtt‎

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,93 +5,101 @@ WEBVTT
55
Übung 1: Daten unter Vertrag nehmen.
66

77
2
8-
00:00:03.502 --> 00:00:09.376
8+
00:00:03.502 --> 00:00:09.381
99
Lege den Kontrakt an und öffne ihn im Data Contract Editor.
1010

1111
3
12-
00:00:09.427 --> 00:00:14.540
12+
00:00:09.431 --> 00:00:14.527
1313
Der Editor öffnet einen neuen, leeren Kontrakt. Setze die Grunddaten.
1414

1515
4
16-
00:00:14.591 --> 00:00:19.874
16+
00:00:14.577 --> 00:00:19.862
1717
Version 1.0.0 und Status draft bleiben. Save schreibt die YAML-Datei auf die Platte.
1818

1919
5
20-
00:00:19.924 --> 00:00:28.212
20+
00:00:19.912 --> 00:00:28.189
2121
Gehe zu Servers und füge die PostgreSQL-Datenbank hinzu.
2222

2323
6
24-
00:00:28.262 --> 00:00:38.098
24+
00:00:28.240 --> 00:00:37.889
2525
Host localhost, Port 5433, Datenbank workshop, Schema orders_v1.
2626

2727
7
28-
00:00:38.147 --> 00:00:43.382
28+
00:00:37.939 --> 00:00:43.193
2929
Gehe zu Schemas und füge die Tabelle orders hinzu.
3030

3131
8
32-
00:00:43.432 --> 00:01:03.319
32+
00:00:43.243 --> 00:01:03.198
3333
Füge die Properties hinzu, jeweils mit logischem Typ und physischem Typ der Datenbank.
3434

3535
9
36-
00:01:03.369 --> 00:01:05.820
36+
00:01:03.248 --> 00:01:05.699
3737
Die übrigen Properties von orders und line_items gehen genauso.
3838

3939
10
40-
00:01:05.870 --> 00:01:15.384
40+
00:01:05.749 --> 00:01:15.266
4141
Beide Tabellen, vollständig beschrieben. Die Diagramm-Ansicht gibt einen Überblick.
4242

4343
11
44-
00:01:15.434 --> 00:01:23.337
44+
00:01:15.316 --> 00:01:23.215
4545
Teste den Kontrakt gegen die echte Datenbank. Alle Checks sind grün.
4646

4747
12
48-
00:01:23.387 --> 00:01:32.012
48+
00:01:23.265 --> 00:01:31.896
4949
Ändere absichtlich einen physischen Typ: Der Test findet die Abweichung.
5050

5151
13
52-
00:01:32.062 --> 00:01:39.717
52+
00:01:31.946 --> 00:01:39.490
5353
customer_email_address ist ein personenbezogenes Datum: Klassifiziere es als confidential.
5454

5555
14
56-
00:01:39.767 --> 00:01:46.962
56+
00:01:39.539 --> 00:01:46.718
5757
Markiere es als required. Der Test prüft dann auf fehlende Werte.
5858

5959
15
60-
00:01:47.012 --> 00:01:53.582
60+
00:01:46.768 --> 00:01:53.344
6161
Teste erneut: required ergänzt einen Check auf fehlende Werte.
6262

6363
16
64-
00:01:53.632 --> 00:02:01.504
64+
00:01:53.394 --> 00:02:01.267
6565
Ergänze einen SQL-Quality-Check: Jede E-Mail enthält ein @.
6666

6767
17
68-
00:02:01.554 --> 00:02:08.545
68+
00:02:01.317 --> 00:02:08.101
6969
Neu in ODCS 3.2: Kontext für KI-Agenten. Öffne Context.
7070

7171
18
72-
00:02:08.596 --> 00:02:14.722
72+
00:02:08.151 --> 00:02:13.972
7373
Ein Verified Statement: eine Frage mit einer geprüften SQL-Antwort, die Agenten wiederverwenden.
7474

7575
19
76-
00:02:14.773 --> 00:02:23.037
76+
00:02:14.023 --> 00:02:22.286
7777
Ein Constraint: was Agenten niemals tun dürfen.
7878

7979
20
80-
00:02:23.088 --> 00:02:29.189
80+
00:02:22.336 --> 00:02:28.449
8181
Ergänze Synonyme und prüfe den Kontrakt mit lint gegen ODCS 3.2.
8282

8383
21
84-
00:02:29.239 --> 00:02:37.862
85-
Ergänze Team, Support und SLAs, setze den Status auf active und teste ein letztes Mal.
84+
00:02:28.499 --> 00:02:35.902
85+
Service Levels: Retention mit Zeitstempel-Spalte wird zum echten Check.
8686

8787
22
88-
00:02:37.912 --> 00:02:41.882
89-
Tipp: Du kannst die Tests auch direkt im Editor ausführen.
88+
00:02:35.952 --> 00:02:45.038
89+
Ein Freshness-Check schlägt fehl: Die Beispieldaten sind ein fester Stand. Wieder entfernen.
9090

9191
23
92-
00:02:41.933 --> 00:02:45.884
93-
Alle Checks bestehen: Schema, Typen und Quality-Regeln.
92+
00:02:45.088 --> 00:02:53.753
93+
Ergänze Team und Support, setze den Status auf active und teste ein letztes Mal.
9494

9595
24
96-
00:02:45.934 --> 00:02:48.884
96+
00:02:53.803 --> 00:02:57.789
97+
Tipp: Du kannst die Tests auch direkt im Editor ausführen.
98+
99+
25
100+
00:02:57.839 --> 00:03:01.790
101+
Alle Checks bestehen: Schema, Typen und Quality-Regeln.
102+
103+
26
104+
00:03:01.840 --> 00:03:04.791
97105
Fertig. Als Nächstes: Evolution von Datenkontrakten.

0 commit comments

Comments
 (0)