@cratis/pi 7.14.2 → 7.14.4
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
|
@@ -40,9 +40,9 @@ changed examples; it does not rerun the reference runner.
|
|
|
40
40
|
**Which tool says what.** The standalone `screenplay` tool 4.68.0 admits ESM v1-v7.
|
|
41
41
|
The `cratis` CLI 3.28.2 and 3.28.3 bundle Screenplay 4.66.0 (ESM v1-v6: generated fixtures and `then returns` report `PLAY0268`). Before `cratis` 3.28.2 the
|
|
42
42
|
bundle was Screenplay 4.60.1, which admitted ESM v1-v5 only and reported a false
|
|
43
|
-
`PLAY0285` on reaction cascades (see "Version skew"). Facts below marked **ESM v6**
|
|
43
|
+
`PLAY0285` on reaction cascades (see "Version skew" in [references/reactions-and-cascades.md](references/reactions-and-cascades.md)). Facts below marked **ESM v6**
|
|
44
44
|
hold for Screenplay 4.61.0 and later: the standalone tool and `cratis` 3.28.2 or later. The full table is in `cratis-screenplay-toolchain`
|
|
45
|
-
(`references/versions.md
|
|
45
|
+
(`references/versions.md`; read it before choosing a compiler or interpreting version-dependent binding diagnostics). Neither tool runs specifications: `screenplay` and
|
|
46
46
|
`cratis screenplay validate` parse and check consistency, the MCP server also binds,
|
|
47
47
|
and spec outcomes come only from the reference runner as a library, Stage's
|
|
48
48
|
specification runner or a rendered application's tests.
|
|
@@ -59,6 +59,46 @@ The specification actions beyond commands (`given clock`, `when clock`,
|
|
|
59
59
|
`Documentation/screenplay/{specifications,diagnostics}.md` and the proposed
|
|
60
60
|
decision 0022. They do not exist before v4.48.0.
|
|
61
61
|
|
|
62
|
+
## Reference execution — what actually runs
|
|
63
|
+
|
|
64
|
+
Screenplay's reference runner executes specifications against an immutable
|
|
65
|
+
in-memory world: no Arc, no Chronicle, no database, no network. Every downstream
|
|
66
|
+
target has one normalized behavior to match.
|
|
67
|
+
|
|
68
|
+
- It runs the capabilities the execution plan admits: declarative validation
|
|
69
|
+
and `require` over command properties, conditional production, literal tags,
|
|
70
|
+
declarative policies, `unique` constraints, and projections as Chronicle
|
|
71
|
+
lowers them. The `cratis-screenplay-model-authoring` language reference lists
|
|
72
|
+
what binds and what the plan admits.
|
|
73
|
+
- Binding is not admission. These projection constructs bind, but the plan
|
|
74
|
+
refuses them: a projection-level `remove via join`; `all` beside removals,
|
|
75
|
+
`children` or `nested`; a `join`, `children` or `remove via join` inside
|
|
76
|
+
`nested`; and any `$eventContext.<path>` other than `eventSourceId`, such as
|
|
77
|
+
`$eventContext.occurred`. The limits apply at every ESM version.
|
|
78
|
+
- A specification that needs **opaque code** — a bodied reducer, a rule with a
|
|
79
|
+
body, a fenced `validate` block, a code policy, or (ESM v6) a reached reaction
|
|
80
|
+
body — returns **unsupported** and
|
|
81
|
+
never passes. Authorization is evaluated first, so a `then denied` case still
|
|
82
|
+
runs when a portable policy decides it. Other specifications in the model run
|
|
83
|
+
normally.
|
|
84
|
+
- Unsupported reachable declarative constructs block the whole execution plan
|
|
85
|
+
rather than running partially: no specification in the model runs, including
|
|
86
|
+
the ones that never touch the refused construct.
|
|
87
|
+
- Reactions: before ESM v6 they never run, not even after `when append`. From ESM
|
|
88
|
+
v6 (standalone tool from 4.61.0) they run after every action, as in "Reactions and
|
|
89
|
+
cascades" ([references/reactions-and-cascades.md](references/reactions-and-cascades.md)). Under `cratis` before 3.28.2 (Screenplay 4.60.1) `when clock`, `when trigger`
|
|
90
|
+
and `when capture` failed binding with `PLAY0268`, and so did reactions and captures; they
|
|
91
|
+
bind on 4.66.0 and `cratis` 3.28.2.
|
|
92
|
+
- A rejected individual command or append leaves the world unchanged; an accepted
|
|
93
|
+
one commits once, then the read models and queries are compared. There is no
|
|
94
|
+
scenario-wide transaction in v6: when a later effect of a cascade or capture
|
|
95
|
+
rejects, the earlier accepted facts and their projections remain.
|
|
96
|
+
|
|
97
|
+
Unsupported is not passed. Report it as "needs a target", not as green. "Specified"
|
|
98
|
+
and "bound" are never "passing": no command-line tool runs these specifications, so a
|
|
99
|
+
pass is claimed only from the reference runner, Stage's specification runner or a
|
|
100
|
+
rendered application's tests, and named as such.
|
|
101
|
+
|
|
62
102
|
## The vocabulary
|
|
63
103
|
|
|
64
104
|
| Construct | Meaning |
|
|
@@ -139,258 +179,23 @@ the one-rejection rule (`PLAY0273`) are reported only when the model binds, so
|
|
|
139
179
|
|
|
140
180
|
## Worked example
|
|
141
181
|
|
|
142
|
-
A command with an authorization gate, a validation rule and a uniqueness
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
```screenplay
|
|
146
|
-
concept InvoiceId : Uuid
|
|
147
|
-
concept InvoiceNumber : String
|
|
148
|
-
policy IsAccountant
|
|
149
|
-
require role "Accountant"
|
|
150
|
-
module Invoicing
|
|
151
|
-
feature Registration
|
|
152
|
-
slice StateChange RegisterInvoice
|
|
153
|
-
command RegisterInvoice
|
|
154
|
-
invoiceId InvoiceId identifier
|
|
155
|
-
invoiceNumber InvoiceNumber
|
|
156
|
-
authorize IsAccountant
|
|
157
|
-
validate
|
|
158
|
-
invoiceNumber not empty message "Invoice number is required"
|
|
159
|
-
produces event InvoiceRegistered
|
|
160
|
-
invoiceNumber InvoiceNumber = invoiceNumber
|
|
161
|
-
constraint UniqueInvoiceNumber
|
|
162
|
-
unique invoiceNumber on InvoiceRegistered
|
|
163
|
-
specification RegisteringAnInvoice
|
|
164
|
-
given caller
|
|
165
|
-
authenticated
|
|
166
|
-
role "Accountant"
|
|
167
|
-
when RegisterInvoice
|
|
168
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
169
|
-
invoiceNumber = "INV-000123"
|
|
170
|
-
then InvoiceRegistered
|
|
171
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
172
|
-
invoiceNumber = "INV-000123"
|
|
173
|
-
then readmodel InvoiceSummary
|
|
174
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
175
|
-
invoiceNumber = "INV-000123"
|
|
176
|
-
specification RejectingAnEmptyInvoiceNumber
|
|
177
|
-
given caller
|
|
178
|
-
authenticated
|
|
179
|
-
role "Accountant"
|
|
180
|
-
when RegisterInvoice
|
|
181
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
182
|
-
invoiceNumber = ""
|
|
183
|
-
then error "Invoice number is required"
|
|
184
|
-
specification RejectingANumberAnotherInvoiceHolds
|
|
185
|
-
given caller
|
|
186
|
-
authenticated
|
|
187
|
-
role "Accountant"
|
|
188
|
-
given InvoiceRegistered
|
|
189
|
-
for "0f5f5f7f-0f6f-4f47-9f39-5c1f2f0a1a9f"
|
|
190
|
-
invoiceNumber = "INV-000123"
|
|
191
|
-
when RegisterInvoice
|
|
192
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
193
|
-
invoiceNumber = "INV-000123"
|
|
194
|
-
then error
|
|
195
|
-
specification DenyingACallerWithoutTheRole
|
|
196
|
-
given caller
|
|
197
|
-
authenticated
|
|
198
|
-
when RegisterInvoice
|
|
199
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
200
|
-
invoiceNumber = "INV-000123"
|
|
201
|
-
then denied
|
|
202
|
-
specification ProjectingAnAppendedInvoice
|
|
203
|
-
when append InvoiceRegistered
|
|
204
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
205
|
-
invoiceNumber = "INV-000123"
|
|
206
|
-
then query InvoiceById
|
|
207
|
-
arguments
|
|
208
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
209
|
-
result
|
|
210
|
-
invoiceNumber = "INV-000123"
|
|
211
|
-
slice StateView InvoiceLookup
|
|
212
|
-
readmodel InvoiceSummary
|
|
213
|
-
invoiceId InvoiceId
|
|
214
|
-
invoiceNumber InvoiceNumber
|
|
215
|
-
query InvoiceById => InvoiceSummary optional
|
|
216
|
-
by invoiceId InvoiceId
|
|
217
|
-
projection InvoiceSummaries => InvoiceSummary
|
|
218
|
-
from InvoiceRegistered
|
|
219
|
-
invoiceId = $eventSourceId
|
|
220
|
-
invoiceNumber = invoiceNumber
|
|
221
|
-
specification LookingUpAnExistingInvoice
|
|
222
|
-
given readmodel InvoiceSummary
|
|
223
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
224
|
-
invoiceNumber = "INV-000001"
|
|
225
|
-
when query InvoiceById
|
|
226
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
227
|
-
then result
|
|
228
|
-
invoiceNumber = "INV-000001"
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
- Inline events are ordinary named facts in `given` and `then`. Assert their
|
|
232
|
-
destination with `for`, not a payload identifier; inline declaration does not
|
|
233
|
-
change fixture or assertion syntax.
|
|
234
|
-
- `RejectingANumberAnotherInvoiceHolds` needs `for`: without it the `given`
|
|
235
|
-
event lands on the command's own event source, and re-claiming your own value
|
|
236
|
-
is not a violation.
|
|
237
|
-
- `ProjectingAnAppendedInvoice` exercises the projection without running the
|
|
238
|
-
command. A `when append` specification may sit in a `StateView` slice, even for an
|
|
239
|
-
event another slice declares, as long as the event's producer gives it one
|
|
240
|
-
unambiguous destination type (binding resolves it from commands in other slices);
|
|
241
|
-
otherwise `for` fails with `PLAY0273`. Only `when <Command>` needs the command's
|
|
242
|
-
own slice.
|
|
243
|
-
- `LookingUpAnExistingInvoice` performs the query as its action. It binds to
|
|
244
|
-
exactly what `then query` with `arguments` and `result` would, so on a version
|
|
245
|
-
before v4.48.0 write it that way instead.
|
|
182
|
+
A command with an authorization gate, a validation rule and a uniqueness constraint, specified in full with inline events, optional-aware queries and read-model assertions.
|
|
183
|
+
Read [references/worked-example.md](references/worked-example.md) when writing or checking a complete command, view or constraint specification and you need the full compiled model to copy the shape from.
|
|
246
184
|
|
|
247
185
|
## Generated fixtures and return expectations (ESM v7)
|
|
248
186
|
|
|
249
|
-
Standalone `screenplay` 4.68.0 or later binds and runs
|
|
250
|
-
|
|
251
|
-
contract of a hand-written command. The model and rules are in `cratis-screenplay-command-surface`; the
|
|
252
|
-
complete example is `cratis-screenplay-toolchain` `references/generated-responses-example.md`.
|
|
253
|
-
|
|
254
|
-
```screenplay excerpt
|
|
255
|
-
specification RegisteringReturnsIdentifiers
|
|
256
|
-
when RegisterProject
|
|
257
|
-
for "11111111-1111-1111-1111-111111111111"
|
|
258
|
-
generated receiptId = "22222222-2222-2222-2222-222222222222"
|
|
259
|
-
name = "Apollo"
|
|
260
|
-
then ProjectRegistered
|
|
261
|
-
for "11111111-1111-1111-1111-111111111111"
|
|
262
|
-
name = "Apollo"
|
|
263
|
-
then returns
|
|
264
|
-
receiptId = "22222222-2222-2222-2222-222222222222"
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
- `for` beneath `when` supplies the generated identifier and an indented `generated <name> = <value>` supplies any other
|
|
268
|
-
generated value; neither goes on the `when` header, and neither is a request mapping. Ordinary `generated = <value>`
|
|
269
|
-
is an input mapping for a property named `generated`.
|
|
270
|
-
- A scalar response is `then returns <value>`; a record uses `then returns` with a non-empty subset of its named
|
|
271
|
-
fields (unknown, duplicate, nongenerated or identifier fixture targets are rejected). Values are concrete literals or
|
|
272
|
-
structured values. A return expectation needs a command action, occurs at most once and cannot accompany
|
|
273
|
-
`then error` or `then denied`; event and state assertions may coexist.
|
|
274
|
-
- The reference runner compares scalar values by semantic equality and records by the asserted subset, reporting
|
|
275
|
-
differences in response field order. An absent optional source yields `Null`; arrays compare in order.
|
|
276
|
-
- `then returns` counts as a success outcome but does not relax event comparison: a command specification with
|
|
277
|
-
no expected events still asserts that no facts were produced.
|
|
278
|
-
- If execution reaches generation without every generated value supplied, the run is `Unsupported(IdentityAllocation)` and
|
|
279
|
-
the specification never passes; nothing is invented. A denial or validation failure happens before generation and
|
|
280
|
-
keeps its own outcome.
|
|
281
|
-
- For a generated identifier `for` is the generation fixture, not a destination assertion: expected events state their
|
|
282
|
-
own destinations. For commands without a generated identifier `when ... for` keeps the destination assertion.
|
|
283
|
-
UUID spellings on generated values normalize to lowercase hyphenated form.
|
|
284
|
-
- A reaction-invoked command that reaches generation is `Unsupported(IdentityAllocation)` (no fixture channel); a
|
|
285
|
-
response-only command runs and its response is discarded.
|
|
187
|
+
Standalone `screenplay` 4.68.0 or later binds and runs generated fixtures (`generated <name> = <value>`, `for` beneath `when`) and `then returns`; the cratis CLI 3.28.3 does not. If execution reaches generation without every generated value supplied, the run is unsupported and never passes.
|
|
188
|
+
Read [references/generated-fixtures.md](references/generated-fixtures.md) when writing generated-value fixtures or scalar and record return expectations for a command.
|
|
286
189
|
|
|
287
190
|
## Actions beyond commands
|
|
288
191
|
|
|
289
|
-
A slice is not always set off by a command
|
|
290
|
-
|
|
291
|
-
| Slice | Action |
|
|
292
|
-
| --- | --- |
|
|
293
|
-
| A view no event builds - its query has a `performer` | `given readmodel` …, `when query <Query>`, `then result` / `then no result` |
|
|
294
|
-
| An automation driven by the clock | `given clock "<instant>"`, `when clock "<later instant>"` |
|
|
295
|
-
| An automation driven by an application trigger | `when trigger <Trigger>` with the values it carries |
|
|
296
|
-
| A translation driven by a capture | `given capture <Capture>` (the record as it was), `when capture <Capture>` (as it is now) |
|
|
297
|
-
|
|
298
|
-
Use `given clock`, never `given time`, to state the scenario occurrence time and
|
|
299
|
-
assert a value mapped from `$context.occurred`. In a command's `produces`, that
|
|
300
|
-
mapping executes when the scenario has `given clock`. It is not the same as
|
|
301
|
-
`$eventContext.occurred` in a projection, which the execution plan refuses (below).
|
|
302
|
-
|
|
303
|
-
**Which tools bind these actions** (probed: `screenplay mcp` 4.66.0 and `cratis screenplay mcp` 3.28.2
|
|
304
|
-
report the complete example below `executableReady` with no executable error, in
|
|
305
|
-
`open-workspace` readiness and `read-workspace` view `executable-diagnostics`;
|
|
306
|
-
`cratis` before 3.28.2 bundled 4.60.1 and did not):
|
|
307
|
-
|
|
308
|
-
- **Screenplay 4.66.0 (ESM v6, from 4.61.0), standalone and `cratis` 3.28.2:** the clock, trigger
|
|
309
|
-
and capture actions, and the `Automation` and `Translate` slices, reactions and
|
|
310
|
-
captures they drive, bind. The reference runner executes them as library code, with
|
|
311
|
-
the semantics in "Reactions and cascades" below.
|
|
312
|
-
- **`cratis` before 3.28.2 (Screenplay 4.60.1, ESM v1-v5):**
|
|
313
|
-
**`when query` executed. The clock, trigger and capture actions did not.** They parsed, printed and were
|
|
314
|
-
checked against the application, but binding reported `PLAY0268` naming the
|
|
315
|
-
proposed ESM v6 (decision 0022), and an `Automation` or `Translate` slice reported
|
|
316
|
-
*is not admitted by ESM v1*. Only binding showed this: `cratis screenplay validate`
|
|
317
|
-
does not bind, so it stayed green.
|
|
318
|
-
|
|
319
|
-
Write the actions either way - they state what sets the slice off. Report each as
|
|
320
|
-
bound and not executed, or as parsed only, naming the tool that said so.
|
|
192
|
+
A slice is not always set off by a command: `given clock`, `when clock`, `when trigger`, `given capture`, `when capture` and `when query` (with `then result` / `then no result`) name what does. Use `given clock`, never `given time`. From ESM v6 (Screenplay 4.61.0 and later, `cratis` 3.28.2 and later) the reference runner executes the clock, trigger and capture actions; before ESM v6 only `when query` executed among them.
|
|
193
|
+
Read [references/actions-beyond-commands.md](references/actions-beyond-commands.md) when the slice is an automation, translation or query view, or you need the action table, grammar and what the reference runner executes for each.
|
|
321
194
|
|
|
322
195
|
## Reactions and cascades (ESM v6)
|
|
323
196
|
|
|
324
|
-
From ESM v6 every action sets reactions off
|
|
325
|
-
|
|
326
|
-
and what those append or invoke runs more, until nothing is left. `then` events
|
|
327
|
-
compare every new fact, the action's and the reactions'.
|
|
328
|
-
|
|
329
|
-
```screenplay
|
|
330
|
-
concept InvoiceId : Uuid
|
|
331
|
-
module Collections
|
|
332
|
-
feature Invoices
|
|
333
|
-
slice StateChange SendInvoice
|
|
334
|
-
command SendInvoice
|
|
335
|
-
invoiceId InvoiceId identifier
|
|
336
|
-
produces InvoiceSent
|
|
337
|
-
for invoiceId
|
|
338
|
-
invoiceId = invoiceId
|
|
339
|
-
event InvoiceSent
|
|
340
|
-
invoiceId InvoiceId
|
|
341
|
-
specification SendingAnInvoiceSchedulesAReminder
|
|
342
|
-
given clock "2026-10-02T09:00:00Z"
|
|
343
|
-
when SendInvoice
|
|
344
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
345
|
-
then InvoiceSent
|
|
346
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
347
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
348
|
-
then ReminderScheduled
|
|
349
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
350
|
-
scheduledAt = "2026-10-02T09:00:00Z"
|
|
351
|
-
slice Automation Reminders
|
|
352
|
-
reaction ReminderScheduler
|
|
353
|
-
description "Schedules a reminder when an invoice is sent"
|
|
354
|
-
when InvoiceSent
|
|
355
|
-
invoiceId
|
|
356
|
-
produces ReminderScheduled
|
|
357
|
-
for invoiceId
|
|
358
|
-
scheduledAt = $context.occurred
|
|
359
|
-
event ReminderScheduled
|
|
360
|
-
scheduledAt DateTime
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
- A specification whose action is a command goes in the slice that declares that
|
|
364
|
-
command, here `SendInvoice`, not in the `Automation` slice that reacts: a command
|
|
365
|
-
from another slice is `PLAY0273` "command is unresolved in its slice" at binding.
|
|
366
|
-
- A command a reaction `invokes` runs through its full pipeline **with no caller**.
|
|
367
|
-
A command that needs one rejects, and that rejection ends the scenario. Each
|
|
368
|
-
invoked command is atomic; the cascade is not, so earlier accepted facts stay.
|
|
369
|
-
There is no syntax for an identity (Screenplay#383). See
|
|
370
|
-
`cratis-screenplay-automations-and-translations` and
|
|
371
|
-
`cratis-screenplay-captures-and-reactions`.
|
|
372
|
-
- The clock is UTC and exact. An `every` or `at` occurrence fires once when it is
|
|
373
|
-
due after `given clock` and at or before `when clock`; `when clock` needs
|
|
374
|
-
`given clock`, so the same instant twice fires nothing.
|
|
375
|
-
- A reached reaction with a code body (`file` or inline) returns unsupported, as
|
|
376
|
-
does a reaction that never settles. The reference stops at 1,000 new facts per
|
|
377
|
-
scenario and 10,000 due occurrences per clock advance.
|
|
378
|
-
- A model that uses these forms selects ESM v6 (`schemaVersion: 6`). Stage 4.24.2
|
|
379
|
-
admits ESM v1-v4 and renders no `Automation` or `Translate` slice, so the whole
|
|
380
|
-
automation is gap-fill against this contract: `cratis-screenplay-render-and-gap-fill`.
|
|
381
|
-
|
|
382
|
-
### Version skew: cascades and the false `PLAY0285` (cratis before 3.28.2)
|
|
383
|
-
|
|
384
|
-
`PLAY0285` (a specification's expected event contradicts every producer of its
|
|
385
|
-
`when` command) runs in the syntax pass, with no binding. Reachability through
|
|
386
|
-
reactions and `invokes` was added after Screenplay 4.60.1. So the example above
|
|
387
|
-
passes `screenplay` 4.68.0 (and is executable-ready over its MCP server) and also passes
|
|
388
|
-
`cratis screenplay validate` 3.28.2 (probed); it failed `cratis screenplay validate` 3.27.1 with
|
|
389
|
-
`PLAY0285` "Specification outcome 'ReminderScheduled' cannot be produced by 'SendInvoice'",
|
|
390
|
-
exit 5 (Cratis/cli#242). If an older bundle still reports it, it is a tool skew, not a
|
|
391
|
-
modeling error: do not delete the `then` line or move the event to make `cratis`
|
|
392
|
-
green. Validate with the standalone tool or a current `cratis`, record which tool gave which
|
|
393
|
-
verdict, and see `cratis-screenplay-toolchain`.
|
|
197
|
+
From ESM v6 every action sets reactions off and `then` events compare every new fact, the action's and the reactions'. A specification whose action is a command goes in the slice that declares the command. A false `PLAY0285` on a cascade under `cratis` before 3.28.2 is tool skew, not a modeling error: never delete the `then` line to silence it.
|
|
198
|
+
Read [references/reactions-and-cascades.md](references/reactions-and-cascades.md) when a specification's expected events include what a reaction appends, when a cascade, clock tick or invoked command is involved, or when `cratis` reports `PLAY0285` on a model that `screenplay` accepts (it holds the "Version skew: cascades and the false `PLAY0285` (cratis before 3.28.2)" section).
|
|
394
199
|
|
|
395
200
|
## Rejections and denials say different things
|
|
396
201
|
|
|
@@ -406,81 +211,8 @@ constraint — that is the constraint speaking, not the view.)
|
|
|
406
211
|
|
|
407
212
|
## Business rule or concept rule?
|
|
408
213
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
1. Does the error depend on **existing system state** - what events occurred?
|
|
412
|
-
→ business rule → write the specification.
|
|
413
|
-
2. Would a different business plausibly have a different rule here?
|
|
414
|
-
→ business rule → write the specification.
|
|
415
|
-
3. Is it a format, range or presence rule on a single value?
|
|
416
|
-
→ put it on the **concept** with its own `validate` block, so the rule travels
|
|
417
|
-
with every use, and write **one rejection specification per concept rule**,
|
|
418
|
-
through **one** command that uses the concept. Not one per command or property
|
|
419
|
-
that uses it.
|
|
420
|
-
|
|
421
|
-
**Write specifications for:** *"Cannot cancel an already-paid invoice"*,
|
|
422
|
-
*"Cannot withdraw more than the balance"*, *"Maximum 100 lines per invoice"*, and,
|
|
423
|
-
once per concept rule, *"Discount cannot exceed 100 percent"*.
|
|
424
|
-
|
|
425
|
-
**Do not write** one specification per use of a concept, or one per format variant
|
|
426
|
-
of the same rule.
|
|
427
|
-
|
|
428
|
-
**Why this differs from earlier guidance.** This skill used to say not to write
|
|
429
|
-
specifications for rules like *"Name cannot be empty"* because the type system
|
|
430
|
-
makes them unrepresentable. In Screenplay a concept `validate` is a runtime rule the
|
|
431
|
-
reference runner executes, not a type-level guarantee . Without a
|
|
432
|
-
rejection specification nothing proves the rule is wired to the command, and a
|
|
433
|
-
rule moved or deleted by an edit goes unnoticed. The cost is one specification per
|
|
434
|
-
rule; the rule stays on the concept, never copied into each command.
|
|
435
|
-
|
|
436
|
-
A complete example: the rule lives on the concept, one command exercises it, and
|
|
437
|
-
each concept rule has a rejection (the boundary above the limit and the rule below
|
|
438
|
-
zero), plus an acceptance at the limit.
|
|
439
|
-
|
|
440
|
-
```screenplay
|
|
441
|
-
concept InvoiceId : Uuid
|
|
442
|
-
concept DiscountPercentage : Int
|
|
443
|
-
validate
|
|
444
|
-
min 0 message "Discount cannot be negative"
|
|
445
|
-
max 100 message "Discount cannot exceed 100 percent"
|
|
446
|
-
module Invoicing
|
|
447
|
-
feature Discounts
|
|
448
|
-
slice StateChange GrantDiscount
|
|
449
|
-
command GrantDiscount
|
|
450
|
-
invoiceId InvoiceId identifier
|
|
451
|
-
discount DiscountPercentage
|
|
452
|
-
produces event DiscountGranted
|
|
453
|
-
discount DiscountPercentage = discount
|
|
454
|
-
specification GrantingAValidDiscount
|
|
455
|
-
when GrantDiscount
|
|
456
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
457
|
-
discount = 15
|
|
458
|
-
then DiscountGranted
|
|
459
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
460
|
-
discount = 15
|
|
461
|
-
specification AcceptingTheUpperBoundary
|
|
462
|
-
when GrantDiscount
|
|
463
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
464
|
-
discount = 100
|
|
465
|
-
then DiscountGranted
|
|
466
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
467
|
-
discount = 100
|
|
468
|
-
specification RejectingADiscountAboveTheUpperBoundary
|
|
469
|
-
when GrantDiscount
|
|
470
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
471
|
-
discount = 101
|
|
472
|
-
then error "Discount cannot exceed 100 percent"
|
|
473
|
-
specification RejectingANegativeDiscount
|
|
474
|
-
when GrantDiscount
|
|
475
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
476
|
-
discount = -1
|
|
477
|
-
then error "Discount cannot be negative"
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
Which scenarios a command needs (denial, duplicates, competing claims, ordering,
|
|
481
|
-
external failure, compensation) and which form fits a mode: coverage-matrix and
|
|
482
|
-
workshop method in `cratis-screenplay-scenario-coverage`. This skill stays the
|
|
483
|
-
grammar and the reference-execution facts.
|
|
214
|
+
Write an error specification for a rule that depends on existing system state or that another business could plausibly set differently. A format, range or presence rule on one value belongs on the concept with its own `validate` block, with **one rejection specification per concept rule**, through one command that uses the concept, not one per use.
|
|
215
|
+
Read [references/concept-rules.md](references/concept-rules.md) when deciding whether a rule needs an error specification or a concept `validate`, or when you need the complete concept-rule example with boundary acceptances and rejections.
|
|
484
216
|
|
|
485
217
|
## Application-boundary coverage
|
|
486
218
|
|
|
@@ -490,46 +222,6 @@ events, read-model state, query results, a rejection or a denial. A specificatio
|
|
|
490
222
|
satisfiable only by an internal function describes a unit, not a slice acceptance
|
|
491
223
|
criterion.
|
|
492
224
|
|
|
493
|
-
## Reference execution — what actually runs
|
|
494
|
-
|
|
495
|
-
Screenplay's reference runner executes specifications against an immutable
|
|
496
|
-
in-memory world: no Arc, no Chronicle, no database, no network. Every downstream
|
|
497
|
-
target has one normalized behavior to match.
|
|
498
|
-
|
|
499
|
-
- It runs the capabilities the execution plan admits: declarative validation
|
|
500
|
-
and `require` over command properties, conditional production, literal tags,
|
|
501
|
-
declarative policies, `unique` constraints, and projections as Chronicle
|
|
502
|
-
lowers them. The `cratis-screenplay-model-authoring` language reference lists
|
|
503
|
-
what binds and what the plan admits.
|
|
504
|
-
- Binding is not admission. These projection constructs bind, but the plan
|
|
505
|
-
refuses them: a projection-level `remove via join`; `all` beside removals,
|
|
506
|
-
`children` or `nested`; a `join`, `children` or `remove via join` inside
|
|
507
|
-
`nested`; and any `$eventContext.<path>` other than `eventSourceId`, such as
|
|
508
|
-
`$eventContext.occurred`. The limits apply at every ESM version.
|
|
509
|
-
- A specification that needs **opaque code** — a bodied reducer, a rule with a
|
|
510
|
-
body, a fenced `validate` block, a code policy, or (ESM v6) a reached reaction
|
|
511
|
-
body — returns **unsupported** and
|
|
512
|
-
never passes. Authorization is evaluated first, so a `then denied` case still
|
|
513
|
-
runs when a portable policy decides it. Other specifications in the model run
|
|
514
|
-
normally.
|
|
515
|
-
- Unsupported reachable declarative constructs block the whole execution plan
|
|
516
|
-
rather than running partially: no specification in the model runs, including
|
|
517
|
-
the ones that never touch the refused construct.
|
|
518
|
-
- Reactions: before ESM v6 they never run, not even after `when append`. From ESM
|
|
519
|
-
v6 (standalone tool from 4.61.0) they run after every action, as in "Reactions and
|
|
520
|
-
cascades". Under `cratis` before 3.28.2 (Screenplay 4.60.1) `when clock`, `when trigger`
|
|
521
|
-
and `when capture` failed binding with `PLAY0268`, and so did reactions and captures; they
|
|
522
|
-
bind on 4.66.0 and `cratis` 3.28.2.
|
|
523
|
-
- A rejected individual command or append leaves the world unchanged; an accepted
|
|
524
|
-
one commits once, then the read models and queries are compared. There is no
|
|
525
|
-
scenario-wide transaction in v6: when a later effect of a cascade or capture
|
|
526
|
-
rejects, the earlier accepted facts and their projections remain.
|
|
527
|
-
|
|
528
|
-
Unsupported is not passed. Report it as "needs a target", not as green. "Specified"
|
|
529
|
-
and "bound" are never "passing": no command-line tool runs these specifications, so a
|
|
530
|
-
pass is claimed only from the reference runner, Stage's specification runner or a
|
|
531
|
-
rendered application's tests, and named as such.
|
|
532
|
-
|
|
533
225
|
## Quality checklist
|
|
534
226
|
|
|
535
227
|
For every specification:
|
package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Actions beyond commands
|
|
2
|
+
|
|
3
|
+
A slice is not always set off by a command. Name what does:
|
|
4
|
+
|
|
5
|
+
| Slice | Action |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| A view no event builds - its query has a `performer` | `given readmodel` …, `when query <Query>`, `then result` / `then no result` |
|
|
8
|
+
| An automation driven by the clock | `given clock "<instant>"`, `when clock "<later instant>"` |
|
|
9
|
+
| An automation driven by an application trigger | `when trigger <Trigger>` with the values it carries |
|
|
10
|
+
| A translation driven by a capture | `given capture <Capture>` (the record as it was), `when capture <Capture>` (as it is now) |
|
|
11
|
+
|
|
12
|
+
Use `given clock`, never `given time`, to state the scenario occurrence time and
|
|
13
|
+
assert a value mapped from `$context.occurred`. In a command's `produces`, that
|
|
14
|
+
mapping executes when the scenario has `given clock`. It is not the same as
|
|
15
|
+
`$eventContext.occurred` in a projection, which the execution plan refuses (SKILL.md, "Reference execution — what actually runs").
|
|
16
|
+
|
|
17
|
+
**Which tools bind these actions** (probed: `screenplay mcp` 4.66.0 and `cratis screenplay mcp` 3.28.2
|
|
18
|
+
report the complete example in [reactions-and-cascades.md](reactions-and-cascades.md) `executableReady` with no executable error, in
|
|
19
|
+
`open-workspace` readiness and `read-workspace` view `executable-diagnostics`;
|
|
20
|
+
`cratis` before 3.28.2 bundled 4.60.1 and did not):
|
|
21
|
+
|
|
22
|
+
- **Screenplay 4.66.0 (ESM v6, from 4.61.0), standalone and `cratis` 3.28.2:** the clock, trigger
|
|
23
|
+
and capture actions, and the `Automation` and `Translate` slices, reactions and
|
|
24
|
+
captures they drive, bind. The reference runner executes them as library code, with
|
|
25
|
+
the semantics in [Reactions and cascades](reactions-and-cascades.md).
|
|
26
|
+
- **`cratis` before 3.28.2 (Screenplay 4.60.1, ESM v1-v5):**
|
|
27
|
+
**`when query` executed. The clock, trigger and capture actions did not.** They parsed, printed and were
|
|
28
|
+
checked against the application, but binding reported `PLAY0268` naming the
|
|
29
|
+
proposed ESM v6 (decision 0022), and an `Automation` or `Translate` slice reported
|
|
30
|
+
*is not admitted by ESM v1*. Only binding showed this: `cratis screenplay validate`
|
|
31
|
+
does not bind, so it stayed green.
|
|
32
|
+
|
|
33
|
+
Write the actions either way - they state what sets the slice off. Report each as
|
|
34
|
+
bound and not executed, or as parsed only, naming the tool that said so.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
## Business rule or concept rule?
|
|
2
|
+
|
|
3
|
+
Before writing an error specification, sort the rule:
|
|
4
|
+
|
|
5
|
+
1. Does the error depend on **existing system state** - what events occurred?
|
|
6
|
+
→ business rule → write the specification.
|
|
7
|
+
2. Would a different business plausibly have a different rule here?
|
|
8
|
+
→ business rule → write the specification.
|
|
9
|
+
3. Is it a format, range or presence rule on a single value?
|
|
10
|
+
→ put it on the **concept** with its own `validate` block, so the rule travels
|
|
11
|
+
with every use, and write **one rejection specification per concept rule**,
|
|
12
|
+
through **one** command that uses the concept. Not one per command or property
|
|
13
|
+
that uses it.
|
|
14
|
+
|
|
15
|
+
**Write specifications for:** *"Cannot cancel an already-paid invoice"*,
|
|
16
|
+
*"Cannot withdraw more than the balance"*, *"Maximum 100 lines per invoice"*, and,
|
|
17
|
+
once per concept rule, *"Discount cannot exceed 100 percent"*.
|
|
18
|
+
|
|
19
|
+
**Do not write** one specification per use of a concept, or one per format variant
|
|
20
|
+
of the same rule.
|
|
21
|
+
|
|
22
|
+
**Why this differs from earlier guidance.** This skill used to say not to write
|
|
23
|
+
specifications for rules like *"Name cannot be empty"* because the type system
|
|
24
|
+
makes them unrepresentable. In Screenplay a concept `validate` is a runtime rule the
|
|
25
|
+
reference runner executes, not a type-level guarantee . Without a
|
|
26
|
+
rejection specification nothing proves the rule is wired to the command, and a
|
|
27
|
+
rule moved or deleted by an edit goes unnoticed. The cost is one specification per
|
|
28
|
+
rule; the rule stays on the concept, never copied into each command.
|
|
29
|
+
|
|
30
|
+
A complete example: the rule lives on the concept, one command exercises it, and
|
|
31
|
+
each concept rule has a rejection (the boundary above the limit and the rule below
|
|
32
|
+
zero), plus an acceptance at the limit.
|
|
33
|
+
|
|
34
|
+
```screenplay
|
|
35
|
+
concept InvoiceId : Uuid
|
|
36
|
+
concept DiscountPercentage : Int
|
|
37
|
+
validate
|
|
38
|
+
min 0 message "Discount cannot be negative"
|
|
39
|
+
max 100 message "Discount cannot exceed 100 percent"
|
|
40
|
+
module Invoicing
|
|
41
|
+
feature Discounts
|
|
42
|
+
slice StateChange GrantDiscount
|
|
43
|
+
command GrantDiscount
|
|
44
|
+
invoiceId InvoiceId identifier
|
|
45
|
+
discount DiscountPercentage
|
|
46
|
+
produces event DiscountGranted
|
|
47
|
+
discount DiscountPercentage = discount
|
|
48
|
+
specification GrantingAValidDiscount
|
|
49
|
+
when GrantDiscount
|
|
50
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
51
|
+
discount = 15
|
|
52
|
+
then DiscountGranted
|
|
53
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
54
|
+
discount = 15
|
|
55
|
+
specification AcceptingTheUpperBoundary
|
|
56
|
+
when GrantDiscount
|
|
57
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
58
|
+
discount = 100
|
|
59
|
+
then DiscountGranted
|
|
60
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
61
|
+
discount = 100
|
|
62
|
+
specification RejectingADiscountAboveTheUpperBoundary
|
|
63
|
+
when GrantDiscount
|
|
64
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
65
|
+
discount = 101
|
|
66
|
+
then error "Discount cannot exceed 100 percent"
|
|
67
|
+
specification RejectingANegativeDiscount
|
|
68
|
+
when GrantDiscount
|
|
69
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
70
|
+
discount = -1
|
|
71
|
+
then error "Discount cannot be negative"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Which scenarios a command needs (denial, duplicates, competing claims, ordering,
|
|
75
|
+
external failure, compensation) and which form fits a mode: coverage-matrix and
|
|
76
|
+
workshop method in `cratis-screenplay-scenario-coverage`. This skill stays the
|
|
77
|
+
grammar and the reference-execution facts.
|
package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## Generated fixtures and return expectations (ESM v7)
|
|
2
|
+
|
|
3
|
+
Standalone `screenplay` 4.68.0 or later binds and runs these; the cratis CLI 3.28.3 (bundled 4.66.0) does not
|
|
4
|
+
bind them, and Stage does not render ESM v7 yet (`STAGE-ESM-016`, tracked in Stage#201), so they pin the
|
|
5
|
+
contract of a hand-written command. The model and rules are in `cratis-screenplay-command-surface`; the
|
|
6
|
+
complete example is `cratis-screenplay-toolchain` `references/generated-responses-example.md`. Read that file when writing generated-value fixtures or scalar and record return expectations and needing a complete reference-executable model.
|
|
7
|
+
|
|
8
|
+
```screenplay excerpt
|
|
9
|
+
specification RegisteringReturnsIdentifiers
|
|
10
|
+
when RegisterProject
|
|
11
|
+
for "11111111-1111-1111-1111-111111111111"
|
|
12
|
+
generated receiptId = "22222222-2222-2222-2222-222222222222"
|
|
13
|
+
name = "Apollo"
|
|
14
|
+
then ProjectRegistered
|
|
15
|
+
for "11111111-1111-1111-1111-111111111111"
|
|
16
|
+
name = "Apollo"
|
|
17
|
+
then returns
|
|
18
|
+
receiptId = "22222222-2222-2222-2222-222222222222"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- `for` beneath `when` supplies the generated identifier and an indented `generated <name> = <value>` supplies any other
|
|
22
|
+
generated value; neither goes on the `when` header, and neither is a request mapping. Ordinary `generated = <value>`
|
|
23
|
+
is an input mapping for a property named `generated`.
|
|
24
|
+
- A scalar response is `then returns <value>`; a record uses `then returns` with a non-empty subset of its named
|
|
25
|
+
fields (unknown, duplicate, nongenerated or identifier fixture targets are rejected). Values are concrete literals or
|
|
26
|
+
structured values. A return expectation needs a command action, occurs at most once and cannot accompany
|
|
27
|
+
`then error` or `then denied`; event and state assertions may coexist.
|
|
28
|
+
- The reference runner compares scalar values by semantic equality and records by the asserted subset, reporting
|
|
29
|
+
differences in response field order. An absent optional source yields `Null`; arrays compare in order.
|
|
30
|
+
- `then returns` counts as a success outcome but does not relax event comparison: a command specification with
|
|
31
|
+
no expected events still asserts that no facts were produced.
|
|
32
|
+
- If execution reaches generation without every generated value supplied, the run is `Unsupported(IdentityAllocation)` and
|
|
33
|
+
the specification never passes; nothing is invented. A denial or validation failure happens before generation and
|
|
34
|
+
keeps its own outcome.
|
|
35
|
+
- For a generated identifier `for` is the generation fixture, not a destination assertion: expected events state their
|
|
36
|
+
own destinations. For commands without a generated identifier `when ... for` keeps the destination assertion.
|
|
37
|
+
UUID spellings on generated values normalize to lowercase hyphenated form.
|
|
38
|
+
- A reaction-invoked command that reaches generation is `Unsupported(IdentityAllocation)` (no fixture channel); a
|
|
39
|
+
response-only command runs and its response is discarded.
|