@cratis/pi 7.38.3 → 7.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/package/corpus/agents/screenplay-modeler.md +1 -1
  2. package/package/corpus/agents/screenplay-reviewer.md +1 -1
  3. package/package/corpus/product-sync.json +11 -11
  4. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +2 -2
  5. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +4 -2
  6. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +1 -1
  7. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +1 -1
  8. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/public-events-and-direction.md +3 -6
  9. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +12 -7
  10. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +5 -6
  11. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +2 -5
  12. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +12 -15
  13. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +6 -15
  14. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +1 -1
  15. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +14 -15
  16. package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +14 -4
  17. package/package/corpus/skills/cratis-screenplay-command-surface/references/enum-numbers.md +11 -13
  18. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +10 -6
  19. package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +23 -1
  20. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +2 -2
  21. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +1 -1
  22. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +13 -13
  23. package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +3 -7
  24. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +9 -12
  25. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +4 -4
  26. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +1 -1
  27. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +3 -8
  28. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +9 -4
  29. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +9 -7
  30. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +26 -6
  31. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +40 -0
  32. package/package/corpus/skills/cratis-screenplay-model-authoring/references/property-links.md +3 -1
  33. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +1 -1
  34. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +1 -1
  35. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +1 -1
  36. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +2 -2
  37. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +1 -1
  38. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +3 -2
  39. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +5 -3
  40. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +2 -6
  41. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +2 -0
  42. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +26 -18
  43. package/package/corpus/skills/cratis-screenplay-read-surface/references/equality-filters.md +208 -0
  44. package/package/corpus/skills/cratis-screenplay-read-surface/references/screen-patterns.md +2 -5
  45. package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +4 -0
  46. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +20 -16
  47. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +1 -1
  48. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +4 -3
  49. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +8 -8
  50. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +2 -5
  51. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +2 -2
  52. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +4 -1
  53. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +8 -19
  54. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-design.md +8 -20
  55. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +9 -23
  56. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +9 -3
  57. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +6 -5
  58. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +2 -1
  59. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +7 -4
  60. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +1 -1
  61. package/package/corpus/skills/cratis-screenplay-slice-design/references/model-reasoning.md +2 -5
  62. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +5 -10
  63. package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +8 -19
  64. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +17 -25
  65. package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +2 -1
  66. package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +3 -3
  67. package/package/corpus/skills/cratis-screenplay-specifications/references/persona-callers-and-cases.md +2 -5
  68. package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +5 -4
  69. package/package/corpus/skills/cratis-screenplay-specifications/references/source-notes.md +10 -0
  70. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +3 -3
  71. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +2 -1
  72. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +2 -2
  73. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +10 -24
  74. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +1 -1
  75. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +23 -17
  76. package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +4 -10
  77. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +11 -23
  78. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +1 -1
  79. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +3 -3
  80. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +4 -3
  81. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +3 -7
  82. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +40 -24
  83. package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +27 -69
  84. package/package/corpus/skills/cratis-screenplay-toolchain/references/preferred-syntax.md +73 -0
  85. package/package/corpus/skills/cratis-screenplay-toolchain/references/production-routes-and-filters.md +1 -1
  86. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +1 -1
  87. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +34 -31
  88. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract-exceptions.json +21 -0
  89. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +7 -1
  90. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  91. package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +4 -3
  92. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +4 -4
  93. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +17 -5
  94. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +50 -34
  95. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +7 -2
  96. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +13 -18
  97. package/package/corpus/skills/cratis-screenplay-ui-composition/references/screen-composition-contract.md +4 -3
  98. package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +3 -2
  99. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +32 -32
  100. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +58 -26
  101. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +17 -20
  102. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +18 -14
  103. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/scene-runtime.md +4 -3
  104. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +2 -2
  105. package/package.json +1 -1
@@ -46,13 +46,9 @@ module Invoicing
46
46
  invoiceId InvoiceId identifier
47
47
  member MemberId
48
48
  amount Decimal
49
- produces InvoiceIssued
50
- for invoiceId
51
- member = member
52
- amount = amount
53
- event InvoiceIssued
54
- member MemberId
55
- amount Decimal
49
+ produces event InvoiceIssued
50
+ member MemberId = member
51
+ amount Decimal = amount
56
52
  constraint IssueOnce
57
53
  unique event InvoiceIssued
58
54
 
@@ -115,8 +111,7 @@ module Invoicing
115
111
  validate
116
112
  require invoice.amount > 0
117
113
  message "Only an open invoice can be settled" // NOT enforced: the view lags (PLAY0268 at binding)
118
- produces InvoiceSettled
119
- for invoiceId
114
+ produces event InvoiceSettled
120
115
  command VoidInvoice
121
116
  invoiceId InvoiceId identifier
122
117
  reason String
@@ -124,12 +119,8 @@ module Invoicing
124
119
  validate
125
120
  require invoice.amount > 0
126
121
  message "Only an open, unpaid invoice can be voided" // NOT enforced: the view lags (PLAY0268 at binding)
127
- produces InvoiceVoided
128
- for invoiceId
129
- reason = reason
130
- event InvoiceSettled
131
- event InvoiceVoided
132
- reason String
122
+ produces event InvoiceVoided
123
+ reason String = reason
133
124
  constraint SettleOrVoid
134
125
  unique event InvoiceSettled
135
126
  unique event InvoiceVoided
@@ -179,11 +170,8 @@ module Invoicing
179
170
  validate
180
171
  require payment.invoiceId == invoiceId
181
172
  message "Only a received, not yet reversed payment can be reversed" // NOT enforced: the view lags (PLAY0268 at binding)
182
- produces PaymentReversed
183
- for invoiceId
184
- amount = amount
185
- event PaymentReversed
186
- amount Decimal
173
+ produces event PaymentReversed
174
+ amount Decimal = amount
187
175
 
188
176
  specification ReversingAReceivedPayment
189
177
  given caller
@@ -48,13 +48,9 @@ module Invoicing
48
48
  amount Decimal
49
49
  validate
50
50
  amount > 0 message "An invoice needs an amount above zero"
51
- produces InvoiceIssued
52
- for invoiceId
53
- member = member
54
- amount = amount
55
- event InvoiceIssued
56
- member MemberId
57
- amount Decimal
51
+ produces event InvoiceIssued
52
+ member MemberId = member
53
+ amount Decimal = amount
58
54
  constraint IssueOnce
59
55
  unique event InvoiceIssued
60
56
 
@@ -94,17 +90,12 @@ module Invoicing
94
90
  description "An invoice ends either settled or voided, never both: SettleOrVoid declares the exclusivity per invoice, enforced at append. Rules about the invoice's stored state are in invoicing-dues-design.md."
95
91
  command SettleInvoice
96
92
  invoiceId InvoiceId identifier
97
- produces InvoiceSettled
98
- for invoiceId
93
+ produces event InvoiceSettled
99
94
  command VoidInvoice
100
95
  invoiceId InvoiceId identifier
101
96
  reason String
102
- produces InvoiceVoided
103
- for invoiceId
104
- reason = reason
105
- event InvoiceSettled
106
- event InvoiceVoided
107
- reason String
97
+ produces event InvoiceVoided
98
+ reason String = reason
108
99
  constraint SettleOrVoid
109
100
  unique event InvoiceSettled
110
101
  unique event InvoiceVoided
@@ -170,9 +161,7 @@ module Invoicing
170
161
  description "Starts a payment attempt. PaymentRequested says only that we asked the gateway; it is NOT the outcome. The outcome arrives later as an external fact (slice PaymentGatewayResults). A request may be repeated after a decline, so there is deliberately no once-only constraint here."
171
162
  command RequestPayment
172
163
  invoiceId InvoiceId identifier
173
- produces PaymentRequested
174
- for invoiceId
175
- event PaymentRequested
164
+ produces event PaymentRequested
176
165
 
177
166
  specification RequestingPayment
178
167
  given caller
@@ -374,11 +363,8 @@ module Invoicing
374
363
  amount Decimal
375
364
  validate
376
365
  amount > 0 message "A top-up needs an amount above zero"
377
- produces CreditToppedUp
378
- for member
379
- amount = amount
380
- event CreditToppedUp
381
- amount Decimal
366
+ produces event CreditToppedUp
367
+ amount Decimal = amount
382
368
 
383
369
  specification ToppingUpCredit
384
370
  given caller
@@ -26,7 +26,7 @@ Screenplay specifications.
26
26
  |---|---|---|
27
27
  | Given | the facts that exist, each with its `for` source: `given InvoiceIssued` with `for "<invoice id>"` | "given an invoice" with no fact, no source |
28
28
  | When | one action with every input stated | an action with inputs left to defaults |
29
- | Then (success) | every production with payload and `for` | "an event is produced" |
29
+ | Then (success) | every expected event with payload and an explicit `for`, including events the command declares inline (the inline default applies to the `produces event` declaration, not to the expectation) | "an event is produced" |
30
30
  | Then (refusal) | `then error "Invoice already settled"`, the rule's own message | `then error` with no message, or `then error ""` |
31
31
  | Then (denial) | `then denied` | `then error` for a caller who is not allowed |
32
32
  | Reason | slice `documentation` says why the rule exists | the rule appears only in a spec title |
@@ -204,7 +204,13 @@ specification MemberCreditAccumulatesTopUps
204
204
  ```
205
205
 
206
206
  ## 6. Views: list contents and the empty list
207
- A list query asserts one `result` block per expected row (count and order are exact), and the
207
+ A list query asserts one `result` block per expected row: count is exact, but rows
208
+ match by read model and key regardless of order. The
208
209
  empty-list intent is a separate claim from a keyed row being absent (`view-and-story-specs.md`
209
210
  "Removal is a positive obligation"). The backing example proves the keyed forms only; whole-list
210
- queries are executable too (`ListOpenInvoices` in the backing example); only `filter`, `scoped to` and `performer` queries stay design-mode expectations recorded in the coverage matrix.
211
+ queries are executable too (`ListOpenInvoices` in the backing example); caller-supplied equality filters on collections bind as ESM v14 since 4.143.0.
212
+ Pass `by` and filters in query arguments; PLAY0468 reports unknown, repeated or
213
+ missing required arguments. Optional filters may be omitted, supplied null is refused.
214
+ Context-sourced/single-result filters, opaque `scoped to`/`performer`, and composite
215
+ `by` remain PLAY0268. Compiled coverage and renderer ceilings:
216
+ read-surface [equality filters](../../cratis-screenplay-read-surface/references/equality-filters.md).
@@ -17,14 +17,15 @@ Typed example/override forms: `cratis-screenplay-specifications`
17
17
  | `when append <Event>` | yes | yes | no |
18
18
  | `then readmodel` / `then query` (keyed `ById`, `arguments`, `result`) | yes | yes | yes |
19
19
  | `then query` on an unfiltered list or a list narrowed by one `by` key (observable too) | yes | yes since 4.105.0: no `arguments` for an unkeyed list, one `result` per row stating the read-model identifier, no `result` = empty list | observable lists render, a non-observable list is `STAGE-ESM-010` (Stage 4.73.1) |
20
- | `then query` on `filter`, `scoped to`, `performer` or `by ... from` queries | yes | no: PLAY0268 at binding | no |
20
+ | Collection query with caller-supplied equality `filter`, including observable | yes | yes since 4.143.0, ESM v14: same-named scalar property/type, AND with `by`; optional omission allowed, supplied null refused; PLAY0468 checks arguments; row order does not matter | no on CLI 3.56.0 / Stage 4.83.0 (v13 ceiling; CLI-RENDER-004 / direct STAGE-ESM-016) |
21
+ | Context `from`, single-result filters, `scoped to`, `performer` or composite `by` | yes | PLAY0268: query context, collection-only filtering, opaque scope/implementation or multipart lookup are unadmitted | no |
21
22
  | `then no readmodel <RM> for "<key>"` | yes | yes | no |
22
23
  | `when query` -> `then result` / `then no result` | yes | yes | same as `then query`: only the query-only cases below |
23
24
  | `given clock` / `when clock`, `when trigger`, `given`/`when capture` | yes | yes (standalone and any current cratis; history: a cratis before 3.28.2 bundle no, see versions.md) | no |
24
- | Command spec listing reaction cascade events | yes (v6 semantics) | false PLAY0285 on a cratis before 3.28.2 bundle only; see SKILL.md "Version skew" | no (no reactions) |
25
- | `generated <name> = <value>` under `when`, `then returns` (ESM v7) | yes | yes on standalone Screenplay 4.68.0 or later and the current cratis bundle (history: PLAY0268 on the 4.66.0 bundled in cratis 3.28.x) | no: Stage 4.73.1 admits v7 but refuses generated values (STAGE-ESM-028) and responses / `then returns` (STAGE-ESM-029); the spec pins the contract of a hand-written command |
25
+ | Command spec listing reaction cascade events | yes (v6 semantics) | false PLAY0285 on a cratis before 3.28.2 bundle only; see SKILL.md "Version skew" | no: STAGE-ESM-011; generated CommandScenario does not settle reactions (Stage 4.83.0) |
26
+ | `generated <name> = <value>` under `when`, `then returns` (ESM v7) | yes | yes on standalone Screenplay 4.68.0 or later and the current cratis bundle (history: PLAY0268 on the 4.66.0 bundled in cratis 3.28.x) | yes on Stage 4.83.0 for required scalar UUID-concept generation and scalar/named responses; unsupported types/combinations remain -028/-038 |
26
27
  | `then events in any order` | yes | yes | yes |
27
- | Event `stream` / `no stream`, typed `for` and stream ids | yes | ESM v8 at 4.125.0 | The pinned CLI reaches Stage route checks (toolchain `references/versions.md`); routed read-model/query replay can still refuse STAGE-ESM-030 |
28
+ | Event `stream` / `no stream`, typed `for` and stream ids | yes | ESM v8 at 4.125.0 | The pinned CLI reaches Stage route checks (toolchain `references/versions.md`); routed read-model/query replay now renders (Stage 4.83.0); reserved names/unformattable fixtures remain STAGE-ESM-030 |
28
29
  | Typed examples and overrides | yes | expanded and type-checked before binding; required fields remain required | depends on expanded contract, not fixture reuse |
29
30
  | `given operation ... fails`, `then operation`, `then compensated` | yes | unadmitted PLAY0268 | gap-fill |
30
31
  | Refusal branches, `when redelivered`, `then no events` | yes | unadmitted PLAY0268 | gap-fill |
@@ -40,7 +41,7 @@ cratis before 3.28.2 bundle is available). Mark each such spec in the coverage m
40
41
  `gap: <reason>` for the narrower modes so the verification and render phases know what will not execute.
41
42
 
42
43
  ## Executable mode
43
- - Every gated spec has `given caller`; every production and every given/expected event has `for`.
44
+ - Every gated spec has `given caller`; every given/expected event has `for`, and so does every plain `produces <Name>` (inline `produces event` omits it and defaults to the identifier).
44
45
  - Each read model has one key shared by its keyed `=> RM optional` queries; the identifier equals
45
46
  the projection's effective key (`cratis-screenplay-slice-design` `references/read-model-design.md`
46
47
  decision table). View specs assert through a keyed query.
@@ -119,7 +119,8 @@ Keep three claims apart:
119
119
  - one stored instance is absent: `then no readmodel`;
120
120
  - a query returns no rows: `then query` without `result`, or `when query` + `then no result`;
121
121
  - a list-valued property is empty: assert that property as `[]`.
122
- List-query results use repeated `result` blocks; count and order are exact. A keyed lookup does
122
+ List-query results use repeated `result` blocks; count is exact and rows match
123
+ by read model and instance key regardless of order. A keyed lookup does
123
124
  not prove an entire list is empty: assert the unkeyed list query itself (an unkeyed query takes no
124
125
  `arguments`; each `result` row states the read-model identifier, else PLAY0351). A snapshot list does not render
125
126
  (`STAGE-ESM-010`, Stage 4.73.1); an `observable` list does. Record that rendering limit.
@@ -73,7 +73,7 @@ report and slice `documentation`, and continue.
73
73
  `Save`, `Set`, `Change`, `Manage` + noun) means several decisions share a form: ask which
74
74
  separate reasons change these values, then split (`references/slicing.md` *Generic edits*).
75
75
  One input per thing the caller decides or supplies; `identifier` on the property naming the
76
- instance (omit only for allocation); `for <identifier>` on every `produces`. Trace each input
76
+ instance (omit only for allocation); inline `produces event <Name>` (no `for`) when the command owns the event; plain `produces <Name>` needs `for <identifier>`. Trace each input
77
77
  (`references/field-lineage.md`). A conditional input is a granularity question: two
78
78
  decisions are two commands; one decision with a dependent rule is an implication
79
79
  (`require a == false or b > c`). Never a boolean attestation input (`confirmsX == true`)
@@ -157,9 +157,12 @@ report and slice `documentation`, and continue.
157
157
  conventional `*Id` only with an admitted list query and no single-instance identifier).
158
158
  Queryless read models need explicit `key`.
159
159
  - At most one builder (projection or reducer) per read model (`PLAY0191`).
160
- - A query's `by` goes on its own body line. At 4.135.0, optional keyed and collection
161
- queries bind, including observable delivery; scalar `by` must be caller-supplied.
162
- Filtered, scoped, performer-backed and composite-block queries remain `PLAY0268`.
160
+ - A query's `by` goes on its own body line. Optional keyed and collection queries
161
+ bind, including observable delivery. Caller-supplied equality filters on collections
162
+ bind as ESM v14 since 4.143.0; `by` ANDs with supplied filters. `from`, single-result
163
+ filters, scope, performer and composite `by` remain PLAY0268 for their respective
164
+ context/cardinality/opaque/multipart gaps. Read read-surface
165
+ [equality filters](../cratis-screenplay-read-surface/references/equality-filters.md).
163
166
  - A `unique` constraint names a property the event declares directly; the constraint name is
164
167
  its identity (renaming starts an empty index).
165
168
  - Unauthorized is `then denied`; a broken rule is `then error`; authorization runs first.
@@ -21,7 +21,7 @@ event field goes nowhere, ask why it is recorded (audit and history are valid an
21
21
  | the user types or picks it | screen `action`, form or dialog input | default for business decisions |
22
22
  | shown before the user acts | form `populate via query` from a read model | the read model must exist and be traced |
23
23
  | the instance being acted on | the `identifier` property, carried from the screen row or route | |
24
- | allocated by the runtime | `Type generated` on a required `Uuid`-backed concept (ESM v7: binds and runs on standalone Screenplay 4.68.0 and later, including the 4.137.0 bundled in CLI 3.53.1 (`PLAY0268` on the 4.66.0 bundled in cratis 3.28.x); Stage 4.73.1 refuses it with STAGE-ESM-028; no concept rules) | never a request input or form field; no policy, rule or requirement may read it (`PLAY0273`); return it with `returns`; where a tool cannot bind it, executable scope needs explicit allocation |
24
+ | allocated by the runtime | `Type generated` on a required `Uuid`-backed concept (ESM v7: binds and runs on standalone Screenplay 4.68.0 and later, including the 4.145.1 bundled in CLI 3.56.0 (`PLAY0268` on the 4.66.0 bundled in cratis 3.28.x); Stage 4.83.0 renders it; unsupported types/combinations remain -028/-038; no concept rules) | never a request input or form field; no policy, rule or requirement may read it (`PLAY0273`); return it with `returns`; where a tool cannot bind it, executable scope needs explicit allocation |
25
25
  | an outside party | capture field `$.x` or a reaction trigger value | `cratis-screenplay-automations-and-translations` |
26
26
  | the caller | not an input: `$context.identity.*` in `produces`; who may act in `authorize`; "acting on own X" is a claim policy matched to the identifier or a command property | never trust a caller-supplied "who am I" |
27
27
 
@@ -37,11 +37,8 @@ module Billing
37
37
  ```
38
38
  recordId String identifier
39
39
  amount Int
40
- produces AmountRecorded
41
- for recordId
42
- amount = amount
43
- event AmountRecorded
44
- amount Int
40
+ produces event AmountRecorded
41
+ amount Int = amount
45
42
  specification RecordingAnAmount
46
43
  description "Witnesses that the agreed amount is retained"
47
44
  when RecordAmount amount = 10
@@ -136,8 +136,8 @@ it stays.
136
136
  | The person... | Design-mode query | Executable/renderable scope |
137
137
  |---|---|---|
138
138
  | opens one thing | `XById => RM optional` + `by xId XId` | binds at 4.135.0 with caller-supplied `by`; check target renderer |
139
- | scans a list | `ListX => RM[]` (optionally `observable`, `filter`) | collection and observable delivery bind at 4.135.0; filters remain PLAY0268; check target renderer |
140
- | sees their own rows | list with scope/`from` on the caller | scope and context-derived `by` remain PLAY0268; access rules are part of the view, enforced by the target |
139
+ | scans a list | `ListX => RM[]` (optionally `observable`, `filter`) | collection/observable delivery bind; caller-supplied equality filters bind since 4.143.0 as ESM v14; check target renderer |
140
+ | sees their own rows | list with scope/`from` on the caller | scope and context-derived `by`/`filter` remain PLAY0268 because portable scope/query context is unadmitted; caller-supplied filters are not access control |
141
141
  | sees a site-wide figure | singleton read model, `from <Event> key literal "global"` on every `from` (a projection-level `key` routes nothing, PLAY0381; example in Screenplay `projections/keys.md`, "Literal keys") | check the binding (V3, `cratis-screenplay-toolchain`) |
142
142
 
143
143
  - `observable` when people are expected to see others' or automation's changes while looking
@@ -231,11 +231,8 @@ module Berths
231
231
  command BookBerth
232
232
  bookingId BookingId identifier
233
233
  berth BerthName
234
- produces BerthBooked
235
- for bookingId
236
- berth = berth
237
- event BerthBooked
238
- berth BerthName
234
+ produces event BerthBooked
235
+ berth BerthName = berth
239
236
  specification BookingABerth
240
237
  given caller
241
238
  authenticated
@@ -250,9 +247,7 @@ module Berths
250
247
  description "A skipper cancels a booking they no longer need"
251
248
  command CancelBooking
252
249
  bookingId BookingId identifier
253
- produces BookingCancelled
254
- for bookingId
255
- event BookingCancelled
250
+ produces event BookingCancelled
256
251
 
257
252
  slice StateView OpenBookings
258
253
  description "The harbour office lists bookings that still hold a berth. BerthBooked sets berth: the booking enters the list. BookingCancelled removes it: a cancelled booking never shows."
@@ -62,13 +62,9 @@ module Lockers
62
62
  number LockerNumber
63
63
  volume Litres
64
64
  authorize IsAttendant
65
- produces LockerInstalled
66
- for lockerId
67
- number = number
68
- volume = volume
69
- event LockerInstalled
70
- number LockerNumber
71
- volume Litres
65
+ produces event LockerInstalled
66
+ number LockerNumber = number
67
+ volume Litres = volume
72
68
  constraint UniqueLockerNumber
73
69
  unique number on LockerInstalled
74
70
  message "That locker number is already installed"
@@ -141,13 +137,9 @@ module Lockers
141
137
  command RequestLocker
142
138
  requestId RequestId identifier
143
139
  preferredVolume Litres
144
- produces LockerRequested
145
- for requestId
146
- preferredVolume = preferredVolume
147
- requestedAt = $context.occurred
148
- event LockerRequested
149
- preferredVolume Litres
150
- requestedAt DateTime
140
+ produces event LockerRequested
141
+ preferredVolume Litres = preferredVolume
142
+ requestedAt DateTime = $context.occurred
151
143
  specification RequestingALocker
152
144
  given caller
153
145
  authenticated
@@ -180,11 +172,8 @@ module Lockers
180
172
  message "The locker is not free"
181
173
  require request.state == "waiting"
182
174
  message "The request is not waiting for a locker"
183
- produces LockerAssigned
184
- for lockerId
185
- requestId = requestId
186
- event LockerAssigned
187
- requestId RequestId
175
+ produces event LockerAssigned
176
+ requestId RequestId = requestId
188
177
  constraint OneRequestPerLocker
189
178
  unique event LockerAssigned
190
179
  message "The locker is already assigned"
@@ -6,23 +6,19 @@ license: MIT
6
6
 
7
7
  # Screenplay specifications
8
8
 
9
+ Read [preferred syntax](../cratis-screenplay-toolchain/references/preferred-syntax.md) when writing or reviewing `.play`.
10
+
9
11
  A `specification` is the acceptance criterion for a slice, written in the same
10
12
  document as the behavior it pins. Given/when/then, in business language, with
11
13
  concrete data.
12
14
 
13
15
  ## Locate the model
14
16
 
15
- Look first for the project's existing `.play` files: the folder holding them is the
16
- model. A new model goes under the repository's `Source/` or `src/` folder, else in a
17
- `Screenplay/` folder at the repository root; never under `.cratis/`, which holds
18
- configuration and the shared AI corpus only. This is the
19
- conventional home for consumer-owned `.play` source; do not invent another
20
- location or search the whole repository before checking it.
21
-
22
- `cratis ai install` manages `.cratis/ai/`, never model files. Never
23
- hand-copy Screenplay source between repositories. Keep Markdown that explains,
24
- questions or navigates the model in the repository's documentation; the `.play`
25
- source is the single flow model.
17
+ Look first for the project's existing `.play` files: their folder is the model.
18
+ For a new model, check `Source/` or `src/`, else use `Screenplay/` at the repository
19
+ root. Never put a model under `.cratis/` or hand-copy it between repositories.
20
+ `cratis ai install` manages `.cratis/ai/`, never model files. Keep explanatory
21
+ Markdown in project documentation; `.play` is the single flow model.
26
22
 
27
23
  ## Verified product sources
28
24
 
@@ -34,20 +30,15 @@ Specification syntax was checked against Screenplay v4.127.0 `specifications.md`
34
30
  older probes in the table remain historical. Pins: `cratis-screenplay-toolchain`
35
31
  `references/versions.md`. Compile commands check source, not reference execution.
36
32
  Use `screenplay test` or MCP `run-specifications` for V4; Stage/target tests are
37
- separate evidence. Unsupported/unbound is never a pass. Typed examples and
33
+ separate evidence. On Screenplay **4.145.0 and later**, propose → review →
34
+ `run-specifications` with `proposalId` → apply.
35
+ PLAY0285 (an impossible `then`) unbinds the whole model and blocks every spec.
36
+ Unsupported/unbound is never a pass. Typed examples and
38
37
  route assertions are in [examples and routes](references/examples-and-routes.md).
39
38
 
40
- Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
41
- `Documentation/screenplay/{specifications,policies,constraints,readmodels,diagnostics}.md`.
42
- The original worked example had reference-runner evidence at that tag. The
43
- example below now uses inline events and canonical optionality; keep its current
44
- compile check distinct from that historical execution evidence.
45
-
46
- The specification actions beyond commands (`given clock`, `when clock`,
47
- `when trigger`, `given capture`, `when capture`, `when query`, `then result`,
48
- `then no result`) were checked against tag `v4.48.0` (commit `3baf4a4`):
49
- `Documentation/screenplay/{specifications,diagnostics}.md` and the proposed
50
- decision 0022. They do not exist before v4.48.0.
39
+ Read [source notes](references/source-notes.md) for the original v4.31.0
40
+ reference-runner evidence and v4.48.0 action syntax. Historical evidence is not
41
+ current execution evidence; run the changed examples at the standalone pin.
51
42
 
52
43
  ## Reference execution — what actually runs
53
44
 
@@ -171,8 +162,9 @@ the one-rejection rule (`PLAY0273`) are reported only when the model binds, so
171
162
  `when append`, a model before ESM v6 expects the appended fact itself; from
172
163
  ESM v6 the appended event is the action and `then` lists only what followed it.
173
164
  - **Read models and query rows:** only the asserted properties must match
174
- (subset); add `exactly` to require every property. Row count and order are
175
- always exact. A missing property does not match an asserted `null`.
165
+ (subset); add `exactly` to require every property. Query row count is exact;
166
+ collection rows match by read model/key regardless of order. Ordering within a
167
+ collection-valued property is unchanged. A missing property does not match an asserted `null`.
176
168
  - **Rejections:** `then error "<message>"` matches the message whatever the rule's
177
169
  validation severity; no form asserts severity. Bare `then error` never matches
178
170
  a denial. Quote a localized key: `then error "$strings.invoices.reasonRequired"`.
@@ -21,7 +21,8 @@ report the complete example in [reactions-and-cascades.md](reactions-and-cascade
21
21
 
22
22
  - **Screenplay 4.66.0 (ESM v6, from 4.61.0), standalone and `cratis` 3.28.2:** the clock, trigger
23
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
24
+ captures they drive, bind. The reference runner executes them through `screenplay test` or MCP
25
+ `run-specifications`, with
25
26
  the semantics in [Reactions and cascades](reactions-and-cascades.md).
26
27
  - **`cratis` before 3.28.2 (Screenplay 4.60.1, ESM v1-v5):**
27
28
  **`when query` executed. The clock, trigger and capture actions did not.** They parsed, printed and were
@@ -1,9 +1,9 @@
1
1
  ## Generated fixtures and return expectations (ESM v7)
2
2
 
3
3
  Standalone `screenplay` 4.68.0 or later binds and runs these, and so does the current cratis bundle (the
4
- cratis 3.28.3 bundle, 4.66.0, did not); Stage 4.73.1 admits ESM v7 but refuses generated values
5
- (`STAGE-ESM-028`) and responses (`STAGE-ESM-029`; Stage#175), so they pin the
6
- contract of a hand-written command. The model and rules are in `cratis-screenplay-command-surface`; the
4
+ cratis 3.28.3 bundle, 4.66.0, did not); CLI 3.56.0 / Stage 4.83.0 render UUID-concept generated values,
5
+ scalar/named responses, fixtures and `then returns`. Unsupported types/result combinations
6
+ remain `STAGE-ESM-028`/`-038`; preserve refused specifications as gap-fill contracts. The model and rules are in `cratis-screenplay-command-surface`; the
7
7
  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.
8
8
 
9
9
  ```screenplay excerpt
@@ -63,11 +63,8 @@ module Billing
63
63
  validate
64
64
  require amount > 0
65
65
  message "The amount must be positive"
66
- produces AmountRecorded
67
- for recordId
68
- amount = amount
69
- event AmountRecorded
70
- amount Int
66
+ produces event AmountRecorded
67
+ amount Int = amount
71
68
  specification RecordingAmounts
72
69
  description "An accountant can record a positive amount"
73
70
  parameter amount Int
@@ -53,10 +53,11 @@ module Collections
53
53
  - A reached reaction with a code body (`file` or inline) returns unsupported, as
54
54
  does a reaction that never settles. The reference stops at 1,000 new facts per
55
55
  scenario and 10,000 due occurrences per clock advance.
56
- - A model that uses these forms selects ESM v6 (`schemaVersion: 6`). Stage 4.73.1
57
- admits ESM v1-v10 by version but renders no `Automation` or `Translate` slice and no reaction
58
- (`STAGE-ESM-024`; `-034` runsAs, `-035` filters, `-037` mixed effects), so the whole
59
- automation is gap-fill against this contract: `cratis-screenplay-render-and-gap-fill`.
56
+ - A model that uses these forms selects ESM v6 (`schemaVersion: 6`). Stage 4.83.0
57
+ admits ESM v1-v13 and renders supported event-triggered Automation, but not Translate,
58
+ captures, non-event triggers or opaque bodies (`-024`), `runsAs` (`-034`), `from` (`-035`)
59
+ or mixed effects (`-037`). Direct-append specs and command specs cascading into reactions
60
+ remain `-011`. Keep refused scope as gap-fill against this contract: `cratis-screenplay-render-and-gap-fill`.
60
61
 
61
62
  ### Version skew: cascades and the false `PLAY0285` (cratis before 3.28.2)
62
63
 
@@ -3,6 +3,16 @@
3
3
 
4
4
  # Retained source notes
5
5
 
6
+ Original evidence: Screenplay v4.31.0 (`355dffb`),
7
+ `Documentation/screenplay/{specifications,policies,constraints,readmodels,diagnostics}.md`.
8
+ The original worked example had reference-runner evidence at that tag; inline
9
+ events and canonical optionality added later need their own current check.
10
+
11
+ Actions beyond commands (`given clock`, `when clock`, `when trigger`, `given capture`,
12
+ `when capture`, `when query`, `then result`, `then no result`) were checked at
13
+ v4.48.0 (`3baf4a4`), `Documentation/screenplay/{specifications,diagnostics}.md`
14
+ and proposed decision 0022. These actions do not exist before v4.48.0.
15
+
6
16
  | Package | Version | Purpose |
7
17
  | --- | --- | --- |
8
18
  | `Cratis.Screenplay` | `4.31.0` | Original parser, binder and reference execution evidence |
@@ -38,7 +38,7 @@ the CLI bundle's Chronicle is in `cratis-screenplay-toolchain` `references/versi
38
38
  | Screenplay | v4.68.0 (`79801bf`) | ESM v7 generated values (`generated identifier`, decision 0026) and decision 0025's numbering; the diagnostics below were read at v4.66.0 (`c89198b`): `identifier`, `for`, constraints, generations, `id` pins, diagnostics PLAY0019/0135/0268/0271/0273/0391-0393/0446-0449/0469/0471 |
39
39
  | Chronicle | v19.50.0 (read; first read at v19.32.0 `f17a2ff`) | CHR0012, CHR0034; open defects #3744, #4123, #4131 (still open) |
40
40
  | Arc | v22.72.0 | `[ProtectedDecision]` and `DecisionRead<T>` (since v22.39.0) |
41
- | Stage | v4.73.1 | rendered apps pin the Arc and Chronicle client/kernel listed in the Stage skill's `references/rendered-application.md`; protected-read APIs available to gap-fill. Historical 4.24.2 admission probe: ESM v4, evolved events refused with `STAGE-ESM-026` |
41
+ | Stage | v4.83.0 | rendered apps pin the Arc and Chronicle client/kernel listed in the Stage skill's `references/rendered-application.md`; protected-read APIs available to gap-fill. Historical 4.24.2 admission probe: ESM v4, evolved events refused with `STAGE-ESM-026` |
42
42
 
43
43
  Full pin table: `references/versions.md` in `cratis-screenplay-toolchain`. Re-check the three
44
44
  Chronicle issues before relying on a constraint in a later release.
@@ -88,9 +88,9 @@ option, mark it `ASSUMED` in the slice or module `documentation` and in the sess
88
88
  namespace, process-stream routing and concurrency scope apart
89
89
  (`references/chronicle-boundaries.md`). Declared `eventsource`/`stream`/`streamId` and
90
90
  command/specification routes bind and reference-execute as ESM v8 on 4.125.0.
91
- The pinned CLI (toolchain `references/versions.md`) reaches Stage construct checks through v10; keep the routing
91
+ The pinned CLI (toolchain `references/versions.md`) reaches Stage construct checks through v13; keep the routing
92
92
  contract when target admission requires gap-fill. Forms/boundaries:
93
- toolchain `references/sources-and-streams.md`. A `generated identifier` (ESM v7, standalone 4.68.0 and later; Stage 4.73.1 refuses it, STAGE-ESM-028) is
93
+ toolchain `references/sources-and-streams.md`. A `generated identifier` (ESM v7, standalone 4.68.0 and later; Stage 4.83.0 renders required scalar UUID concepts; unsupported types/results still refuse -028/-038) is
94
94
  generated fresh on every acceptance: it is not a retry identity, and generated values give no
95
95
  idempotency, retry or deduplication guarantee. When a retry must find the same stream, the caller
96
96
  supplies the identifier before the first attempt.
@@ -178,7 +178,8 @@ integration support.
178
178
 
179
179
  Never let an external system's ids, codes or shapes become our domain vocabulary: translate at
180
180
  the edge, keep the external reference as a property when it is needed for correlation or dedup.
181
- Stage renders no Automation or Translate slice today, so the whole translation is gap-fill code
181
+ Stage 4.83.0 renders supported internal event-triggered Automation, but Translate,
182
+ captures and foreign/public event boundaries remain refused. The translation is gap-fill
182
183
  with the model as its contract (`cratis-screenplay-render-and-gap-fill`).
183
184
 
184
185
  ## Change data capture is not a domain event
@@ -38,8 +38,8 @@ number. Removing a member still needs replay and mixed-reader compatibility deci
38
38
 
39
39
  Numbered members may have sparse or negative unique int32 values, all or none per
40
40
  enum. Source authoring shipped in 4.137.0; non-positional numbers bind as ESM v12
41
- in 4.139.0. Positional pins retain older executable bytes/version. CLI 3.53.1 and
42
- Stage 4.73.1 bundle 4.137.0 and do not admit v12; keep the pins and report the gap.
41
+ in 4.139.0. Positional pins retain older executable bytes/version. CLI 3.56.0 bundles Screenplay 4.145.1 /
42
+ Stage 4.83.0, admitting v12 and rendering explicit member numbers; keep the pins.
43
43
  Short-lived input/view-only enums may remain positional. Use opt-in
44
44
  `--check enum-pinning` (PLAY0671) to find unnumbered enums used by event properties.
45
45
  Syntax/example and source evidence: command-surface [enum numbers](../../cratis-screenplay-command-surface/references/enum-numbers.md).
@@ -49,13 +49,9 @@ module Membership
49
49
  email Email
50
50
  name String
51
51
  authorize IsCoordinator
52
- produces MemberRegistered
53
- for memberId
54
- email = email
55
- name = name
56
- event MemberRegistered
57
- email Email
58
- name String
52
+ produces event MemberRegistered
53
+ email Email = email
54
+ name String = name
59
55
  constraint UniqueMemberEmail
60
56
  unique email on MemberRegistered
61
57
  ignore casing
@@ -102,11 +98,8 @@ module Courses
102
98
  command OpenCourse
103
99
  courseId CourseId identifier
104
100
  seats Int
105
- produces CourseOpened
106
- for courseId
107
- seats = seats
108
- event CourseOpened
109
- seats Int
101
+ produces event CourseOpened
102
+ seats Int = seats
110
103
  specification OpeningACourse
111
104
  given caller
112
105
  authenticated
@@ -176,13 +169,9 @@ module Courses
176
169
  validate
177
170
  require course.openSeats > 0
178
171
  message "The course is full" // NOT enforced: the view lags (PLAY0268 at binding)
179
- produces MemberEnrolled
180
- for enrolmentId
181
- courseId = courseId // cross-stream references are payload
182
- memberId = memberId
183
- event MemberEnrolled
184
- courseId CourseId
185
- memberId MemberId
172
+ produces event MemberEnrolled
173
+ courseId CourseId = courseId // cross-stream references are payload
174
+ memberId MemberId = memberId
186
175
  constraint OneActiveEnrolmentPerMemberAndCourse
187
176
  unique courseId, memberId on MemberEnrolled
188
177
  released by EnrolmentWithdrawn
@@ -276,11 +265,8 @@ module Courses
276
265
  validate
277
266
  require enrolment.courseId == courseId
278
267
  message "The enrolment does not belong to that course" // NOT enforced today
279
- produces EnrolmentWithdrawn
280
- for enrolmentId
281
- courseId = courseId
282
- event EnrolmentWithdrawn
283
- courseId CourseId
268
+ produces event EnrolmentWithdrawn
269
+ courseId CourseId = courseId
284
270
  constraint WithdrawOnce
285
271
  unique event EnrolmentWithdrawn
286
272
  specification WithdrawingAnEnrolment
@@ -16,6 +16,6 @@
16
16
  { "kind": "skill-contains", "value": "bind and reference-execute as ESM v8" },
17
17
  { "kind": "skill-contains", "value": "STAGE-ESM-026" },
18
18
  { "kind": "skill-contains", "value": "generated values give no\n idempotency, retry or deduplication guarantee" },
19
- { "kind": "skill-contains", "value": "Stage construct checks through v10" }
19
+ { "kind": "skill-contains", "value": "Stage construct checks through v13" }
20
20
  ]
21
21
  }