@cratis/pi 7.164.0 → 7.164.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-arc-react-page/references/from-screenplay.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +4 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/dictionaries-set-once-ordering.md +47 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -0
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +2 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +24 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/routes-and-external-operations.md +1 -1
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-delivery-planning/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-delivery-planning/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +16 -5
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +2 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +6 -6
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +13 -3
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/storylines.md +68 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +9 -1
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-model-review/verification.json +2 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +1 -1
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-projections/references/dictionaries-and-ordering.md +64 -0
- package/package/corpus/skills/cratis-screenplay-projections/references/graphs.md +99 -2
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +5 -0
- package/package/corpus/skills/cratis-screenplay-projections/verification.json +7 -1
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +4 -2
- package/package/corpus/skills/cratis-screenplay-read-surface/references/screen-levels.md +2 -2
- package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +8 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +5 -1
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +1 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/references/model-reasoning.md +1 -1
- package/package/corpus/skills/cratis-screenplay-specifications/references/graph-steps.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +5 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +52 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +3 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +14 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/model-export-diff-rename.md +68 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1557 -42
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +2 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +1 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +14 -1
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +1 -1
- package/package.json +1 -1
|
@@ -34,7 +34,7 @@ UI model/runtime in Stage output; read `cratis-stage-rendering-and-sandbox`
|
|
|
34
34
|
|
|
35
35
|
So no product source maps a `.play` screen to an Arc React page. A hand-written
|
|
36
36
|
page is a **gap-fill** (`cratis-screenplay-render-and-gap-fill`) with the `.play`
|
|
37
|
-
screen as its contract. Screens are deferred by
|
|
37
|
+
screen as its contract. Screens are deferred by default (an ESM v42 export admits only their data, actions, navigation and layout): that deferral
|
|
38
38
|
is information `PLAY0269` and does not block binding, but the authoring
|
|
39
39
|
diagnostics still apply (syntax, unresolved or ambiguous references), and
|
|
40
40
|
warnings fail a warnings-as-errors gate. A clean compile proves the model is
|
|
@@ -263,6 +263,10 @@ or a reactor rather than annotating the projection.
|
|
|
263
263
|
Their two optional arguments are in **opposite order**: `[FromAll(contextProperty,
|
|
264
264
|
property)]` and `[FromEvery(property, contextProperty)]`. Name them.
|
|
265
265
|
|
|
266
|
+
## Dictionary keys, set once and ordering
|
|
267
|
+
|
|
268
|
+
Requires Chronicle 19.150.0 (check the installed `Cratis.Chronicle` package). Fluent `.SetOnce(...)`, keyed `.Set/.Add/.Subtract/.Increment/.Decrement/.Count(m => m.Dict, e => key)`, `.RemoveKey(...)`, and children `.Prepend()`, `.OrderBy(...)`, `.OrderByDescending(...)`; model-bound `SetOnce = true`, `Prepend = true`, `OrderBy`/`OrderByDescending`. See [dictionaries, set once and ordering](references/dictionaries-set-once-ordering.md).
|
|
269
|
+
|
|
266
270
|
## Graph projections — nodes and edges
|
|
267
271
|
|
|
268
272
|
A graph projection turns events into idempotent operations on a property graph
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Dictionary keys, set once and children ordering (.NET)
|
|
2
|
+
|
|
3
|
+
Read this when a projection keeps a first value, writes one entry per key into a dictionary property, or keeps children in a chosen order.
|
|
4
|
+
Requires Chronicle 19.150.0 (check the installed `Cratis.Chronicle` package).
|
|
5
|
+
|
|
6
|
+
## Fluent
|
|
7
|
+
|
|
8
|
+
```csharp
|
|
9
|
+
builder
|
|
10
|
+
.From<ItemSold>(_ => _
|
|
11
|
+
.SetOnce(m => m.OriginalTitle).To(e => e.Title)
|
|
12
|
+
.SetOnce(m => m.Created).ToEventContextProperty(c => c.Occurred)
|
|
13
|
+
.Add(m => m.UnitsByCategory, e => e.Category).With(e => e.Quantity)
|
|
14
|
+
.Increment(m => m.SalesByCategory, e => e.Category)
|
|
15
|
+
.Count(m => m.SalesByUser, c => c.CausedBy.Subject)
|
|
16
|
+
.SetOnce(m => m.FirstSaleByCategory, e => e.Category).ToEventContextProperty(c => c.Occurred))
|
|
17
|
+
.From<ItemReturned>(_ => _
|
|
18
|
+
.Subtract(m => m.UnitsByCategory, e => e.Category).With(e => e.Quantity)
|
|
19
|
+
.Decrement(m => m.SalesByCategory, e => e.Category))
|
|
20
|
+
.From<CategoryRetired>(_ => _.RemoveKey(m => m.UnitsByCategory, e => e.Category))
|
|
21
|
+
.Children(m => m.Comments, children => children
|
|
22
|
+
.IdentifiedBy(c => c.CommentId)
|
|
23
|
+
.Prepend()
|
|
24
|
+
.From<CommentPosted>(_ => _.UsingKey(e => e.CommentId)))
|
|
25
|
+
.Children(m => m.Tasks, children => children
|
|
26
|
+
.IdentifiedBy(t => t.TaskId)
|
|
27
|
+
.OrderByDescending(t => t.Priority)
|
|
28
|
+
.From<TaskAdded>(_ => _.UsingKey(e => e.TaskId)));
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Model-bound
|
|
32
|
+
|
|
33
|
+
| Need | Attribute |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| Keep the first value | `SetOnce = true` on `[SetFrom<E>]` or `[SetFromContext<E>]` |
|
|
36
|
+
| Newest child first | `[ChildrenFrom<E>(key: ..., Prepend = true)]` |
|
|
37
|
+
| Sorted children | `[ChildrenFrom<E>(key: ..., OrderBy = nameof(Child.Prop))]` or `OrderByDescending = ...` |
|
|
38
|
+
|
|
39
|
+
A collection takes one ordering; different orderings or an unknown sort property fail at build time.
|
|
40
|
+
|
|
41
|
+
## Semantics
|
|
42
|
+
|
|
43
|
+
- A dictionary property must be a dictionary (or a property-less object); keys are strings. `Add`, `Subtract`, `Increment`, `Decrement` and `Count` use 64-bit integers.
|
|
44
|
+
- An event-content key must be non-empty, contain no `.`, `[`, `]` or NUL, and not start with `$`; a bad key fails the event and the partition shows the failure. Context and `CausedBy` keys are not checked (`john.doe` nests), so prefer `CausedBy.Subject`. A null or missing key skips the mapping; a key path the event type lacks fails at registration.
|
|
45
|
+
- `SetOnce` assigns again after the property was cleared to null.
|
|
46
|
+
- Equal sort values tie-break by child identifier ascending.
|
|
47
|
+
- Choose a projection over a reducer when the only state is a per-key map, a first value, or child order, with no branching on prior state.
|
|
@@ -34,6 +34,7 @@ Reverify product sources before claiming support for another version.
|
|
|
34
34
|
|
|
35
35
|
- Direct property mapping, counters and sums usually read best as projections.
|
|
36
36
|
Fluent definitions add mapping structure, not arbitrary per-event code.
|
|
37
|
+
- If the reducer would only key a dictionary, keep a first value or order children, use a projection (see [dictionaries, set once and ordering](../cratis-chronicle-projection/references/dictionaries-set-once-ordering.md)).
|
|
37
38
|
- Prior-state branches and guarded calculations often read best as reducers.
|
|
38
39
|
Explain the state-transition rule, rather than proving both projection APIs
|
|
39
40
|
incapable. Reducers fold per event source: no native cross-source joins,
|
|
@@ -6,6 +6,8 @@ license: MIT
|
|
|
6
6
|
|
|
7
7
|
# Use Lens against a running Arc application
|
|
8
8
|
|
|
9
|
+
Screenplay `user` declarations (`cratis-screenplay-command-surface`, "Users") are development identities Stage can offer to Lens when its development mode and explicit users switch are both on.
|
|
10
|
+
|
|
9
11
|
Lens is a Manifest V3 browser extension that impersonates a user and a tenant
|
|
10
12
|
against an Arc application you are developing, and executes that application's
|
|
11
13
|
commands and queries from a popup. It changes nothing in the application: it
|
|
@@ -208,7 +208,7 @@ Mapping sources that bind: a command property, a literal, `$context.occurred` an
|
|
|
208
208
|
|
|
209
209
|
## Routes and external operations
|
|
210
210
|
|
|
211
|
-
Commands never produce public events; external
|
|
211
|
+
Commands never produce public events; external operations stay unadmitted (`PLAY0268`); systems are admitted once any declares an ability (ESM v50). Read [references/routes-and-external-operations.md](references/routes-and-external-operations.md) when choosing routes, `stream` overrides, public or foreign events, or `system`/`uses`/`operation` declarations (see also [operation intent](references/operations.md)).
|
|
212
212
|
|
|
213
213
|
## `concurrency`
|
|
214
214
|
|
|
@@ -236,6 +236,8 @@ declaring a policy (including `require anonymous` for a deliberately public comm
|
|
|
236
236
|
A policy that decides from recorded state declares `reads <Model> [as alias] [by property]` and a state condition in `require`
|
|
237
237
|
(`plan.dataQuality == true`, `article.author == $identity.id`); an absent read denies. See the same reference, "Policies that decide from recorded state".
|
|
238
238
|
|
|
239
|
+
A `user` line names a development session identity and the personas it plays; see the same reference, "Users".
|
|
240
|
+
|
|
239
241
|
`authorize` says who may act; whether the command exists for the caller at all is `available`, with `provide` for `$context` values: `cratis-screenplay-availability`.
|
|
240
242
|
|
|
241
243
|
## Event data subject
|
package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
5
|
- `policy` and `persona`
|
|
6
|
+
- Users
|
|
6
7
|
- Anonymous policy
|
|
7
8
|
- Policy negation
|
|
8
9
|
- Policies that decide from recorded state
|
|
@@ -38,6 +39,29 @@ A `persona` is authoring metadata: the binder reports it as information `PLAY027
|
|
|
38
39
|
(report-only) and it does not block binding; an unknown policy it lists is an error.
|
|
39
40
|
Personas an `onboarding` block invites or grants must be declared here; see `cratis-screenplay-authentication-and-onboarding`.
|
|
40
41
|
|
|
42
|
+
## Users
|
|
43
|
+
|
|
44
|
+
Requires Screenplay 5.11.0 or later (`screenplay --version`). A `user` is a person a development or test session can act as: one top-level line naming the personas it plays. Personas are roles (`Accountant`); users are people (`kari`).
|
|
45
|
+
|
|
46
|
+
```screenplay
|
|
47
|
+
policy IsAccountant
|
|
48
|
+
require role "Accountant"
|
|
49
|
+
policy IsInvoiceManager
|
|
50
|
+
require role "InvoiceManager"
|
|
51
|
+
|
|
52
|
+
persona Accountant
|
|
53
|
+
policy IsAccountant
|
|
54
|
+
persona InvoiceManager
|
|
55
|
+
policy IsInvoiceManager
|
|
56
|
+
|
|
57
|
+
user kari "Kari Nordmann" as Accountant, InvoiceManager
|
|
58
|
+
user guest "Guest"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The name is the identity a session presents; the quoted display name is optional. A user plays only declared personas (`PLAY0888`), names are unique (`PLAY0889`), and a user with no persona is authenticated and holds no roles, which tests a signed-in person without access. A user holds the roles and claims its personas' policies give it.
|
|
62
|
+
|
|
63
|
+
Like `persona`, a user is syntax-only: it never enters the executable model, so the bytes and revision are unchanged and a model without users compiles as before. Users exist for tooling that exercises a running application; Stage offers them to Lens only when its development mode and its explicit users switch are both on, never in a published or rendered application.
|
|
64
|
+
|
|
41
65
|
## Anonymous policy
|
|
42
66
|
|
|
43
67
|
Requires Screenplay 4.231.0 (ESM v31; `screenplay --version`); older compilers reject
|
|
@@ -16,6 +16,6 @@ for the released ESM v9 boundary and quoted opaque origins.
|
|
|
16
16
|
|
|
17
17
|
Use `system`, `uses` and inline/standalone `operation` declarations to state
|
|
18
18
|
external work in the authored production sequence, with execute/compensate phase
|
|
19
|
-
intent.
|
|
19
|
+
intent. Operations remain unadmitted (PLAY0268), as do systems when no system declares an ability (any ability admits every system at ESM v50); none are post-commit reactions. Read
|
|
20
20
|
[operation intent](operations.md) for forms, boundaries and checked
|
|
21
21
|
failure/compensation specification syntax.
|
|
@@ -114,6 +114,8 @@
|
|
|
114
114
|
{ "kind": "skill-contains", "value": "PLAY0682", "file": "references/generated-values-and-responses.md" },
|
|
115
115
|
{ "kind": "skill-contains", "value": "zero trailing bits", "file": "references/generated-values-and-responses.md" },
|
|
116
116
|
{ "kind": "skill-contains", "value": "STAGE-ESM-038", "file": "references/generated-values-and-responses.md" },
|
|
117
|
-
{ "kind": "skill-contains", "value": "file Validations/AllowedEmailDomain.cs", "file": "references/validate-rules.md" }
|
|
117
|
+
{ "kind": "skill-contains", "value": "file Validations/AllowedEmailDomain.cs", "file": "references/validate-rules.md" },
|
|
118
|
+
{"kind":"skill-contains","value":"`PLAY0888`","file":"references/policy-persona-seed.md"},
|
|
119
|
+
{"kind":"skill-contains","value":"user kari","file":"references/policy-persona-seed.md"}
|
|
118
120
|
]
|
|
119
121
|
}
|
|
@@ -113,6 +113,6 @@ provides a claim tool such as `issue_work`, its claim step is that guard.
|
|
|
113
113
|
- `references/provenance.md` - sources and what was not adopted.
|
|
114
114
|
|
|
115
115
|
## Related skills
|
|
116
|
-
`cratis-screenplay-slice-design` (slice dependencies), `cratis-screenplay-model-authoring`
|
|
116
|
+
after a model change, `slices` from `screenplay diff --format json` (with `modelWide` and `affectedSlices`) scopes the re-planning; `screenplay export --scope <slice>` hands one slice's executable model to a builder and `screenplay diff` lists what changed ([CLI reference](../cratis-screenplay-toolchain/references/model-export-diff-rename.md)); `cratis-screenplay-slice-design` (slice dependencies), `cratis-screenplay-model-authoring`
|
|
117
117
|
(MCP navigation), `cratis-screenplay-render-and-gap-fill` (what renders, gap-fill handoff),
|
|
118
118
|
`cratis-screenplay-modeling-lifecycle` (phases and gates).
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
{ "kind": "skill-contains", "value": "Never quote an accuracy", "file": "SKILL.md" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "Estimate fit", "file": "references/velocity-and-capacity.md" },
|
|
13
13
|
{ "kind": "skill-contains", "value": "Wave 1", "file": "references/parallel-delivery.md" },
|
|
14
|
-
{ "kind": "skill-contains", "value": "One GitHub issue per slice group", "file": "references/parallel-delivery.md" }
|
|
14
|
+
{ "kind": "skill-contains", "value": "One GitHub issue per slice group", "file": "references/parallel-delivery.md" },
|
|
15
|
+
{"kind":"skill-contains","value":"--scope <slice>"},
|
|
16
|
+
{"kind":"skill-contains","value":"affectedSlices"}
|
|
15
17
|
]
|
|
16
18
|
}
|
package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Parsed is not runnable: ESM versions and dispositions
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Which ESM version a model needs
|
|
6
|
+
- Dispositions to keep apart
|
|
7
|
+
- The Step 7 clock example
|
|
8
|
+
- Trigger reads and event generations
|
|
9
|
+
- What binds depends on which tool
|
|
10
|
+
- A CLI and Stage that admit v15
|
|
11
|
+
|
|
3
12
|
Checked: `SemanticModelBinder.cs`, `Versions.cs`,
|
|
4
13
|
`Documentation/screenplay/{commands,operations,event-sources,reactions,tool,interoperability}.md`.
|
|
5
14
|
The binder selects v8 for event routes, v10 for declared reaction identity, v11 for retained
|
|
@@ -23,8 +32,10 @@ Tool versions and consumer boundaries: toolchain `SKILL.md`.
|
|
|
23
32
|
Reasons remain report-only PLAY0270; binding proves neither encryption nor erasure.
|
|
24
33
|
- v17 for `when redelivered` and `then no events`; v19 for reaction
|
|
25
34
|
refusal branches and `$refusal` values. Older compilers report PLAY0268.
|
|
26
|
-
- Operations
|
|
27
|
-
(PLAY0268)
|
|
35
|
+
- Operations and the exact numeric **source mode** (`numbers exact`) remain unadmitted
|
|
36
|
+
(PLAY0268), as do systems when no system in the model declares an ability. Once any system
|
|
37
|
+
declares one, every system is admitted at ESM v50 and an ability invocation selects v51.
|
|
38
|
+
Version allocation is not inferred from an older planning decision.
|
|
28
39
|
|
|
29
40
|
## Dispositions to keep apart
|
|
30
41
|
|
|
@@ -41,7 +52,7 @@ Tool versions and consumer boundaries: toolchain `SKILL.md`.
|
|
|
41
52
|
| Declared reaction invocation actor | v10 binding/reference execution; older CLI parser PLAY0137; Stage renders role/authenticated reaction identity; claim-reading/opaque gates retain STAGE-ESM-034, not a v10 version refusal |
|
|
42
53
|
| Redelivery and `then no events` | v17 binding/reference execution; older compilers refuse PLAY0268 |
|
|
43
54
|
| Reaction refusal branches and `$refusal` | v19 binding/reference execution; older compilers refuse PLAY0268 |
|
|
44
|
-
| Operations
|
|
55
|
+
| Operations, systems in a model with no ability, `numbers exact` source mode | Source accepted; whole binding refuses PLAY0268 |
|
|
45
56
|
| UI | Authoring/deferred metadata; runtime support is a separate consumer contract |
|
|
46
57
|
|
|
47
58
|
Run standalone `screenplay test` or MCP `run-specifications` for V4. Compile
|
|
@@ -83,8 +94,8 @@ accepted proposal or parsed node with a running application.
|
|
|
83
94
|
and command/specification routes as v8; reaction `runs as` identity as v10;
|
|
84
95
|
qualifying Double literals lower exactly as v11 and non-positional enum numbers
|
|
85
96
|
as v12. Use `screenplay test` or MCP `run-specifications` for V4.
|
|
86
|
-
Operations
|
|
87
|
-
(PLAY0268); redelivery/no-event assertions execute as v17 and refusals as v19. The CLI and Stage render supported generation strategies and v15 freshness,
|
|
97
|
+
Operations and the `numbers exact` **source mode** remain unadmitted, as do systems when no
|
|
98
|
+
system declares an ability (PLAY0268; any ability admits all systems at v50); redelivery/no-event assertions execute as v17 and refusals as v19. The CLI and Stage render supported generation strategies and v15 freshness,
|
|
88
99
|
scalar/named responses, enum numbers, compliance and supported event reactions.
|
|
89
100
|
The pair reaches construct checks through the ESM version it bundles, not blanket rendering; supported v14 filters
|
|
90
101
|
render. Current boundaries and source evidence:
|
|
@@ -35,6 +35,8 @@ still need binding and otherwise substitute their own slice. Inspect
|
|
|
35
35
|
ambiguous identities; fix parse/placement errors first. Read the notes reference
|
|
36
36
|
for refusals, `ambiguous: true`, typed targets and every `substitutions` entry.
|
|
37
37
|
|
|
38
|
+
Read [storylines](references/storylines.md) to name a journey across modules, features and slices.
|
|
39
|
+
|
|
38
40
|
## Choosing a strategy
|
|
39
41
|
|
|
40
42
|
Read [shop strategies and entropy](references/choosing-generation.md) before
|
package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md
CHANGED
|
@@ -21,9 +21,9 @@ repository is the full list; this page is the authoring summary.
|
|
|
21
21
|
|
|
22
22
|
## Accepted constructs
|
|
23
23
|
|
|
24
|
-
**Top level:** `domain`, `import`, `concept`, `type`, `policy`, `persona`,
|
|
25
|
-
`authentication`, `identity`, `purpose`, `trigger`, `design system` (one per application: `modes`, `default theme`, `tokens`, `components`, `words`, `rules`), `theme` (`implements`, `compatible with`, `palette`, `values`, a block per mode), `layout`, `ui profile`, `behavior`,
|
|
26
|
-
`sink`, `module`, `seed`, authoring-only
|
|
24
|
+
**Top level:** `domain`, `import`, `concept`, `type`, `policy`, `persona`, `user` (development identity; [users](../../cratis-screenplay-command-surface/references/policy-persona-seed.md#users)),
|
|
25
|
+
`authentication`, `identity`, `purpose`, `storyline` (authoring-only; [storylines](storylines.md)), `trigger`, `design system` (one per application: `modes`, `default theme`, `tokens`, `components`, `words`, `rules`), `theme` (`implements`, `compatible with`, `palette`, `values`, a block per mode), `layout`, `ui profile`, `behavior`,
|
|
26
|
+
`sink`, `module`, `seed`, `system` (admitted at ESM v50 once any system declares an ability; otherwise authoring-only), and admitted `eventsource` with its `stream`s (ESM v8).
|
|
27
27
|
|
|
28
28
|
**Inside a module:** `description`, `authorize`, `import "<glob>"`,
|
|
29
29
|
`screen`/`dialog` templates, `form`, `contribute`, `on`/`uses` behavior
|
|
@@ -305,7 +305,7 @@ See read-surface `references/named-keys.md` for the collection-key exclusion alg
|
|
|
305
305
|
| Binds as opaque code (v3); reference runner reports unsupported | Bodied reducers, bodied named rules, fenced `validate` blocks, code or file policies. A pure reducer body is the only attachment Stage admits |
|
|
306
306
|
| Information only, never blocks | `persona` (report-only: `PLAY0270`, the policies it lists must exist), `authentication`, `onboarding` (see `cratis-screenplay-authentication-and-onboarding`), `domain`, `seed`, descriptions and `file` provenance. A persona does not block binding and does not change behavior, so state persona scope in a description or a policy the model uses |
|
|
307
307
|
| Binds as ESM v7 (`PLAY0268` on a compiler that stops before v7) | `generated` properties and `returns` responses, generated fixtures and `then returns`: bound and executed by the reference runner; a policy, rule or requirement that references a generated value is `PLAY0273`, and generated-concept rules select v20 with PLAY0688/0689 proof diagnostics. Stage renders supported UUID/String strategies, scalar/named responses and fixtures; unsupported types/result combinations remain `-028`/`-038` |
|
|
308
|
-
| Authorable, not executable (PLAY0268) |
|
|
308
|
+
| Authorable, not executable (PLAY0268) | Operations, systems when no system declares an ability (any ability admits every system at v50), the `numbers exact` source mode (PLAY0268; exact lowering of qualifying Double literals is the admitted v11) remain unadmitted |
|
|
309
309
|
| Concept generation strategies (ESM v15) | Required scalar generatable Uuid/String concepts; concept-owned uuid/uuidv7/ulid/typeid/nanoid/bytes strategies and admitted modifiers. Strict fixture encoding; Guarded whole-source freshness rejects Concurrency with no append/retry. Generated secrets and sequence remain refused; generated-concept rules select v20, pattern/random/rule and checksum validation select v21. Stage renders supported strategies: command-surface `references/generated-values-and-responses.md` |
|
|
310
310
|
| Response-name UI continuations (no ESM change) | Form submit and execute-success scopes, own failure PLAY0685, nested shadowing and outer success in inner failure; field/parameter precedence. An older bundled compiler lacks resolution; Scene runtime binding remains downstream. UI composition `references/response-continuations.md` |
|
|
311
311
|
| Collection equality filters (ESM v14) | Caller-supplied `filter name Type [optional]`, no `from`, matching a same-named scalar primitive/concept/enum read-model property with the same nominal type. AND with `by`; optional omission does not narrow, supplied null is refused. PLAY0468 covers unknown/repeated/missing required spec arguments; result rows compare by read-model/key regardless of order. Read read-surface `references/equality-filters.md` for the compiled example and renderer ceilings |
|
|
@@ -323,7 +323,7 @@ See read-surface `references/named-keys.md` for the collection-key exclusion alg
|
|
|
323
323
|
| Blocks binding (`PLAY0268`) | enum/identity compliance and events combining personal or explicitly subject-scoped secret values with explicit subject marks; a compiler that stops before v13 refuses all `pii`/`secret` concepts ("compliance attributes require portable data-subject semantics"), while v13 binds them and Stage renders protection; bare `rule <Name>`, read paths without protected opt-in or in unsupported positions such as `produces when`, date comparisons with mixed primitives, optional condition operands, `$context`, protected read paths or `today`, date rules on concepts or reaction `where`, `$context.tenant`/claims/roles/causation in `produces`, `$env` conditions, `file` constraints, unquoted `import` of an external contract, a read model with neither explicit `key` nor unambiguous query-based identity as described above (several key marks bind as v27; older binders refuse PLAY0268; toolchain `language-admission.md`), queries with context `from` sources (typed query context is unadmitted), single-result filters (collections only), `scoped to` (opaque scope) or a `by` block on a list query or non-optional single result (a `performer` query is not refused: it is an opaque read, PLAY0270, left out of the executable model; [version gate](../../cratis-screenplay-toolchain/references/executable-subset.md#code-attachments-what-binds-what-never-does)); optional keyed and collection queries, including caller-supplied equality filters and observable delivery, bind, `$causedBy` and templates in projections |
|
|
324
324
|
| Blocks binding (`PLAY0800`) | Attached file/inline command `handler` with no unconditional `produces`, with `produces ... when`, or with an unresolved body. Beside unconditional `produces` with a resolved body it binds as the v23 result contract, and pending described intent also binds v23 (command-surface `references/described-handlers.md` has the compiler gate). Read required typed `arguments.subject` for the command, never parse the message. Compiler prerequisite and older PLAY0268 attribution: [diagnostic arguments](../../cratis-screenplay-toolchain/references/diagnostic-arguments.md) |
|
|
325
325
|
| Blocks binding (`PLAY0271`, legacy meaning) | Command reads without protected opt-in and `concurrency`; combined protected reads/concurrency is PLAY0783 |
|
|
326
|
-
| Deferred (`PLAY0269`, information) | Screens, layouts, templates, forms, contributions, UI profiles, themes, behaviors and `on`/`uses` |
|
|
326
|
+
| Deferred by default (`PLAY0269`, information; screens admitted on request as ESM v42 with `--screens`) | Screens, layouts, templates, forms, contributions, UI profiles, themes, behaviors and `on`/`uses` |
|
|
327
327
|
| Metadata only (`PLAY0270`, information) | `domain`, `seed`, `persona`, trigger and other descriptions, and `file` provenance on declarations |
|
|
328
328
|
|
|
329
329
|
The table is a snapshot, not a contract: ask the binder (MCP `executable-diagnostics`
|
|
@@ -349,7 +349,7 @@ full historical shapes, not deployed-schema immutability or a working migrator.
|
|
|
349
349
|
Code attachment/source-map support likewise does not prove code round-trip
|
|
350
350
|
execution equivalence.
|
|
351
351
|
|
|
352
|
-
Operations remain authorable/unadmitted (PLAY0268). Named event sources/streams
|
|
352
|
+
Operations remain authorable/unadmitted (PLAY0268); systems are admitted once any system declares an ability. Named event sources/streams
|
|
353
353
|
and routes bind and reference-execute as v8; reaction identity as v10.
|
|
354
354
|
Use standalone `screenplay test` or MCP `run-specifications` for a reference
|
|
355
355
|
verdict, and independently check CLI/Stage admission. Never drop a contract to bind.
|
|
@@ -234,7 +234,7 @@ connection. Passing `open-workspace.path` does **not** avoid it, because the err
|
|
|
234
234
|
| Repair | `PLAY0166`, `0478`, `0469`, `0471`, `0479`, `0516`, `0563`, `0564`, `0565`, `0614`, `0653`, `0683`, `0684` (and recipe-only `0397`); `PLAY0470` only with author intent ([destination intent repair](destination-intent-repair.md)) | `propose-repair` with `formatting`; PLAY0166/0478 may pin attachment evidence (`pinRepairEvidence` and `expectedRepairEvidenceRevision`), never fix-all PLAY0478 |
|
|
235
235
|
| Inline event extraction | `produces event ...` to a declared event | `propose-extract-inline-event` |
|
|
236
236
|
| Parser-invalid document | no editable handles | `propose-source` `replace-document` with corrected source, or typed `propose-ast` document replacement |
|
|
237
|
-
| Unadmitted constructs |
|
|
237
|
+
| Unadmitted constructs | operations, systems when no system declares an ability, the `numbers exact` source mode | reviewed Authoring `propose-source` (whole documents) or `propose-ast` (typed edits); preserve intent and report PLAY0268 |
|
|
238
238
|
| Admitted source/stream routing | ESM v8 | typed `propose-ast`; `propose-rename` repairs proven route references; target admission separate |
|
|
239
239
|
|
|
240
240
|
PLAY0683/PLAY0684 repairs raise NanoID size or bytes count to at least 64 random
|
|
@@ -67,7 +67,7 @@ the [MCP loop](mcp-loop.md).
|
|
|
67
67
|
| Group | Tools | Intent |
|
|
68
68
|
| --- | --- | --- |
|
|
69
69
|
| Understanding | `describe-application`, `search-declarations`, `find-declaration`, `declaration-details`, `list-storylines` (one optional argument) | Navigate logical hierarchy, inspect bounded details and list storylines |
|
|
70
|
-
| References and examples | `find-references`, `dependencies`, `dependency-graph`, `find-fixtures`, `find-assertion-gaps`, `find-specification-obligations`, `find-modeling-smells`, `trace-lineage`, `semantic-diff` | Inspect declared relationships and authored examples, not executed coverage |
|
|
70
|
+
| References and examples | `list-storylines`, `find-references`, `dependencies`, `dependency-graph`, `find-fixtures`, `find-assertion-gaps`, `find-specification-obligations`, `find-modeling-smells`, `trace-lineage`, `semantic-diff` | Inspect declared relationships and authored examples, not executed coverage |
|
|
71
71
|
| Source and validation | `diagnostics`, `ui-profiles` (also the design system, themes and resolved values per mode), `read-document`, `merged-document`, `syntax-schema` | Read exact source or typed structure and diagnose problems |
|
|
72
72
|
| Workspace inspection | `open-workspace`, `read-workspace`, `read-ast`, `workspace-state`, `export-workspace`, `repair-capabilities` | Obtain current identities, handles, readiness, code attachment requirements, source-map locations, durable-state status and the repair catalog |
|
|
73
73
|
| Visual (MCP-Apps hosts only) | `visualize-model` | Draw the board for the model or a `proposalId`; its `sketch` argument previews a what-if of whole documents. Reads only |
|
|
@@ -396,7 +396,7 @@ leave the event standalone; never work around it with text edits.
|
|
|
396
396
|
|
|
397
397
|
Requires Screenplay 4.223.0 (`screenplay --version`) for `trace-lineage`.
|
|
398
398
|
|
|
399
|
-
`trace-lineage` takes a read-model property `address` and returns a paged tree
|
|
399
|
+
Requires Screenplay 6.6.0 or later (`screenplay --version`) for `direction` and for command, event and screen-field addresses. `trace-lineage` takes a property `address` (a command, event or read-model property: the owner's address and the member; or a screen field: the screen's or form's address and the bound property) and a `direction` (`upstream`, `downstream` or `both`, the default). Downstream a command property goes to the event properties its productions set, to the read-model properties its projections set (and the command properties a reaction's `invokes` sets), then to the queries and screens that show it; a form input field has only downstream hops and a shown field only upstream ones; a command with a `handler` stops at `opaque`. Hops carry `id`, `parent`, `depth`, `direction`, `role`, `status`, `kind`, `address`, `location` (and, for projections, `mode` and `block`). It returns a paged tree
|
|
400
400
|
(`limit`, `offset`) from the property through projection or reducer mappings, joins and
|
|
401
401
|
child mappings to the event property, then to the producing command property or capture
|
|
402
402
|
source. A broken hop is reported where the chain breaks, several sources appear as
|
|
@@ -405,6 +405,16 @@ advisory.
|
|
|
405
405
|
|
|
406
406
|
Requires Screenplay 4.153.0 or later (`screenplay --version`) for `propose-rename` to consult release-baseline mutability; before it, `propose-rename` pins the previous effective name without a baseline.
|
|
407
407
|
|
|
408
|
+
`read-workspace` with `view: "executable-model"` and `screens: true` admits screens (ESM v42; Screenplay 6.8.0 or later); a reference the model does not hold is refused with `ScreensRefused`.
|
|
409
|
+
|
|
410
|
+
`read-workspace` also pages `view: "api-description"` (OpenAPI 3.1) and `view: "ui-contract"` (`screenplay-ui/1`) like `executable-model`; `api-description` is unavailable (`available: false`) without an executable model (Screenplay 6.5.0 or later).
|
|
411
|
+
|
|
412
|
+
`semantic-diff` results carry `slices`, the per-slice change summary (`slices`, `modelWide`, `affectedSlices`; Screenplay 6.2.0 or later); the tool count is unchanged.
|
|
413
|
+
|
|
414
|
+
`syntax-schema` exposes graph query collects as `GraphQuerySyntax.collects` (`GraphCollectSyntax` with `property`, `from`, `hop`, `returns`; Screenplay 6.29.0 or later, `screenplay --version`); `propose-ast` adds, replaces and removes them through the ordinary typed operations, and the member is omitted when a query collects nothing.
|
|
415
|
+
|
|
416
|
+
`screenplay rename` is the scriptable, identity-preserving alternative to `propose-rename` plus `apply` (Screenplay 6.1.0 or later; see [export, compare and rename](../../cratis-screenplay-toolchain/references/model-export-diff-rename.md)).
|
|
417
|
+
|
|
408
418
|
`propose-rename` consults release-baseline mutability: without a
|
|
409
419
|
baseline it conservatively pins the previous effective name; an unadmitted event
|
|
410
420
|
gets no new pin, while any admitted revision requires preserving its stored name.
|
|
@@ -487,7 +497,7 @@ cannot rename a part through `propose-rename`. Operations and
|
|
|
487
497
|
exact numeric mode remain unadmitted. Check installed schemas, especially when
|
|
488
498
|
the CLI bundle predates the standalone tool.
|
|
489
499
|
|
|
490
|
-
|
|
500
|
+
Operations remain authoring-only (PLAY0268), as do systems when no system declares an ability; any ability admits every system at ESM v50. Sources/streams and their
|
|
491
501
|
routes are admitted v8, not syntax-only; see toolchain `references/sources-and-streams.md`.
|
|
492
502
|
`generated` properties and `returns` responses are admitted as ESM v7 and bind. The server reads and edits them: `declaration-details` exposes `isGenerated`
|
|
493
503
|
and a command `response` view, `route` and `streams` views; `read-workspace` offers
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
4
|
+
# Storylines
|
|
5
|
+
|
|
6
|
+
Read this when a journey that crosses several modules, features and slices must be named, reviewed or walked step by step.
|
|
7
|
+
Requires Screenplay 6.6.0 or later (`screenplay --version`).
|
|
8
|
+
|
|
9
|
+
A `storyline` is authoring metadata: the executable model, the semantic revision and every generated artifact are identical with or without it.
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
storyline <Name> ["<title>"]
|
|
13
|
+
[description "<text>"]
|
|
14
|
+
<kind> <reference> ["<note>"]*
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- `<Name>` is unique among the application's storylines (`PLAY0943`); the optional title is what a board shows.
|
|
18
|
+
- `<kind>` is `module`, `feature`, `slice`, `command`, `event`, `readmodel`, `query`, `screen` or `reaction`; line order is path order.
|
|
19
|
+
- `<reference>` is the element's name; qualify it (`Returns.Requests`, `Requests.RequestReturn`) when several elements of that kind match (`PLAY0198`, warning).
|
|
20
|
+
- A storyline is declared at the top level, in exactly one file of a folder model.
|
|
21
|
+
|
|
22
|
+
```screenplay expect PLAY0533
|
|
23
|
+
concept ItemId : Uuid
|
|
24
|
+
|
|
25
|
+
module Returns
|
|
26
|
+
feature Requests
|
|
27
|
+
slice StateChange RequestReturn
|
|
28
|
+
command RequestReturn
|
|
29
|
+
itemId ItemId
|
|
30
|
+
produces ReturnRequested
|
|
31
|
+
itemId = itemId
|
|
32
|
+
|
|
33
|
+
event ReturnRequested
|
|
34
|
+
itemId ItemId
|
|
35
|
+
|
|
36
|
+
slice StateView PendingReturns
|
|
37
|
+
readmodel PendingReturn
|
|
38
|
+
itemId ItemId
|
|
39
|
+
|
|
40
|
+
projection PendingReturn
|
|
41
|
+
from ReturnRequested
|
|
42
|
+
key itemId
|
|
43
|
+
|
|
44
|
+
query AllPending => PendingReturn[]
|
|
45
|
+
|
|
46
|
+
storyline ReturnAnItem "A customer returns an item"
|
|
47
|
+
description "From the request to the list the warehouse works from"
|
|
48
|
+
feature Returns.Requests
|
|
49
|
+
command RequestReturn "The customer asks to return the item"
|
|
50
|
+
event ReturnRequested
|
|
51
|
+
readmodel PendingReturn
|
|
52
|
+
query AllPending "The warehouse sees the return"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Diagnostics
|
|
56
|
+
|
|
57
|
+
| Code | Severity | Meaning |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `PLAY0940` | Error | Malformed `storyline` declaration |
|
|
60
|
+
| `PLAY0941` | Error | A step is not `<kind> <reference> ["<note>"]`, has an unknown kind, or has a line nested under it |
|
|
61
|
+
| `PLAY0942` | Warning | A step names no element; remove it or point it at its replacement |
|
|
62
|
+
| `PLAY0943` | Error | Two storylines carry the same name |
|
|
63
|
+
|
|
64
|
+
## Renames and tools
|
|
65
|
+
|
|
66
|
+
- Renaming or moving an element rewrites the steps that name it (`propose-rename`, `screenplay rename`).
|
|
67
|
+
- MCP `list-storylines` (optional `name`) lists each storyline's steps with kind, reference, note and the resolved element's kind, address, location and semantic id, or `missing` / `ambiguous`.
|
|
68
|
+
- Storylines are AST nodes (`StorylineSyntax`, `StorylineStepSyntax`): `read-ast` reads them; `propose-ast` and `propose-source` edit them. `search-declarations` and `declaration-details` use kind `Storyline`; `export-workspace` keeps them.
|
|
@@ -268,6 +268,14 @@
|
|
|
268
268
|
{ "kind": "skill-contains", "value": "`sink`, `module`, `seed`", "file": "references/language-reference.md" },
|
|
269
269
|
{ "kind": "skill-contains", "value": "| `PLAY0937` | Warning | A repeated identical `sink` line |", "file": "references/language-reference.md" },
|
|
270
270
|
{ "kind": "skill-contains", "value": "`ReadModelSyntax.sink` and `GraphSyntax.sink` hold the chosen name", "file": "references/language-reference.md" },
|
|
271
|
-
{ "kind": "skill-contains", "value": "repaired occurrence by occurrence, never by message text or in bulk" }
|
|
271
|
+
{ "kind": "skill-contains", "value": "repaired occurrence by occurrence, never by message text or in bulk" },
|
|
272
|
+
{ "kind": "skill-contains", "value": "GraphCollectSyntax", "file": "references/mcp-tools.md" },
|
|
273
|
+
{"kind":"skill-contains","value":"screenplay rename","file":"references/mcp-tools.md"},
|
|
274
|
+
{"kind":"skill-contains","value":"ScreensRefused","file":"references/mcp-tools.md"},
|
|
275
|
+
{"kind":"skill-contains","value":"api-description","file":"references/mcp-tools.md"},
|
|
276
|
+
{"kind":"skill-contains","value":"`slices`","file":"references/mcp-tools.md"},
|
|
277
|
+
{"kind":"skill-contains","value":"list-storylines","file":"references/mcp-tools.md"},
|
|
278
|
+
{"kind":"skill-contains","value":"storyline ReturnAnItem","file":"references/storylines.md"},
|
|
279
|
+
{"kind":"skill-contains","value":"`direction`","file":"references/mcp-tools.md"}
|
|
272
280
|
]
|
|
273
281
|
}
|
|
@@ -66,6 +66,7 @@ model's behalf.
|
|
|
66
66
|
or literal, to the screen, reaction or integration that supplies it. Trace a field with the
|
|
67
67
|
`screenplay` MCP server's `trace-lineage` tool (paged tree, breaks, branches and opaque hops
|
|
68
68
|
are reported) rather than stitching `dependencies` calls; confirm each hop in the model.
|
|
69
|
+
Trace both directions (`direction`: `upstream`, `downstream`, `both`); `screenplay lineage <address> [PATH] [--direction ...] [--format json]` prints the same tree for scripts (exit 0 complete, 1 breaks, 2 cannot run; Screenplay 6.6.0 or later for command, event and screen-field addresses).
|
|
69
70
|
Requires Screenplay 4.223.0 (`screenplay --version`); on older releases use `dependencies`. AutoMap fills same-named
|
|
70
71
|
fields silently: count them. Forward: every event to a consumer or a terminal reason; every
|
|
71
72
|
command input to an event field or a rule. Before calling data missing, search the model.
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
{ "kind": "skill-contains", "value": "could a non-technical product owner read it and immediately understand" },
|
|
25
25
|
{ "kind": "skill-contains", "value": "a \"simple relay\" is not exempt from having pending work" },
|
|
26
26
|
{ "kind": "skill-contains", "value": "| H5 | Sinks: every declared `sink` is used by a read model or graph (`PLAY0938`), names differ ignoring case (`PLAY0932`)", "file": "references/checklist.md" },
|
|
27
|
-
{ "kind": "skill-contains", "value": "no read model exposes a `secret` concept", "file": "references/mode-compliance.md" }
|
|
27
|
+
{ "kind": "skill-contains", "value": "no read model exposes a `secret` concept", "file": "references/mode-compliance.md" },
|
|
28
|
+
{"kind":"skill-contains","value":"screenplay lineage"}
|
|
28
29
|
]
|
|
29
30
|
}
|
package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md
CHANGED
|
@@ -23,7 +23,7 @@ speaks in them; never model board mechanics (lanes, node ids, positions).
|
|
|
23
23
|
| Role permission ("Cannot") | `policy` + `authorize` + `then denied` spec; ownership via `claim ... matches subject` | `[Authorize(Policy)]`, generated policies | authorization |
|
|
24
24
|
| Precondition on stream state | `command reads protected` + eligible `reads`/`require` (v25 reference protection); legacy/refused reads remain stated intent. the Cratis renderer renders protected reads as Arc read protection once the CLI bundles a Stage that supports it (older bundles refuse them with STAGE-ESM-044; releases in command-surface `references/protected-reads.md`); semantic-engine execution is separate from generated-app protection. Target Arc `[ProtectedDecision]` + `DecisionRead<T>` or Chronicle DCB needs separate verification | decision over a guarded read | command validation |
|
|
25
25
|
| Generated id (`derived:uuid4()`) | `generated` (authorable, not executable) | id supplied before `Handle()` | commands |
|
|
26
|
-
| External system / outbound call | `Translate` slice (inbound); `system
|
|
26
|
+
| External system / outbound call | `Translate` slice (inbound); `system` with abilities (admitted ESM v50), `operation` (authorable, not executable) or Automation (outbound) | `ICommandOperation` / reactor | operations, reactors |
|
|
27
27
|
| HTML mockup | `screen` Level 1 + board (`visualize-model`) | default Scene composition | ui composition |
|
|
28
28
|
| Event sequence / inbox, outbox / observer | event source `for` identity / not modeled in `.play` (record as target) / `reaction` or projection | event sequence / inbox, outbox / observer | event sources, observers |
|
|
29
29
|
| Ready (corpus behaviour lifecycle) | P6 accepted on a source identity | n/a | n/a |
|
|
@@ -201,6 +201,7 @@ nested billingContact
|
|
|
201
201
|
- **`nested <property>`** — a single nullable object. It **must** contain at least
|
|
202
202
|
one `from` (error `PLAY0067`), and `clear with <Event>` drops the whole object
|
|
203
203
|
back to null. To clear one property instead, use a `clear <property>` mapping.
|
|
204
|
+
- **Ordering, `set once` and dictionary keys**: a `children` block may carry `insert first` or `sort by <property>`; `set once` keeps a first value; a target may end in `.$eventContent.<path>`. See [dictionaries and ordering](references/dictionaries-and-ordering.md).
|
|
204
205
|
|
|
205
206
|
## Removal
|
|
206
207
|
|
package/package/corpus/skills/cratis-screenplay-projections/references/dictionaries-and-ordering.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Set once, dictionary keys and children ordering
|
|
2
|
+
|
|
3
|
+
Read this when a projection must keep the first value of a property, write one entry per key into a dictionary, or keep children in a chosen order.
|
|
4
|
+
Requires Screenplay 6.9.0 or later (`screenplay --version`); a model that uses `set once` or an ordered `children` block selects ESM v43.
|
|
5
|
+
|
|
6
|
+
## Set once
|
|
7
|
+
|
|
8
|
+
`set once <property> = <expression>` (or `to`) assigns only while the property is missing or null; later events leave it. It is replay-stable and works in `from`, `every`, `all` and `with` blocks. A property named `once` is written `set @once = ...`.
|
|
9
|
+
|
|
10
|
+
```screenplay excerpt
|
|
11
|
+
from ModelDefined
|
|
12
|
+
name = name
|
|
13
|
+
set once createdBy = $causedBy.subject
|
|
14
|
+
set once createdAt = $eventContext.occurred
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Choose it over a reducer when the only state needed is the first value ("created by", "created at").
|
|
18
|
+
|
|
19
|
+
## Dictionary keys
|
|
20
|
+
|
|
21
|
+
A target may end in a dynamic key: `<property>.$eventContent.<path>`, `.$eventContext.<path>` or `.$causedBy.subject|name|userName`. The value the key reads becomes the dictionary key. Assignment, `set once`, `increment`, `decrement`, `count`, `add`, `subtract` and `remove` all accept one.
|
|
22
|
+
|
|
23
|
+
```screenplay excerpt
|
|
24
|
+
from SlotAssigned
|
|
25
|
+
slots.$eventContent.slot = series
|
|
26
|
+
count assignmentsByUser.$causedBy.userName
|
|
27
|
+
from SlotDropped
|
|
28
|
+
remove slots.$eventContent.slot
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `remove <target>` deletes the entry; the target must end in a dynamic key (`PLAY0956`). Removing an absent key does nothing. Escape a property named `with` or `via`: `remove @with.$eventContent.slot`.
|
|
32
|
+
- `clear <target>` with a dynamic key is an error (`PLAY0963`); write `remove`.
|
|
33
|
+
- Screenplay has no dictionary type, so a dynamic key on a property the read model declares is a warning (`PLAY0962`). Dictionary entries are for projections whose read model lives in application code. The reference evaluator does not run them and reports `PLAY0268` for those lines.
|
|
34
|
+
- Prefer `$causedBy.subject` for identity keys; the other members are not checked for characters such as `.`.
|
|
35
|
+
|
|
36
|
+
## Children ordering
|
|
37
|
+
|
|
38
|
+
One ordering line directly inside a `children` block: `insert last` (the default), `insert first`, or `sort by <property> [ascending|descending]`.
|
|
39
|
+
|
|
40
|
+
```screenplay excerpt
|
|
41
|
+
children lineItems identified by lineNumber
|
|
42
|
+
sort by quantity descending
|
|
43
|
+
from InvoiceLineItemAdded key lineNumber
|
|
44
|
+
parent invoiceId
|
|
45
|
+
quantity = quantity
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- The order is stored and applied when a child is added; updating a child never moves it. The sort is stable, a missing value sorts first ascending and last descending, and a dotted path is allowed.
|
|
49
|
+
- Two ordering lines in one block are `PLAY0959`; an ordering line outside `children`, with indented lines or malformed is `PLAY0958`; a `sort by` property the child type does not declare is a warning (`PLAY0960`).
|
|
50
|
+
|
|
51
|
+
## Diagnostics
|
|
52
|
+
|
|
53
|
+
| Code | Severity | Meaning |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `PLAY0956` | Error | `remove <target>` without a dynamic key |
|
|
56
|
+
| `PLAY0957` | Error | `.$eventContent` without a path, or a `.$causedBy` member other than `subject`, `name`, `userName` |
|
|
57
|
+
| `PLAY0958` | Error | Malformed ordering line, one with indented lines, or one outside `children` |
|
|
58
|
+
| `PLAY0959` | Error | More than one ordering line in a `children` block |
|
|
59
|
+
| `PLAY0960` | Warning | `sort by` names a property the child type does not declare |
|
|
60
|
+
| `PLAY0961` | Warning | `.$eventContent` path the handled event does not have |
|
|
61
|
+
| `PLAY0962` | Warning | Dynamic key on a property the read model declares |
|
|
62
|
+
| `PLAY0963` | Error | `clear` with a dynamic key |
|
|
63
|
+
|
|
64
|
+
The .NET fluent and model-bound forms are in [dictionary keys, set once and ordering](../../cratis-chronicle-projection/references/dictionaries-set-once-ordering.md).
|