@cratis/pi 7.6.1 → 7.6.2
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-screenplay-captures-and-reactions/SKILL.md +8 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +3 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +85 -8
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +20 -7
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +25 -15
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +44 -8
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +40 -21
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +53 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +7 -0
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +11 -0
- package/package/corpus/skills/cratis-screenplay-projections/verification.json +3 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +26 -14
- package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +4 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +18 -12
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +4 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +16 -9
- package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +5 -0
- package/package.json +1 -1
|
@@ -26,6 +26,10 @@ source is the single flow model.
|
|
|
26
26
|
| Package | Version | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| `Cratis.Screenplay` | `4.31.0` | CDL parser, reaction and trigger parsers, diagnostics, semantic binder |
|
|
29
|
+
| `Cratis.Screenplay` | main `fd18129` | Command-only inline event boundary |
|
|
30
|
+
|
|
31
|
+
The update follows `commands.md`, `events.md` and `diagnostics.md` at that main
|
|
32
|
+
commit (after v4.52.0); no reaction or capture example changes in this update.
|
|
29
33
|
|
|
30
34
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
31
35
|
`Documentation/screenplay/{captures,captures/grammar,reactions,triggers,interactions,file-references,grammar,diagnostics}.md`
|
|
@@ -188,6 +192,10 @@ reaction is an error; combine with `and`/`or` instead.
|
|
|
188
192
|
|
|
189
193
|
### Effects — `produces` vs `invokes`
|
|
190
194
|
|
|
195
|
+
Inline `produces event <Name>` is command-only (`PLAY0474` in a reaction).
|
|
196
|
+
Declare reaction-produced events separately and use plain `produces <Name>`.
|
|
197
|
+
Do not extend the inline command destination default or its repairs to reactions.
|
|
198
|
+
|
|
191
199
|
Excerpt, inside an `Automation` slice:
|
|
192
200
|
|
|
193
201
|
```screenplay
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"input": "Translate external data into events and declare a reaction.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "command-only (`PLAY0474` in a reaction)" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "Do not extend the inline command destination default" },
|
|
6
9
|
{ "kind": "skill-contains", "value": ".cratis/screenplay/" },
|
|
7
10
|
{ "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, not `.cratis/screenplay/`" },
|
|
8
11
|
{ "kind": "skill-contains", "value": "cannot be mixed in one clause" },
|
|
@@ -25,12 +25,17 @@ source is the single flow model.
|
|
|
25
25
|
|
|
26
26
|
| Package | Version | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
|
-
| `Cratis.Screenplay` | `4.31.0` |
|
|
28
|
+
| `Cratis.Screenplay` | `4.31.0` | Original examples and executable boundaries |
|
|
29
|
+
| `Cratis.Screenplay` | main `fd18129` | Inline events, repairs and canonical `optional`; changed examples compiled |
|
|
30
|
+
|
|
31
|
+
The update follows `commands.md`, `events.md`, `types.md`, `diagnostics.md`,
|
|
32
|
+
`mcp/authoring-tools.md` and decision 0023 at that main commit (after v4.52.0).
|
|
33
|
+
Compilation checks syntax and model consistency, not reference execution.
|
|
29
34
|
|
|
30
35
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
31
36
|
`Documentation/screenplay/{commands,constraints,policies,context,concepts,diagnostics}.md`
|
|
32
|
-
and decisions 0001 and 0003
|
|
33
|
-
|
|
37
|
+
and decisions 0001 and 0003 established the original baseline. Changed examples
|
|
38
|
+
use the newer main commit above; do not attribute their verification to the old tag.
|
|
34
39
|
|
|
35
40
|
"Parses" and "runs" are different claims. The executable profile, and what
|
|
36
41
|
each construct binds to, is in the `cratis-screenplay-model-authoring` language
|
|
@@ -47,17 +52,21 @@ command RegisterInvoice
|
|
|
47
52
|
invoiceId InvoiceId identifier
|
|
48
53
|
invoiceNumber InvoiceNumber
|
|
49
54
|
lines InvoiceLine[]
|
|
50
|
-
note String
|
|
55
|
+
note String optional
|
|
51
56
|
authorize CanManageInvoice
|
|
52
57
|
validate
|
|
53
58
|
invoiceNumber not empty message "Invoice number is required"
|
|
54
59
|
invoiceNumber matches "^INV-[0-9]{6}$" severity warning message "Must look like INV-000000"
|
|
55
60
|
produces InvoiceRegistered
|
|
56
|
-
|
|
61
|
+
for invoiceId
|
|
57
62
|
registeredAt = $context.occurred
|
|
58
63
|
```
|
|
59
64
|
|
|
60
|
-
Type modifiers: `<Type>[]` for a collection, `<Type
|
|
65
|
+
Type modifiers: `<Type>[]` for a collection, `<Type> optional` for absence.
|
|
66
|
+
`Type[] optional` makes the whole collection optional, not its items. Legacy
|
|
67
|
+
`Type?` still parses with information `PLAY0479`; use its repair or editor quick
|
|
68
|
+
fix to migrate. `--warnaserror` does not reject information diagnostics.
|
|
69
|
+
`reads X optional` is not supported yet.
|
|
61
70
|
|
|
62
71
|
⚠️ **The parser enforces no clause order.** The house order is description,
|
|
63
72
|
properties, `reads`, `authorize`, `validate`, `produces`/`handler`, `concurrency`.
|
|
@@ -189,6 +198,68 @@ A continuation line extends the clause.
|
|
|
189
198
|
reaches a policy implemented in code, the reference runner reports the outcome
|
|
190
199
|
unsupported; it never guesses allow or deny.
|
|
191
200
|
|
|
201
|
+
## Inline events and destinations
|
|
202
|
+
|
|
203
|
+
Use `produces event` when the command introduces a new, generation-1 event.
|
|
204
|
+
This complete example declares its payload and mappings together:
|
|
205
|
+
|
|
206
|
+
````screenplay
|
|
207
|
+
concept ProjectId : Uuid
|
|
208
|
+
concept ProjectName : String
|
|
209
|
+
module Projects
|
|
210
|
+
feature Naming
|
|
211
|
+
slice StateChange RenameProject
|
|
212
|
+
command RenameProject
|
|
213
|
+
projectId ProjectId identifier
|
|
214
|
+
name ProjectName
|
|
215
|
+
produces event ProjectRenamed
|
|
216
|
+
description "A project received a new name"
|
|
217
|
+
documentation
|
|
218
|
+
```markdown
|
|
219
|
+
Existing links retain the project's identity.
|
|
220
|
+
```
|
|
221
|
+
tag audit
|
|
222
|
+
name ProjectName = name
|
|
223
|
+
````
|
|
224
|
+
|
|
225
|
+
The omitted `for` means the command's required scalar identifier **only for
|
|
226
|
+
inline productions**, when every production targets that same source. Once a
|
|
227
|
+
production targets another source, every production must state `for`. Mixing
|
|
228
|
+
omitted inline and plain destinations also fails (`PLAY0470`); there is no
|
|
229
|
+
verified MCP repair for that diagnostic. Explicit syntax does not make cross-source
|
|
230
|
+
execution supported.
|
|
231
|
+
|
|
232
|
+
Plain `produces X` references a declared event; omitting `for` does not infer
|
|
233
|
+
the command's identifier. In ESM v2+, it inherits a sibling production's resolved
|
|
234
|
+
destination through the command destination default. An allocated identity is
|
|
235
|
+
used only when no production resolves a destination. State `for` explicitly on
|
|
236
|
+
every production targeting the identifier. `PLAY0478` offers advice and a
|
|
237
|
+
reviewed repair, not permission to silently retarget an append. Supply an
|
|
238
|
+
allocated identity to the executable model when allocation is intentional.
|
|
239
|
+
|
|
240
|
+
Inline declarations are slice-owned contracts, usable by other consumers.
|
|
241
|
+
Their `tag` lines are event-type tags; plain production tags apply at that one
|
|
242
|
+
append site. Both inline and standalone events accept a quoted description or
|
|
243
|
+
text/Markdown description fence, and one nonempty fenced Markdown `documentation`.
|
|
244
|
+
New events omit `id`. Only a rename preserving an old stored name needs
|
|
245
|
+
`id "<old name>"`; it does not replace the catalog's `EventContractId`.
|
|
246
|
+
|
|
247
|
+
| Diagnostic | What to change |
|
|
248
|
+
| --- | --- |
|
|
249
|
+
| `PLAY0469` | Do not copy the same-source command identifier into payload. Inline copies warn; plain copies with explicit `for` are information. Review persistence before changing a contract. |
|
|
250
|
+
| `PLAY0471` / `PLAY0472` | Remove a redundant name-equal `id`; an id must be one nonempty quoted value. |
|
|
251
|
+
| `PLAY0473` / `PLAY0474` | Avoid declaration/import collisions; inline events belong only in commands, never reactions. |
|
|
252
|
+
| `PLAY0475` | Extract the inline event before adding generations. |
|
|
253
|
+
| `PLAY0476` | Inline `origin` and unescaped system-assigned production metadata are forbidden. |
|
|
254
|
+
| `PLAY0477` | Use one nonempty Markdown documentation fence. |
|
|
255
|
+
|
|
256
|
+
MCP can declare a missing produced event (`PLAY0166`), add explicit routing
|
|
257
|
+
(`PLAY0478`), remove a redundant pin (`PLAY0471`), or remove an inline identifier
|
|
258
|
+
copy (`PLAY0469`). The last **changes the event contract**, retires a property,
|
|
259
|
+
refuses affected consumers/opaque implementations and is not fix-all. It does
|
|
260
|
+
not establish that stored data is safe to migrate. Use
|
|
261
|
+
`cratis-screenplay-model-authoring` for discovery, preview, extraction and rename.
|
|
262
|
+
|
|
192
263
|
## `produces`
|
|
193
264
|
|
|
194
265
|
- **Mapping sources** that bind to the executable model: a command property
|
|
@@ -216,7 +287,7 @@ A continuation line extends the clause.
|
|
|
216
287
|
```screenplay
|
|
217
288
|
produces when isProForma == true
|
|
218
289
|
ProFormaInvoiceIssued
|
|
219
|
-
|
|
290
|
+
for invoiceId
|
|
220
291
|
```
|
|
221
292
|
|
|
222
293
|
## `concurrency`
|
|
@@ -234,7 +305,12 @@ the executable model does not bind it (`PLAY0271`), and it does not protect a
|
|
|
234
305
|
| `streamId <Name>` | an event stream id |
|
|
235
306
|
| `events <A>, <B>` | the listed event types |
|
|
236
307
|
|
|
237
|
-
An empty block or an unknown dimension is an error.
|
|
308
|
+
An empty block or an unknown dimension is an error. Omitting `concurrency` does
|
|
309
|
+
not mean unchecked appends: Chronicle's default optimistic concurrency applies
|
|
310
|
+
to the routed scope. This does not make command `reads` protected.
|
|
311
|
+
|
|
312
|
+
Decision 0023's generated values, `returns`, operations, named event sources and
|
|
313
|
+
streams, `derive` and `provide` are planned, not available yet.
|
|
238
314
|
|
|
239
315
|
## `constraint` — uniqueness at append time
|
|
240
316
|
|
|
@@ -364,6 +440,7 @@ Four contexts, and **what each omits is load-bearing** — read
|
|
|
364
440
|
## Verify
|
|
365
441
|
|
|
366
442
|
- [ ] `screenplay <model> --warnaserror` reports zero errors and zero warnings.
|
|
443
|
+
- [ ] No unintended `PLAY0478` or `PLAY0479` information remains.
|
|
367
444
|
- [ ] At most one command property carries `identifier`, and no event property does.
|
|
368
445
|
- [ ] Format rules live on the `concept`; state-dependent rules are specifications.
|
|
369
446
|
- [ ] Every `authorize` combining policies writes `and`/`or` explicitly.
|
|
@@ -78,6 +78,16 @@ roles, claims and causation report `PLAY0268`.
|
|
|
78
78
|
|
|
79
79
|
An unknown `$context.` path is reported, so a typo does not silently become null.
|
|
80
80
|
|
|
81
|
+
## Production metadata is not a context expression
|
|
82
|
+
|
|
83
|
+
`namespace`, `sequence`, `correlation`, `causation`, `causedBy` and `occurred`
|
|
84
|
+
are reserved, system-assigned directives in production bodies (`PLAY0476`).
|
|
85
|
+
They are not routing knobs. Escape a genuine payload property with `@`, as in
|
|
86
|
+
`@sequence String = name` in an inline event. `occurred at` is not available yet.
|
|
87
|
+
Reading `$context.occurred` into a payload mapping does not assign the event's
|
|
88
|
+
occurrence metadata; use `given clock`, never `given time`, to state scenario time
|
|
89
|
+
(the specification skill distinguishes parsing from execution).
|
|
90
|
+
|
|
81
91
|
## The other expression roots
|
|
82
92
|
|
|
83
93
|
| Root | Where | Yields |
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
"input": "Declare a Screenplay command with validation, authorization, a uniqueness constraint and a state-dependent rule.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "produces event ProjectRenamed" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "name ProjectName = name" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "In ESM v2+, it inherits a sibling production's resolved\ndestination through the command destination default" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "An allocated identity is\nused only when no production resolves a destination" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "State `for` explicitly on\nevery production targeting the identifier" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "PLAY0478" },
|
|
13
|
+
{ "kind": "skill-contains", "value": "PLAY0479" },
|
|
14
|
+
{ "kind": "skill-contains", "value": "changes the event contract" },
|
|
15
|
+
{ "kind": "skill-contains", "value": "`reads X optional` is not supported yet" },
|
|
6
16
|
{
|
|
7
17
|
"kind": "skill-contains",
|
|
8
18
|
"value": ".cratis/screenplay/"
|
|
@@ -34,12 +34,16 @@ source is the single flow model.
|
|
|
34
34
|
| --- | --- | --- |
|
|
35
35
|
| `Cratis.Screenplay` | `4.31.0` | Compiler: parser, validator, diagnostics, folder merge, semantic binder |
|
|
36
36
|
| `Cratis.Screenplay.Tool` | `4.31.0` | The `screenplay` dotnet tool |
|
|
37
|
+
| `Cratis.Screenplay` | main `fd18129` | Inline contracts and event context; changed nine-step examples compiled |
|
|
38
|
+
|
|
39
|
+
The update follows `commands.md`, `events.md` and decision 0023 at that main
|
|
40
|
+
commit (after v4.52.0); compilation does not establish reference execution.
|
|
37
41
|
|
|
38
42
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
39
43
|
`Documentation/screenplay/{slices,commands,folders,printing,interactions,specifications}.md`,
|
|
40
|
-
`projections/keys.md`, and decisions 0001 to 0014
|
|
41
|
-
[nine-
|
|
42
|
-
|
|
44
|
+
`projections/keys.md`, and decisions 0001 to 0014 established the original
|
|
45
|
+
baseline. Changed [nine-step examples](references/nine-steps.md) use the newer
|
|
46
|
+
main commit above; do not attribute their verification to the old tag.
|
|
43
47
|
|
|
44
48
|
> **Method lineage.** The two-phase process, the nine steps, the four patterns and
|
|
45
49
|
> the GWT discipline follow **Event Modeling** (Adam Dymitruk; Martin Dilger,
|
|
@@ -132,6 +136,13 @@ compile or will not be safe. Both are deliberate.
|
|
|
132
136
|
- **The event-source identity is never an event property.** The command binds it
|
|
133
137
|
with `identifier` on at most one property; marking an *event* property
|
|
134
138
|
`identifier` is an error: *an event never carries its event source id*.
|
|
139
|
+
- **Inline events remain slice-owned contracts.** A command may introduce one
|
|
140
|
+
with `produces event <Name>` and typed mappings; other slices still consume it
|
|
141
|
+
by name. Extracting it changes placement, not its contract or projection meaning.
|
|
142
|
+
- **Storage identity is not payload identity.** `for` selects the event source;
|
|
143
|
+
`id "<old name>"` preserves an event type's old persisted name on rename. New
|
|
144
|
+
events omit the pin, and the pin does not replace catalog identity. Do not copy
|
|
145
|
+
the same-source identifier into payload merely to project it; use `$eventSourceId`.
|
|
135
146
|
- **Domain facts, not runtime context.** Test: would this field have the same value
|
|
136
147
|
if the event were replayed on a different machine? If not, it does not belong.
|
|
137
148
|
|
|
@@ -288,10 +299,12 @@ read a clean `screenplay` run as evidence a construct works downstream.
|
|
|
288
299
|
|
|
289
300
|
Decision 0006 shipped in Screenplay 4.31.0: a reaction trigger can declare the
|
|
290
301
|
views it decides from with `reads` (see `cratis-screenplay-captures-and-reactions`),
|
|
291
|
-
but nothing enforces them yet.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
302
|
+
but nothing enforces them yet. Event generations and typed repairs now ship;
|
|
303
|
+
generations do not supply deployed migrations. Do not treat every accepted
|
|
304
|
+
decision as implemented: affected-instance declarations, per-event subjects,
|
|
305
|
+
external origin and richer query delivery remain unavailable. Decision 0023's
|
|
306
|
+
responses, operations, streams and derived/provided values are planned, not
|
|
307
|
+
available yet; do not turn their examples into usable syntax.
|
|
295
308
|
|
|
296
309
|
## Route near misses
|
|
297
310
|
|
|
@@ -85,7 +85,9 @@ Commands are imperative and present tense: `RegisterInvoice`, `ProcessPayment`.
|
|
|
85
85
|
**Output:** the `command` declaration with its properties, its `identifier`
|
|
86
86
|
property (at most one; leave it out only when the runtime should allocate a new
|
|
87
87
|
identity), `authorize`, and `produces`. Excerpt: the concepts, the policy and the
|
|
88
|
-
event are declared elsewhere in the model.
|
|
88
|
+
event are declared elsewhere in the model. Give the event a description of the
|
|
89
|
+
fact, and fenced Markdown `documentation` when its meaning needs elaboration.
|
|
90
|
+
Alternatively, declare it in the command with `produces event` and typed mappings.
|
|
89
91
|
|
|
90
92
|
```screenplay
|
|
91
93
|
slice StateChange RegisterInvoice
|
|
@@ -96,7 +98,7 @@ slice StateChange RegisterInvoice
|
|
|
96
98
|
validate
|
|
97
99
|
invoiceNumber not empty message "Invoice number is required"
|
|
98
100
|
produces InvoiceRegistered
|
|
99
|
-
|
|
101
|
+
for invoiceId
|
|
100
102
|
invoiceNumber = invoiceNumber
|
|
101
103
|
registeredAt = $context.occurred
|
|
102
104
|
```
|
|
@@ -116,7 +118,7 @@ Verify **every** field traces back to an event:
|
|
|
116
118
|
|
|
117
119
|
```text
|
|
118
120
|
InvoiceListReadModel:
|
|
119
|
-
invoiceId <- InvoiceRegistered
|
|
121
|
+
invoiceId <- InvoiceRegistered event context ($eventSourceId)
|
|
120
122
|
invoiceNumber <- InvoiceRegistered.invoiceNumber
|
|
121
123
|
status <- InvoiceRegistered, InvoiceSent, InvoicePaid
|
|
122
124
|
```
|
|
@@ -128,10 +130,11 @@ a collection type, not a singular value.
|
|
|
128
130
|
builds it. **Exactly one thing may build a read model** — two builders is a
|
|
129
131
|
compile error (`PLAY0191`).
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
key
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
Route each `from` deliberately. When the instance is the event source, omit the
|
|
134
|
+
key and map its identity from `$eventSourceId`; do not duplicate it in payload.
|
|
135
|
+
A `from` without a key never inherits another `from`'s key, and a projection-level
|
|
136
|
+
`key` routes nothing (`PLAY0381`). Excerpt: the concepts and events are declared
|
|
137
|
+
elsewhere, and both events target the invoice's event source.
|
|
135
138
|
|
|
136
139
|
```screenplay
|
|
137
140
|
slice StateView InvoiceList
|
|
@@ -140,9 +143,11 @@ slice StateView InvoiceList
|
|
|
140
143
|
invoiceNumber InvoiceNumber
|
|
141
144
|
status InvoiceStatus
|
|
142
145
|
projection InvoiceList => InvoiceListReadModel
|
|
143
|
-
from InvoiceRegistered
|
|
146
|
+
from InvoiceRegistered
|
|
147
|
+
invoiceId = $eventSourceId
|
|
144
148
|
status = "draft"
|
|
145
|
-
from InvoiceSent
|
|
149
|
+
from InvoiceSent
|
|
150
|
+
invoiceId = $eventSourceId
|
|
146
151
|
status = "sent"
|
|
147
152
|
query ListInvoices => InvoiceListReadModel[]
|
|
148
153
|
```
|
|
@@ -164,20 +169,25 @@ system state?"* If no, it is co-production — one `StateChange` slice with seve
|
|
|
164
169
|
**Output:** the `reaction`, in an `Automation` slice. It documents the automation;
|
|
165
170
|
it does not bind to the executable model today. When the automation decides from
|
|
166
171
|
a view, declare it under the trigger with `reads` (see
|
|
167
|
-
`cratis-screenplay-captures-and-reactions`).
|
|
168
|
-
command are declared in their own slices.
|
|
172
|
+
`cratis-screenplay-captures-and-reactions`). Intent-only excerpt: the event and
|
|
173
|
+
command are declared in their own slices; the view comes from Step 6.
|
|
169
174
|
|
|
170
175
|
```screenplay
|
|
171
176
|
slice Automation ChaseOverdueInvoices
|
|
172
177
|
reaction OverdueChaser
|
|
173
178
|
when InvoiceRegistered
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
description "Check the invoice's due date and unpaid state before requesting MarkInvoiceOverdue for the triggering event's source"
|
|
180
|
+
reads InvoiceListReadModel
|
|
176
181
|
invokes MarkInvoiceOverdue
|
|
177
|
-
invoiceId = invoiceId
|
|
178
|
-
where dueDate < today
|
|
179
182
|
```
|
|
180
183
|
|
|
184
|
+
The realization must obtain `invoiceId` from the triggering event's source
|
|
185
|
+
identity, not its payload. Screenplay does not yet document a reaction-context
|
|
186
|
+
binding for invocation arguments; `$eventSourceId` is documented for projections,
|
|
187
|
+
not reaction mappings. Leave the argument mapping and overdue decision as intent
|
|
188
|
+
until realization supplies them. Do not select missing `invoiceId` or `dueDate`
|
|
189
|
+
payload fields from Step 5's event, or add them merely to make this reaction parse.
|
|
190
|
+
|
|
181
191
|
`produces` and `invokes` are indented **inside** the trigger; only `description`
|
|
182
192
|
and `where` sit at reaction level. Outdenting an effect gives `PLAY0137`.
|
|
183
193
|
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"input": "Facilitate an event modeling session and land the model as .play source.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "Inline events remain slice-owned contracts" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "Storage identity is not payload identity" },
|
|
6
9
|
{
|
|
7
10
|
"kind": "skill-contains",
|
|
8
11
|
"value": ".cratis/screenplay/"
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
46
|
"kind": "skill-contains",
|
|
44
|
-
"value": "
|
|
47
|
+
"value": "Event generations and typed repairs now ship"
|
|
45
48
|
},
|
|
46
49
|
{
|
|
47
50
|
"kind": "skill-contains",
|
|
@@ -13,20 +13,25 @@ the compiler already knows declarations, references, hierarchy and source owners
|
|
|
13
13
|
Screenplay remains experimental. **Valid source is not necessarily executable.**
|
|
14
14
|
It does not generate or run an application; Stage owns rendering/runtime admission.
|
|
15
15
|
See the [language reference](references/language-reference.md) for constructs,
|
|
16
|
-
the executable profile and
|
|
16
|
+
the executable profile and a complete compiled model.
|
|
17
17
|
|
|
18
18
|
## Verified product sources
|
|
19
19
|
|
|
20
20
|
| Package | Version | Purpose |
|
|
21
21
|
| --- | --- | --- |
|
|
22
|
-
| `Cratis.Screenplay` | `4.31.0` |
|
|
22
|
+
| `Cratis.Screenplay` | `4.31.0` | Original compiler, ESM and workspace evidence |
|
|
23
|
+
| `Cratis.Screenplay` | main `fd18129` | Inline events, repairs, rename/extraction and `optional` |
|
|
24
|
+
|
|
25
|
+
The update follows `commands.md`, `events.md`, `types.md`, `diagnostics.md`,
|
|
26
|
+
`mcp/authoring-tools.md`, `vscode.md` and decision 0023 at that main commit
|
|
27
|
+
(after v4.52.0). Changed examples were compiled; MCP contracts were read, not
|
|
28
|
+
exercised against a live server.
|
|
23
29
|
|
|
24
30
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
25
31
|
`Documentation/screenplay/{ast-authoring,mcp,mcp-authoring,printing,file-references,diagnostics}.md`
|
|
26
|
-
and the release notes for v4.17.0 to v4.31.0
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
another version behaves the same.
|
|
32
|
+
and the release notes for v4.17.0 to v4.31.0 established the original baseline.
|
|
33
|
+
The updated registration model in the language reference uses inline events and
|
|
34
|
+
`optional`; its current verification is compilation, not reference execution.
|
|
30
35
|
|
|
31
36
|
## Locate and connect
|
|
32
37
|
|
|
@@ -105,7 +110,38 @@ each lost comment (`PLAY0288` also reports their count and lines). Untouched
|
|
|
105
110
|
documents retain exact bytes. A printer that loses requested structural fields
|
|
106
111
|
rejects the plan.
|
|
107
112
|
|
|
108
|
-
|
|
113
|
+
## Repair or extract before rewriting
|
|
114
|
+
|
|
115
|
+
Read `read-workspace` with `view: "diagnostics"`, then `view: "repairs"` at the
|
|
116
|
+
same revision. Pass the returned `diagnosticCode`, `subject`, required formatting
|
|
117
|
+
and both revisions to `propose-repair`; preview with `read-proposal`, then `apply`.
|
|
118
|
+
Discovery lists verified repairs only when their acceptance checks pass (the
|
|
119
|
+
legacy `PLAY0397` fence recipe is an exception). A cached discovery verdict is
|
|
120
|
+
not a cached proposal: the selected repair gets a fresh transaction.
|
|
121
|
+
|
|
122
|
+
- `PLAY0166`: declare a missing produced event only when mapping types are known.
|
|
123
|
+
- `PLAY0478`: explicitly choose the identifier destination for a plain production;
|
|
124
|
+
this is a routing decision, not a spelling-only cleanup.
|
|
125
|
+
- `PLAY0471`: remove a redundant name-equal event pin without changing semantics.
|
|
126
|
+
- `PLAY0469`: remove an inline identifier payload copy. It **changes the event
|
|
127
|
+
contract**, retires a property and refuses consumer/opaque impact. No fix-all.
|
|
128
|
+
The catalog does not prove whether events were persisted; ask about stored
|
|
129
|
+
contracts before removing fields. No automatic generation-evolution repair ships.
|
|
130
|
+
- `PLAY0479`: migrate optionality spelling with `PreserveTrivia`; document scope
|
|
131
|
+
migrates all occurrences together. Keep the `query Q => observable?` exception.
|
|
132
|
+
|
|
133
|
+
Use `propose-extract-inline-event` on the inline `EventSyntax` handle before
|
|
134
|
+
adding a generation. It makes the declaration standalone, preserves metadata,
|
|
135
|
+
identities and canonical ESM, and states the formerly implicit `for`. It needs
|
|
136
|
+
canonical formatting consent and refuses comment loss. There is no reverse
|
|
137
|
+
inlining operation.
|
|
138
|
+
|
|
139
|
+
Event `propose-rename` pins `id "<old name>"` by default; existing older pins
|
|
140
|
+
survive. Use `eventNeverPersisted: true` only when that is known, to skip a new
|
|
141
|
+
pin. Renaming back to the pinned name removes it. Catalog persistence and stored
|
|
142
|
+
event history are different things.
|
|
143
|
+
|
|
144
|
+
Read the [MCP tool guide](references/mcp-tools.md) for exact repair limits and refusals.
|
|
109
145
|
|
|
110
146
|
## Choose a readable layout
|
|
111
147
|
|
|
@@ -186,7 +222,7 @@ The ordinary CLI remains useful for whole-folder validation:
|
|
|
186
222
|
cratis screenplay validate .cratis/screenplay --warnings-as-errors
|
|
187
223
|
```
|
|
188
224
|
|
|
189
|
-
|
|
225
|
+
Repair and refactoring guidance follows Screenplay main `fd18129`. The Cratis
|
|
190
226
|
CLI bundles its own Screenplay version, so check the installed `tools/list`
|
|
191
227
|
schemas before relying on a view or argument named here (for example
|
|
192
228
|
`dropped-comments` or `implementation-requirements`). Do not invent a command,
|
package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md
CHANGED
|
@@ -57,12 +57,12 @@ tagged fence (` ```csharp `); the older language-line form still parses with
|
|
|
57
57
|
warning `PLAY0397`. Query the MCP's `syntax-schema` instead of inventing JSON
|
|
58
58
|
members or translating names from memory.
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Complete model
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
This registration model uses an inline event and context identity rather than
|
|
63
|
+
copying the identifier into payload. It was compiled at main `fd18129` with zero
|
|
64
|
+
source diagnostics; that check does not run its specifications. Inline lowering
|
|
65
|
+
and `optional` spelling do not themselves select a newer ESM version.
|
|
66
66
|
|
|
67
67
|
```screenplay
|
|
68
68
|
concept ProjectId : Uuid
|
|
@@ -75,19 +75,14 @@ module Projects
|
|
|
75
75
|
name ProjectName
|
|
76
76
|
validate
|
|
77
77
|
name not empty message "Project name is required"
|
|
78
|
-
produces ProjectRegistered
|
|
79
|
-
|
|
80
|
-
projectId = projectId
|
|
81
|
-
name = name
|
|
82
|
-
event ProjectRegistered
|
|
83
|
-
projectId ProjectId
|
|
84
|
-
name ProjectName
|
|
78
|
+
produces event ProjectRegistered
|
|
79
|
+
name ProjectName = name
|
|
85
80
|
specification RegisteringAProject
|
|
86
81
|
when RegisterProject
|
|
87
82
|
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
88
83
|
name = "Screenplay"
|
|
89
84
|
then ProjectRegistered
|
|
90
|
-
|
|
85
|
+
for "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
91
86
|
name = "Screenplay"
|
|
92
87
|
then readmodel ProjectSummary
|
|
93
88
|
projectId = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
|
|
@@ -107,10 +102,11 @@ module Projects
|
|
|
107
102
|
readmodel ProjectSummary
|
|
108
103
|
projectId ProjectId
|
|
109
104
|
name ProjectName
|
|
110
|
-
query ProjectById => ProjectSummary
|
|
105
|
+
query ProjectById => ProjectSummary optional
|
|
111
106
|
by projectId ProjectId
|
|
112
107
|
projection ProjectSummaryProjection => ProjectSummary
|
|
113
|
-
from ProjectRegistered
|
|
108
|
+
from ProjectRegistered
|
|
109
|
+
projectId = $eventSourceId
|
|
114
110
|
name = name
|
|
115
111
|
```
|
|
116
112
|
|
|
@@ -136,6 +132,13 @@ The ESM version is selected by what a model uses, never by the author:
|
|
|
136
132
|
`policy` implemented in code or a file. They bind as opaque requirements with
|
|
137
133
|
capability `pure`. The reference runner returns `SemanticUnsupported` whenever
|
|
138
134
|
it would need one, so a specification that depends on one never passes.
|
|
135
|
+
- **v4** represents complete event generations, with one contract identity and
|
|
136
|
+
distinct revision property identities. Historical declarations are not migration
|
|
137
|
+
implementations; a target without migration support must reject the contract.
|
|
138
|
+
|
|
139
|
+
Inline events lower to slice-owned standalone contracts and preserve equivalent
|
|
140
|
+
canonical bytes. Event `description`, `documentation` and rename-only `id` are
|
|
141
|
+
authoring metadata, not new ESM bytes or replacements for catalog identity.
|
|
139
142
|
|
|
140
143
|
Binding is not the last gate before the reference runner. The runner needs an
|
|
141
144
|
execution plan, and the plan is created only when every reachable capability is
|
|
@@ -150,7 +153,7 @@ what blocks binding (Screenplay v4.31.0):
|
|
|
150
153
|
| Binds and runs in the reference runner | `StateChange`/`StateView` slices; `produces` including `when` conditions over command properties and literal tags; the portable validation rules, `matches email`, quoted `matches` patterns and `require` over command properties; declarative policies and `authorize` on modules, features, commands and keyed queries; `unique` constraints; projections as Chronicle lowers them, including variants, except the projection constructs in the next row; specifications, including `given caller`, `then denied` and `when append` |
|
|
151
154
|
| Binds, but the reference execution plan refuses it | A projection-level `remove via join`; `all` beside removals, `children` or `nested`; a `join`, `children` or `remove via join` inside `nested`; any event-context value other than the event source identity in a projection mapping or key, such as `$eventContext.occurred`, `$eventContext.sequenceNumber` or `$eventContext.causedBy.subject` (`$eventSourceId` and `$eventContext.eventSourceId` run) |
|
|
152
155
|
| Binds as opaque code (v3); reference runner reports unsupported | Bodied reducers, bodied named rules, fenced `validate` blocks, code or file policies |
|
|
153
|
-
| Blocks binding (`PLAY0268`) | `Automation` and `Translate` slices, reactions (with or without trigger `reads`), captures, top-level `trigger`, `persona`, `@pii`/`@sensitive` concepts, command `handler`, bare `rule <Name>`, `require` or conditions over read-model paths, dates and `today` in comparisons, `$context.tenant`/claims/roles/causation in `produces`, `$env` conditions, `file` constraints, a read model whose keyed queries in its own slice do not share one `by` property (none, or two different properties; several queries over the same property bind), any query other than `=> <ReadModel
|
|
156
|
+
| Blocks binding (`PLAY0268`) | `Automation` and `Translate` slices, reactions (with or without trigger `reads`), captures, top-level `trigger`, `persona`, `@pii`/`@sensitive` concepts, command `handler`, bare `rule <Name>`, `require` or conditions over read-model paths, dates and `today` in comparisons, `$context.tenant`/claims/roles/causation in `produces`, `$env` conditions, `file` constraints, a read model whose keyed queries in its own slice do not share one `by` property (none, or two different properties; several queries over the same property bind), any query other than `=> <ReadModel> optional` with one caller-supplied `by` argument (so also observable, filtered, scoped and performer-backed queries), `$causedBy` and templates in projections |
|
|
154
157
|
| Blocks binding (`PLAY0271`, legacy meaning) | Command `reads` and `concurrency` |
|
|
155
158
|
| Deferred (`PLAY0269`, information) | Screens, layouts, templates, forms, contributions, UI profiles, themes, behaviors and `on`/`uses` |
|
|
156
159
|
| Metadata only (`PLAY0270`, information) | `domain`, `seed`, descriptions and `file` provenance on declarations |
|
|
@@ -168,11 +171,27 @@ Decision 0006 shipped in Screenplay 4.31.0: a reaction trigger may declare
|
|
|
168
171
|
`cratis-screenplay-captures-and-reactions`). Reactions still block binding, so
|
|
169
172
|
those reads are declared, not enforced.
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
Do not infer availability from an accepted decision. Event generations and typed
|
|
175
|
+
diagnostic repairs now exist; see the event and MCP references rather than the
|
|
176
|
+
old blanket claim that decisions 0011–0014 are unimplemented. Generations describe
|
|
177
|
+
full historical shapes, not deployed-schema immutability or a working migrator.
|
|
178
|
+
Code attachment/source-map support likewise does not prove code round-trip
|
|
179
|
+
execution equivalence.
|
|
180
|
+
|
|
181
|
+
Decision 0023's generated values and `returns` (allocated ESM v8), operations
|
|
182
|
+
(v9), named event sources/streams (v10), and protected reads, `derive`/`provide`
|
|
183
|
+
(v11) are planned, not available yet. Do not teach their example syntax as usable.
|
|
184
|
+
The allocations are not shipped capabilities. Affected-instance declarations,
|
|
185
|
+
per-event data subjects, external event origin and query paging/sorting/change-set
|
|
186
|
+
delivery also remain unavailable here.
|
|
187
|
+
|
|
188
|
+
`Type optional` is canonical for admitted type references; `Type?` remains
|
|
189
|
+
compatible with information `PLAY0479`. The modifier follows `[]` for an optional
|
|
190
|
+
collection. It changes no `IsOptional` meaning or ESM bytes. Keep the exceptional
|
|
191
|
+
one-shot result `query Q => observable?` when the type itself is named
|
|
192
|
+
`observable`: `observable optional` would be parsed as a live result of a type
|
|
193
|
+
named `optional`. Screen data, behavior parameters, concept bases and
|
|
194
|
+
`reads X optional` do not accept optionality.
|
|
176
195
|
|
|
177
196
|
## Editor support
|
|
178
197
|
|
|
@@ -20,7 +20,7 @@ these short descriptions.
|
|
|
20
20
|
| References and examples | `find-references`, `dependencies`, `find-fixtures`, `find-assertion-gaps` | Inspect declared relationships and authored examples, not executed coverage |
|
|
21
21
|
| Source and validation | `diagnostics`, `read-document`, `merged-document`, `syntax-schema` | Read exact source or typed structure and diagnose problems |
|
|
22
22
|
| Workspace inspection | `open-workspace`, `read-workspace`, `read-ast`, `workspace-state`, `export-workspace` | Obtain current identities, handles, readiness, code attachment requirements and durable-state status |
|
|
23
|
-
| Planning | `propose-ast`, `propose-rename`, `propose`, `recommend-layout`, `expand-layout` | Produce validated, reviewable candidates without writing them |
|
|
23
|
+
| Planning | `propose-ast`, `propose-rename`, `propose-repair`, `propose-extract-inline-event`, `propose`, `recommend-layout`, `expand-layout` | Produce validated, reviewable candidates without writing them |
|
|
24
24
|
| Review | `read-proposal`, `discard-proposal` | Inspect exact changes, dropped comments and proposed attachments, or abandon a connection-local proposal |
|
|
25
25
|
| Effects | `apply`, `recover-workspace` | Apply an accepted plan or explicitly recover an interrupted write |
|
|
26
26
|
|
|
@@ -29,6 +29,58 @@ for full-language authoring and `propose-rename` for proved logical renames. A
|
|
|
29
29
|
source-only authoring proposal may be accepted while `executableReady` is false.
|
|
30
30
|
That is not permission to claim the application runs.
|
|
31
31
|
|
|
32
|
+
## Diagnostic repairs and refactorings
|
|
33
|
+
|
|
34
|
+
Check installed `tools/list` before using these capabilities. Read `read-workspace`
|
|
35
|
+
with `view: "diagnostics"`, then `view: "repairs"` at the current revision.
|
|
36
|
+
`read-ast` reports parser diagnostics, not all compilation diagnostics.
|
|
37
|
+
|
|
38
|
+
| Code | Offered repair and boundary |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `PLAY0166` | Declare a missing command-produced event in its slice. Infer known command-path types (retaining concepts) or `$context.occurred` as `DateTime`; refuse uncertain/conflicting shapes, imports, existing declarations, cross-file producers and parser-invalid workspaces. |
|
|
41
|
+
| `PLAY0478` | Add `for <identifier>` to a plain production. Both models must be executable; refuse a version change or retargeting another production. Accept only if the identifier, not allocation, is intended. |
|
|
42
|
+
| `PLAY0471` | Remove a redundant event id only with unchanged executable model, catalog and comments. |
|
|
43
|
+
| `PLAY0469` | Remove an inline same-source identifier property and mapping, retiring its semantic address. This changes the contract; `canFixAll` is false. Refuse other consumers, opaque impact, changed routing or comment loss. Plain contracts get guidance only. |
|
|
44
|
+
| `PLAY0479` | Migrate one optional type spelling, or all in a document, preserving syntax and trivia. Exclude `query Q => observable?`. |
|
|
45
|
+
|
|
46
|
+
These discoveries verify acceptance before listing a repair. Only compact
|
|
47
|
+
acceptance/conflict verdicts are cached on the immutable snapshot, not diagnostics,
|
|
48
|
+
proposals or write plans. Optionality discovery verifies the document migration
|
|
49
|
+
once, then offers its occurrences. `PLAY0397` on legacy `validate csharp` is a
|
|
50
|
+
recipe-only discovery whose proposal may still fail; do not generalize it to all
|
|
51
|
+
legacy fences.
|
|
52
|
+
|
|
53
|
+
Send the selected `diagnosticCode` and original `subject` to `propose-repair`,
|
|
54
|
+
with both revisions and the returned `requiredFormatting`. For optionality,
|
|
55
|
+
select `scope: "document"` during discovery to get the document root handle;
|
|
56
|
+
pass that handle, not a scope argument, to the proposal. Its default is
|
|
57
|
+
`PreserveTrivia`; the other listed repairs need explicit
|
|
58
|
+
`CanonicalizeTouchedDocuments` consent. Every proposal runs one fresh transaction
|
|
59
|
+
for the selected subject. Review bytes before `apply`; no discovery writes files.
|
|
60
|
+
|
|
61
|
+
An unknown code, subject or recipe yields `UnknownRepair`. A known recipe that
|
|
62
|
+
fails verification returns `success: false`, typed `conflicts`,
|
|
63
|
+
`authoringDiagnostics` and `executableDiagnostics`, without a proposal ID.
|
|
64
|
+
`InvalidOperation` is a transaction conflict, not an unknown recipe. Rediscover
|
|
65
|
+
after revision drift; never turn a refusal into a text replacement.
|
|
66
|
+
|
|
67
|
+
`propose-extract-inline-event` takes the inline event's `subject`, both revisions
|
|
68
|
+
and `formatting: "CanonicalizeTouchedDocuments"`. It moves the declaration to
|
|
69
|
+
its owning slice and makes an implicit identifier destination explicit. Metadata,
|
|
70
|
+
tags and identities survive; canonical ESM must stay byte-identical and every
|
|
71
|
+
comment must survive exactly once. Extract before adding `generation`, not after
|
|
72
|
+
making the document parser-invalid. This is a refactoring, not a diagnostic repair.
|
|
73
|
+
|
|
74
|
+
`propose-rename` conservatively pins an event's previous effective name. Set
|
|
75
|
+
`eventNeverPersisted: true` only with knowledge of storage history; the identity
|
|
76
|
+
catalog is not that evidence. It skips a new pin, removes a redundant current-name
|
|
77
|
+
pin, but retains a pin for a different earlier name. Contradictory generation pins
|
|
78
|
+
refuse the rename. Do not promise a generation-2 payload-removal repair or a
|
|
79
|
+
`PLAY0470` repair: neither is available.
|
|
80
|
+
|
|
81
|
+
VS Code and Monaco provide local optionality quick fixes without .NET; they do
|
|
82
|
+
not host these production-repair transactions. Use MCP for production repairs.
|
|
83
|
+
|
|
32
84
|
## Revision and ownership rules
|
|
33
85
|
|
|
34
86
|
- A source query's `sourceRevision` binds its pages. Use `expectedSourceRevision`
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
"input": "Author and organize a Screenplay model in a repository.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "view: \"repairs\"" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "propose-repair" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "propose-extract-inline-event" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "eventNeverPersisted: true" },
|
|
11
|
+
{ "kind": "skill-contains", "value": "No automatic generation-evolution repair ships" },
|
|
12
|
+
{ "kind": "skill-contains", "value": "`PLAY0479`: migrate optionality spelling with `PreserveTrivia`" },
|
|
6
13
|
{
|
|
7
14
|
"kind": "skill-contains",
|
|
8
15
|
"value": ".cratis/screenplay/"
|
|
@@ -26,6 +26,10 @@ source is the single flow model.
|
|
|
26
26
|
| Package | Version | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| `Cratis.Screenplay` | `4.31.0` | PDL parser, validator, diagnostics, semantic binder |
|
|
29
|
+
| `Cratis.Screenplay` | main `fd18129` | Inline event extraction and context identity guidance |
|
|
30
|
+
|
|
31
|
+
The update follows `commands.md`, `events.md` and `mcp/authoring-tools.md` at
|
|
32
|
+
that main commit (after v4.52.0); no PDL example changes in this update.
|
|
29
33
|
|
|
30
34
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
31
35
|
`Documentation/screenplay/projections/` (including `semantic-model.md`, `keys.md`
|
|
@@ -95,6 +99,13 @@ the event source id. A `from` without a key does **not** inherit another
|
|
|
95
99
|
update the same instance only if the event source id happens to equal
|
|
96
100
|
`invoiceId`.
|
|
97
101
|
|
|
102
|
+
For same-source events, map the read-model identity from `$eventSourceId`
|
|
103
|
+
(or `$eventContext.eventSourceId`), not a duplicated payload field. An event
|
|
104
|
+
declared by `produces event` is still a named slice-owned contract: projections
|
|
105
|
+
subscribe to it exactly like a standalone event. Verified extraction preserves
|
|
106
|
+
canonical ESM and identities, so it changes no projection contract. Removing a
|
|
107
|
+
payload property is different and requires consumer/persistence review.
|
|
108
|
+
|
|
98
109
|
A second key on one `from` is error `PLAY0060`. A template expression in a
|
|
99
110
|
composite key is error `PLAY0073`; an empty composite key is `PLAY0074`.
|
|
100
111
|
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
"input": "Build a read model from events with the Projection Declaration Language.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "it changes no projection contract" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "map the read-model identity from `$eventSourceId`" },
|
|
6
9
|
{ "kind": "skill-contains", "value": ".cratis/screenplay/" },
|
|
7
10
|
{ "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, not `.cratis/screenplay/`" },
|
|
8
11
|
{ "kind": "skill-contains", "value": "AutoMap is on by default" },
|
|
@@ -24,12 +24,16 @@ source is the single flow model.
|
|
|
24
24
|
|
|
25
25
|
| Package | Version | Purpose |
|
|
26
26
|
| --- | --- | --- |
|
|
27
|
-
| `Cratis.Screenplay` | `4.31.0` |
|
|
27
|
+
| `Cratis.Screenplay` | `4.31.0` | Original parser, validator and binder evidence |
|
|
28
|
+
| `Cratis.Screenplay` | main `fd18129` | Canonical optionality; changed examples compiled |
|
|
29
|
+
|
|
30
|
+
The update follows `types.md`, `queries.md` and `vscode.md` at that main commit
|
|
31
|
+
(after v4.52.0). Compilation does not establish query execution.
|
|
28
32
|
|
|
29
33
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
30
34
|
`Documentation/screenplay/{queries,readmodels,screens,policies,specifications,interactions}.md`
|
|
31
|
-
and decision 0010
|
|
32
|
-
|
|
35
|
+
and decision 0010 established the original baseline. Changed examples use the
|
|
36
|
+
newer main commit above; do not attribute their verification to the old tag.
|
|
33
37
|
|
|
34
38
|
## `readmodel` — shape only
|
|
35
39
|
|
|
@@ -40,7 +44,7 @@ readmodel AccountBalance
|
|
|
40
44
|
description "What the account is worth right now"
|
|
41
45
|
balance Decimal
|
|
42
46
|
movements Int
|
|
43
|
-
note String
|
|
47
|
+
note String optional
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
A read model declares what it **is** — nothing about what builds it. Whatever
|
|
@@ -50,9 +54,10 @@ error `PLAY0191`. See `cratis-screenplay-projections` for the builder side.
|
|
|
50
54
|
Do not mark a read-model property `identifier`. The executable model infers the
|
|
51
55
|
instance identifier from the `by` property of the keyed queries that return the
|
|
52
56
|
read model in its own slice
|
|
53
|
-
(`query InvoiceById => InvoiceSummary
|
|
57
|
+
(`query InvoiceById => InvoiceSummary optional`, then `by invoiceId InvoiceId`
|
|
58
|
+
on its own body line). Several queries
|
|
54
59
|
over the same `by` property are fine; each must still have the shape the
|
|
55
|
-
executable model admits, `=> <ReadModel
|
|
60
|
+
executable model admits, `=> <ReadModel> optional` with one caller-supplied `by`. A read
|
|
56
61
|
model with no keyed query, or with keyed queries over different `by` properties,
|
|
57
62
|
has no unambiguous identifier and does not bind (`PLAY0268`), and specifications
|
|
58
63
|
cannot select an instance of it.
|
|
@@ -64,21 +69,28 @@ Excerpt: the concepts, the read model and the policy are declared elsewhere.
|
|
|
64
69
|
```screenplay
|
|
65
70
|
query ListInvoices => InvoiceListReadModel[]
|
|
66
71
|
description "Every invoice the caller may see, narrowed by status and customer"
|
|
67
|
-
filter status InvoiceStatus
|
|
68
|
-
filter customerId CustomerId
|
|
72
|
+
filter status InvoiceStatus optional
|
|
73
|
+
filter customerId CustomerId optional
|
|
69
74
|
filter tenantId TenantId from $context.tenant
|
|
70
75
|
authorize IsAuthenticated
|
|
71
76
|
```
|
|
72
77
|
|
|
73
|
-
Return-type forms after `=>`: `ReadModel`, `ReadModel
|
|
74
|
-
optionally prefixed `observable`.
|
|
78
|
+
Return-type forms after `=>`: `ReadModel`, `ReadModel optional`, `ReadModel[]`,
|
|
79
|
+
each optionally prefixed `observable`. `ReadModel[] optional` permits an absent
|
|
80
|
+
collection, not absent items. Legacy `Type?` reports information `PLAY0479`,
|
|
81
|
+
which does not fail `--warnaserror`; use a verified repair or editor quick fix.
|
|
82
|
+
|
|
83
|
+
Keep `query Q => observable?` only for a one-shot query returning an optional
|
|
84
|
+
scalar type named `observable`. It is the canonical exception and has no
|
|
85
|
+
`PLAY0479`: `observable optional` instead means a live result of a type named
|
|
86
|
+
`optional`. Do not migrate that exception.
|
|
75
87
|
|
|
76
88
|
### `by` vs `filter` — and why it is a security decision
|
|
77
89
|
|
|
78
90
|
| Clause | Meaning |
|
|
79
91
|
| --- | --- |
|
|
80
92
|
| `by` | the **identifying** parameter — the query returns the instance it identifies |
|
|
81
|
-
| `filter` | an optional parameter narrowing the result set; usually typed
|
|
93
|
+
| `filter` | an optional parameter narrowing the result set; usually typed `optional` |
|
|
82
94
|
| `from <source>` | fills the parameter **from the context** instead of from the caller |
|
|
83
95
|
|
|
84
96
|
⚠️ **Anything the caller must not be able to choose — the tenant, the caller's own
|
|
@@ -115,7 +127,7 @@ Treat every `scoped to global` in a review as a question to answer, not a detail
|
|
|
115
127
|
`=> observable OverdueInvoicesReadModel[]` declares a live read that keeps
|
|
116
128
|
pushing; without the marker a query is one-shot, which is the default and what
|
|
117
129
|
most reads are. The marker qualifies only *how* the result arrives, so it composes
|
|
118
|
-
with `[]`,
|
|
130
|
+
with `[]`, `optional`, `by`, `filter`, `authorize` and a `performer`, and a screen binds
|
|
119
131
|
to a live query exactly as it binds to a one-shot one. The delivery itself is the
|
|
120
132
|
target runtime's: the executable model does not bind observable queries.
|
|
121
133
|
|
|
@@ -135,13 +147,13 @@ A read model a performer composes needs no projection, and no event builds it.
|
|
|
135
147
|
Specify it from state with `given readmodel`, then `when query <Query>` with the
|
|
136
148
|
arguments and `then result` (v4.48.0) - see `cratis-screenplay-specifications`.
|
|
137
149
|
|
|
138
|
-
A query's key goes on its own `by` line in the body. `query X => RM
|
|
150
|
+
A query's key goes on its own `by` line in the body. `query X => RM optional by id Type`
|
|
139
151
|
on the header line is a declaration error, not a shorthand.
|
|
140
152
|
|
|
141
153
|
### What runs
|
|
142
154
|
|
|
143
155
|
In the executable model today, only the keyed snapshot shape binds:
|
|
144
|
-
`=> <ReadModel
|
|
156
|
+
`=> <ReadModel> optional` with one caller-supplied `by` argument and no `observable`,
|
|
145
157
|
`filter`, `scoped to` or `performer`. Anything else, including `=> <ReadModel>`
|
|
146
158
|
and `=> <ReadModel>[]`, reports `PLAY0268`. Its `authorize` gate runs before
|
|
147
159
|
the lookup, ANDed with module and feature gates; a denied caller gets
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
"input": "Declare a Screenplay query and the screen that binds to it.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "filter status InvoiceStatus optional" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "query Q => observable?" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "information `PLAY0479`" },
|
|
6
10
|
{ "kind": "skill-contains", "value": ".cratis/screenplay/" },
|
|
7
11
|
{ "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, not `.cratis/screenplay/`" },
|
|
8
12
|
{ "kind": "skill-contains", "value": "The tenant is the default and stays unstated" },
|
|
@@ -25,13 +25,18 @@ source is the single flow model.
|
|
|
25
25
|
|
|
26
26
|
| Package | Version | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
|
-
| `Cratis.Screenplay` | `4.31.0` |
|
|
28
|
+
| `Cratis.Screenplay` | `4.31.0` | Original parser, binder and reference execution evidence |
|
|
29
|
+
| `Cratis.Screenplay` | main `fd18129` | Inline facts, `optional` and clock spelling; changed examples compiled |
|
|
30
|
+
|
|
31
|
+
The update follows `commands.md`, `events.md`, `types.md` and
|
|
32
|
+
`specifications.md` at that main commit (after v4.52.0). This pass compiles the
|
|
33
|
+
changed examples; it does not rerun the reference runner.
|
|
29
34
|
|
|
30
35
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
31
36
|
`Documentation/screenplay/{specifications,policies,constraints,readmodels,diagnostics}.md`.
|
|
32
|
-
The worked example
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
The original worked example had reference-runner evidence at that tag. The
|
|
38
|
+
example below now uses inline events and canonical optionality; keep its current
|
|
39
|
+
compile check distinct from that historical execution evidence.
|
|
35
40
|
|
|
36
41
|
The specification actions beyond commands (`given clock`, `when clock`,
|
|
37
42
|
`when trigger`, `given capture`, `when capture`, `when query`, `then result`,
|
|
@@ -127,11 +132,8 @@ module Invoicing
|
|
|
127
132
|
authorize IsAccountant
|
|
128
133
|
validate
|
|
129
134
|
invoiceNumber not empty message "Invoice number is required"
|
|
130
|
-
produces InvoiceRegistered
|
|
131
|
-
|
|
132
|
-
invoiceNumber = invoiceNumber
|
|
133
|
-
event InvoiceRegistered
|
|
134
|
-
invoiceNumber InvoiceNumber
|
|
135
|
+
produces event InvoiceRegistered
|
|
136
|
+
invoiceNumber InvoiceNumber = invoiceNumber
|
|
135
137
|
constraint UniqueInvoiceNumber
|
|
136
138
|
unique invoiceNumber on InvoiceRegistered
|
|
137
139
|
specification RegisteringAnInvoice
|
|
@@ -186,7 +188,7 @@ module Invoicing
|
|
|
186
188
|
readmodel InvoiceSummary
|
|
187
189
|
invoiceId InvoiceId
|
|
188
190
|
invoiceNumber InvoiceNumber
|
|
189
|
-
query InvoiceById => InvoiceSummary
|
|
191
|
+
query InvoiceById => InvoiceSummary optional
|
|
190
192
|
by invoiceId InvoiceId
|
|
191
193
|
projection InvoiceSummaries => InvoiceSummary
|
|
192
194
|
from InvoiceRegistered
|
|
@@ -202,6 +204,9 @@ module Invoicing
|
|
|
202
204
|
invoiceNumber = "INV-000001"
|
|
203
205
|
```
|
|
204
206
|
|
|
207
|
+
- Inline events are ordinary named facts in `given` and `then`. Assert their
|
|
208
|
+
destination with `for`, not a payload identifier; inline declaration does not
|
|
209
|
+
change fixture or assertion syntax.
|
|
205
210
|
- `RejectingANumberAnotherInvoiceHolds` needs `for`: without it the `given`
|
|
206
211
|
event lands on the command's own event source, and re-claiming your own value
|
|
207
212
|
is not a violation.
|
|
@@ -223,8 +228,9 @@ A slice is not always set off by a command. Name what does:
|
|
|
223
228
|
| An automation driven by an application trigger | `when trigger <Trigger>` with the values it carries |
|
|
224
229
|
| A translation driven by a capture | `given capture <Capture>` (the record as it was), `when capture <Capture>` (as it is now) |
|
|
225
230
|
|
|
226
|
-
`given clock
|
|
227
|
-
a value
|
|
231
|
+
Use `given clock`, never `given time`, to state the scenario occurrence time and
|
|
232
|
+
assert a value mapped from `$context.occurred`. The clock fixture is documented
|
|
233
|
+
on main, but its executable admission is still deferred as described below.
|
|
228
234
|
|
|
229
235
|
**`when query` executes today. The clock, trigger and capture actions do not.**
|
|
230
236
|
They parse, print and are checked against the application, but binding reports
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
"input": "Write given/when/then specifications for a Screenplay slice.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "Inline events are ordinary named facts" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "Use `given clock`, never `given time`" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "query InvoiceById => InvoiceSummary optional" },
|
|
6
10
|
{
|
|
7
11
|
"kind": "skill-contains",
|
|
8
12
|
"value": ".cratis/screenplay/"
|
|
@@ -25,12 +25,16 @@ source is the single flow model.
|
|
|
25
25
|
|
|
26
26
|
| Package | Version | Purpose |
|
|
27
27
|
| --- | --- | --- |
|
|
28
|
-
| `Cratis.Screenplay` | `4.31.0` |
|
|
28
|
+
| `Cratis.Screenplay` | `4.31.0` | Original UI composition parser evidence |
|
|
29
|
+
| `Cratis.Screenplay` | main `fd18129` | Cancellation routing and `optional`; changed example compiled |
|
|
30
|
+
|
|
31
|
+
The update follows `commands.md`, `events.md`, `queries.md` and decision 0023
|
|
32
|
+
at that main commit (after v4.52.0). It does not verify UI rendering.
|
|
29
33
|
|
|
30
34
|
Checked against the Screenplay repository at tag `v4.31.0` (commit `355dffb`):
|
|
31
35
|
`Documentation/screenplay/{templates,layout-arrangement,forms,contributions,interactions,ui-profile,theme,internationalization,file-references}.md`.
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
Those checks established the original baseline. The changed cancellation
|
|
37
|
+
example uses the newer main commit above, not the old tag.
|
|
34
38
|
|
|
35
39
|
Every construct on this page is deferred from the executable model with
|
|
36
40
|
information `PLAY0269`: it never blocks binding, and it is not evidence that a
|
|
@@ -205,10 +209,7 @@ module Invoicing
|
|
|
205
209
|
slice StateChange CancelInvoice
|
|
206
210
|
command CancelInvoice
|
|
207
211
|
invoiceId InvoiceId identifier
|
|
208
|
-
produces InvoiceCancelled
|
|
209
|
-
invoiceId = invoiceId
|
|
210
|
-
event InvoiceCancelled
|
|
211
|
-
invoiceId InvoiceId
|
|
212
|
+
produces event InvoiceCancelled
|
|
212
213
|
screen CancelInvoiceScreen
|
|
213
214
|
data InvoiceStatusView via query InvoiceStatusById by invoiceId
|
|
214
215
|
uses ConfirmThenExecute
|
|
@@ -223,12 +224,18 @@ module Invoicing
|
|
|
223
224
|
invoiceId InvoiceId
|
|
224
225
|
cancelled Bool
|
|
225
226
|
projection InvoiceStatuses => InvoiceStatusView
|
|
226
|
-
from InvoiceCancelled
|
|
227
|
+
from InvoiceCancelled
|
|
228
|
+
invoiceId = $eventSourceId
|
|
227
229
|
cancelled = true
|
|
228
|
-
query InvoiceStatusById => InvoiceStatusView
|
|
230
|
+
query InvoiceStatusById => InvoiceStatusView optional
|
|
229
231
|
by invoiceId InvoiceId
|
|
230
232
|
```
|
|
231
233
|
|
|
234
|
+
The inline event targets `invoiceId` without copying it into payload; the
|
|
235
|
+
projection obtains it from event context. Command `returns` and response-field
|
|
236
|
+
bindings in `on submit`/`on success` are planned in decision 0023, not available
|
|
237
|
+
yet. An existing success continuation does not imply a response contract.
|
|
238
|
+
|
|
232
239
|
- Write the one-off case inline; name it with `behavior` when several places need
|
|
233
240
|
the same wiring. A `uses` site must supply exactly the declared parameters
|
|
234
241
|
(`PLAY0337`, `PLAY0338`).
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
"input": "Declare the application shell, a screen template and a command form.",
|
|
4
4
|
"fixtures": [],
|
|
5
5
|
"assertions": [
|
|
6
|
+
{ "kind": "skill-contains", "value": "main `fd18129`" },
|
|
7
|
+
{ "kind": "skill-contains", "value": "produces event InvoiceCancelled" },
|
|
8
|
+
{ "kind": "skill-contains", "value": "invoiceId = $eventSourceId" },
|
|
9
|
+
{ "kind": "skill-contains", "value": "InvoiceStatusView optional" },
|
|
10
|
+
{ "kind": "skill-contains", "value": "An existing success continuation does not imply a response contract" },
|
|
6
11
|
{ "kind": "skill-contains", "value": ".cratis/screenplay/" },
|
|
7
12
|
{ "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, not `.cratis/screenplay/`" },
|
|
8
13
|
{ "kind": "skill-contains", "value": "A form is discovered, not referenced" },
|