@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,98 @@
|
|
|
1
|
+
# Worked example: a payment provider into invoicing
|
|
2
|
+
|
|
3
|
+
An integration walked end to end, in the order of the interview: catalog, correlation,
|
|
4
|
+
translation rules, failure and recovery, result. The domain is invoicing; the outside system is a
|
|
5
|
+
payment provider. Every provider name, field and sample below is synthetic. The structure follows
|
|
6
|
+
the TrogonStack translating-external-events skill (MIT; see `references/provenance.md`); the
|
|
7
|
+
analysis is adapted to Screenplay `capture`, translator `reaction` and `constraint`.
|
|
8
|
+
|
|
9
|
+
## 1. Catalog (interview question 1)
|
|
10
|
+
The user said only "the provider tells us when invoices are paid". Not enough to skip the
|
|
11
|
+
interview: no event types, no samples, no correlation. Asked: which systems, which record types,
|
|
12
|
+
what each carries, how it arrives, who authenticates it.
|
|
13
|
+
|
|
14
|
+
| Source | Record type | Channel | Business occurrence | Sample fields (synthetic) |
|
|
15
|
+
|---|---|---|---|---|
|
|
16
|
+
| PayCo | `payment.settled` | webhook | money reached our account | `id` "evt_01", `payment` "pay_77", `reference` "INV-2026-0042", `amountMinor` 15000, `currency` "NOK", `settledAt` 1790000000 |
|
|
17
|
+
| PayCo | `payment.failed` | webhook | attempt did not settle | `id`, `payment`, `reference`, `reason` "card_declined" |
|
|
18
|
+
| PayCo | `payment.refunded` | webhook | money returned | `id`, `payment`, `refund` "re_5", `reference`, `amountMinor` |
|
|
19
|
+
| PayCo | `dispute.opened` | webhook | cardholder disputes | `id`, `payment`, `deadline` |
|
|
20
|
+
| PayCo | `payout.created` | webhook | provider pays us out | `id`, `batch` |
|
|
21
|
+
|
|
22
|
+
Follow-ups asked next, each from the previous answer: which header carries the signature, and who
|
|
23
|
+
verifies it (answer: the gateway in front of the app: a target requirement); do we know `reference`
|
|
24
|
+
(yes: we send our invoice number when creating the payment: we start the interaction); what happens
|
|
25
|
+
if two refunds for one payment arrive (both legitimate: a refund is not a duplicate of the first). Does a refund carry its own stable id, the same on every redelivery? (yes: `refund`; confirm with the provider, because the whole dedup rests on it).
|
|
26
|
+
`payout.created` has no consumer: excluded explicitly with that reason, not silently dropped.
|
|
27
|
+
|
|
28
|
+
## 2. Technical analysis
|
|
29
|
+
| Technical fact | Problem if used directly | Decision |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `amountMinor` integer minor units | unit and scale are implicit | translate to our `Money` with currency; unsupported currencies are a recorded failure |
|
|
32
|
+
| `settledAt` Unix seconds | provider time is not our occurrence time | own field `settledAt`; `$context.occurred` stays the capture time |
|
|
33
|
+
| `payment` "pay_77" | provider identity, not ours | kept as `paymentRef` property for refund correlation; never an event source id |
|
|
34
|
+
| `reference` "INV-2026-0042" | echo of our value | capture `key`: lands the record on the invoice's stream |
|
|
35
|
+
| `id` "evt_01" | delivery id, not the occurrence | never the dedup key: it may change on redelivery, and one payment has several occurrences |
|
|
36
|
+
| `refund` "re_5" | provider's identity of one refund occurrence | stable occurrence key for refunds; separate from the delivery id and from `payment` |
|
|
37
|
+
|
|
38
|
+
## 3. Correlation
|
|
39
|
+
We create the bridge when the payment is started: the command that starts it allocates the invoice
|
|
40
|
+
stream id, and the realization sends it as the provider's `reference`. The echo is the capture
|
|
41
|
+
`key`. The record that arrives before the invoice exists is a named case: park, reject or record an
|
|
42
|
+
orphan fact (decided with the expert: record a `PaymentWithoutInvoiceReceived` fact for follow-up).
|
|
43
|
+
|
|
44
|
+
## 4. Translation rules (target-field completeness)
|
|
45
|
+
| Our event | Field | Source | Transformation | Missing or invalid |
|
|
46
|
+
|---|---|---|---|---|
|
|
47
|
+
| `InvoiceSettled` | `invoiceId` (stream) | `reference` | key | unknown: orphan fact |
|
|
48
|
+
| | `amount` | `amountMinor`, `currency` | scale by currency | unknown currency: failure fact |
|
|
49
|
+
| | `settledAt` | `settledAt` | seconds to instant | missing: reject record, failure fact |
|
|
50
|
+
| | `paymentRef` | `payment` | as is | missing: failure fact |
|
|
51
|
+
| `PaymentAttemptFailed` | `reasonCode` | `reason` | translate known codes | unknown code: failure fact, never a default |
|
|
52
|
+
| `InvoicePaymentRefunded` | `refundRef` (stream) | `refund` | capture `key` of the refund capture: each refund occurrence is its own stream | missing: failure fact |
|
|
53
|
+
| | `invoiceNumber`, `amount`, `paymentRef` | `reference`, `amountMinor`, `payment` | as above | refund above settled: cross-stream rule, review case (see section 5) |
|
|
54
|
+
|
|
55
|
+
Every target field has an origin or a recorded blocker. Source fields not in the table are
|
|
56
|
+
dispositioned: `dispute.opened.deadline` is kept for a follow-up automation; `batch` is ignored.
|
|
57
|
+
|
|
58
|
+
## 5. Scenarios per record type
|
|
59
|
+
Happy path; arrives before the invoice; duplicate delivery of the same occurrence; two distinct
|
|
60
|
+
refunds; settled then failed out of order; unknown currency; unknown reason code; amount changed
|
|
61
|
+
with the same status; malformed record; consent or tenant mismatch (enforced at the gateway:
|
|
62
|
+
named, with its negative case). The full catalog is `references/cases-to-specify.md`.
|
|
63
|
+
|
|
64
|
+
**Refund dedup.** A single `unique event` on the invoice stream would refuse the second legitimate
|
|
65
|
+
refund, and change detection per invoice key cannot tell an identical second refund from a retry.
|
|
66
|
+
So the refund capture is keyed by the occurrence (`key refund`): every refund is its own stream,
|
|
67
|
+
`unique event InvoicePaymentRefunded` on that stream is the atomic dedup, and the invoice is
|
|
68
|
+
referenced by a property. Cases to specify, with identical payment and amount in both:
|
|
69
|
+
- `re_5` delivered twice: the second delivery appends nothing new (the first fact is already there).
|
|
70
|
+
- `re_5` and `re_6` for the same payment and amount: two refund facts, both kept.
|
|
71
|
+
The cost is that "refunds never exceed the settled amount" now spans streams; it is a rule for
|
|
72
|
+
`cratis-screenplay-streams-and-consistency`, not something this dedup provides. Reserve
|
|
73
|
+
`unique event` on the invoice stream for facts allowed once per invoice (`InvoiceSettled`).
|
|
74
|
+
|
|
75
|
+
## 6. Failure and recovery (owner per class)
|
|
76
|
+
| Class | Visible as | Owner | Resumes by |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| unknown correlation | orphan fact in a review list | finance clerk | linking the invoice, then re-translating |
|
|
79
|
+
| unknown currency or code | failure fact | integration owner | adding the mapping; the record is replayed from the failure fact |
|
|
80
|
+
| duplicate delivery | nothing new | none | occurrence-keyed stream (settlement: invoice stream) plus `unique event` |
|
|
81
|
+
| signature invalid | refused before the app | gateway owner | operational alert |
|
|
82
|
+
|
|
83
|
+
Logging alone is not recovery: each row has an owner and a way back.
|
|
84
|
+
|
|
85
|
+
## 7. Result as the skill reports it
|
|
86
|
+
Hypothetical packet: no PayCo model exists in this example, so no verdict below is evidence.
|
|
87
|
+
```text
|
|
88
|
+
Integration: PayCo -> invoicing Types cataloged: 5 (4 translated, 1 excluded: payout.created, no consumer)
|
|
89
|
+
payment.settled complete: correlation (own reference, echoed), target fields traced, 6 cases named (3 specified)
|
|
90
|
+
payment.failed open: reason codes beyond card_declined unknown (question for the integration owner)
|
|
91
|
+
payment.refunded open: refund-above-settled rule undecided
|
|
92
|
+
dispute.opened blocked: no consumer decided
|
|
93
|
+
Target requirements: signature verified before the app; idempotent webhook acknowledgement
|
|
94
|
+
Verdicts: V1 not run (no PayCo model written), V3 not run (same), V4 not run: no route
|
|
95
|
+
```
|
|
96
|
+
The model for the settled record is `translate-example.md` in miniature: correlation key, an
|
|
97
|
+
external fact in provider vocabulary, translator reactions that record our facts, a constraint on
|
|
98
|
+
our fact.
|
package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill": "cratis-screenplay-automations-and-translations",
|
|
3
|
+
"input": "Our payment provider sends webhooks when invoices are paid or refunded, and we must email a receipt afterwards. Model the integration and the follow-up in the Screenplay model.",
|
|
4
|
+
"fixtures": [],
|
|
5
|
+
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "`[ExecuteCommandsAsSystem(\"<role>\")]`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "Screenplay#383" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "renders no Automation or Translate slice" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "never invent `runs as`" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "**One meaning of Translation:**" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "complete, open or blocked" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "never write a mapping" },
|
|
13
|
+
{ "kind": "skill-contains", "value": "V4 is \"not run: no route\"" }
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -27,49 +27,222 @@ source is the single flow model.
|
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| `Cratis.Screenplay` | `4.31.0` | CDL parser, reaction and trigger parsers, diagnostics, semantic binder |
|
|
29
29
|
| `Cratis.Screenplay` | main `fd18129` | Command-only inline event boundary |
|
|
30
|
+
| `Cratis.Screenplay` | `4.64.0` (`7e16162`) | ESM v6: reactions, clock, trigger and capture specifications bind; `invokes` caller rule; probed with the standalone tool and its MCP server |
|
|
30
31
|
|
|
31
32
|
The update follows `commands.md`, `events.md` and `diagnostics.md` at that main
|
|
32
|
-
commit (after v4.52.0)
|
|
33
|
+
commit (after v4.52.0).
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
Historical baseline evidence: the original examples were checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
35
36
|
`Documentation/screenplay/{captures,captures/grammar,reactions,triggers,interactions,file-references,grammar,diagnostics}.md`
|
|
36
|
-
and decisions 0003, 0006 and 0009
|
|
37
|
-
version's compiler.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
specification
|
|
37
|
+
and decisions 0003, 0006 and 0009; those original examples compiled with that
|
|
38
|
+
version's compiler. The specification actions and ESM v6 text were checked at
|
|
39
|
+
`v4.64.0` (see its row above), and the complete examples here and in
|
|
40
|
+
`references/complete-examples.md` compile with the standalone 4.64.0 compiler.
|
|
41
|
+
Reverify before claiming another version behaves the same.
|
|
42
|
+
|
|
43
|
+
⚠️ **Which tool admits them depends on its Screenplay version.** The ESM level
|
|
44
|
+
decides, not the slice type:
|
|
45
|
+
|
|
46
|
+
- **Standalone `screenplay` 4.64.0 (ESM v1-v6, from 4.61.0):** `Automation` and
|
|
47
|
+
`Translate` slices, reactions, declared triggers and captures bind, and the
|
|
48
|
+
reference runner executes them. Probed: the complete example below is
|
|
49
|
+
`executableReady` over `screenplay mcp`.
|
|
50
|
+
- **`cratis` 3.27.1 (Screenplay 4.60.1, ESM v1-v5):** an `Automation` or `Translate`
|
|
51
|
+
slice fails binding with `PLAY0268` (*Slice '<name>' of type '<type>' is not
|
|
52
|
+
admitted by ESM v1*), reactions report *requires portable occurrence and effect
|
|
53
|
+
semantics*, and captures *require a portable compiled CDL plan*. Only binding
|
|
54
|
+
shows this; `cratis screenplay validate` does not bind. It also reports a false
|
|
55
|
+
`PLAY0285` on a specification that follows a reaction cascade (Cratis/cli#242).
|
|
56
|
+
- **Stage 4.24.0** admits ESM v1-v3 and renders no `Automation` or `Translate`
|
|
57
|
+
slice. The automation is gap-fill, with the `.play` slice and its specifications
|
|
58
|
+
as the contract: `cratis-screenplay-render-and-gap-fill`.
|
|
59
|
+
|
|
60
|
+
Model them whenever the `.play` file is the deliverable, and say which tool bound
|
|
61
|
+
them. Versions and messages: `cratis-screenplay-toolchain` (`references/versions.md`).
|
|
62
|
+
Method (the four-part automation test, loops, translations versus automations):
|
|
63
|
+
`cratis-screenplay-automations-and-translations`.
|
|
64
|
+
|
|
65
|
+
**Specify what sets them off** (v4.48.0, checked at tag `v4.48.0`, commit
|
|
66
|
+
`3baf4a4`; execution from ESM v6, checked at `v4.64.0`): `when clock "<instant>"`
|
|
67
|
+
for a reaction on `every` or `at`, `when trigger <Trigger>` with its values for one
|
|
68
|
+
on an application trigger, and `given capture` / `when capture <Capture>` with the
|
|
69
|
+
source record's fields for a capture, then the events that should follow.
|
|
70
|
+
`given clock` fixes the occurrence time, so values mapped from `$context.occurred`
|
|
71
|
+
can be asserted. Excerpt of the complete example below:
|
|
72
|
+
|
|
73
|
+
```screenplay excerpt
|
|
74
|
+
specification IssuingTheWeeklyDigest
|
|
55
75
|
given clock "2026-10-05T07:00:00Z"
|
|
56
76
|
when clock "2026-10-05T07:30:00Z"
|
|
57
|
-
then
|
|
77
|
+
then DigestIssued
|
|
78
|
+
for "weekly"
|
|
58
79
|
issuedAt = "2026-10-05T07:30:00Z"
|
|
59
80
|
```
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
Under `cratis` 3.27.1 these actions parse and are checked against the application
|
|
83
|
+
but bind to nothing (`PLAY0268` names ESM v6, decision 0022): report such a
|
|
84
|
+
specification as parsed, not executed. Clock rules: the clock is UTC and exact; an
|
|
85
|
+
occurrence fires once when it is **due after `given clock` and at or before
|
|
86
|
+
`when clock`**, in time order; intervals count from the Unix epoch; `when clock`
|
|
87
|
+
needs `given clock`, so equal instants fire nothing. Limits: 10,000 occurrences per
|
|
88
|
+
advance, 1,000 new facts per scenario. Spec grammar and outcome comparison:
|
|
89
|
+
`cratis-screenplay-specifications`.
|
|
90
|
+
|
|
91
|
+
## Complete example (ESM v6)
|
|
92
|
+
|
|
93
|
+
One document with every construct below: an application trigger, a reaction on an
|
|
94
|
+
event, on a trigger (with `where` and `invokes`), on a view read and on the clock, and
|
|
95
|
+
a capture with its specifications. The excerpts later in this skill have their own
|
|
96
|
+
complete parent documents in `references/complete-examples.md`.
|
|
97
|
+
|
|
98
|
+
```screenplay
|
|
99
|
+
// Needs the standalone screenplay compiler (ESM v6)
|
|
100
|
+
concept InvoiceId : Uuid
|
|
101
|
+
trigger PaymentFileArrived
|
|
102
|
+
description "The bank's payment file listed a payment for an invoice"
|
|
103
|
+
invoiceId InvoiceId
|
|
104
|
+
amount Decimal
|
|
105
|
+
module Collections
|
|
106
|
+
feature Invoices
|
|
107
|
+
slice StateChange SendInvoice
|
|
108
|
+
command SendInvoice
|
|
109
|
+
invoiceId InvoiceId identifier
|
|
110
|
+
amount Decimal
|
|
111
|
+
produces InvoiceSent
|
|
112
|
+
for invoiceId
|
|
113
|
+
invoiceId = invoiceId
|
|
114
|
+
amount = amount
|
|
115
|
+
sentAt = $context.occurred
|
|
116
|
+
event InvoiceSent
|
|
117
|
+
invoiceId InvoiceId
|
|
118
|
+
amount Decimal
|
|
119
|
+
sentAt DateTime
|
|
120
|
+
slice StateChange CloseInvoice
|
|
121
|
+
command CloseInvoice
|
|
122
|
+
invoiceId InvoiceId identifier
|
|
123
|
+
reason String
|
|
124
|
+
validate
|
|
125
|
+
reason not empty message "A reason is required"
|
|
126
|
+
produces InvoiceClosed
|
|
127
|
+
for invoiceId
|
|
128
|
+
reason = reason
|
|
129
|
+
event InvoiceClosed
|
|
130
|
+
reason String
|
|
131
|
+
constraint OnlyClosedOnce
|
|
132
|
+
unique event InvoiceClosed
|
|
133
|
+
slice StateView InvoiceBalances
|
|
134
|
+
readmodel InvoiceBalance
|
|
135
|
+
invoiceId InvoiceId
|
|
136
|
+
outstanding Decimal
|
|
137
|
+
query InvoiceBalanceById => InvoiceBalance optional
|
|
138
|
+
by invoiceId InvoiceId
|
|
139
|
+
projection InvoiceBalances => InvoiceBalance
|
|
140
|
+
from InvoiceSent
|
|
141
|
+
invoiceId = $eventSourceId
|
|
142
|
+
outstanding = amount
|
|
143
|
+
slice StateChange SendPaymentReminder
|
|
144
|
+
command SendPaymentReminder
|
|
145
|
+
invoiceId InvoiceId identifier
|
|
146
|
+
produces PaymentReminderSent
|
|
147
|
+
for invoiceId
|
|
148
|
+
reminderNumber = 1
|
|
149
|
+
event PaymentReminderSent
|
|
150
|
+
reminderNumber Int
|
|
151
|
+
slice Automation Reminders
|
|
152
|
+
reaction RemindOnDueDate
|
|
153
|
+
description "Reminds the customer when an invoice falls due unpaid"
|
|
154
|
+
when InvoiceFellDue
|
|
155
|
+
invoiceId
|
|
156
|
+
reads InvoiceBalance as balance by invoiceId
|
|
157
|
+
invokes SendPaymentReminder
|
|
158
|
+
invoiceId = invoiceId
|
|
159
|
+
reaction ReminderScheduler
|
|
160
|
+
description "Schedules a reminder when an invoice is sent"
|
|
161
|
+
when InvoiceSent
|
|
162
|
+
invoiceId
|
|
163
|
+
produces ReminderScheduled
|
|
164
|
+
scheduledAt = $context.occurred
|
|
165
|
+
reaction PaymentImporter
|
|
166
|
+
description "Closes an invoice the bank file shows as paid"
|
|
167
|
+
when PaymentFileArrived
|
|
168
|
+
invoiceId
|
|
169
|
+
amount
|
|
170
|
+
invokes CloseInvoice
|
|
171
|
+
invoiceId = invoiceId
|
|
172
|
+
reason = "paid"
|
|
173
|
+
where amount > 0
|
|
174
|
+
reaction WeeklyDigest
|
|
175
|
+
description "Issues the collections digest every Monday morning"
|
|
176
|
+
at 07:30 on Monday
|
|
177
|
+
produces DigestIssued
|
|
178
|
+
for "weekly"
|
|
179
|
+
issuedAt = $context.occurred
|
|
180
|
+
event InvoiceFellDue
|
|
181
|
+
invoiceId InvoiceId
|
|
182
|
+
event ReminderScheduled
|
|
183
|
+
scheduledAt DateTime
|
|
184
|
+
event DigestIssued
|
|
185
|
+
issuedAt DateTime
|
|
186
|
+
specification SchedulingAReminderWhenAnInvoiceIsSent
|
|
187
|
+
given clock "2026-10-02T09:00:00Z"
|
|
188
|
+
when append InvoiceSent
|
|
189
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
190
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
191
|
+
amount = 120
|
|
192
|
+
sentAt = "2026-10-02T09:00:00Z"
|
|
193
|
+
then ReminderScheduled
|
|
194
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
195
|
+
scheduledAt = "2026-10-02T09:00:00Z"
|
|
196
|
+
specification ClosingAPaidInvoice
|
|
197
|
+
when trigger PaymentFileArrived
|
|
198
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
199
|
+
amount = 120
|
|
200
|
+
then InvoiceClosed
|
|
201
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
202
|
+
reason = "paid"
|
|
203
|
+
specification IssuingTheWeeklyDigest
|
|
204
|
+
given clock "2026-10-05T07:00:00Z"
|
|
205
|
+
when clock "2026-10-05T07:30:00Z"
|
|
206
|
+
then DigestIssued
|
|
207
|
+
for "weekly"
|
|
208
|
+
issuedAt = "2026-10-05T07:30:00Z"
|
|
209
|
+
slice Translate LegacyInvoiceSync
|
|
210
|
+
capture LegacyInvoiceCapture
|
|
211
|
+
source api
|
|
212
|
+
api LegacyInvoicingApi
|
|
213
|
+
route /invoices
|
|
214
|
+
poll 5m
|
|
215
|
+
key id
|
|
216
|
+
map
|
|
217
|
+
status = status translate
|
|
218
|
+
"sendt" => sent
|
|
219
|
+
"betalt" => paid
|
|
220
|
+
append LegacyInvoicePaid
|
|
221
|
+
tag legacy
|
|
222
|
+
when status from "sent" to "paid"
|
|
223
|
+
paidAt = $context.occurred
|
|
224
|
+
event LegacyInvoicePaid
|
|
225
|
+
paidAt DateTime
|
|
226
|
+
specification SeeingALegacyPayment
|
|
227
|
+
given clock "2026-10-02T12:00:00Z"
|
|
228
|
+
given capture LegacyInvoiceCapture
|
|
229
|
+
id = "inv-42"
|
|
230
|
+
status = "sendt"
|
|
231
|
+
when capture LegacyInvoiceCapture
|
|
232
|
+
id = "inv-42"
|
|
233
|
+
status = "betalt"
|
|
234
|
+
then LegacyInvoicePaid
|
|
235
|
+
for "inv-42"
|
|
236
|
+
paidAt = "2026-10-02T12:00:00Z"
|
|
237
|
+
```
|
|
65
238
|
|
|
66
239
|
## `capture` — the Change Data Capture Language
|
|
67
240
|
|
|
68
241
|
Captures live in `Translate` slices and are the anti-corruption layer: external
|
|
69
|
-
shapes in, domain events out. Excerpt
|
|
70
|
-
|
|
242
|
+
shapes in, domain events out. Excerpt; complete document: `references/complete-examples.md`,
|
|
243
|
+
"Capture with `source`, `map`, `append` and `children`".
|
|
71
244
|
|
|
72
|
-
```screenplay
|
|
245
|
+
```screenplay excerpt
|
|
73
246
|
slice Translate LegacyInvoiceSync
|
|
74
247
|
capture LegacyInvoiceCapture
|
|
75
248
|
source api
|
|
@@ -104,7 +277,11 @@ slice Translate LegacyInvoiceSync
|
|
|
104
277
|
free-form name/value pairs, so a typo is not caught. The three kinds are
|
|
105
278
|
convention, not enforcement.
|
|
106
279
|
|
|
107
|
-
**`key <property>`** names the source property identifying an instance.
|
|
280
|
+
**`key <property>`** names the source property identifying an instance. From ESM v6
|
|
281
|
+
a capture without a `key` does not bind (`PLAY0268`). In a specification the
|
|
282
|
+
reference is handed records (`given capture`, `when capture`) and never contacts a
|
|
283
|
+
`source`, which stays realization metadata; events append to the event source the
|
|
284
|
+
record's `key` names, and `$context.occurred` is the scenario's `given clock`.
|
|
108
285
|
|
|
109
286
|
Declaring an event's external origin on the `event` itself is accepted as
|
|
110
287
|
Screenplay decision 0009 but **not in the language**; a `capture` in a
|
|
@@ -128,7 +305,7 @@ capture context, `$env.` for an environment variable, plus literals and template
|
|
|
128
305
|
| `when <Path> from <v> to <v>` | that property makes that exact transition |
|
|
129
306
|
| `when <a> or <b> [or <c>]` | any of those properties change |
|
|
130
307
|
| `when <a> and <b> [and <c>]` | all of those properties change |
|
|
131
|
-
| ``when `<expression>` `` | a raw template expression is true (captured verbatim,
|
|
308
|
+
| ``when `<expression>` `` | a raw template expression is true (captured verbatim; from ESM v6 the reference evaluates fields, literals, `==`, `!=`, the ordering operators, `&&`, `||`, `!` and parentheses, and an expression outside that grammar does not bind) |
|
|
132
309
|
|
|
133
310
|
⚠️ **`or` and `and` cannot be mixed in one clause** — `when a or b and c` is a
|
|
134
311
|
compile error. Split it into two `append` blocks.
|
|
@@ -138,10 +315,10 @@ an optional `map` and any number of `append` blocks.
|
|
|
138
315
|
|
|
139
316
|
## `reaction`
|
|
140
317
|
|
|
141
|
-
Excerpt
|
|
142
|
-
|
|
318
|
+
Excerpt; complete document: `references/complete-examples.md`,
|
|
319
|
+
"Reaction on a declared trigger with `where` and `invokes`".
|
|
143
320
|
|
|
144
|
-
```screenplay
|
|
321
|
+
```screenplay excerpt
|
|
145
322
|
slice Automation NotifyOnBuildFailure
|
|
146
323
|
reaction NotifyOnFailure
|
|
147
324
|
description "Tells the owning team when a watched build fails"
|
|
@@ -150,6 +327,7 @@ slice Automation NotifyOnBuildFailure
|
|
|
150
327
|
outcome
|
|
151
328
|
invokes SendFailureNotice
|
|
152
329
|
repository = repository
|
|
330
|
+
outcome = outcome
|
|
153
331
|
where outcome == "failed"
|
|
154
332
|
```
|
|
155
333
|
|
|
@@ -196,9 +374,10 @@ Inline `produces event <Name>` is command-only (`PLAY0474` in a reaction).
|
|
|
196
374
|
Declare reaction-produced events separately and use plain `produces <Name>`.
|
|
197
375
|
Do not extend the inline command destination default or its repairs to reactions.
|
|
198
376
|
|
|
199
|
-
Excerpt
|
|
377
|
+
Excerpt; complete document: `references/complete-examples.md`,
|
|
378
|
+
"Reaction with `produces` and `invokes`":
|
|
200
379
|
|
|
201
|
-
```screenplay
|
|
380
|
+
```screenplay excerpt
|
|
202
381
|
reaction Provisioner
|
|
203
382
|
when InvitationAccepted
|
|
204
383
|
workspaceId
|
|
@@ -207,12 +386,32 @@ reaction Provisioner
|
|
|
207
386
|
workspaceId = workspaceId
|
|
208
387
|
invokes SendWelcomeMail
|
|
209
388
|
workspaceId = workspaceId
|
|
389
|
+
template = "welcome"
|
|
210
390
|
```
|
|
211
391
|
|
|
212
|
-
|
|
213
|
-
|
|
392
|
+
A `produces` without `for` appends to the event source of the event that set the
|
|
393
|
+
reaction off. A clock, application or built-in trigger has no such event, so what it
|
|
394
|
+
produces needs `for` - a value the trigger carries, or literal text.
|
|
395
|
+
|
|
396
|
+
**The different word is the point.** `produces` requests a fact append, subject to
|
|
397
|
+
append-time constraints. `invokes` asks for a command, which additionally runs the
|
|
398
|
+
command's authorization, validation and requirements, and may reject.
|
|
214
399
|
Using `produces` for both would say those are the same kind of consequence.
|
|
215
400
|
|
|
401
|
+
**Who is the caller of an `invokes`?** Nobody. In the reference execution the invoked
|
|
402
|
+
command runs its full pipeline - authorization, validation, requirements,
|
|
403
|
+
constraints - **with no caller**; a command that needs one rejects, and the
|
|
404
|
+
rejection ends the scenario. Each invoked command is atomic, but the cascade is not,
|
|
405
|
+
so facts accepted earlier remain. There is no syntax for a trusted identity today
|
|
406
|
+
(Screenplay#383, open): never invent `runs as` or a `given caller` for a reaction.
|
|
407
|
+
Say so in the model: a `description` on the reaction that names the trusted actor
|
|
408
|
+
the target must use. At code level a rendered or hand-written target runs such a
|
|
409
|
+
command as the system with `[ExecuteCommandsAsSystem]` (Arc 20.56.0 and later, so
|
|
410
|
+
also in a rendered application's Arc 22.25.0). An authorized command a reaction
|
|
411
|
+
invokes needs that decision made explicit, in the model's description and in the
|
|
412
|
+
gap-fill code, not left to a rejection nobody expected. Cascades and their
|
|
413
|
+
specification limits: `cratis-screenplay-specifications`.
|
|
414
|
+
|
|
216
415
|
Both are declarations of *what happens*, not of how — a trigger can state its
|
|
217
416
|
consequences **and** carry a `file` or an inline block in a tagged fence
|
|
218
417
|
(` ```csharp `) that implements them. That code is an implementation attachment:
|
|
@@ -222,11 +421,11 @@ the model lists it (role, owner, content hash) but never runs it.
|
|
|
222
421
|
|
|
223
422
|
An automation decides from state. A trigger names the views it consults with
|
|
224
423
|
`reads <View> [as <alias>] [by <trigger value>]` — the same word and meaning as
|
|
225
|
-
a command's `reads`: the state the behavior decides from. Excerpt
|
|
226
|
-
`
|
|
227
|
-
|
|
424
|
+
a command's `reads`: the state the behavior decides from. Excerpt; complete
|
|
425
|
+
document: `references/complete-examples.md`, "Trigger `reads` on an event and on the
|
|
426
|
+
clock" (authoring-valid; the `file` bodies stop it binding at ESM v6).
|
|
228
427
|
|
|
229
|
-
```screenplay
|
|
428
|
+
```screenplay excerpt
|
|
230
429
|
slice Automation ChaseOverdueInvoices
|
|
231
430
|
reaction RemindOnDueDate
|
|
232
431
|
description "Reminds the customer when an invoice falls due unpaid"
|
|
@@ -235,6 +434,7 @@ slice Automation ChaseOverdueInvoices
|
|
|
235
434
|
reads InvoiceBalance as balance by invoiceId
|
|
236
435
|
invokes SendPaymentReminder
|
|
237
436
|
invoiceId = invoiceId
|
|
437
|
+
channel = "email"
|
|
238
438
|
file Reactions/RemindOnDueDate.cs
|
|
239
439
|
reaction SweepOverdueInvoices
|
|
240
440
|
description "Re-checks every overdue invoice each morning"
|
|
@@ -259,20 +459,27 @@ slice Automation ChaseOverdueInvoices
|
|
|
259
459
|
- `for each <View>` is reserved for a future view-driven trigger. It is not a
|
|
260
460
|
trigger today (`PLAY0137`).
|
|
261
461
|
|
|
262
|
-
⚠️ **Declared, not enforced.**
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
462
|
+
⚠️ **Declared, not enforced.** A trigger `reads` gives no runtime protection. From
|
|
463
|
+
ESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces
|
|
464
|
+
directly**, or whose effect is an opaque body (`file` or an inline block), fails
|
|
465
|
+
binding, because its decision dependency cannot be protected. A reaction that only
|
|
466
|
+
`invokes` a command binds, and the decision, and any protection, belong to that
|
|
467
|
+
command's own reads. Command `reads` give none yet either (`PLAY0271`, #129).
|
|
468
|
+
Decision 0006 leaves `where` over read paths out of scope, and `where` needs
|
|
469
|
+
every operand to resolve from the trigger's declared scalar occurrence shape (listed in
|
|
470
|
+
the input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in
|
|
471
|
+
the invoked command or the implementation. Under `cratis` 3.27.1 none of this
|
|
472
|
+
binds at all (`PLAY0268`).
|
|
268
473
|
|
|
269
474
|
## `trigger`
|
|
270
475
|
|
|
271
476
|
```screenplay
|
|
477
|
+
concept Repository : String
|
|
478
|
+
|
|
272
479
|
trigger BuildFinished
|
|
273
480
|
description "CI reported a finished build on a watched repository"
|
|
274
481
|
repository Repository
|
|
275
|
-
outcome
|
|
482
|
+
outcome String
|
|
276
483
|
```
|
|
277
484
|
|
|
278
485
|
A trigger declares two things: **that the name exists**, and **what an occurrence
|
|
@@ -322,7 +529,11 @@ something is reported. `Startup` and `Shutdown` are registered the second way.
|
|
|
322
529
|
|
|
323
530
|
## Verify
|
|
324
531
|
|
|
325
|
-
- [ ] `screenplay <model> --warnaserror` reports zero errors and zero warnings
|
|
532
|
+
- [ ] `screenplay <model> --warnaserror` reports zero errors and zero warnings
|
|
533
|
+
(standalone 4.64.0). Under `cratis` 3.27.1 expect `PLAY0268` at binding and a
|
|
534
|
+
false `PLAY0285` on cascade specifications, and report them as tool skew.
|
|
535
|
+
- [ ] The tool that bound the model is named: ESM v6 constructs are "bound" only by
|
|
536
|
+
the standalone tool; no tool runs the specifications.
|
|
326
537
|
- [ ] Each automation has all four components — occurrence, state consulted,
|
|
327
538
|
conditional logic, resulting command or event. If it always fires
|
|
328
539
|
unconditionally it is co-production, not an automation.
|
|
@@ -335,9 +546,15 @@ something is reported. `Startup` and `Shutdown` are registered the second way.
|
|
|
335
546
|
value the trigger takes, and clock triggers read without `by`.
|
|
336
547
|
- [ ] Nobody reports trigger or command `reads` as protected; UI clicks are
|
|
337
548
|
interactions, not triggers.
|
|
549
|
+
- [ ] Every `invokes` of an authorized command names the trusted actor in a
|
|
550
|
+
description; no caller is invented for a reaction.
|
|
338
551
|
|
|
339
552
|
## Route near misses
|
|
340
553
|
|
|
341
554
|
- Deciding whether a behavior is an automation at all: `cratis-screenplay-event-modeling`.
|
|
555
|
+
- Automation, translation and loop-safety method, and the trusted-actor decision: `cratis-screenplay-automations-and-translations`.
|
|
556
|
+
- Specifying clocks, triggers, captures and cascades: `cratis-screenplay-specifications`.
|
|
557
|
+
- Which tool binds ESM v6 and what each reports: `cratis-screenplay-toolchain`.
|
|
558
|
+
- Hand-built code for an automation Stage does not render: `cratis-screenplay-render-and-gap-fill`.
|
|
342
559
|
- The commands a reaction invokes: `cratis-screenplay-command-surface`.
|
|
343
560
|
- Hand-written C# Chronicle reactors: `cratis-chronicle-reactor`.
|