@cratis/pi 7.14.2 → 7.14.3
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/skills/cratis-application-slice-conformance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +20 -15
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
- package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
- package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
- package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +69 -227
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +15 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +21 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +12 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
- package/package.json +1 -1
|
@@ -33,6 +33,31 @@ identity, effect and pending-work contract at that point; do not postpone it to
|
|
|
33
33
|
gap-fill or hand-written delivery with the model as contract (`references/realization-and-gap-fill.md`).
|
|
34
34
|
- Invoked commands run with no caller; `.play` cannot name an actor (Screenplay#383).
|
|
35
35
|
|
|
36
|
+
## Effect guarantees and recovery traps
|
|
37
|
+
| Guarantee | What it promises | What can show it |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| **once-only fact** | `CertificateSent` exists at most once for an enrolment | `constraint … unique event` on the right stream + a violation spec |
|
|
40
|
+
| **idempotent handling** | asking again gives the caller the same outcome, no new effect | target behaviour (map "already has the event" to success where intended); the model shows a rejection |
|
|
41
|
+
| **exactly-once external effect** | the person receives one certificate, the card is charged once | nothing in the model; only the outside system's dedup or a reconciliation can |
|
|
42
|
+
|
|
43
|
+
A todo list + reaction + unique constraint proves the first. It does **not** prove the third:
|
|
44
|
+
the send can succeed and the append fail (crash, lost reply, constraint race), and the retry
|
|
45
|
+
sends again.
|
|
46
|
+
|
|
47
|
+
- A reaction cascade is not one transaction: earlier accepted facts stay when a later invoked
|
|
48
|
+
command rejects (Screenplay `reactions.md`). Design each step to be retried on its own.
|
|
49
|
+
- Replay and recovery redelivery are different. Chronicle `[OnceOnly]` skips replays (rewind,
|
|
50
|
+
redaction, revision) only; a recovered failed partition redelivers the event as a normal
|
|
51
|
+
observation. A receipt keyed by `ReactorDelivery.Id` identifies the retry. Name both.
|
|
52
|
+
|
|
53
|
+
## Capture data-protection traps
|
|
54
|
+
A field left out of `map` still passes through the capture's working record: omission is not
|
|
55
|
+
redaction. Check the append mappings and every resulting event property, and record whether
|
|
56
|
+
the target stores raw or last-seen source records and how they are minimized.
|
|
57
|
+
Personal data kept in events needs `@pii` on its concept and a purpose; keep the annotation
|
|
58
|
+
even when it blocks binding. Never record bearer tokens, magic links or signed URLs as facts
|
|
59
|
+
(a keyed hash or reference at most), and never put PII on the event-source id.
|
|
60
|
+
|
|
36
61
|
## Verified product sources
|
|
37
62
|
| Package | Version | Used for |
|
|
38
63
|
| --- | --- | --- |
|
|
@@ -42,7 +67,7 @@ identity, effect and pending-work contract at that point; do not postpone it to
|
|
|
42
67
|
| Arc | v22.50.5 | `ExecuteCommandsAsSystemAttribute` (since v20.56.0) |
|
|
43
68
|
| Chronicle | v19.32.0 | `OnceOnlyAttribute`, `ReactorDelivery` and `Documentation/reactors/delivery-identity.mdx` |
|
|
44
69
|
|
|
45
|
-
|
|
70
|
+
Read `references/versions.md` in `cratis-screenplay-toolchain` when selecting a tool or checking the full version and capability pins. Reverify before claiming
|
|
46
71
|
another version behaves the same.
|
|
47
72
|
|
|
48
73
|
## When / when not
|
|
@@ -74,7 +99,7 @@ open question, not an invented answer):
|
|
|
74
99
|
|
|
75
100
|
**Unattended:** assume visibly. Record each assumption as a labelled open decision in `STATE.md`
|
|
76
101
|
(`.ai-work/screenplay/<model-slug>/STATE.md`), mark the dependent slice open, never write a mapping
|
|
77
|
-
or actor that nobody confirmed.
|
|
102
|
+
or actor that nobody confirmed. Read `references/worked-integration.md` when you need a transcript-shaped example of the integration interview, correlation, translation rules, scenarios, and recovery output.
|
|
78
103
|
|
|
79
104
|
## Procedure
|
|
80
105
|
1. **Inventory.** List every reaction, trigger and external source/type in scope; read their
|
|
@@ -155,7 +180,7 @@ Never report a verdict without the tool and version that produced it.
|
|
|
155
180
|
target-field completeness as well as source-field dispositions.
|
|
156
181
|
- One happy path is not coverage: cite the spec or the missing case for each branch, denial, competing
|
|
157
182
|
claim and closing event.
|
|
158
|
-
- Every complete example compiles
|
|
183
|
+
- Every complete example compiles. Read `references/todo-list-example.md` when modeling a pending-work automation, and `references/translate-example.md` when modeling capture plus translator reactions.
|
|
159
184
|
|
|
160
185
|
## Route near misses
|
|
161
186
|
- Grammar: `cratis-screenplay-captures-and-reactions`; invoked commands: `cratis-screenplay-command-surface`;
|
|
@@ -168,4 +193,4 @@ Never report a verdict without the tool and version that produced it.
|
|
|
168
193
|
- Hand-written reactors and replay semantics: `cratis-chronicle-reactor`.
|
|
169
194
|
|
|
170
195
|
## Lineage
|
|
171
|
-
|
|
196
|
+
Read `references/provenance.md` when checking sources, adaptations, attribution, or approaches deliberately not adopted.
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Automation patterns
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- 1. Deciding whether it is an automation
|
|
6
|
+
- 2. Todo list in Screenplay
|
|
7
|
+
- 3. Effects: `produces` vs `invokes`
|
|
8
|
+
- 4. The actor behind an invoke
|
|
9
|
+
- 5. Termination
|
|
10
|
+
- 6. Clock and trigger occurrences
|
|
11
|
+
- 7. Shapes to question in review
|
|
12
|
+
- 8. Chain completion checkpoint
|
|
13
|
+
- 9. Fan-out
|
|
14
|
+
|
|
3
15
|
Complete compiled example: `todo-list-example.md` (binds on Screenplay 4.66.0; the list query
|
|
4
16
|
and retry sweep that do not bind are shown there as marked excerpts).
|
|
5
17
|
|
|
@@ -36,8 +48,8 @@ Outcomes:
|
|
|
36
48
|
- A reaction `when <OpeningFact>` that invokes the command producing the closing fact.
|
|
37
49
|
The trigger may `reads` the item view to document its input; that is not protection.
|
|
38
50
|
- A retry sweep on a clock reads the whole view (no `by` on clock reads). Iterating its items
|
|
39
|
-
declaratively (`for each <View>`) is reserved syntax;
|
|
40
|
-
which the reference never runs. Durable fan-out is outside
|
|
51
|
+
declaratively (`for each <View>`) is reserved syntax; on Screenplay 4.66.0 the sweep needs a code body,
|
|
52
|
+
which the reference never runs. Durable fan-out is outside Screenplay 4.66.0 (Screenplay#286).
|
|
41
53
|
- Specify the list as a small story: empty -> item present (`then query …ById`) -> closed
|
|
42
54
|
(`when append <Closing>` + `then no readmodel … for`), plus "not opened" for facts that
|
|
43
55
|
must not queue work.
|
|
@@ -56,7 +68,7 @@ When a todo list is not needed: the effect is immediate, internal and cannot fai
|
|
|
56
68
|
| caller | n/a | **none**: gated commands reject |
|
|
57
69
|
|
|
58
70
|
## 4. The actor behind an invoke
|
|
59
|
-
|
|
71
|
+
On Screenplay 4.66.0 there is no caller: the invoked command runs its full pipeline (authorization, validation,
|
|
60
72
|
requirements, constraints) with no caller, a command that needs one rejects, and the rejection
|
|
61
73
|
ends the scenario. Screenplay has no syntax for an identity (Screenplay#383, open); never invent
|
|
62
74
|
`runs as` or a caller line. At code level the realization is a Chronicle reactor whose returned
|
|
@@ -74,7 +86,7 @@ Decide and record one of:
|
|
|
74
86
|
should refuse it.
|
|
75
87
|
3. **Gated command + trusted actor + recorded gap** - when the command must stay protected.
|
|
76
88
|
Keep the gate (a policy requiring the service role), name the role as the intended actor,
|
|
77
|
-
and record that
|
|
89
|
+
and record that Screenplay 4.66.0 cannot declare it. The reference rejects the caller-less invoke,
|
|
78
90
|
so the automation spec cannot pass: do not write a fake passing spec. Report V4 as "not run:
|
|
79
91
|
no route" (no available route executes these specs) and record the expected rejection and
|
|
80
92
|
the trusted-actor gap separately, citing the reaction semantics (a command that requires a
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# Effects and idempotency
|
|
2
2
|
|
|
3
3
|
## Three guarantees, three proofs
|
|
4
|
-
|
|
5
|
-
|---|---|---|
|
|
6
|
-
| **once-only fact** | `CertificateSent` exists at most once for an enrolment | `constraint … unique event` on the right stream + a violation spec |
|
|
7
|
-
| **idempotent handling** | asking again gives the caller the same outcome, no new effect | target behaviour (map "already has the event" to success where intended); the model shows a rejection |
|
|
8
|
-
| **exactly-once external effect** | the person receives one certificate, the card is charged once | nothing in the model; only the outside system's dedup or a reconciliation can |
|
|
9
|
-
|
|
10
|
-
A todo list + reaction + unique constraint proves the first. It does **not** prove the third:
|
|
11
|
-
the send can succeed and the append fail (crash, lost reply, constraint race), and the retry
|
|
12
|
-
sends again.
|
|
4
|
+
See "Effect guarantees and recovery traps" in SKILL.md.
|
|
13
5
|
|
|
14
6
|
## Where the external call sits
|
|
15
7
|
The model states facts; the call to the outside world happens in the realization of a command
|
|
@@ -41,13 +33,12 @@ key; write a reconciliation case.
|
|
|
41
33
|
durable as the target's last-seen store.
|
|
42
34
|
|
|
43
35
|
## Ordering and lost acknowledgements
|
|
44
|
-
|
|
45
|
-
command rejects (Screenplay `reactions.md`). Design each step to be retried on its own.
|
|
36
|
+
See "Effect guarantees and recovery traps" in SKILL.md.
|
|
46
37
|
- Facts are reacted to in append order in the reference; across sources assume no order.
|
|
47
38
|
- A capture spec does not acknowledge the source or store a new last-seen record; prefix
|
|
48
39
|
facts that were accepted do not mean the record was processed (Screenplay `captures.md`).
|
|
49
40
|
Record how the target acknowledges.
|
|
50
|
-
- Delivery guarantees, acknowledgements and durable fan-out are outside
|
|
41
|
+
- Delivery guarantees, acknowledgements and durable fan-out are outside Screenplay 4.66.0 (Screenplay#286);
|
|
51
42
|
never describe them as provided.
|
|
52
43
|
|
|
53
44
|
## Projection lag and rebuild
|
|
@@ -56,9 +47,7 @@ key; write a reconciliation case.
|
|
|
56
47
|
- Rebuilding the queue from history restores only genuinely open items, because closing facts
|
|
57
48
|
are history too. A reaction must not repeat external effects on replay or rebuild: confirm
|
|
58
49
|
the target's replay behaviour before relying on it, and record the answer.
|
|
59
|
-
|
|
60
|
-
redaction, revision) only; a recovered failed partition redelivers the event as a normal
|
|
61
|
-
observation. A receipt keyed by `ReactorDelivery.Id` identifies the retry. Name both.
|
|
50
|
+
See "Effect guarantees and recovery traps" in SKILL.md.
|
|
62
51
|
|
|
63
52
|
## What to write down (slice `description` + `STATE.md`)
|
|
64
53
|
- Effect placement (1-4) and why. Placement 4 is syntax-only: say the model then has no
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Example: a todo-list automation
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Design-only additions
|
|
6
|
+
|
|
3
7
|
A complete model: a result opens a work item, a reaction invokes a command, the command's fact
|
|
4
8
|
closes the item. It binds on Screenplay 4.66.0 (`executableReady: true`), standalone and through `cratis screenplay mcp`
|
|
5
9
|
3.28.2; `cratis render` 3.28.2 refuses it whole (`STAGE-ESM-016`). The cratis 3.27.1 bundle (4.60.1)
|
|
@@ -18,7 +22,7 @@ What the model proves and what it does not:
|
|
|
18
22
|
- Not proven: that the certificate email reaches the person once. See
|
|
19
23
|
`references/effects-and-idempotency.md`.
|
|
20
24
|
- The actor behind `SendCertificate` is a recorded security decision in the `Certification`
|
|
21
|
-
module `description`, because reaction invocations carry no caller
|
|
25
|
+
module `description`, because reaction invocations carry no caller on Screenplay 4.66.0 (Screenplay#383).
|
|
22
26
|
- No local engine runs Automation specifications: report them as authored, not as run.
|
|
23
27
|
|
|
24
28
|
```screenplay
|
|
@@ -198,7 +202,7 @@ query PendingCertificates => PendingCertificate[]
|
|
|
198
202
|
// Parent: the complete document above, slice Automation SendCertificates, after CertificateSender.
|
|
199
203
|
// The sweep reads the whole view (a clock trigger takes no `by`); iterating items needs code.
|
|
200
204
|
reaction CertificateRetrySweep
|
|
201
|
-
description "Retries items still pending; per-item fan-out needs code
|
|
205
|
+
description "Retries items still pending; per-item fan-out needs code on Screenplay 4.66.0 (#286)"
|
|
202
206
|
every 15 minutes
|
|
203
207
|
reads PendingCertificate
|
|
204
208
|
file Reactions/RetryPendingCertificates.cs
|
|
@@ -42,12 +42,7 @@ For every field of the outside record, decide and write in the slice `descriptio
|
|
|
42
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
43
|
Missing data our fact needs: either enrich from our side, or the fact is not ready yet
|
|
44
44
|
(model a pending fact plus a case to specify), never invent defaults.
|
|
45
|
-
|
|
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.
|
|
45
|
+
See "Capture data-protection traps" in SKILL.md.
|
|
51
46
|
Malformed or unmappable input becomes a recorded failure fact (or a dead-letter view), never
|
|
52
47
|
a dropped record or a thrown error, which would pause the observer partition.
|
|
53
48
|
|
|
@@ -63,182 +63,49 @@ decides, not the slice type:
|
|
|
63
63
|
as the contract: `cratis-screenplay-render-and-gap-fill`.
|
|
64
64
|
|
|
65
65
|
Model them whenever the `.play` file is the deliverable, and say which tool bound
|
|
66
|
-
them.
|
|
66
|
+
them. Read `cratis-screenplay-toolchain` (`references/versions.md`) when selecting a compiler version or interpreting version-dependent messages.
|
|
67
67
|
Method (the four-part automation test, loops, translations versus automations):
|
|
68
68
|
`cratis-screenplay-automations-and-translations`.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
`3baf4a4`; execution from ESM v6, checked at `v4.66.0`): `when clock "<instant>"`
|
|
72
|
-
for a reaction on `every` or `at`, `when trigger <Trigger>` with its values for one
|
|
73
|
-
on an application trigger, and `given capture` / `when capture <Capture>` with the
|
|
74
|
-
source record's fields for a capture, then the events that should follow.
|
|
75
|
-
`given clock` fixes the occurrence time, so values mapped from `$context.occurred`
|
|
76
|
-
can be asserted. Excerpt of the complete example below:
|
|
70
|
+
## Specify what sets them off
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
A specification names what sets the automation off: `when clock`, `when trigger` or `when capture`. No command runs these specifications; report one as authored, not executed.
|
|
73
|
+
|
|
74
|
+
Read [references/specifying-triggers-and-clock.md](references/specifying-triggers-and-clock.md) when writing a specification for a reaction, trigger or capture, or when the clock, occurrence or limit rules matter.
|
|
75
|
+
|
|
76
|
+
## Caller-less invokes and unprotected reads
|
|
77
|
+
|
|
78
|
+
**Who is the caller of an `invokes`?** Nobody. In the reference execution the invoked
|
|
79
|
+
command runs its full pipeline - authorization, validation, requirements,
|
|
80
|
+
constraints - **with no caller**; a command that needs one rejects, and the
|
|
81
|
+
rejection ends the scenario. Each invoked command is atomic, but the cascade is not,
|
|
82
|
+
so facts accepted earlier remain. There is no syntax for a trusted identity in the verified Screenplay versions
|
|
83
|
+
(Screenplay#383, open): never invent `runs as` or a `given caller` for a reaction.
|
|
84
|
+
Say so in the model: a `description` on the reaction that names the trusted actor
|
|
85
|
+
the target must use. At code level a rendered or hand-written target runs such a
|
|
86
|
+
command as the system with `[ExecuteCommandsAsSystem]` (Arc 20.56.0 and later, so
|
|
87
|
+
also in a rendered application's Arc 22.25.0). An authorized command a reaction
|
|
88
|
+
invokes needs that decision made explicit, in the model's description and in the
|
|
89
|
+
gap-fill code, not left to a rejection nobody expected. Cascades and their
|
|
90
|
+
specification limits: `cratis-screenplay-specifications`.
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
⚠️ **Declared, not enforced.** A trigger `reads` gives no runtime protection. From
|
|
93
|
+
ESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces
|
|
94
|
+
directly**, or whose effect is an opaque body (`file` or an inline block), fails
|
|
95
|
+
binding, because its decision dependency cannot be protected. A reaction that only
|
|
96
|
+
`invokes` a command binds, and the decision, and any protection, belong to that
|
|
97
|
+
command's own reads. Command `reads` give none yet either (`PLAY0271`, #129).
|
|
98
|
+
Decision 0006 leaves `where` over read paths out of scope, and `where` needs
|
|
99
|
+
every operand to resolve from the trigger's declared scalar occurrence shape (listed in
|
|
100
|
+
the input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in
|
|
101
|
+
the invoked command or the implementation. Under `cratis` before 3.28.2 none of this
|
|
102
|
+
bound at all (`PLAY0268`); `cratis` 3.28.2 binds it like the standalone tool.
|
|
95
103
|
|
|
96
104
|
## Complete example (ESM v6)
|
|
97
105
|
|
|
98
|
-
One document with every construct
|
|
99
|
-
event, on a trigger (with `where` and `invokes`), on a view read and on the clock, and
|
|
100
|
-
a capture with its specifications. The excerpts later in this skill have their own
|
|
101
|
-
complete parent documents in `references/complete-examples.md`.
|
|
106
|
+
One document with every construct (application trigger, reactions on an event, a trigger, a view read and the clock, and a capture with specifications) is kept in the reference file.
|
|
102
107
|
|
|
103
|
-
|
|
104
|
-
concept InvoiceId : Uuid
|
|
105
|
-
trigger PaymentFileArrived
|
|
106
|
-
description "The bank's payment file listed a payment for an invoice"
|
|
107
|
-
invoiceId InvoiceId
|
|
108
|
-
amount Decimal
|
|
109
|
-
module Collections
|
|
110
|
-
feature Invoices
|
|
111
|
-
slice StateChange SendInvoice
|
|
112
|
-
command SendInvoice
|
|
113
|
-
invoiceId InvoiceId identifier
|
|
114
|
-
amount Decimal
|
|
115
|
-
produces InvoiceSent
|
|
116
|
-
for invoiceId
|
|
117
|
-
invoiceId = invoiceId
|
|
118
|
-
amount = amount
|
|
119
|
-
sentAt = $context.occurred
|
|
120
|
-
event InvoiceSent
|
|
121
|
-
invoiceId InvoiceId
|
|
122
|
-
amount Decimal
|
|
123
|
-
sentAt DateTime
|
|
124
|
-
slice StateChange CloseInvoice
|
|
125
|
-
command CloseInvoice
|
|
126
|
-
invoiceId InvoiceId identifier
|
|
127
|
-
reason String
|
|
128
|
-
validate
|
|
129
|
-
reason not empty message "A reason is required"
|
|
130
|
-
produces InvoiceClosed
|
|
131
|
-
for invoiceId
|
|
132
|
-
reason = reason
|
|
133
|
-
event InvoiceClosed
|
|
134
|
-
reason String
|
|
135
|
-
constraint OnlyClosedOnce
|
|
136
|
-
unique event InvoiceClosed
|
|
137
|
-
slice StateView InvoiceBalances
|
|
138
|
-
readmodel InvoiceBalance
|
|
139
|
-
invoiceId InvoiceId
|
|
140
|
-
outstanding Decimal
|
|
141
|
-
query InvoiceBalanceById => InvoiceBalance optional
|
|
142
|
-
by invoiceId InvoiceId
|
|
143
|
-
projection InvoiceBalances => InvoiceBalance
|
|
144
|
-
from InvoiceSent
|
|
145
|
-
invoiceId = $eventSourceId
|
|
146
|
-
outstanding = amount
|
|
147
|
-
slice StateChange SendPaymentReminder
|
|
148
|
-
command SendPaymentReminder
|
|
149
|
-
invoiceId InvoiceId identifier
|
|
150
|
-
produces PaymentReminderSent
|
|
151
|
-
for invoiceId
|
|
152
|
-
reminderNumber = 1
|
|
153
|
-
event PaymentReminderSent
|
|
154
|
-
reminderNumber Int
|
|
155
|
-
slice Automation Reminders
|
|
156
|
-
reaction RemindOnDueDate
|
|
157
|
-
description "Reminds the customer when an invoice falls due unpaid"
|
|
158
|
-
when InvoiceFellDue
|
|
159
|
-
invoiceId
|
|
160
|
-
reads InvoiceBalance as balance by invoiceId
|
|
161
|
-
invokes SendPaymentReminder
|
|
162
|
-
invoiceId = invoiceId
|
|
163
|
-
reaction ReminderScheduler
|
|
164
|
-
description "Schedules a reminder when an invoice is sent"
|
|
165
|
-
when InvoiceSent
|
|
166
|
-
invoiceId
|
|
167
|
-
produces ReminderScheduled
|
|
168
|
-
scheduledAt = $context.occurred
|
|
169
|
-
reaction PaymentImporter
|
|
170
|
-
description "Closes an invoice the bank file shows as paid"
|
|
171
|
-
when PaymentFileArrived
|
|
172
|
-
invoiceId
|
|
173
|
-
amount
|
|
174
|
-
invokes CloseInvoice
|
|
175
|
-
invoiceId = invoiceId
|
|
176
|
-
reason = "paid"
|
|
177
|
-
where amount > 0
|
|
178
|
-
reaction WeeklyDigest
|
|
179
|
-
description "Issues the collections digest every Monday morning"
|
|
180
|
-
at 07:30 on Monday
|
|
181
|
-
produces DigestIssued
|
|
182
|
-
for "weekly"
|
|
183
|
-
issuedAt = $context.occurred
|
|
184
|
-
event InvoiceFellDue
|
|
185
|
-
invoiceId InvoiceId
|
|
186
|
-
event ReminderScheduled
|
|
187
|
-
scheduledAt DateTime
|
|
188
|
-
event DigestIssued
|
|
189
|
-
issuedAt DateTime
|
|
190
|
-
specification SchedulingAReminderWhenAnInvoiceIsSent
|
|
191
|
-
given clock "2026-10-02T09:00:00Z"
|
|
192
|
-
when append InvoiceSent
|
|
193
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
194
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
195
|
-
amount = 120
|
|
196
|
-
sentAt = "2026-10-02T09:00:00Z"
|
|
197
|
-
then ReminderScheduled
|
|
198
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
199
|
-
scheduledAt = "2026-10-02T09:00:00Z"
|
|
200
|
-
specification ClosingAPaidInvoice
|
|
201
|
-
when trigger PaymentFileArrived
|
|
202
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
203
|
-
amount = 120
|
|
204
|
-
then InvoiceClosed
|
|
205
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
206
|
-
reason = "paid"
|
|
207
|
-
specification IssuingTheWeeklyDigest
|
|
208
|
-
given clock "2026-10-05T07:00:00Z"
|
|
209
|
-
when clock "2026-10-05T07:30:00Z"
|
|
210
|
-
then DigestIssued
|
|
211
|
-
for "weekly"
|
|
212
|
-
issuedAt = "2026-10-05T07:30:00Z"
|
|
213
|
-
slice Translate LegacyInvoiceSync
|
|
214
|
-
capture LegacyInvoiceCapture
|
|
215
|
-
source api
|
|
216
|
-
api LegacyInvoicingApi
|
|
217
|
-
route /invoices
|
|
218
|
-
poll 5m
|
|
219
|
-
key id
|
|
220
|
-
map
|
|
221
|
-
status = status translate
|
|
222
|
-
"sendt" => sent
|
|
223
|
-
"betalt" => paid
|
|
224
|
-
append LegacyInvoicePaid
|
|
225
|
-
tag legacy
|
|
226
|
-
when status from "sent" to "paid"
|
|
227
|
-
paidAt = $context.occurred
|
|
228
|
-
event LegacyInvoicePaid
|
|
229
|
-
paidAt DateTime
|
|
230
|
-
specification SeeingALegacyPayment
|
|
231
|
-
given clock "2026-10-02T12:00:00Z"
|
|
232
|
-
given capture LegacyInvoiceCapture
|
|
233
|
-
id = "inv-42"
|
|
234
|
-
status = "sendt"
|
|
235
|
-
when capture LegacyInvoiceCapture
|
|
236
|
-
id = "inv-42"
|
|
237
|
-
status = "betalt"
|
|
238
|
-
then LegacyInvoicePaid
|
|
239
|
-
for "inv-42"
|
|
240
|
-
paidAt = "2026-10-02T12:00:00Z"
|
|
241
|
-
```
|
|
108
|
+
Read [references/complete-examples.md](references/complete-examples.md) when you need a complete, compiling parent document for an excerpt or want to check the authoring and binding prerequisites.
|
|
242
109
|
|
|
243
110
|
## `capture` — the Change Data Capture Language
|
|
244
111
|
|
|
@@ -246,34 +113,9 @@ Captures live in `Translate` slices and are the anti-corruption layer: external
|
|
|
246
113
|
shapes in, domain events out. Excerpt; complete document: `references/complete-examples.md`,
|
|
247
114
|
"Capture with `source`, `map`, `append` and `children`".
|
|
248
115
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
source api
|
|
253
|
-
api LegacyInvoicingApi
|
|
254
|
-
route /invoices
|
|
255
|
-
poll 5m
|
|
256
|
-
key id
|
|
257
|
-
map
|
|
258
|
-
status = status translate
|
|
259
|
-
"utkast" => draft
|
|
260
|
-
"sendt" => sent
|
|
261
|
-
"betalt" => paid
|
|
262
|
-
append InvoiceStatusChanged
|
|
263
|
-
tag legacy
|
|
264
|
-
when status
|
|
265
|
-
invoiceId = $.id
|
|
266
|
-
status = $.status
|
|
267
|
-
changedAt = $context.occurred
|
|
268
|
-
append InvoicePaidFromSent
|
|
269
|
-
when status from "sent" to "paid"
|
|
270
|
-
invoiceId = $.id
|
|
271
|
-
children lineItems identified by lineNumber
|
|
272
|
-
append InvoiceLineItemAdded
|
|
273
|
-
when added
|
|
274
|
-
invoiceId = $.id
|
|
275
|
-
lineNumber = $.lineNumber
|
|
276
|
-
```
|
|
116
|
+
The full capture excerpt (`source`, `key`, `map` with `translate`, two `append` blocks and `children`) is in the reference file.
|
|
117
|
+
|
|
118
|
+
Read [references/capture-map-and-example.md](references/capture-map-and-example.md) when writing a capture's `map` block, or when you need the excerpt of a capture with `append` and `children`.
|
|
277
119
|
|
|
278
120
|
**`source <kind>`** with indented settings. The documented kinds and settings are
|
|
279
121
|
`api` (`api`, `route`, `poll`), `webhook` (`path`) and `message` (`topic`).
|
|
@@ -289,15 +131,9 @@ record's `key` names, and `$context.occurred` is the scenario's `given clock`.
|
|
|
289
131
|
|
|
290
132
|
Declaring an event's external origin on the `event` itself is accepted as
|
|
291
133
|
Screenplay decision 0009 but **not in the language**; a `capture` in a
|
|
292
|
-
`Translate` slice is how outside data enters a model
|
|
293
|
-
|
|
294
|
-
**`map`** reshapes before events are appended: direct rename
|
|
295
|
-
(`productName = name`), a backtick template, `translate` with indented
|
|
296
|
-
`"source" => target` entries, and `split <source> by "<sep>"` with indented target
|
|
297
|
-
properties.
|
|
134
|
+
`Translate` slice is how outside data enters a model in the verified Screenplay versions.
|
|
298
135
|
|
|
299
|
-
|
|
300
|
-
capture context, `$env.` for an environment variable, plus literals and templates.
|
|
136
|
+
**`map`** reshapes properties before events are appended (rename, template, `translate`, `split`; mapping sources are `$.`, `$context.` and `$env.`); syntax is in the reference file linked above.
|
|
301
137
|
|
|
302
138
|
**`append <Event>`** with optional `tag` lines and one `when` clause:
|
|
303
139
|
|
|
@@ -402,19 +238,7 @@ append-time constraints. `invokes` asks for a command, which additionally runs t
|
|
|
402
238
|
command's authorization, validation and requirements, and may reject.
|
|
403
239
|
Using `produces` for both would say those are the same kind of consequence.
|
|
404
240
|
|
|
405
|
-
**Who is the caller of an `invokes`?** Nobody
|
|
406
|
-
command runs its full pipeline - authorization, validation, requirements,
|
|
407
|
-
constraints - **with no caller**; a command that needs one rejects, and the
|
|
408
|
-
rejection ends the scenario. Each invoked command is atomic, but the cascade is not,
|
|
409
|
-
so facts accepted earlier remain. There is no syntax for a trusted identity today
|
|
410
|
-
(Screenplay#383, open): never invent `runs as` or a `given caller` for a reaction.
|
|
411
|
-
Say so in the model: a `description` on the reaction that names the trusted actor
|
|
412
|
-
the target must use. At code level a rendered or hand-written target runs such a
|
|
413
|
-
command as the system with `[ExecuteCommandsAsSystem]` (Arc 20.56.0 and later, so
|
|
414
|
-
also in a rendered application's Arc 22.25.0). An authorized command a reaction
|
|
415
|
-
invokes needs that decision made explicit, in the model's description and in the
|
|
416
|
-
gap-fill code, not left to a rejection nobody expected. Cascades and their
|
|
417
|
-
specification limits: `cratis-screenplay-specifications`.
|
|
241
|
+
**Who is the caller of an `invokes`?** Nobody; see *Caller-less invokes and unprotected reads* above before writing one.
|
|
418
242
|
|
|
419
243
|
Both are declarations of *what happens*, not of how — a trigger can state its
|
|
420
244
|
consequences **and** carry a `file` or an inline block in a tagged fence
|
|
@@ -429,23 +253,9 @@ a command's `reads`: the state the behavior decides from. Excerpt; complete
|
|
|
429
253
|
document: `references/complete-examples.md`, "Trigger `reads` on an event and on the
|
|
430
254
|
clock" (authoring-valid; the `file` bodies stop it binding at ESM v6).
|
|
431
255
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
description "Reminds the customer when an invoice falls due unpaid"
|
|
436
|
-
when InvoiceFellDue
|
|
437
|
-
invoiceId
|
|
438
|
-
reads InvoiceBalance as balance by invoiceId
|
|
439
|
-
invokes SendPaymentReminder
|
|
440
|
-
invoiceId = invoiceId
|
|
441
|
-
channel = "email"
|
|
442
|
-
file Reactions/RemindOnDueDate.cs
|
|
443
|
-
reaction SweepOverdueInvoices
|
|
444
|
-
description "Re-checks every overdue invoice each morning"
|
|
445
|
-
at 08:00
|
|
446
|
-
reads OverdueInvoice
|
|
447
|
-
file Reactions/SweepOverdueInvoices.cs
|
|
448
|
-
```
|
|
256
|
+
The excerpt of a reaction with `reads` on an event and on the clock is in the reference file.
|
|
257
|
+
|
|
258
|
+
Read [references/trigger-reads-example.md](references/trigger-reads-example.md) when writing a trigger `reads` with `by` or an alias, or a clock trigger that reads a whole view.
|
|
449
259
|
|
|
450
260
|
- `reads` sits **under a trigger**, beside the values it takes and its effects.
|
|
451
261
|
Each trigger declares its own.
|
|
@@ -461,19 +271,9 @@ slice Automation ChaseOverdueInvoices
|
|
|
461
271
|
written `@reads`. A bare `reads` line is error `PLAY0175`, and
|
|
462
272
|
`reads <PrimitiveType>` is warning `PLAY0444`; both messages name the escape.
|
|
463
273
|
- `for each <View>` is reserved for a future view-driven trigger. It is not a
|
|
464
|
-
trigger
|
|
274
|
+
trigger in the verified Screenplay versions (`PLAY0137`).
|
|
465
275
|
|
|
466
|
-
⚠️ **Declared, not enforced.**
|
|
467
|
-
ESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces
|
|
468
|
-
directly**, or whose effect is an opaque body (`file` or an inline block), fails
|
|
469
|
-
binding, because its decision dependency cannot be protected. A reaction that only
|
|
470
|
-
`invokes` a command binds, and the decision, and any protection, belong to that
|
|
471
|
-
command's own reads. Command `reads` give none yet either (`PLAY0271`, #129).
|
|
472
|
-
Decision 0006 leaves `where` over read paths out of scope, and `where` needs
|
|
473
|
-
every operand to resolve from the trigger's declared scalar occurrence shape (listed in
|
|
474
|
-
the input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in
|
|
475
|
-
the invoked command or the implementation. Under `cratis` before 3.28.2 none of this
|
|
476
|
-
bound at all (`PLAY0268`); `cratis` 3.28.2 binds it like the standalone tool.
|
|
276
|
+
⚠️ **Declared, not enforced.** See *Caller-less invokes and unprotected reads* above.
|
|
477
277
|
|
|
478
278
|
## `trigger`
|
|
479
279
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Capture map and example
|
|
2
|
+
|
|
3
|
+
## Capture excerpt
|
|
4
|
+
|
|
5
|
+
```screenplay excerpt
|
|
6
|
+
slice Translate LegacyInvoiceSync
|
|
7
|
+
capture LegacyInvoiceCapture
|
|
8
|
+
source api
|
|
9
|
+
api LegacyInvoicingApi
|
|
10
|
+
route /invoices
|
|
11
|
+
poll 5m
|
|
12
|
+
key id
|
|
13
|
+
map
|
|
14
|
+
status = status translate
|
|
15
|
+
"utkast" => draft
|
|
16
|
+
"sendt" => sent
|
|
17
|
+
"betalt" => paid
|
|
18
|
+
append InvoiceStatusChanged
|
|
19
|
+
tag legacy
|
|
20
|
+
when status
|
|
21
|
+
invoiceId = $.id
|
|
22
|
+
status = $.status
|
|
23
|
+
changedAt = $context.occurred
|
|
24
|
+
append InvoicePaidFromSent
|
|
25
|
+
when status from "sent" to "paid"
|
|
26
|
+
invoiceId = $.id
|
|
27
|
+
children lineItems identified by lineNumber
|
|
28
|
+
append InvoiceLineItemAdded
|
|
29
|
+
when added
|
|
30
|
+
invoiceId = $.id
|
|
31
|
+
lineNumber = $.lineNumber
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Capture `map`
|
|
35
|
+
|
|
36
|
+
**`map`** reshapes before events are appended: direct rename
|
|
37
|
+
(`productName = name`), a backtick template, `translate` with indented
|
|
38
|
+
`"source" => target` entries, and `split <source> by "<sep>"` with indented target
|
|
39
|
+
properties.
|
|
40
|
+
|
|
41
|
+
**Mapping sources:** `$.` for a value from the current source item, `$context.` for
|
|
42
|
+
capture context, `$env.` for an environment variable, plus literals and templates.
|