@cratis/pi 7.158.0 → 7.158.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.
Files changed (37) hide show
  1. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +7 -0
  2. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +73 -0
  3. package/package/corpus/skills/cratis-documentation-writing/SKILL.md +43 -127
  4. package/package/corpus/skills/cratis-documentation-writing/references/writing-guidance.md +110 -0
  5. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/public-events-and-direction.md +21 -0
  6. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +6 -0
  7. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +54 -126
  8. package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +6 -0
  9. package/package/corpus/skills/cratis-screenplay-command-surface/references/concepts-and-types.md +38 -0
  10. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +19 -0
  11. package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +61 -0
  12. package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +7 -0
  13. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +1 -5
  14. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +21 -8
  15. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +3 -3
  16. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +1 -1
  17. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +51 -97
  18. package/package/corpus/skills/cratis-screenplay-projections/references/mapping-sources.md +33 -0
  19. package/package/corpus/skills/cratis-screenplay-projections/references/outbound-every.md +12 -0
  20. package/package/corpus/skills/cratis-screenplay-projections/references/reducers.md +40 -0
  21. package/package/corpus/skills/cratis-screenplay-projections/references/stage-admission.md +18 -0
  22. package/package/corpus/skills/cratis-screenplay-projections/verification.json +2 -3
  23. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +61 -134
  24. package/package/corpus/skills/cratis-screenplay-read-surface/references/passive.md +78 -0
  25. package/package/corpus/skills/cratis-screenplay-read-surface/references/performer-bodies.md +29 -0
  26. package/package/corpus/skills/cratis-screenplay-read-surface/references/query-execution.md +21 -0
  27. package/package/corpus/skills/cratis-screenplay-read-surface/references/screen-levels.md +51 -0
  28. package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +5 -2
  29. package/package/corpus/skills/cratis-screenplay-reverse-engineering/references/synthesis-rules.md +7 -4
  30. package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +21 -0
  31. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +15 -0
  32. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +12 -2
  33. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +1 -0
  34. package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +7 -122
  35. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/voice-guidance.md +139 -0
  36. package/package/corpus/skills/cratis-writing-voice-and-cadence/verification.json +9 -9
  37. package/package.json +1 -1
@@ -14,27 +14,22 @@ text. This is half of every event model, and the half most easily got wrong.
14
14
 
15
15
  ## Locate the model
16
16
 
17
- Look first for the project's existing `.play` files: the folder holding them is the
18
- model. Reuse existing model/workspace roots; code-only `Source/` or `src/` does
19
- not qualify. Otherwise use repository-root `Screenplay/`, never `.cratis/`
20
- (configuration/shared corpus only). Read [discovery/version gates](../cratis-screenplay-event-modeling/references/file-layout.md#locate-the-model)
21
- when locating the model; do not invent another location.
17
+ The folder holding the project's existing `.play` files is the model; code-only
18
+ `Source/` or `src/` does not qualify. Otherwise use repository-root `Screenplay/`,
19
+ never `.cratis/`. Read [discovery/version gates](../cratis-screenplay-event-modeling/references/file-layout.md#locate-the-model)
20
+ and do not invent another location.
22
21
 
23
- `cratis ai install` manages `.cratis/ai/`, never model files. Never
24
- hand-copy Screenplay source between repositories. Keep Markdown that explains,
25
- questions or navigates the model in the repository's documentation; the `.play`
26
- source is the single flow model.
22
+ `cratis ai install` manages `.cratis/ai/`, never model files. Never hand-copy
23
+ Screenplay source between repositories; the `.play` source is the single flow model.
27
24
 
28
25
  ## Product sources
29
26
 
30
- Consult Screenplay `Documentation/screenplay/projections/` for grammar and semantics,
31
- `readmodels.md` for targets and `diagnostics.md` for errors. Verify examples with
32
- the standalone compiler before claiming another version behaves the same.
27
+ Screenplay `Documentation/screenplay/projections/` covers grammar and semantics,
28
+ `readmodels.md` targets and `diagnostics.md` errors.
33
29
 
34
- **Chronicle decides what a projection means.**
35
- Screenplay owns the grammar; which instance an event affects, what a join may
36
- create and what a removal removes follow Chronicle's lowering. Syntax that
37
- compiles can still mean something other than it seems: read the warnings.
30
+ **Chronicle decides what a projection means.** Screenplay owns the grammar; which instance an
31
+ event affects, what a join may create and what a removal removes follow Chronicle's lowering.
32
+ Syntax that compiles can still mean something else: read the warnings.
38
33
 
39
34
  ## The shape
40
35
 
@@ -73,12 +68,9 @@ graph projection to its graph's sink; only the `readmodel` or `graph` body carri
73
68
 
74
69
  In an explicitly outbound Translate slice, `projection P => PublicEvent` or
75
70
  `reducer P => PublicEvent` targets the slice's one local public event (ESM v9).
76
- The projection folds one instance per event source id; opaque reducers remain
77
- Unsupported in reference execution. Read
78
- [public-event folds](../cratis-screenplay-automations-and-translations/references/public-events-and-direction.md)
79
- for publication rules and the `when append`/`then PublicEvent` specification.
80
- A reducer can filter `from Source[.Stream]` (ESM v10); a projection cannot.
81
- Read [observer filters](../cratis-screenplay-toolchain/references/production-routes-and-filters.md).
71
+ Read [public-event folds](../cratis-screenplay-automations-and-translations/references/public-events-and-direction.md)
72
+ for publication rules and specifications. A reducer can filter `from Source[.Stream]`
73
+ (ESM v10); a projection cannot: [observer filters](../cratis-screenplay-toolchain/references/production-routes-and-filters.md).
82
74
 
83
75
  ## Projection-level directives
84
76
 
@@ -113,18 +105,12 @@ For same-source events, map the read-model identity from `$eventSourceId`
113
105
  (or `$eventContext.eventSourceId`), not a duplicated payload field. That holds for
114
106
  executable or design scope; in renderable scope (Stage) never map it from `$eventSourceId`:
115
107
  the key of a scoped projection establishes it (`cratis-stage-rendering-and-sandbox`
116
- `references/admission.md`). An event
117
- declared by `produces event` is still a named slice-owned contract: projections
118
- subscribe to it exactly like a standalone event. Verified extraction preserves
119
- canonical ESM and identities, so it changes no projection contract. Removing a
120
- payload property is different and requires consumer/persistence review.
108
+ `references/admission.md`). An event declared by `produces event` is a named
109
+ slice-owned contract: projections subscribe to it like a standalone event.
110
+ Removing a payload property needs consumer/persistence review.
121
111
 
122
- A read model with several flat `key` parts needs that block in every root `from` and
123
- `remove with` (`PLAY0661`/`PLAY0662`); other blocks and reducers there are `PLAY0268`
124
- (`references/pdl-grammar.md`).
125
-
126
- A second key on one `from` is error `PLAY0060`. A template expression in a
127
- composite key is error `PLAY0073`; an empty composite key is `PLAY0074`.
112
+ Key errors (`PLAY0060`, `PLAY0073`, `PLAY0074`, `PLAY0661`/`PLAY0662`, `PLAY0268`) are in
113
+ [key diagnostics](references/mapping-sources.md#key-diagnostics).
128
114
 
129
115
  ## `from` vs `every` vs `all`
130
116
 
@@ -146,14 +132,17 @@ subscribe to every event type: `all` inside `children` or `nested` behaves as
146
132
  `lastUpdatedAt`. The `every` block **inside** a `children` block does not accept
147
133
  it — it is already in a children context.
148
134
 
135
+ ⚠️ A projection that targets a public event and combines `from` with `every` over different
136
+ producible event types is refused as `InvalidSemanticContract` (no `PLAY` code). Read
137
+ [outbound `every`](references/outbound-every.md) when writing one.
138
+
149
139
  ## One event per level
150
140
 
151
141
  One event type is used once per projection level (`PLAY0801`): two `from` blocks
152
142
  cannot update two rows at that level, even with different keys. Combine mappings
153
143
  for one row; model a genuine second domain fact as its own event. Never invent
154
144
  events only to satisfy the read side. Joins use a separate set; each children,
155
- nested and variant block starts fresh sets. Read [event scope](references/pdl-grammar.md#event-scope)
156
- for grouped events, removals and compiler compatibility.
145
+ nested and variant block starts fresh sets. See [event scope](references/pdl-grammar.md#event-scope).
157
146
 
158
147
  ## Property mapping and AutoMap
159
148
 
@@ -167,24 +156,11 @@ without one, the joined event follows its level's auto-map.
167
156
  Requires Screenplay 4.212.4 (`screenplay --version`) for joined-event auto-map
168
157
  overrides in executable binding; older binders replace the setting with the level's.
169
158
 
170
- Mapping sources: a property path (`name`, `contactInfo.email`), a literal
171
- (`true`, `"Pending"`, `42`, `null`), `$eventSourceId`, and
172
- `$eventContext.<path>` from the event-context catalog (for example `occurred`,
173
- `sequenceNumber`, `correlationId`, `causedBy.subject`; an unknown path warns with
174
- `PLAY0295`). Templates (`` `${first} ${last}` ``) and `$causedBy.<…>` parse but
175
- do not bind to the executable model; write `$eventContext.causedBy.subject`
176
- instead of `$causedBy.subject`.
177
-
178
- ⚠️ Only the event source identity (`$eventSourceId`,
179
- `$eventContext.eventSourceId`) runs in the reference runner. Any other
180
- `$eventContext` path in a mapping or key — `occurred` in the shape above,
181
- `sequenceNumber`, `causedBy.subject` — binds, but the reference execution plan
182
- refuses it, so no specification in that model runs there. Use it when the target
183
- needs it, and report those specifications as needing a target.
184
-
185
- `clear <property>` removes a value and is equivalent to `= null`; prefer `clear`.
186
- It takes a dotted path (`clear Owner.Note`) and escapes reserved names
187
- (`clear @with`).
159
+ Mapping sources are a property path, a literal, `$eventSourceId` and `$eventContext.<path>`.
160
+ ⚠️ Only the event source identity runs in the reference runner; any other `$eventContext`
161
+ path (such as `occurred` in the shape above) binds but its specifications cannot run there.
162
+ `clear <property>` removes a value; prefer it to `= null`. Read
163
+ [mapping sources](references/mapping-sources.md) for the catalog, `PLAY0295` and `clear` paths.
188
164
 
189
165
  ## Arithmetic
190
166
 
@@ -231,12 +207,9 @@ remove via join on CustomerAccountClosed
231
207
 
232
208
  `remove with <Event> [key <expr>]` removes the instance the event identifies.
233
209
  `remove via join on <Event> [key <expr>]` removes instances reached through a
234
- join. On a projection's own level, as in the second line above, it has no
235
- verified meaning — Chronicle's engine wires it as a child removal — so it binds
236
- but the reference execution plan refuses it. Use it inside `children`. Inside
237
- `children`, both take an indented `parent <expr>` — and **only**
238
- `parent`; anything else is error `PLAY0069`. Several removal conditions may
239
- coexist.
210
+ join; on a projection's own level (second line above) it binds but the reference
211
+ execution plan refuses it, so use it inside `children`. There both forms take an
212
+ indented `parent <expr>` and **only** `parent` (`PLAY0069`).
240
213
 
241
214
  ## Variants — one identity, mutually exclusive read models
242
215
 
@@ -248,10 +221,9 @@ A `graph` declares node labels (one `key` each) and edge types; `projection X =>
248
221
  builds it with `node` and `edge` blocks. Nothing writes to a graph except events.
249
222
  Requires Screenplay 5.7.0 (`screenplay --version`).
250
223
 
251
- Choose a graph for traversals (membership, nesting, paths) and a document read model
252
- for lookups by key. Design by **reading the graph backwards**: write each question
253
- as a path, make every hop an edge type and every stop a node label, then name the
254
- event that creates and the one that removes each. Read
224
+ Choose a graph for traversals and a document read model for lookups by key. Design by
225
+ **reading the graph backwards**: write each question as a path, make every hop an edge type
226
+ and every stop a node label, then name the event that creates and removes each. Read
255
227
  [references/graphs.md](references/graphs.md) for syntax, operations, a graph in a named sink
256
228
  (`sink People for graphs`) and `PLAY0862`–`PLAY0877`.
257
229
 
@@ -281,48 +253,31 @@ state depends on the current one — a running balance, a state machine.
281
253
  `Event`, `Key`, `Tenant`, `Occurred`, `SequenceNumber` and `IsFirst` are always
282
254
  there.
283
255
 
284
- What the executable model does with it (ESM v3):
285
-
286
- - Every `on` rule needs a body, inline or `file`. Mixing bodied and body-less
287
- rules is `PLAY0398`; two rules for one event is `PLAY0399`; a reducer with no
288
- bodies is rejected with a hint to write a projection.
289
- - The key is **always the event source id** — a reducer cannot route by an event
290
- property. State starts at null; returning null deletes the instance. A query
291
- `by` another identity type warns `PLAY0690`; use a projection keyed on each `from`
292
- or a join ([reducer identity](references/reducer-identity.md)).
293
- - The body is an opaque attachment identified by a content hash, never compiled
294
- or run by Screenplay. The reference runner cannot compute reducer state, so a
295
- specification that reads a reducer-built read model reports unsupported and
296
- never passes. A target must supply the transition. Stage admits only pure reducer bodies
297
- (Roslyn allowlist, `STAGE-ESM-019`/`-022`); an impure body is gap-fill code, and the model stays the contract.
256
+ `context.Key` is text; read it typed with `context.KeyAs<T>()` (Requires Screenplay 5.2.0).
257
+
258
+ Key facts: every `on` rule needs a body, inline or `file` (`PLAY0398`/`PLAY0399`); the key is
259
+ **always the event source id**, and a query `by` another identity warns `PLAY0690`
260
+ ([reducer identity](references/reducer-identity.md)); the reference runner cannot compute
261
+ reducer state, so a specification reading a reducer-built read model never passes. Read
262
+ [reducer details](references/reducers.md) for `KeyAs<T>()`, the executable-model rules and Stage
263
+ admission.
298
264
 
299
265
  **Prefer a projection where one will do.** A reducer is code, and code is the part
300
266
  of a document a reader cannot check at a glance.
301
267
 
302
268
  Read [pdl-grammar.md](references/pdl-grammar.md) when checking exact syntax, interpreting a projection diagnostic code, or needing a worked example.
303
269
 
304
- ## `STAGE-ESM-017` on a projection passes `validate` and fails at `render`
305
-
306
- Symptom: `cratis screenplay validate --executable` exits 0, then `cratis render` (or `render --check`)
307
- refuses with `STAGE-ESM-017` and a generic message whose location is a `sem1:<hash>`, not a source line
308
- (seen on Stage 4.192.0 and CLI 3.94.0). Cause: `validate --executable` binds only Screenplay's model;
309
- Stage's admission runs only in `render`. Check every `from` block in turn:
310
-
311
- 1. **Key.** An event property or the event source. A root `from` also accepts a constant text key (nonempty, only letters, digits, `_`, space and `. / : * + -`); any other literal key, and a literal key outside a root, is refused.
312
- 2. **Do not overwrite the key.** A mapping onto the key property must restate the key itself (`from E` keyed by the event source with `berthId = $eventSourceId`, or the key's own event property); mapping a different value onto it is refused (`MatchesKey`). Simplest is to leave the key property unmapped.
313
- 3. **`$eventSourceId` into a non-key target** is admitted in a `from` block keyed by an event property, when every command and reaction producing the event addresses it with a non-collection value of exactly the target's type (optionality ignored). It is refused in `join`s, for a mismatched type, and for an event nothing produces.
314
- 4. **No `$context.*`.** Map an event property instead and have the command set it. The compiler may refuse it first (`PLAY0152`); Stage refuses a context value in a projection with `STAGE-ESM-017`.
315
- 5. **Targets.** A target path through an optional or non-composite intermediate is refused; an optional leaf and a path through required composites are fine. The event property mapped from must exist on the event.
270
+ ## `STAGE-ESM-017` passes `validate` and fails at `render`
316
271
 
317
- Bisect: run `cratis render <root> --target cratis --name <App> --destination <dir> --check` (plans,
318
- writes nothing), comment out `from` blocks one at a time until the error clears, then apply the list to
319
- the block that cleared it. Reference: `cratis-stage-rendering-and-sandbox` `references/admission.md`.
272
+ `validate --executable` binds only Screenplay's model; Stage's admission runs only in `render`.
273
+ Read [Stage admission](references/stage-admission.md) when `cratis render` refuses a projection
274
+ with `STAGE-ESM-017` after `validate` exits 0.
320
275
 
321
276
  ## Verify
322
277
 
323
- - [ ] Standalone `screenplay <model> --warnaserror` reports zero errors and zero
324
- warnings; or `cratis screenplay validate --warnings-as-errors` on the model folder
325
- (an older bundled compiler can stop at a lower ESM version). Name which tool produced the result. If it reports diagnostics, correct the model and rerun the same command; report unresolved diagnostics as blockers rather than a passing verification.
278
+ - [ ] Standalone `screenplay <model> --warnaserror` or `cratis screenplay validate --warnings-as-errors`
279
+ reports zero errors and warnings (an older bundled compiler can stop at a lower ESM version).
280
+ Name the tool; fix and rerun, and report unresolved diagnostics as blockers.
326
281
  - [ ] Each read model has **exactly one** builder.
327
282
  - [ ] No projection-level `key`; every `from` that must address the same
328
283
  instance is keyed on the same identity.
@@ -332,8 +287,7 @@ the block that cleared it. Reference: `cratis-stage-rendering-and-sandbox` `refe
332
287
  right level.
333
288
  - [ ] Every `children` block's `from` declares `parent`.
334
289
  - [ ] Every `nested` block contains at least one `from`.
335
- - [ ] No `$causedBy`, template or `sequence` where the model must run.
336
- - [ ] Where specifications must run in the reference runner: no `$eventContext`
290
+ - [ ] Where the model must run: no `$causedBy`, template or `sequence`; no `$eventContext`
337
291
  path other than `eventSourceId`, no projection-level `remove via join`, no
338
292
  `all` beside removals, `children` or `nested`, and no `join`, `children` or
339
293
  `remove via join` inside `nested`.
@@ -0,0 +1,33 @@
1
+ # Mapping sources and key diagnostics
2
+
3
+ Read this when choosing what a property mapping reads from, using `$eventContext`, or diagnosing a key error.
4
+
5
+ ## Mapping sources
6
+
7
+ A property path (`name`, `contactInfo.email`), a literal
8
+ (`true`, `"Pending"`, `42`, `null`), `$eventSourceId`, and
9
+ `$eventContext.<path>` from the event-context catalog (for example `occurred`,
10
+ `sequenceNumber`, `correlationId`, `causedBy.subject`; an unknown path warns with
11
+ `PLAY0295`). Templates (`` `${first} ${last}` ``) and `$causedBy.<…>` parse but
12
+ do not bind to the executable model; write `$eventContext.causedBy.subject`
13
+ instead of `$causedBy.subject`.
14
+
15
+ ⚠️ Only the event source identity (`$eventSourceId`,
16
+ `$eventContext.eventSourceId`) runs in the reference runner. Any other
17
+ `$eventContext` path in a mapping or key — `occurred`, `sequenceNumber`,
18
+ `causedBy.subject` — binds, but the reference execution plan
19
+ refuses it, so no specification in that model runs there. Use it when the target
20
+ needs it, and report those specifications as needing a target.
21
+
22
+ `clear <property>` removes a value and is equivalent to `= null`; prefer `clear`.
23
+ It takes a dotted path (`clear Owner.Note`) and escapes reserved names
24
+ (`clear @with`).
25
+
26
+ ## Key diagnostics
27
+
28
+ A read model with several flat `key` parts needs that block in every root `from` and
29
+ `remove with` (`PLAY0661`/`PLAY0662`); other blocks and reducers there are `PLAY0268`
30
+ (see [pdl-grammar.md](pdl-grammar.md)).
31
+
32
+ A second key on one `from` is error `PLAY0060`. A template expression in a
33
+ composite key is error `PLAY0073`; an empty composite key is `PLAY0074`.
@@ -0,0 +1,12 @@
1
+ # `from` plus `every` in an outbound event projection
2
+
3
+ Read this when a projection that targets a public event combines `from` and `every`.
4
+
5
+ In an outbound Translate slice, events that outbound projections publish count as producers for
6
+ routed facts, `every`/`all` scopes and source-type inference. An `every` scope therefore folds
7
+ every producible event type, so a projection that combines `from` and `every` over *different*
8
+ producible event types is ambiguous and refused: the published event no longer has one distinct
9
+ source type. The executable model reports it as `InvalidSemanticContract` ("needs one unambiguous
10
+ declared producer destination type") when a routed fact or specification fixture needs that
11
+ type; no `PLAY` code is assigned. Keep the producing events to one source type, or drop `every`
12
+ and map each event in its own `from`.
@@ -0,0 +1,40 @@
1
+ # Reducer details
2
+
3
+ Read this when writing a reducer body that needs the read model's key, or when checking what the
4
+ executable model and the reference runner do with a reducer.
5
+
6
+ ## Reading the key as a typed value
7
+
8
+ `context.Key` is text. Read it as the read model's key type with `context.KeyAs<T>()`
9
+ instead of parsing it: `T` is `string`, `Guid` (UUID text in N, D, B or P form, without
10
+ whitespace) or a key concept with one public constructor taking a `string` or `Guid`.
11
+
12
+ ```csharp
13
+ var id = context.KeyAs<AccountId>();
14
+ return context.State is null
15
+ ? new(id, context.Event.amount)
16
+ : context.State with { balance = context.State.balance + context.Event.amount };
17
+ ```
18
+
19
+ Malformed UUID text and an unsupported `T` throw `ContextKeyNotConvertible` (the raw key is
20
+ not in the message); a concept's own validation exception propagates unchanged. The compiler
21
+ accepts `KeyAs<T>()` only for a read model with one required, non-collection Uuid or Text key;
22
+ a composite key and a reducer that targets an event keep reading `Key`. This is executable-model
23
+ support: Stage does not yet generate `KeyAs<T>()` on typed reducer contexts, so a rendered reducer
24
+ that needs it is a gap to fill by hand.
25
+ Requires Screenplay 5.2.0 (`screenplay --version`); an older tool has no `KeyAs<T>()`.
26
+
27
+ ## What the executable model does (ESM v3)
28
+
29
+ - Every `on` rule needs a body, inline or `file`. Mixing bodied and body-less
30
+ rules is `PLAY0398`; two rules for one event is `PLAY0399`; a reducer with no
31
+ bodies is rejected with a hint to write a projection.
32
+ - The key is **always the event source id** — a reducer cannot route by an event
33
+ property. State starts at null; returning null deletes the instance. A query
34
+ `by` another identity type warns `PLAY0690`; use a projection keyed on each `from`
35
+ or a join ([reducer identity](reducer-identity.md)).
36
+ - The body is an opaque attachment identified by a content hash, never compiled
37
+ or run by Screenplay. The reference runner cannot compute reducer state, so a
38
+ specification that reads a reducer-built read model reports unsupported and
39
+ never passes. A target must supply the transition. Stage admits only pure reducer bodies
40
+ (Roslyn allowlist, `STAGE-ESM-019`/`-022`); an impure body is gap-fill code, and the model stays the contract.
@@ -0,0 +1,18 @@
1
+ # `STAGE-ESM-017` on a projection passes `validate` and fails at `render`
2
+
3
+ Read this when `cratis render` refuses a projection that `cratis screenplay validate --executable` accepted.
4
+
5
+ Symptom: `cratis screenplay validate --executable` exits 0, then `cratis render` (or `render --check`)
6
+ refuses with `STAGE-ESM-017` and a generic message whose location is a `sem1:<hash>`, not a source line
7
+ (seen on older Stage and CLI builds). Cause: `validate --executable` binds only Screenplay's model;
8
+ Stage's admission runs only in `render`. Check every `from` block in turn:
9
+
10
+ 1. **Key.** An event property or the event source. A root `from` also accepts a constant text key (nonempty, only letters, digits, `_`, space and `. / : * + -`); any other literal key, and a literal key outside a root, is refused.
11
+ 2. **Do not overwrite the key.** A mapping onto the key property must restate the key itself (`from E` keyed by the event source with `berthId = $eventSourceId`, or the key's own event property); mapping a different value onto it is refused (`MatchesKey`). Simplest is to leave the key property unmapped.
12
+ 3. **`$eventSourceId` into a non-key target** is admitted in a `from` block keyed by an event property, when every command and reaction producing the event addresses it with a non-collection value of exactly the target's type (optionality ignored). It is refused in `join`s, for a mismatched type, and for an event nothing produces.
13
+ 4. **No `$context.*`.** Map an event property instead and have the command set it. The compiler may refuse it first (`PLAY0152`); Stage refuses a context value in a projection with `STAGE-ESM-017`.
14
+ 5. **Targets.** A target path through an optional or non-composite intermediate is refused; an optional leaf and a path through required composites are fine. The event property mapped from must exist on the event.
15
+
16
+ Bisect: run `cratis render <root> --target cratis --name <App> --destination <dir> --check` (plans,
17
+ writes nothing), comment out `from` blocks one at a time until the error clears, then apply the list to
18
+ the block that cleared it. Reference: `cratis-stage-rendering-and-sandbox` `references/admission.md`.
@@ -4,9 +4,8 @@
4
4
  "fixtures": [],
5
5
  "assertions": [
6
6
  { "kind": "play-compiles" },
7
- { "kind": "skill-contains", "value": "it changes no projection contract" },
8
7
  { "kind": "skill-contains", "value": "map the read-model identity from `$eventSourceId`" },
9
- { "kind": "skill-contains", "value": "Look first for the project's existing `.play` files" },
8
+ { "kind": "skill-contains", "value": "The folder holding the project's existing `.play` files" },
10
9
  { "kind": "skill-contains", "value": "`cratis ai install` manages `.cratis/ai/`, never model files" },
11
10
  { "kind": "skill-contains", "value": "AutoMap is on by default" },
12
11
  { "kind": "skill-contains", "value": "decides auto-mapping for that event alone" },
@@ -25,7 +24,7 @@
25
24
  { "kind": "skill-contains", "value": "references/pdl-grammar.md" },
26
25
  { "kind": "skill-contains", "value": "Do not write `key` on the projection." },
27
26
  { "kind": "skill-contains", "value": "**routes nothing** (`PLAY0381`)" },
28
- { "kind": "skill-contains", "value": "The key is **always the event source id**" },
27
+ { "kind": "skill-contains", "value": "The key is **always the event source id**", "file": "references/reducers.md" },
29
28
  { "kind": "skill-contains", "value": "**A join never creates an" },
30
29
  { "kind": "skill-contains", "value": "Inline code uses a tagged fence" },
31
30
  { "kind": "skill-contains", "value": "PLAY0690", "file": "references/reducer-identity.md" },