@cratis/pi 7.153.10 → 7.155.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 (32) hide show
  1. package/package/corpus/agents/post-mortem.md +78 -0
  2. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +2 -1
  3. package/package/corpus/harnesses/pi/agents/post-mortem.md +75 -0
  4. package/package/corpus/product-sync.json +1 -0
  5. package/package/corpus/rules/profiles.md +2 -1
  6. package/package/corpus/skills/cratis-engineering-post-mortem/LICENSE +2 -0
  7. package/package/corpus/skills/cratis-engineering-post-mortem/SKILL.md +113 -0
  8. package/package/corpus/skills/cratis-engineering-post-mortem/references/examples/silent-backup-failure.md +201 -0
  9. package/package/corpus/skills/cratis-engineering-post-mortem/references/examples/unintended-release-regression.md +216 -0
  10. package/package/corpus/skills/cratis-engineering-post-mortem/references/public-safe-wording.md +44 -0
  11. package/package/corpus/skills/cratis-engineering-post-mortem/references/review-template.md +168 -0
  12. package/package/corpus/skills/cratis-engineering-post-mortem/verification.json +13 -0
  13. package/package/corpus/skills/cratis-screenplay-availability/LICENSE +2 -0
  14. package/package/corpus/skills/cratis-screenplay-availability/SKILL.md +150 -0
  15. package/package/corpus/skills/cratis-screenplay-availability/references/complete-example.md +78 -0
  16. package/package/corpus/skills/cratis-screenplay-availability/references/review-checks.md +49 -0
  17. package/package/corpus/skills/cratis-screenplay-availability/references/runtime-ownership.md +26 -0
  18. package/package/corpus/skills/cratis-screenplay-availability/verification.json +18 -0
  19. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +2 -0
  20. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +4 -0
  21. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -0
  22. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -0
  23. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -0
  24. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +2 -0
  25. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +16 -0
  26. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +31 -0
  27. package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +3 -0
  28. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +16350 -11796
  29. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  30. package/package/corpus/skills/cratis-screenplay-ui-composition/references/guarded-interactions.md +8 -0
  31. package/package/profile-catalog.json +2 -0
  32. package/package.json +1 -1
@@ -0,0 +1,78 @@
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
+ # Complete example: gates, an availability, a persona audience and a provided value
5
+
6
+ Gates sit at module, feature, slice, command and screen level and AND down the path. The persona
7
+ `audience` line is authoring metadata. The `provide` at application level is read by the
8
+ availability's `when` and by the command's gate; the slice-level query reads
9
+ `$context.arguments`, which only a query has.
10
+
11
+ ```screenplay
12
+ audience Plus
13
+ description "Customers on the Plus commercial package"
14
+
15
+ audience Preview
16
+ description "Tenants taking part in the preview"
17
+
18
+ availability DataQuality
19
+ description "Sold with the Plus package, once the vessel has reported"
20
+ for Plus
21
+ when $context.vessel.hasReported == true
22
+
23
+ availability Everything
24
+ description "Anything sold or being previewed"
25
+ for Plus or Preview
26
+
27
+ persona FleetManager
28
+ audience Plus
29
+
30
+ provide vessel Vessel optional from query VesselByKey by $context.arguments.vesselId
31
+
32
+ module Fleet
33
+ available with Everything
34
+
35
+ feature DataQuality
36
+ available with DataQuality
37
+
38
+ slice StateChange ReportVessel
39
+ available for Plus and (Preview or Plus)
40
+
41
+ event VesselReported
42
+ note String
43
+
44
+ command ReportVessel
45
+ available when $context.vessel.hasReported == true
46
+ vesselId Uuid identifier
47
+ note String
48
+ produces VesselReported
49
+ for vesselId
50
+ note = note
51
+
52
+ screen ReportScreen
53
+ available for Plus
54
+ action ReportVessel for screen
55
+
56
+ slice StateView Vessels
57
+ query VesselByKey => Vessel optional
58
+ available for Plus
59
+ by vesselId Uuid
60
+
61
+ readmodel Vessel
62
+ vesselId Uuid
63
+ hasReported Bool
64
+
65
+ event VesselRegistered
66
+ vesselId Uuid
67
+
68
+ projection Vessels => Vessel
69
+ from VesselRegistered key vesselId
70
+ vesselId = vesselId
71
+
72
+ screen VesselScreen
73
+ available for Preview
74
+ ```
75
+
76
+ The application-level `provide` has to resolve per request for the command as well as the query;
77
+ `$context.arguments.vesselId` does not exist for a command, so state a slice-level override with
78
+ `$context.command.<key>` when a command needs the value.
@@ -0,0 +1,49 @@
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
+ # Review checks for availability and context values
5
+
6
+ Run these on any model that declares `audience`, `availability`, `available` or `provide`. Report a finding
7
+ with the construct address and the change to ask for; do not edit the model in a review.
8
+
9
+ ## Gates
10
+
11
+ 1. **A gate no persona can satisfy.** For each `available for` (through `with`, `and` and `or`), find a persona whose
12
+ authoring `audience` lines satisfy it. If none can, the part is unreachable by every persona: the audience is
13
+ missing from personas, mistyped, or the gate is wrong. Personas are authoring only, so this is a model-quality
14
+ check, not a runtime one.
15
+ 2. **Unreferenced audiences.** An `audience` that no `available for`, `availability` `for` or persona names is dead.
16
+ Ask whether it is a leftover or a missing gate.
17
+ 3. **Undeclared names.** PLAY1135 and PLAY1136 mean nothing can grant the audience or the availability, so the gate
18
+ is permanently closed. Treat as a defect, not noise.
19
+ 4. **Gate on the wrong level.** A gate repeated on every slice of a feature belongs on the feature. A gate that
20
+ hides something a sibling still `invokes` triggers the cross-slice warning (PLAY1139); check it is intended.
21
+ 5. **Availability used as authorization, or the reverse.** A role, claim or ownership test in `available when`, or a
22
+ package or rollout in a `policy`, is in the wrong mechanism.
23
+ 6. **Specifications.** None may depend on a gate; specifications always run with everything available. A
24
+ specification written to prove a closed gate is invalid.
25
+ 7. **Audience name confusion.** No gate reads `$context.identity.claims.aud` as if it were an audience, and no event
26
+ carries Chronicle's routing audience as a field.
27
+ 8. **Entitlements.** A package already enforced by Box Office modules is not also modeled as an audience unless
28
+ the model deliberately reads a host value.
29
+
30
+ ## Provided values
31
+
32
+ 1. **A `provide` whose key cannot be resolved for a command.** `$context.arguments.<key>` is the query's input and
33
+ has no meaning for a command; a command needs `$context.command.<key>`. A feature-level `provide ... from query`
34
+ that serves both a command and a query cannot name the key for both, so ask for a slice-level override.
35
+ A required value (no `optional`) that a command cannot resolve refuses the command.
36
+ 2. **A rule reading identity-derived values.** `RuleContext` has no `Identity`. A `provide` derived from
37
+ `$context.identity` or `$context.causedBy` that a rule reads smuggles roles or claims into validation. Ask for it
38
+ to move to a `policy`, or for the reason to be stated.
39
+ 3. **Reserved or overriding names.** A name equal to a built-in is PLAY1124; an override with another type is PLAY1125.
40
+ 4. **Source quality.** A `query` source must be keyed, snapshot and not observable; opaque `host`, code and `file`
41
+ sources mean the reference evaluator cannot decide a gate that reads them.
42
+ 5. **Required versus optional.** Optional means "can be absent and the gate denies"; required means "absence refuses
43
+ the request". Check each value matches the intent for its readers.
44
+ 6. **Executable claims.** Do not claim a `provide` runs end to end while the toolchain reports PLAY0268 for it.
45
+ 7. **Unprovided reads.** An `available when` reading a value nothing provides at that place (PLAY1138) stays closed.
46
+
47
+ ## Verdict wording
48
+
49
+ Report the checks run, each finding with severity, and what was not checked (runtime audience grants, opaque conditions).
@@ -0,0 +1,26 @@
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
+ # Who owns what at runtime
5
+
6
+ The model says what is gated and what is provided; the runtime enforces it. A model author never
7
+ writes enforcement code and an application never calls the pieces below.
8
+
9
+ | Piece | Owns |
10
+ | --- | --- |
11
+ | Screenplay | The language: `audience`, `availability`, `available`, `provide`, their diagnostics, and the reference evaluator (every gate available in specifications; opaque sources unsupported) |
12
+ | Choreography engine | Evaluates an availability for a request: Available, Unavailable with a reason, or Unknown, which denies. A failure to decide is an error result, never a denial. Request-scoped context values are resolved lazily, once per request |
13
+ | Showrunner GuestList | The audience contracts: public events that grant and withdraw an audience at tenant, user and system level, payload field `Audience`; the newest grant wins and a withdrawal removes only its own level |
14
+ | Arc | Enforcement at the command and query boundary, before authorization, refusing with `NotAvailable` |
15
+ | Stage | Renders and runs the admitted model with the engine; consumes it rather than owning it |
16
+ | Direct | Not called by an application. Box Office module entitlements stay separate and unchanged |
17
+
18
+ ## Consequences for modeling
19
+
20
+ - The model declares audiences and never members. Do not add a membership event or a grant command to the
21
+ model to simulate GuestList; granting is the runtime's job.
22
+ - Chronicle's routing audience stays in event options and is never a field of an event.
23
+ - A union of audiences comes from tenant, user and system levels; a reaction sees the tenant's and system's only.
24
+ - Decide a hidden entry from `NotAvailable`, not from guessing the package in client code.
25
+ - An `available when` reading a provided value depends on that value resolving per request: choose a key that
26
+ exists for the job (`$context.command.<key>` or `$context.arguments.<key>`).
@@ -0,0 +1,18 @@
1
+ {
2
+ "skill": "cratis-screenplay-availability",
3
+ "input": "Gate the DataQuality feature to the Plus package and provide the vessel being viewed for a gate.",
4
+ "fixtures": [],
5
+ "assertions": [
6
+ { "kind": "play-compiles" },
7
+ { "kind": "skill-contains", "value": "Unknown never opens a gate" },
8
+ { "kind": "skill-contains", "value": "NotAvailable" },
9
+ { "kind": "skill-contains", "value": "Specifications always run with everything available" },
10
+ { "kind": "skill-contains", "value": "Persona `audience` lines are authoring only" },
11
+ { "kind": "skill-contains", "value": "PLAY1139" },
12
+ { "kind": "skill-contains", "value": "$context.identity.claims.aud" },
13
+ { "kind": "skill-contains", "value": "PLAY1124" },
14
+ { "kind": "skill-contains", "file": "references/runtime-ownership.md", "value": "Showrunner GuestList" },
15
+ { "kind": "skill-contains", "file": "references/review-checks.md", "value": "A gate no persona can satisfy" },
16
+ { "kind": "skill-contains", "file": "references/review-checks.md", "value": "A rule reading identity-derived values" }
17
+ ]
18
+ }
@@ -304,6 +304,8 @@ Chronicle's constraints enforce **uniqueness only**; use one when two concurrent
304
304
  A policy has **exactly one** `require` line (`PLAY0441`) **or** one implementation, never both (`PLAY0440`). Read [references/policy-persona-seed.md](references/policy-persona-seed.md) when
305
305
  declaring a policy (including `require anonymous` for a deliberately public command or query), a persona, or a `seed` block.
306
306
 
307
+ `authorize` says who may act; whether the command exists for the caller at all is `available`, with `provide` for `$context` values: `cratis-screenplay-availability`.
308
+
307
309
  ## Event data subject
308
310
 
309
311
  A trailing `subject` on an event property is report-only (`PLAY0270`); see [compliance](references/compliance.md#event-data-subject).
@@ -151,6 +151,10 @@ Be a sharp business analyst seeing the domain fresh: walk each persona's journey
151
151
  ## Independent review
152
152
  P5 uses a fresh reviewer who authored nothing in scope; record reviewer/author models or `model: not exposed`, label a same-model review and let the user decide sufficiency. Read lifecycle "Independent review" when arranging P5; the model-family rationale is in `references/report-template.md` ("Independent review").
153
153
 
154
+ ## Availability and context pass
155
+
156
+ For a model with `available` or `provide`, check: a gate no persona can satisfy, unreferenced or undeclared audiences, a gate used as authorization (or the reverse), a `provide` whose key cannot be resolved for a command, a rule reading identity-derived values, and specifications that depend on a gate. Read [review checks](../cratis-screenplay-availability/references/review-checks.md).
157
+
154
158
  ## Rules
155
159
  - Compiler contracts (defects when the mode needs them): V1 must pass with warnings
156
160
  as errors; PLAY0029 means a construct was silently dropped. Current source checks
@@ -304,6 +304,8 @@ choosing a whole action list rather than one labeled command, use block-form
304
304
  `when`/`otherwise` on click, double click, select or change:
305
305
  [guarded interactions](../cratis-screenplay-ui-composition/references/guarded-interactions.md).
306
306
 
307
+ `available` and `provide`: `cratis-screenplay-availability`.
308
+
307
309
  ## How a bare name resolves
308
310
 
309
311
  **Inside out:** the slice, then the enclosing feature, then the module, then the
@@ -150,6 +150,8 @@ Ask the batch below only for what the request leaves open: (1) origin of each ac
150
150
  Ask `references/review-questions.md` (reachability, forms in disguise, secrets, fan-in,
151
151
  collections, invariants, who sees which rows); report a finding only with a domain consequence.
152
152
 
153
+ **Gate versus authorize.** A slice that exists only for some tenants, users or the system (a package, a rollout, a switch) takes `available` on the slice or its feature; who may act inside it stays `authorize`. A value a gate or code needs that the request lacks is a slice-level `provide` naming `$context.command.<key>` or `$context.arguments.<key>`. Box Office modules, audiences and Chronicle routing audiences are different things. See `cratis-screenplay-availability`.
154
+
153
155
  ## Public boundaries and view identity
154
156
 
155
157
  Translate crosses an application boundary (inbound consumes foreign public events; outbound folds private facts into exactly one local public event type); commands never publish public events. Mark view identity with trailing `key`; flat composite view keys bind as ESM v27 (Requires Screenplay 4.204.0) - keep the true identity. Read [references/public-boundaries-and-keys.md](references/public-boundaries-and-keys.md) when a slice crosses an application boundary or a view needs a composite identity.
@@ -171,6 +171,8 @@ Requires Chronicle 19.59.6 or later (19.59.3 for the InMemory provider) for the
171
171
 
172
172
  **Review questions** (findings only with a domain consequence): read [references/review-questions.md](references/review-questions.md) for the stream, race, optional-property, boundary and eventual-consistency questions (decision tree and red flags for collection- or log-shaped streams are in `references/stream-patterns.md`).
173
173
 
174
+ Availability is not a consistency boundary. Events, projections and reactions run whether or not a slice is available (a reaction is never gated), so a gate never needs a replay; `provide` values are read per request and are no part of a command's decision reads. See `cratis-screenplay-availability`.
175
+
174
176
  ## Gate
175
177
  Do not report done until all hold; otherwise report what is open:
176
178
  - Every identifier has its identity sentence, the event-membership table and a justified decision.
@@ -174,6 +174,8 @@ with ordered imports means future files need explicit imports.
174
174
  not legal compliance, retention or runtime subject realization. See
175
175
  command-surface `references/context.md` and `references/compliance.md`.
176
176
 
177
+ `audience`, `availability`, `available` and `provide` diagnostics are PLAY1119-PLAY1141; executing a `provide` reports PLAY0268. Specifications and the reference evaluator treat every gate as available; opaque sources are unsupported, never allowed. See `cratis-screenplay-availability`.
178
+
177
179
  ## Edit strategy
178
180
 
179
181
  Read [the MCP authoring loop](../cratis-screenplay-model-authoring/references/mcp-loop.md)
@@ -172,6 +172,22 @@ are PLAY0565 information and repeated markers are PLAY0653 warning. Event `subje
172
172
  is report-only lineage; processing purposes/checks/reports declare use, not lawful
173
173
  processing or runtime retention. See command-surface `references/compliance.md`.
174
174
 
175
+ `audiences` and provided names are also `$context.` paths beneath their level. Syntax (6.25.0 and 6.26.0; see command-surface and availability skills):
176
+
177
+ ```text
178
+ audience Plus
179
+ description "Plus package"
180
+ availability Sold
181
+ for Plus
182
+ when $context.vessel.hasReported == true
183
+ provide vessel Vessel optional from query VesselByKey by $context.arguments.vesselId
184
+ available for Plus or (Preview and Early)
185
+ available when $context.region == "Nordics"
186
+ available with Sold
187
+ ```
188
+
189
+ `available` is allowed on a module, feature, slice, command, query and screen; `provide` at application, module, feature and slice. Specifications run with every gate available.
190
+
175
191
  ## `$eventContext.` (projections)
176
192
  `eventType{.id,.generation,.tombstone}`, `eventSourceType`, `eventSourceId`, `eventStreamType`,
177
193
  `eventStreamId`, `sequenceNumber`, `occurred`, `occurred.Week`, `eventStore`, `namespace`,
@@ -17,6 +17,8 @@
17
17
  - Guarded interaction diagnostics
18
18
  - UI profile shell: root template, options, appearance
19
19
  - Design systems and themes (PLAY0916-PLAY0930)
20
+ - Provided values (PLAY1119-PLAY1129)
21
+ - Audiences and availability (PLAY1130-PLAY1141)
20
22
  - Sinks (PLAY0931-PLAY0939)
21
23
  - Structural completeness and timeline checks
22
24
  - Editor versus C# verdicts
@@ -351,6 +353,35 @@ Requires a Screenplay release that carries design systems (next minor after 6.2.
351
353
  | PLAY0929 | W | `accent`, `corners` or `font` in a profile's `appearance` is deprecated; put the value in the theme. |
352
354
  | PLAY0930 | E | A theme's `implements`, `palette`, `values` or mode block is malformed or repeated. |
353
355
 
356
+ ## Provided values (PLAY1119-PLAY1129)
357
+
358
+ `provide` needs Screenplay 6.25.0. Fix by changing the model; PLAY0268 reports executing it.
359
+
360
+ | Code | Fix |
361
+ | --- | --- |
362
+ | PLAY1119-PLAY1122 | write `provide <name> <Type> [optional] from <source>`; a source is `query`, `host`, a literal, a `$context` expression, a `file` or an inline body, never a body beside `from` |
363
+ | PLAY1123 | one declaration per name per level; override lower down instead |
364
+ | PLAY1124 | `tenant`, `identity`, `causedBy`, `causation`, `occurred`, `audiences`, `command`, `arguments` are reserved; rename |
365
+ | PLAY1125 | an override keeps the type |
366
+ | PLAY1126-PLAY1128 | the source query must be declared once, keyed, snapshot (not observable) and return the provided type |
367
+ | PLAY1129 | break the read cycle between provided values |
368
+
369
+ ## Audiences and availability (PLAY1130-PLAY1141)
370
+
371
+ Requires Screenplay 6.26.0. Errors fix the line; warnings leave the gate closed, never open.
372
+
373
+ | Code | Fix |
374
+ | --- | --- |
375
+ | PLAY1130-PLAY1132 | shapes: `audience <Name>` with `description` only; `availability <Name>` with `description`, `for`, `when`, `with`; `available for \| when \| with <operand>` |
376
+ | PLAY1133, PLAY1134 | declare each audience and availability once |
377
+ | PLAY1135, PLAY1136 | W: declare the audience or availability, or correct the name; undeclared means nothing can grant it |
378
+ | PLAY1137 | break the `with` cycle |
379
+ | PLAY1138 | W: provide the value at or above the gate, or change the condition |
380
+ | PLAY1139 | W: align the audiences of invoker and command, or accept the refusal; `when` is skipped, reactions are never gated |
381
+ | PLAY1140, PLAY1141 | an `available for`/`with` line holds names, `and`, `or` and balanced parentheses only |
382
+
383
+ See `../../cratis-screenplay-availability/SKILL.md`.
384
+
354
385
  ## Sinks (PLAY0931-PLAY0939)
355
386
 
356
387
  Requires Screenplay 6.4.0 (`screenplay --version`). A `sink <Name> for readmodels|graphs`
@@ -33,6 +33,7 @@ exact language/semantic pairs; binding, reference execution and rendering are se
33
33
  | v34 | A specification `then invokes <Command>` (decision 0115; PLAY0815/PLAY0816) | Writes `thenInvocations` only when present. When one is stated, the slice's recorded invocations must match in count and order, comparing only stated values; a refused invocation counts | Stage spec runner compares it; the Cratis renderer refuses models after v33 with `STAGE-ESM-016` |
34
34
  | v35 | Reserved for handler result contract v2 (decision 0119); no construct selects it | | |
35
35
  | v36 | `statemachine` and `workflow` declarations (decision 0124; PLAY0834-PLAY0851) | Serializes `stateMachines` and `workflows`; specifications run them; earlier models keep their version and bytes | Stage refuses v36 models with `STAGE-ESM-016` |
36
+ | v53 | `audience`, `availability` and `available` gates (decision 0162; PLAY1130-PLAY1141) | Serializes the gates; specifications and the reference evaluator treat every gate as available and report opaque `provide` sources as unsupported; earlier models keep their version and bytes | Admission by Stage is separate: a refusal such as `STAGE-ESM-016` means the model is not renderable yet, never a reason to drop the gate. See `../../cratis-screenplay-availability/SKILL.md` |
36
37
 
37
38
  Constructs of decision 0098 with no executable-model content need no version: application-level hooks in a layout's actions outlet (`default <id> title "..." slice <Slice>` with an optional indented `authorize <Policy>`), and a capture over events that copies a list (`lines = $.lines`) or fans out with `children lines identified by sku`. Check `screenplay --version` against the release that admitted v29 and v30 before relying on them. Decision 0115 withdrew 0098's command specification that states the public event its outbound Translate slice publishes: a specification runs only its own slice, so the Translate slice states the public event in its own `when append` specification.
38
39
 
@@ -54,6 +55,8 @@ Requires Screenplay 4.204.0 (ESM v27; `screenplay --version`) for composite read
54
55
 
55
56
  Requires Screenplay 4.205.0 (ESM v28; `screenplay --version`) for Uuid equality in command conditions; older binders report PLAY0268.
56
57
 
58
+ Requires Screenplay 6.26.0 (ESM v53; `screenplay --version`) for audiences, availabilities and gates, and 6.25.0 for `provide`; older compilers report the lines as unknown.
59
+
57
60
  Current renderer versus semantic-execution support is owned by
58
61
  [Stage target boundaries](../../cratis-stage-rendering-and-sandbox/references/current-boundaries.md),
59
62
  at the product inventory's reviewed baseline; the CLI still applies its independent version gate.