@cratis/pi 7.5.1 → 7.6.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 (24) hide show
  1. package/package/corpus/rules/application-profile.md +2 -0
  2. package/package/corpus/rules/code-quality.csharp.md +1 -1
  3. package/package/corpus/rules/csharp.md +2 -0
  4. package/package/corpus/rules/reactors.md +1 -0
  5. package/package/corpus/rules/specs.scenarios.csharp.md +1 -0
  6. package/package/corpus/rules/vertical-slices.md +6 -1
  7. package/package/corpus/skills/cratis-arc-command/SKILL.md +27 -3
  8. package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +26 -7
  9. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +23 -2
  10. package/package/corpus/skills/cratis-arc-command-operation/LICENSE +2 -0
  11. package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +277 -0
  12. package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +229 -0
  13. package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +252 -0
  14. package/package/corpus/skills/cratis-arc-command-operation/verification.json +19 -0
  15. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +3 -0
  16. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +20 -0
  17. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +3 -0
  18. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +31 -1
  19. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +19 -5
  20. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +7 -0
  21. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +61 -9
  22. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +12 -0
  23. package/package/profile-catalog.json +1 -0
  24. package/package.json +1 -1
@@ -33,6 +33,12 @@ The worked example below compiles with zero diagnostics, binds to ESM v2, and
33
33
  all six specifications pass the reference runner at that tag. Reverify before
34
34
  claiming another version behaves the same.
35
35
 
36
+ The specification actions beyond commands (`given clock`, `when clock`,
37
+ `when trigger`, `given capture`, `when capture`, `when query`, `then result`,
38
+ `then no result`) were checked against tag `v4.48.0` (commit `3baf4a4`):
39
+ `Documentation/screenplay/{specifications,diagnostics}.md` and the proposed
40
+ decision 0022. They do not exist before v4.48.0.
41
+
36
42
  ## The vocabulary
37
43
 
38
44
  | Construct | Meaning |
@@ -42,6 +48,13 @@ claiming another version behaves the same.
42
48
  | `given caller` | the caller: `authenticated`, `role "<r>"`, repeatable `claim "<type>" = "<value>"`; empty means unauthenticated |
43
49
  | `when <CommandType>` | run a command |
44
50
  | `when append <EventType>` | append one event: constraints and projections run, the command and reactions do not |
51
+ | `when query <Query>` | perform a query with the argument values beneath it (v4.48.0) |
52
+ | `then result [exactly]` | one expected row of the performed query; repeat for several (v4.48.0) |
53
+ | `then no result` | the performed query returns nothing (v4.48.0) |
54
+ | `given clock "<instant>"` | the ISO 8601 instant the scenario happens at (v4.48.0) |
55
+ | `when clock "<instant>"` | the clock reaches an instant; scheduled reactions that are due run (v4.48.0) |
56
+ | `when trigger <Trigger>` | an application trigger fires with the values beneath it (v4.48.0) |
57
+ | `given capture` / `when capture <Capture>` | an earlier and the current record of a capture's source (v4.48.0) |
45
58
  | `then <EventType>` | an expected new event |
46
59
  | `then events in any order` | compare the new events without regard to order |
47
60
  | `then readmodel <ReadModelType> [exactly]` | read-model state afterwards — must state the identifier |
@@ -52,10 +65,23 @@ claiming another version behaves the same.
52
65
  | `for <value>` | the event source of a `given`/`then` event, or of the `when` command or appended event |
53
66
  | `<property> = <value>` | a literal, `null`, or a one-line JSON-shaped object or list: `lines = [{"sku":"A-1","quantity":2}]` |
54
67
 
68
+ From v4.48.0 an enumeration value binds whether it is written bare
69
+ (`status = sent`), qualified (`status = InvoiceStatus.sent`) or quoted, and a
70
+ `DateTime` value binds as a plain ISO 8601 instant (`"2026-10-05T08:00:00Z"`).
71
+ Before v4.48.0 only the quoted member and the full round-trip instant
72
+ (`"2026-10-05T08:00:00.0000000Z"`) bound, although the compiler accepted all of
73
+ them - quote members when a model must bind on older versions.
74
+
55
75
  Rules the binder enforces:
56
76
 
57
- - **At most one action** — `when` or `when append` (`PLAY0358`). Without an
58
- action, assert only `then readmodel` or `then query` (`PLAY0352`).
77
+ - **At most one action** — a command, `when append`, `when clock`, `when trigger`,
78
+ `when capture` or `when query` (`PLAY0097`, `PLAY0358`). Without an action,
79
+ assert only `then readmodel` or `then query` (`PLAY0352`).
80
+ - **`then result` and `then no result` need `when query`**, and `when query`
81
+ needs one of them or `then denied` (`PLAY0465`). Each argument is a `by` or
82
+ `filter` parameter of the query (`PLAY0468`).
83
+ - **A clock instant is ISO 8601 with an offset or `Z`**, such as
84
+ `"2026-10-05T08:00:00Z"` (`PLAY0461`); `given clock` appears at most once.
59
85
  - **`then` contains either events or an error — never both.** A rejection
60
86
  specification has exactly one rejection and no success outcome.
61
87
  - **`then denied` stands alone**: not with events, errors or state assertions
@@ -170,11 +196,10 @@ module Invoicing
170
196
  given readmodel InvoiceSummary
171
197
  invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
172
198
  invoiceNumber = "INV-000001"
173
- then query InvoiceById
174
- arguments
175
- invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
176
- result
177
- invoiceNumber = "INV-000001"
199
+ when query InvoiceById
200
+ invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
201
+ then result
202
+ invoiceNumber = "INV-000001"
178
203
  ```
179
204
 
180
205
  - `RejectingANumberAnotherInvoiceHolds` needs `for`: without it the `given`
@@ -183,7 +208,30 @@ module Invoicing
183
208
  - `ProjectingAnAppendedInvoice` exercises the projection without running the
184
209
  command. Put `for`-bearing specifications in the slice whose command produces
185
210
  the event; placed in the view slice, binding fails with `PLAY0273`.
186
- - `LookingUpAnExistingInvoice` has no action: it checks established state only.
211
+ - `LookingUpAnExistingInvoice` performs the query as its action. It binds to
212
+ exactly what `then query` with `arguments` and `result` would, so on a version
213
+ before v4.48.0 write it that way instead.
214
+
215
+ ## Actions beyond commands
216
+
217
+ A slice is not always set off by a command. Name what does:
218
+
219
+ | Slice | Action |
220
+ | --- | --- |
221
+ | A view no event builds - its query has a `performer` | `given readmodel` …, `when query <Query>`, `then result` / `then no result` |
222
+ | An automation driven by the clock | `given clock "<instant>"`, `when clock "<later instant>"` |
223
+ | An automation driven by an application trigger | `when trigger <Trigger>` with the values it carries |
224
+ | A translation driven by a capture | `given capture <Capture>` (the record as it was), `when capture <Capture>` (as it is now) |
225
+
226
+ `given clock` also fixes the occurrence time of every action in the scenario, so
227
+ a value a `produces` maps from `$context.occurred` can be asserted.
228
+
229
+ **`when query` executes today. The clock, trigger and capture actions do not.**
230
+ They parse, print and are checked against the application, but binding reports
231
+ `PLAY0268` naming the proposed ESM v6 (decision 0022): the executable model does
232
+ not yet admit automation or translate slices, nor the reactions and captures these
233
+ actions drive. Write them - they state what sets the slice off - and report them
234
+ as parsed, not executed.
187
235
 
188
236
  ## Rejections and denials say different things
189
237
 
@@ -248,7 +296,9 @@ target has one normalized behavior to match.
248
296
  - Unsupported reachable declarative constructs block the whole execution plan
249
297
  rather than running partially: no specification in the model runs, including
250
298
  the ones that never touch the refused construct.
251
- - Reactions never run, not even after `when append`.
299
+ - Reactions never run, not even after `when append`. `when clock`,
300
+ `when trigger` and `when capture` fail binding until ESM v6 is accepted and
301
+ built.
252
302
  - A rejection leaves the world unchanged; an accepted action commits once, then
253
303
  the read models and queries are compared.
254
304
 
@@ -273,6 +323,8 @@ For command specifications:
273
323
 
274
324
  For view specifications:
275
325
 
326
+ - [ ] A view a `performer` composes is specified with `given readmodel`,
327
+ `when query` and `then result` or `then no result`.
276
328
  - [ ] `given readmodel` is a complete instance with its identifier.
277
329
  - [ ] `then readmodel` states the identifier and the properties that matter; add
278
330
  `exactly` only when extra properties must fail the assertion.
@@ -34,6 +34,18 @@
34
34
  {
35
35
  "kind": "skill-contains",
36
36
  "value": "Bare `then error` never matches\n a denial"
37
+ },
38
+ {
39
+ "kind": "skill-contains",
40
+ "value": "**`when query` executes today. The clock, trigger and capture actions do not.**"
41
+ },
42
+ {
43
+ "kind": "skill-contains",
44
+ "value": "`then result` and `then no result` need `when query`"
45
+ },
46
+ {
47
+ "kind": "skill-contains",
48
+ "value": "A clock instant is ISO 8601 with an offset or `Z`"
37
49
  }
38
50
  ]
39
51
  }
@@ -253,6 +253,7 @@
253
253
  "availableTargets": [
254
254
  "cratis-arc-command",
255
255
  "cratis-arc-command-execution",
256
+ "cratis-arc-command-operation",
256
257
  "cratis-arc-command-validation",
257
258
  "cratis-arc-observable-query-http",
258
259
  "cratis-arc-query-paging"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [