@cratis/pi 7.6.5 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/corpus/agents/backend-developer.md +14 -0
- package/package/corpus/agents/code-reviewer.md +16 -0
- package/package/corpus/agents/coordinator.md +17 -0
- package/package/corpus/agents/frontend-developer.md +17 -0
- package/package/corpus/agents/orchestrator.md +18 -0
- package/package/corpus/agents/planner.md +24 -0
- package/package/corpus/agents/screenplay-modeler.md +57 -0
- package/package/corpus/agents/screenplay-renderer.md +42 -0
- package/package/corpus/agents/screenplay-reviewer.md +45 -0
- package/package/corpus/agents/slice-implementer.md +32 -5
- package/package/corpus/agents/spec-writer.md +16 -3
- package/package/corpus/prompts/add-reactor.prompt.md +5 -3
- package/package/corpus/prompts/new-vertical-slice.prompt.md +16 -5
- package/package/corpus/prompts/write-specs.prompt.md +12 -6
- package/package/corpus/rules/application-profile.md +7 -3
- package/package/corpus/rules/general.md +8 -3
- package/package/corpus/rules/glossary.md +1 -1
- package/package/corpus/rules/profiles.md +42 -4
- package/package/corpus/rules/reactors.md +30 -22
- package/package/corpus/rules/vertical-slices.md +3 -1
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +13 -0
- package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +2 -0
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +173 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +66 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +49 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +23 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/worked-example.md +91 -0
- package/package/corpus/skills/cratis-application-slice-conformance/verification.json +14 -0
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +57 -1
- package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +16 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +68 -8
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +199 -0
- package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +10 -0
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +38 -10
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +58 -6
- package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +9 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +47 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +11 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +13 -0
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +13 -0
- package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +35 -16
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +28 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +166 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +31 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +139 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +69 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +88 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +64 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +37 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +34 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +208 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +126 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +93 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/worked-integration.md +98 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +267 -50
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +185 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +60 -12
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +42 -12
- package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +30 -0
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +229 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +37 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +64 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +62 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +222 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +66 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +152 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +111 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +37 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +119 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/worked-session.md +87 -0
- package/package/corpus/skills/cratis-screenplay-discovery/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +140 -77
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +51 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +114 -28
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +50 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +28 -3
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +31 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +239 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/chronicle-observations.md +25 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +79 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +48 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +75 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +164 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +88 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +47 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +147 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +36 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +126 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +52 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +17 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +77 -57
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +50 -20
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +211 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +44 -6
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +64 -10
- package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +34 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +209 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +89 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +128 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +176 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +36 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +149 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +59 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +255 -0
- package/package/corpus/skills/cratis-screenplay-model-review/verification.json +13 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +32 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +239 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/code-reading-and-tokens.md +55 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +124 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +84 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/opt-in.md +48 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phase-report-inventories.md +25 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +162 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +53 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +63 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +31 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +31 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +46 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +204 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +55 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +86 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +16 -0
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +14 -3
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +15 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +2 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +179 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +99 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +67 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +72 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +27 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +56 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +124 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +14 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +31 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +200 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +579 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/chronicle-verification.md +24 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +102 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +41 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +196 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +102 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +71 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +91 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +13 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +30 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +236 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +107 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +130 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +20 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +201 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +23 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +41 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +122 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +305 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +43 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +217 -36
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +28 -4
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +33 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +191 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +154 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +54 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +191 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +70 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +65 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +128 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +378 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +14 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +2 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +177 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +121 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +319 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +96 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +107 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +48 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +113 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +148 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +267 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +51 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +88 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +51 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +134 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +134 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +53 -5
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +56 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +65 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
- package/package/corpus/skills/cratis-specification-by-example/SKILL.md +44 -1
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +10 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +186 -219
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +177 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +150 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +87 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +98 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +19 -0
- package/package/profile-catalog.json +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Integration contracts
|
|
2
|
+
|
|
3
|
+
Use before completing a new or changed translation. Keep accepted decisions in the relevant
|
|
4
|
+
`.play` descriptions and specs; open questions and target requirements go to `STATE.md`. Do
|
|
5
|
+
not create a second canonical model.
|
|
6
|
+
|
|
7
|
+
## Resolve only the unknowns
|
|
8
|
+
For each in-scope source and record type:
|
|
9
|
+
| Question | Why it matters |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Who sends it, through which channel? | Names the external authority and trust boundary. |
|
|
12
|
+
| What does a sanitized sample contain? | Fields, types, cardinality, missing values. |
|
|
13
|
+
| What business occurrence does it report? | Fact versus snapshot or transport status. |
|
|
14
|
+
| Which identifier finds our entity? | Correlation and event destination. |
|
|
15
|
+
| Is mapping direct, aggregated or enriched? | Reveals dependencies and incomplete-input cases. |
|
|
16
|
+
| What if required context arrives later? | Pending work, rejection or reconciliation. |
|
|
17
|
+
| Who handles records we cannot accept? | Failure recovery needs an owner. |
|
|
18
|
+
Ask the next question from the previous answer. Use synthetic samples; no credentials or
|
|
19
|
+
production personal data. Cite existing answers instead of re-asking. Resolve every cataloged
|
|
20
|
+
type or exclude it explicitly.
|
|
21
|
+
|
|
22
|
+
## Trust and meaning
|
|
23
|
+
Record which component verifies source authenticity, tenant/entity ownership, schema and
|
|
24
|
+
business preconditions. A `capture` source declaration proves none of these. If Screenplay
|
|
25
|
+
cannot express an acceptance rule, keep it as a named target requirement with its negative
|
|
26
|
+
case; do not invent syntax or call it enforced.
|
|
27
|
+
|
|
28
|
+
Per technical field: identity scope and provider vocabulary; units, currency, precision;
|
|
29
|
+
absent, null, malformed and unknown-code behavior; provider time versus receipt time versus
|
|
30
|
+
model occurrence time; personal-data purpose, consent and retention. `$context.occurred` in a
|
|
31
|
+
capture is the capture/scenario time: give a provider timestamp its own field and mapping.
|
|
32
|
+
|
|
33
|
+
## Trace both directions
|
|
34
|
+
Classify source fields (map, enrich, infer, ignore), then walk every required field of the
|
|
35
|
+
intended event and command:
|
|
36
|
+
| Target field or destination | Source | Transformation | Missing/invalid outcome |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
Every target needs an available origin or a recorded blocker. A reaction's selected values
|
|
39
|
+
must exist on its trigger; `reads` does not make view data a portable mapping source; a clock
|
|
40
|
+
has no selected values. Inference needs a business-accepted rule, never a convenient default.
|
|
41
|
+
Prefer enrichment from established local facts; an outside lookup is its own dependency with
|
|
42
|
+
failure and freshness terms, not an imagined capture operation.
|
|
43
|
+
|
|
44
|
+
## Separate the identities
|
|
45
|
+
Name separately when they differ: our entity/event source; the provider's object reference;
|
|
46
|
+
the logical occurrence or revision; the delivery id; workflow correlation and immediate
|
|
47
|
+
cause. Create the correlation bridge when starting the outside interaction, or define how an
|
|
48
|
+
unsolicited record gets one; cover a record that arrives before the bridge. Define duplicates
|
|
49
|
+
by business occurrence, not by provider object id alone; state dedup scope, retention and
|
|
50
|
+
atomic enforcement (a preliminary lookup is not a concurrency guarantee).
|
|
51
|
+
|
|
52
|
+
## Recoverable failure
|
|
53
|
+
Per failure class choose: ignore, reject, defer, terminal failure or reconcile; say what is
|
|
54
|
+
visible, who acts, how processing resumes. Cover unknown correlation, unavailable enrichment,
|
|
55
|
+
invalid input, partial progress and uncertain external results. Logging is not recovery. A
|
|
56
|
+
resumed attempt keeps the logical work identity and idempotency key and does not repeat
|
|
57
|
+
effects that already succeeded.
|
|
58
|
+
|
|
59
|
+
## Faithful realization
|
|
60
|
+
The accepted `.play` revision is the behavioral contract. A realization may choose reactor,
|
|
61
|
+
scheduler or queue mechanism but may not drop pending visibility, add filters, guess fields
|
|
62
|
+
or weaken authorization. Specify event-to-command mapping at the reaction boundary; a
|
|
63
|
+
command-only spec does not exercise it. Unsupported realization is a gap routed to delivery,
|
|
64
|
+
not a silent model change.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
## Adapted closely (MIT)
|
|
4
|
+
Source: `TrogonStack/agentskills`, commit `7b249d3ee42d8b7e11fa564141ebd5fbc37aadf1`,
|
|
5
|
+
Copyright (c) 2025 Straw Hat, LLC, MIT. The complete notice is in this skill's `LICENSE`.
|
|
6
|
+
|
|
7
|
+
| Our content | From | Adaptation |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `SKILL.md` Interview phase: skip condition, the sources and mapping questions with follow-ups, "missing correlation first" | `plugins/trogonstack-eventmodeling/skills/eventmodeling-translating-external-events/SKILL.md` (Interview Phase) | rewritten for Screenplay captures; added automation and recovery questions and the unattended rule |
|
|
10
|
+
| `references/worked-integration.md` structure: catalog, technical analysis, correlation, translation rules, scenarios, failure and recovery, output | same file, Workflow 1 to 7 and Output Format | new domain (invoicing, synthetic provider); target-field completeness table, recovery owner column and `capture`/`constraint` mapping added; the payment and geofence examples are not reused |
|
|
11
|
+
| `references/integration-contracts.md` question table and the quality checklist ideas (every type has a rule, correlation, external ids kept for dedup, validation, missing data) | same file, Quality Checklist and Key Principles | merged into the contract and the audit |
|
|
12
|
+
|
|
13
|
+
Reviewed and not adopted: the translating skill's "Default Gracefully" principle (sensible
|
|
14
|
+
defaults for missing data) is replaced by "never fabricate a default"; its log-and-drop failure
|
|
15
|
+
handling is replaced by recorded failure facts. `plugins/trogonstack-eda` was skimmed; nothing
|
|
16
|
+
adopted.
|
|
17
|
+
|
|
18
|
+
## Ideas only (written independently)
|
|
19
|
+
Nebulit-GmbH/agentic-engineer has no licence; nothing is copied.
|
|
20
|
+
- idea from Nebulit-GmbH/agentic-engineer@07b0f30:`.claude/skills/eventmodeling-designing-automation-chains`:
|
|
21
|
+
resolve the automation chain at the moment it is introduced, and audit every automation
|
|
22
|
+
exhaustively with a per-declaration result. Written independently as `SKILL.md` Gate and
|
|
23
|
+
`references/audit-format.md`. Its compulsory queue and never-closing translation queue were rejected.
|
|
24
|
+
- idea from Nebulit-GmbH/agentic-engineer@07b0f30:`.claude/skills/build-automation`: keep the model
|
|
25
|
+
authoritative, exact input mappings, explicit filtering, repeated-command cases. Written
|
|
26
|
+
independently in `references/realization-and-gap-fill.md` and `references/cases-to-specify.md`.
|
|
27
|
+
Its implementation recipe was dropped.
|
|
28
|
+
|
|
29
|
+
## Carried forward
|
|
30
|
+
`references/automation-patterns.md`, `translation-patterns.md`, `effects-and-idempotency.md`,
|
|
31
|
+
`cases-to-specify.md` and both examples come from the earlier Cratis drafts of this skill.
|
|
32
|
+
Changes in this version: the examples are complete fenced documents that compile (the translate
|
|
33
|
+
example's anonymous-booking spec gained the `given caller` PLAY0389 requires; the todo-list
|
|
34
|
+
example's list query, `reads` and retry sweep moved to marked design-only excerpts so the core
|
|
35
|
+
binds); tool-qualified verdict text; the trusted-actor text now names `[ExecuteCommandsAsSystem]`
|
|
36
|
+
(Arc v20.56.0, available in a rendered app's Arc 22.25.0) and Screenplay#383; Stage renders no
|
|
37
|
+
Automation or Translate slice (Stage#79).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Realization and gap-fill
|
|
2
|
+
|
|
3
|
+
The `.play` revision is the contract; this file says what that means once code is needed. It is
|
|
4
|
+
the automation-and-translation addendum to `cratis-screenplay-render-and-gap-fill`; read that
|
|
5
|
+
skill for the admission, publication and ownership rules.
|
|
6
|
+
|
|
7
|
+
## What Stage does not do
|
|
8
|
+
Stage 4.24.0 renders no Automation or Translate slice (Stage#79). A model that contains one is not
|
|
9
|
+
admitted: it needs ESM v6, Stage admits ESM v1 to v3 (STAGE-ESM-016 for the whole model), and the
|
|
10
|
+
cratis 3.27.1 bundled compiler binds these slices as PLAY0268. So the automation or translation is
|
|
11
|
+
hand-written delivery with the model as its contract. A `Customizations/` file never makes a
|
|
12
|
+
rejected model renderable, and never claim a whole-application V5 from a subset. Choose the route
|
|
13
|
+
with `cratis-screenplay-render-and-gap-fill`.
|
|
14
|
+
|
|
15
|
+
## Where the pieces go (hand-written)
|
|
16
|
+
| Model element | Realization | Skill |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| reaction `when <Event>` with `invokes` or `produces` | Chronicle reactor returning commands or events | `cratis-chronicle-reactor` |
|
|
19
|
+
| trusted actor for `invokes` | `[ExecuteCommandsAsSystem("<role>")]` on the reactor plus a policy requiring the role (Arc, since v20.56.0; available in a rendered app's Arc 22.25.0) | `cratis-chronicle-reactor` |
|
|
20
|
+
| clock trigger, application trigger | scheduler or host signal that raises the occurrence | `cratis-engineering-effect-boundaries` |
|
|
21
|
+
| call to an outside system | adapter behind an effect boundary, keyed by the idempotency key in the model | `cratis-engineering-effect-boundaries` |
|
|
22
|
+
| capture source (webhook, poll, topic) | adapter that authenticates, parses and appends | `cratis-engineering-effect-boundaries` |
|
|
23
|
+
| replay versus recovery redelivery | `[OnceOnly]` for replay; a receipt keyed by `ReactorDelivery.Id` for recovery | `cratis-chronicle-reactor` |
|
|
24
|
+
|
|
25
|
+
`[ProtectedDecision]` (Arc v22.39.0 and later) is not available in a Stage-rendered app (Arc
|
|
26
|
+
22.25.0), and `Directory.Packages.props` there is Stage-managed: do not edit it to get a newer Arc.
|
|
27
|
+
|
|
28
|
+
## Faithful realization
|
|
29
|
+
A realization may choose the reactor, scheduler or queue mechanism. It may not: drop pending
|
|
30
|
+
visibility, add filters the model does not state, guess a field, or weaken authorization. Specify
|
|
31
|
+
the event-to-command mapping at the reaction boundary (a command-only spec does not exercise it).
|
|
32
|
+
An unsupported realization is a gap reported to delivery, never a silent change to the model.
|
|
33
|
+
After writing it, check it element by element against the slice with
|
|
34
|
+
`cratis-application-slice-conformance`.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Example: a todo-list automation
|
|
2
|
+
|
|
3
|
+
A complete model: a result opens a work item, a reaction invokes a command, the command's fact
|
|
4
|
+
closes the item. It binds on Screenplay 4.64.0 (`executableReady: true`); the cratis 3.27.1
|
|
5
|
+
bundled compiler (Screenplay 4.60.1) rejects the Automation slice at binding with PLAY0268. Versions: `cratis-screenplay-toolchain` `references/versions.md`.
|
|
6
|
+
|
|
7
|
+
The first spec lists the whole cascade (`then` names every new fact: `CoursePassed`, and
|
|
8
|
+
`CertificateSent` through the reaction), and `given clock` supplies the instant that
|
|
9
|
+
`$context.occurred` needs. The cratis 3.27.1 bundled compiler reports a false PLAY0285 on that
|
|
10
|
+
cascade (cli#242), so the fence carries the standalone-compiler marker. These specs were not
|
|
11
|
+
run (V4: not run, no route); the expectations follow the v4.64.0 reference semantics.
|
|
12
|
+
|
|
13
|
+
What the model proves and what it does not:
|
|
14
|
+
|
|
15
|
+
- Proven by the model: one `CertificateSent` per enrolment (`unique event`), the queue opening
|
|
16
|
+
and closing, a gated `RecordCompletion` that refuses non-coordinators.
|
|
17
|
+
- Not proven: that the certificate email reaches the person once. See
|
|
18
|
+
`references/effects-and-idempotency.md`.
|
|
19
|
+
- The actor behind `SendCertificate` is a recorded security decision in the `Certification`
|
|
20
|
+
module `description`, because reaction invocations carry no caller today (Screenplay#383).
|
|
21
|
+
- No local engine runs Automation specifications: report them as authored, not as run.
|
|
22
|
+
|
|
23
|
+
```screenplay
|
|
24
|
+
// Needs the standalone screenplay compiler (ESM v6)
|
|
25
|
+
// Todo-list automation. Shape: CoursePassed opens an item -> CertificateSender invokes
|
|
26
|
+
// SendCertificate -> CertificateSent closes the item. The once-only FACT is
|
|
27
|
+
// `unique event CertificateSent`; the external send is NOT proven once-only by this model.
|
|
28
|
+
|
|
29
|
+
domain Acme.Academy
|
|
30
|
+
|
|
31
|
+
concept EnrolmentId : Uuid
|
|
32
|
+
|
|
33
|
+
policy IsAuthenticated
|
|
34
|
+
require authenticated
|
|
35
|
+
policy IsCoordinator
|
|
36
|
+
require role "Coordinator"
|
|
37
|
+
persona Coordinator
|
|
38
|
+
description "Records course results. Cannot: send certificates by hand"
|
|
39
|
+
policy IsAuthenticated
|
|
40
|
+
policy IsCoordinator
|
|
41
|
+
|
|
42
|
+
module Courses
|
|
43
|
+
authorize IsAuthenticated
|
|
44
|
+
feature Results
|
|
45
|
+
authorize IsCoordinator
|
|
46
|
+
slice StateChange RecordCompletion
|
|
47
|
+
command RecordCompletion
|
|
48
|
+
enrolmentId EnrolmentId identifier
|
|
49
|
+
passed Bool
|
|
50
|
+
produces when passed == true
|
|
51
|
+
CoursePassed
|
|
52
|
+
for enrolmentId
|
|
53
|
+
enrolmentId = enrolmentId // copied on purpose: the reaction selects it as a value
|
|
54
|
+
completedAt = $context.occurred // carried on the fact: a projection cannot read $eventContext.occurred
|
|
55
|
+
produces when passed == false
|
|
56
|
+
CourseFailed
|
|
57
|
+
for enrolmentId
|
|
58
|
+
event CoursePassed
|
|
59
|
+
enrolmentId EnrolmentId
|
|
60
|
+
completedAt DateTime
|
|
61
|
+
event CourseFailed
|
|
62
|
+
constraint OneResultPerEnrolment
|
|
63
|
+
unique event CoursePassed
|
|
64
|
+
unique event CourseFailed
|
|
65
|
+
specification RecordingAPass
|
|
66
|
+
given caller
|
|
67
|
+
authenticated
|
|
68
|
+
role "Coordinator"
|
|
69
|
+
given clock "2026-10-05T08:00:00Z"
|
|
70
|
+
when RecordCompletion
|
|
71
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
72
|
+
passed = true
|
|
73
|
+
then CoursePassed
|
|
74
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
75
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
76
|
+
completedAt = "2026-10-05T08:00:00Z"
|
|
77
|
+
then CertificateSent
|
|
78
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
79
|
+
sentAt = "2026-10-05T08:00:00Z"
|
|
80
|
+
specification RefusingANonCoordinator
|
|
81
|
+
given caller
|
|
82
|
+
authenticated
|
|
83
|
+
role "Learner"
|
|
84
|
+
when RecordCompletion
|
|
85
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
86
|
+
passed = true
|
|
87
|
+
then denied
|
|
88
|
+
specification RecordingAFail
|
|
89
|
+
given caller
|
|
90
|
+
authenticated
|
|
91
|
+
role "Coordinator"
|
|
92
|
+
given clock "2026-10-05T08:00:00Z"
|
|
93
|
+
when RecordCompletion
|
|
94
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
95
|
+
passed = false
|
|
96
|
+
then CourseFailed
|
|
97
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
98
|
+
|
|
99
|
+
module Certification
|
|
100
|
+
description "Trusted background boundary. No persona or screen issues SendCertificate; only the CertificateSender reaction invokes it, and reaction invocations carry no caller. Leaving the command ungated is a SECURITY DECISION, accepted only because: (1) it appends a fact keyed to one enrolment, (2) a repeat is rejected by IssueOnce, (3) the realization must not expose it to external callers (requirement to verify in the target). If (3) cannot hold, gate it with a service-actor policy and record the capability gap instead (reaction invocations carry no caller: Screenplay#383)."
|
|
101
|
+
feature Certificates
|
|
102
|
+
slice StateView CertificatesToSend
|
|
103
|
+
description "Work queue: membership means 'still to send'; there is no status flag"
|
|
104
|
+
readmodel PendingCertificate
|
|
105
|
+
enrolmentId EnrolmentId
|
|
106
|
+
completedAt DateTime
|
|
107
|
+
query PendingCertificateById => PendingCertificate optional
|
|
108
|
+
by enrolmentId EnrolmentId
|
|
109
|
+
projection CertificatesToSend => PendingCertificate
|
|
110
|
+
from CoursePassed
|
|
111
|
+
enrolmentId = $eventSourceId
|
|
112
|
+
completedAt = completedAt
|
|
113
|
+
remove with CertificateSent
|
|
114
|
+
specification OpeningAnItem
|
|
115
|
+
given CoursePassed
|
|
116
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
117
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
118
|
+
completedAt = "2026-10-05T08:00:00Z"
|
|
119
|
+
then query PendingCertificateById
|
|
120
|
+
arguments
|
|
121
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
122
|
+
result
|
|
123
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
124
|
+
completedAt = "2026-10-05T08:00:00Z"
|
|
125
|
+
specification ClosingAnItem
|
|
126
|
+
given CoursePassed
|
|
127
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
128
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
129
|
+
completedAt = "2026-10-05T08:00:00Z"
|
|
130
|
+
when append CertificateSent
|
|
131
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
132
|
+
sentAt = "2026-10-05T08:00:00Z"
|
|
133
|
+
then no readmodel PendingCertificate for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
134
|
+
specification NotQueueingAFail
|
|
135
|
+
when append CourseFailed
|
|
136
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
137
|
+
then no readmodel PendingCertificate for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
138
|
+
|
|
139
|
+
slice StateChange SendCertificate
|
|
140
|
+
description "Realization sends the certificate with idempotency key = enrolment id, then appends"
|
|
141
|
+
command SendCertificate
|
|
142
|
+
enrolmentId EnrolmentId identifier
|
|
143
|
+
produces CertificateSent
|
|
144
|
+
for enrolmentId
|
|
145
|
+
sentAt = $context.occurred
|
|
146
|
+
event CertificateSent
|
|
147
|
+
sentAt DateTime
|
|
148
|
+
constraint IssueOnce
|
|
149
|
+
unique event CertificateSent
|
|
150
|
+
specification SendingACertificate
|
|
151
|
+
given clock "2026-10-05T08:00:00Z"
|
|
152
|
+
when SendCertificate
|
|
153
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
154
|
+
then CertificateSent
|
|
155
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
156
|
+
sentAt = "2026-10-05T08:00:00Z"
|
|
157
|
+
specification RefusingASecondSend
|
|
158
|
+
given clock "2026-10-05T08:00:00Z"
|
|
159
|
+
given CertificateSent
|
|
160
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
161
|
+
sentAt = "2026-10-05T08:00:00Z"
|
|
162
|
+
when SendCertificate
|
|
163
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
164
|
+
then error "Constraint 'IssueOnce' is violated: the event source already has the constrained event."
|
|
165
|
+
|
|
166
|
+
slice Automation SendCertificates
|
|
167
|
+
reaction CertificateSender
|
|
168
|
+
description "Sends a certificate for every passed course; ends at CertificateSent"
|
|
169
|
+
when CoursePassed
|
|
170
|
+
enrolmentId
|
|
171
|
+
invokes SendCertificate
|
|
172
|
+
enrolmentId = enrolmentId
|
|
173
|
+
specification SendingAfterAPass
|
|
174
|
+
given clock "2026-10-05T08:00:00Z"
|
|
175
|
+
when append CoursePassed
|
|
176
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
177
|
+
enrolmentId = "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
178
|
+
completedAt = "2026-10-05T08:00:00Z"
|
|
179
|
+
then CertificateSent
|
|
180
|
+
for "0d3b9e2a-6c4f-4f1e-8b7a-5e2d1c3b4a01"
|
|
181
|
+
sentAt = "2026-10-05T08:00:00Z"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Design-only additions
|
|
185
|
+
|
|
186
|
+
Two things a real queue often wants do not bind on 4.64.0 and stay out of the complete model
|
|
187
|
+
above: a list query (the visible queue) and a retry sweep that reads the whole view. Both parse
|
|
188
|
+
(V1) and report PLAY0268 at binding; durable per-item fan-out is outside the language
|
|
189
|
+
(Screenplay#286). Keep them in the model only when the document is the deliverable and say so
|
|
190
|
+
in the verdict.
|
|
191
|
+
|
|
192
|
+
```screenplay excerpt
|
|
193
|
+
// Parent: the complete document above, slice StateView CertificatesToSend.
|
|
194
|
+
query PendingCertificates => PendingCertificate[]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```screenplay excerpt
|
|
198
|
+
// Parent: the complete document above, slice Automation SendCertificates, after CertificateSender.
|
|
199
|
+
// The sweep reads the whole view (a clock trigger takes no `by`); iterating items needs code.
|
|
200
|
+
reaction CertificateRetrySweep
|
|
201
|
+
description "Retries items still pending; per-item fan-out needs code today (#286)"
|
|
202
|
+
every 15 minutes
|
|
203
|
+
reads PendingCertificate
|
|
204
|
+
file Reactions/RetryPendingCertificates.cs
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`reads` documents what a trigger consults; it never protects (a trigger with `reads` that
|
|
208
|
+
`produces` directly fails binding: decide in a command instead).
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Example: a Translate slice
|
|
2
|
+
|
|
3
|
+
A complete model: a webhook record from an outside proctoring service is captured, kept as an
|
|
4
|
+
external fact in the provider's vocabulary, then translated by reactions into our facts. It
|
|
5
|
+
binds on Screenplay 4.64.0 (`executableReady: true`); the cratis 3.27.1 bundled compiler
|
|
6
|
+
(Screenplay 4.60.1) compiles it (V1) but rejects the Translate slice at binding (PLAY0268).
|
|
7
|
+
|
|
8
|
+
Read the slice `description`: it is the per-field disposition (map, translate, ignore) and it
|
|
9
|
+
states what this example does not do. Examples never show the whole integration contract; use
|
|
10
|
+
`references/integration-contracts.md` and `references/worked-integration.md` for the rest.
|
|
11
|
+
|
|
12
|
+
```screenplay
|
|
13
|
+
// Translate slice. Correlation is created on OUR side: BookExam allocates the attempt id and the
|
|
14
|
+
// realization hands it to the proctoring service as its reference; the service's webhook echoes
|
|
15
|
+
// it, so the capture `key` lands every record on the attempt's own stream. The external fact keeps
|
|
16
|
+
// the provider's vocabulary (ProctorResultReceived); translator reactions record our facts.
|
|
17
|
+
|
|
18
|
+
domain Acme.Academy
|
|
19
|
+
|
|
20
|
+
concept AttemptId : Uuid
|
|
21
|
+
concept MemberId : Uuid
|
|
22
|
+
concept ProctorOutcome : Enum
|
|
23
|
+
passed
|
|
24
|
+
failed
|
|
25
|
+
|
|
26
|
+
policy IsAuthenticated
|
|
27
|
+
require authenticated
|
|
28
|
+
persona Member
|
|
29
|
+
description "Takes exams. Cannot: record or change results"
|
|
30
|
+
policy IsAuthenticated
|
|
31
|
+
|
|
32
|
+
module Exams
|
|
33
|
+
description "Exam attempts, graded by an external proctoring service"
|
|
34
|
+
authorize IsAuthenticated
|
|
35
|
+
feature Attempts
|
|
36
|
+
slice StateChange BookExam
|
|
37
|
+
command BookExam
|
|
38
|
+
attemptId AttemptId identifier
|
|
39
|
+
memberId MemberId
|
|
40
|
+
produces ExamBooked
|
|
41
|
+
for attemptId
|
|
42
|
+
memberId = memberId
|
|
43
|
+
event ExamBooked
|
|
44
|
+
memberId MemberId
|
|
45
|
+
specification BookingAnExam
|
|
46
|
+
given caller
|
|
47
|
+
authenticated
|
|
48
|
+
when BookExam
|
|
49
|
+
attemptId = "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
50
|
+
memberId = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
51
|
+
then ExamBooked
|
|
52
|
+
for "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
53
|
+
memberId = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
54
|
+
specification RefusingAnAnonymousBooking
|
|
55
|
+
given caller
|
|
56
|
+
when BookExam
|
|
57
|
+
attemptId = "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
58
|
+
memberId = "6f1c2a8e-0b1d-4d55-9a3e-2f6a7c1d0e11"
|
|
59
|
+
then denied
|
|
60
|
+
|
|
61
|
+
slice Translate ImportProctorResults
|
|
62
|
+
description "Per external field: reference -> correlation key (our attempt id, echoed); outcome -> translated to our enum; score -> kept; examinerNote -> ignored (free text, may hold personal data, no consumer). Repeated delivery: this example compares outcome only. An unchanged outcome appends nothing, even if the score changed, so it does not implement score corrections. OneResultPerAttempt refuses a second local result. Changed outcomes and score-only corrections need an explicit correction policy (open decision, recorded in STATE.md, not an overwrite) before this is a complete integration."
|
|
63
|
+
capture ProctorResults
|
|
64
|
+
source webhook
|
|
65
|
+
path /webhooks/proctoring/results
|
|
66
|
+
key reference
|
|
67
|
+
map
|
|
68
|
+
outcome = outcome translate
|
|
69
|
+
"P" => passed
|
|
70
|
+
"F" => failed
|
|
71
|
+
append ProctorResultReceived
|
|
72
|
+
when outcome
|
|
73
|
+
outcome = $.outcome
|
|
74
|
+
score = $.score
|
|
75
|
+
reaction PassTranslator
|
|
76
|
+
when ProctorResultReceived
|
|
77
|
+
outcome
|
|
78
|
+
score
|
|
79
|
+
produces ExamPassed
|
|
80
|
+
score = score
|
|
81
|
+
where outcome == "passed"
|
|
82
|
+
reaction FailTranslator
|
|
83
|
+
when ProctorResultReceived
|
|
84
|
+
outcome
|
|
85
|
+
produces ExamFailed
|
|
86
|
+
where outcome == "failed"
|
|
87
|
+
event ProctorResultReceived
|
|
88
|
+
outcome ProctorOutcome
|
|
89
|
+
score Int
|
|
90
|
+
event ExamPassed
|
|
91
|
+
score Int
|
|
92
|
+
event ExamFailed
|
|
93
|
+
constraint OneResultPerAttempt
|
|
94
|
+
unique event ExamPassed
|
|
95
|
+
unique event ExamFailed
|
|
96
|
+
specification TranslatingAPass
|
|
97
|
+
when capture ProctorResults
|
|
98
|
+
reference = "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
99
|
+
outcome = "P"
|
|
100
|
+
score = 87
|
|
101
|
+
then ProctorResultReceived
|
|
102
|
+
for "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
103
|
+
outcome = "passed"
|
|
104
|
+
score = 87
|
|
105
|
+
then ExamPassed
|
|
106
|
+
for "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
107
|
+
score = 87
|
|
108
|
+
specification RefusingASecondResult
|
|
109
|
+
given ExamPassed
|
|
110
|
+
for "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
111
|
+
score = 87
|
|
112
|
+
when append ProctorResultReceived
|
|
113
|
+
for "7e9d1c2b-4a3f-4e5d-8c6b-1a2b3c4d5e06"
|
|
114
|
+
outcome = "failed"
|
|
115
|
+
score = 40
|
|
116
|
+
then error "Constraint 'OneResultPerAttempt' is violated: the event source already has the constrained event."
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Notes for the reader:
|
|
120
|
+
|
|
121
|
+
- A capture, the translator reactions and the events they append stay in one `Translate`
|
|
122
|
+
slice. `then` lists every new fact, so `TranslatingAPass` names both the external fact and ours.
|
|
123
|
+
- The unauthenticated-booking spec needs an explicit `given caller` (empty means no caller);
|
|
124
|
+
an authorized command exercised without one is PLAY0389 at binding.
|
|
125
|
+
- Authenticity of the webhook, tenant ownership and a score-correction policy are not in the
|
|
126
|
+
model. They are target requirements and an open decision (see the slice description).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Translation patterns
|
|
2
|
+
|
|
3
|
+
Complete compiled example: `translate-example.md` (binds on Screenplay 4.64.0; the cratis 3.27.1
|
|
4
|
+
bundled compiler compiles it but rejects the slice at binding).
|
|
5
|
+
|
|
6
|
+
## 1. Where outside facts may enter
|
|
7
|
+
Only two routes, both in a `Translate` slice:
|
|
8
|
+
- **`capture`** over a source (api poll, webhook, message topic): key, map, conditional
|
|
9
|
+
appends. Change detection compares each record with the last one seen for the same key.
|
|
10
|
+
- **translator `reaction`** over an event imported from another context (unquoted
|
|
11
|
+
`import Context.Event`) or over the external fact a capture appended.
|
|
12
|
+
Not a translation: our own event-to-event follow-up (Automation), infrastructure plumbing,
|
|
13
|
+
and raw database row changes published as-is.
|
|
14
|
+
|
|
15
|
+
## 2. Correlation first
|
|
16
|
+
Before mapping fields, answer: how does an outside record find *our* stream?
|
|
17
|
+
| Situation | Approach |
|
|
18
|
+
|---|---|
|
|
19
|
+
| we start the outside interaction | allocate our id first and send it out as their reference; their reply echoes it; capture `key` = that field (`translate-example.md`: `reference`) |
|
|
20
|
+
| they start it and carry our id | key on it; validate it exists (an unknown id is a case to specify) |
|
|
21
|
+
| they only carry their own id | record their id on our fact when we first learn it, and keep a lookup view from their id to ours; the record that arrives before the link exists is a case to specify |
|
|
22
|
+
Never make an outside id our stream identity unless the business genuinely identifies the
|
|
23
|
+
thing by it. Keep it as a property when it is needed to correlate or deduplicate.
|
|
24
|
+
|
|
25
|
+
## 3. Two vocabularies
|
|
26
|
+
- The capture appends an **external fact** in the provider's terms (`ProctorResultReceived`
|
|
27
|
+
with a translated `outcome`).
|
|
28
|
+
- Translator reactions record **our facts** in business terms (`ExamPassed`, `ExamFailed`),
|
|
29
|
+
each guarded by our constraints.
|
|
30
|
+
- A further worker needs a distinct local decision, obligation or external effect; otherwise
|
|
31
|
+
project views from our fact directly.
|
|
32
|
+
- Name our facts for what they mean to us, not for the transport (`…Synced`,
|
|
33
|
+
`…WebhookReceived` are smells).
|
|
34
|
+
|
|
35
|
+
## 4. Per-field disposition
|
|
36
|
+
For every field of the outside record, decide and write in the slice `description`:
|
|
37
|
+
| Disposition | Meaning | Screenplay |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| **map** | carried into our fact as is or translated | `map` + mapping `x = $.x`; `translate` for codes |
|
|
40
|
+
| **enrich** | we add data the record lacks, from our own facts | later decision in a command or view; not in the capture |
|
|
41
|
+
| **infer** | derived from the record by a rule the business confirms | `map` template or a translator condition |
|
|
42
|
+
| **ignore** | not needed, or not permitted for this purpose | keep it out of appended event payloads; define separately what source/last-seen records the target retains |
|
|
43
|
+
Missing data our fact needs: either enrich from our side, or the fact is not ready yet
|
|
44
|
+
(model a pending fact plus a case to specify), never invent defaults.
|
|
45
|
+
A field left out of `map` still passes through the capture's working record: omission is not
|
|
46
|
+
redaction. Check the append mappings and every resulting event property, and record whether
|
|
47
|
+
the target stores raw or last-seen source records and how they are minimized.
|
|
48
|
+
Personal data kept in events needs `@pii` on its concept and a purpose; keep the annotation
|
|
49
|
+
even when it blocks binding. Never record bearer tokens, magic links or signed URLs as facts
|
|
50
|
+
(a keyed hash or reference at most), and never put PII on the event-source id.
|
|
51
|
+
Malformed or unmappable input becomes a recorded failure fact (or a dead-letter view), never
|
|
52
|
+
a dropped record or a thrown error, which would pause the observer partition.
|
|
53
|
+
|
|
54
|
+
## 5. Dedup and ordering
|
|
55
|
+
Two layers, each with its own scope:
|
|
56
|
+
1. **Capture change detection** - per `key`, against the last record seen. An unchanged
|
|
57
|
+
redelivery appends nothing. Where the last-seen record is stored and how long it survives
|
|
58
|
+
is the target's business; specs supply it explicitly with `given capture` and never persist
|
|
59
|
+
it.
|
|
60
|
+
2. **Constraint on our fact** - `unique event` per stream (one result per attempt), or
|
|
61
|
+
`unique externalRef on OurFact` when the same outside reference must never land on two of
|
|
62
|
+
our streams. A property constraint does **not** stop the same stream receiving the same
|
|
63
|
+
value twice; add `unique event` for that.
|
|
64
|
+
Out-of-order records: decide whether an older record may overwrite a newer one. Use
|
|
65
|
+
`when field from <v> to <v>` for transitions that only make sense in one direction, and
|
|
66
|
+
specify the reverse arrival.
|
|
67
|
+
A rejection by our constraint inside a capture stops that record's processing in the
|
|
68
|
+
reference; what the target does with the source record (acknowledge, retry, park) is a
|
|
69
|
+
realization decision to record.
|
|
70
|
+
|
|
71
|
+
Distinguish the provider's object id, its event/delivery id and its revision. One object can
|
|
72
|
+
produce several legitimate events (charge, refund); define which repetition is a duplicate
|
|
73
|
+
and its retention window before choosing constraints. `unique event` fits only when the
|
|
74
|
+
business permits that event once per source. Change detection evaluates only the fields in
|
|
75
|
+
the append conditions: a redelivery with the same outcome but a changed score or amount is
|
|
76
|
+
not automatically a duplicate; decide whether it is a correction, deferred work or a
|
|
77
|
+
rejection, and specify it.
|
|
78
|
+
|
|
79
|
+
## 6. Corrections from outside
|
|
80
|
+
When the outside system changes its mind (re-grade, refund, cancelled delivery), the change
|
|
81
|
+
is a new fact for us (`ResultCorrected`), never an overwrite. Mutually exclusive
|
|
82
|
+
`unique event` lines will refuse a second result; decide with the expert whether a correction
|
|
83
|
+
event with `released by` or a separate correction flow is right.
|
|
84
|
+
|
|
85
|
+
## 7. Specifying translations
|
|
86
|
+
- `when capture <Capture>` with record fields (as the source names them) -> `then` the
|
|
87
|
+
external fact and, under v6, what translator reactions appended (`then` lists every new
|
|
88
|
+
fact).
|
|
89
|
+
- `given capture` for the previous record when a condition compares (`from … to …`,
|
|
90
|
+
unchanged redelivery).
|
|
91
|
+
- `when append <ExternalFact>` -> `then <OurFact>` to test a translator reaction alone.
|
|
92
|
+
- Case list: `cases-to-specify.md`. These forms parse (probed in
|
|
93
|
+
`translate-example.md`) but are not executed by any local engine.
|