@cratis/pi 7.153.9 → 7.154.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 (25) hide show
  1. package/package/corpus/harnesses/copilot/instructions/fast-feedback.instructions.md +14 -1
  2. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +1 -0
  3. package/package/corpus/product-sync.json +1 -0
  4. package/package/corpus/rules/fast-feedback.md +14 -1
  5. package/package/corpus/rules/profiles.md +1 -0
  6. package/package/corpus/skills/cratis-screenplay-availability/LICENSE +2 -0
  7. package/package/corpus/skills/cratis-screenplay-availability/SKILL.md +150 -0
  8. package/package/corpus/skills/cratis-screenplay-availability/references/complete-example.md +78 -0
  9. package/package/corpus/skills/cratis-screenplay-availability/references/review-checks.md +49 -0
  10. package/package/corpus/skills/cratis-screenplay-availability/references/runtime-ownership.md +26 -0
  11. package/package/corpus/skills/cratis-screenplay-availability/verification.json +18 -0
  12. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +2 -0
  13. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +4 -0
  14. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -0
  15. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -0
  16. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -0
  17. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +2 -0
  18. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +16 -0
  19. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +31 -0
  20. package/package/corpus/skills/cratis-screenplay-toolchain/references/language-admission.md +3 -0
  21. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +16350 -11796
  22. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  23. package/package/corpus/skills/cratis-screenplay-ui-composition/references/guarded-interactions.md +8 -0
  24. package/package/profile-catalog.json +1 -0
  25. package/package.json +1 -1
@@ -29,9 +29,22 @@ default) per [`general.md`](../../../rules/general.md).
29
29
  - **[contract] Analyzers and generators are cheap or they are not added.** A slow one is an
30
30
  upstream issue; see [`framework.md`](./framework.instructions.md) for how analyzers are written for speed.
31
31
  - **[convention] Specify with the cheapest proof that is real.** Call a pure decision directly;
32
- use a scenario for what only the framework pipeline or engine proves. The per-artifact table is in
32
+ use the in-memory scenario helpers for slice behavior through the Arc/Chronicle pipeline, which
33
+ cost milliseconds. The per-artifact table is in
33
34
  [`specs.scenarios.csharp.md`](./specs.scenarios.csharp.instructions.md); the universal base is in
34
35
  [`specs.md`](./specs.instructions.md).
36
+ - **[convention] Hosts, kernels, containers and browsers prove only contracts this repository
37
+ owns:** storage format, wire protocol, migration, generated proxy or package, deploy image, or a
38
+ real third-party integration. Never start one to re-prove Arc or Chronicle behavior. Build it once
39
+ per class or collection, never per fact, and keep it out of the default pull-request lane unless
40
+ that contract changed.
41
+ - **[contract] Consumer routing/e2e and service-boundary regression tests stay in the
42
+ pull-request lane.** A consumer's test of its own routing, or of a boundary between its services,
43
+ protects a contract the repository owns; the previous bullet is not a reason to move it off pull
44
+ requests or retire it.
45
+ - **[contract] Retiring a consumer assertion needs a named upstream spec** in the owning
46
+ repository that fails when the consumer behavior breaks. Without that mapping the assertion
47
+ stays.
35
48
 
36
49
  A cold full-suite run under a minute is the target for a repository's spec gate. It is a budget to
37
50
  protect, not a reason to delete coverage.
@@ -293,6 +293,7 @@ and one phase skill, then the construct skill needed for syntax.
293
293
  | `cratis-screenplay-slice-design` | Commands, refusals, views, field lineage and slice boundaries |
294
294
  | `cratis-screenplay-streams-and-consistency` | Business identities, atomic invariants, concurrency, evolution and ownership |
295
295
  | `cratis-screenplay-automations-and-translations` | Follow-up work, external data to our facts, recovery and deduplication |
296
+ | `cratis-screenplay-availability` | `audience`, `available`, `provide` |
296
297
  | `cratis-screenplay-scenario-coverage` | Coverage matrix, rejection, denial, lifecycle and external-failure scenarios |
297
298
  | `cratis-screenplay-model-review` | Independent critique, evidence checklist and business-question explanation |
298
299
  | `cratis-screenplay-legacy-extraction` | Evidence-led extraction, expert verification and loss report |
@@ -181,6 +181,7 @@
181
181
  "skills": [
182
182
  "cratis-application-slice-conformance",
183
183
  "cratis-screenplay-automations-and-translations",
184
+ "cratis-screenplay-availability",
184
185
  "cratis-screenplay-captures-and-reactions",
185
186
  "cratis-screenplay-command-surface",
186
187
  "cratis-screenplay-delivery-planning",
@@ -28,9 +28,22 @@ default) per [`general.md`](./general.md).
28
28
  - **[contract] Analyzers and generators are cheap or they are not added.** A slow one is an
29
29
  upstream issue; see [`framework.md`](./framework.md) for how analyzers are written for speed.
30
30
  - **[convention] Specify with the cheapest proof that is real.** Call a pure decision directly;
31
- use a scenario for what only the framework pipeline or engine proves. The per-artifact table is in
31
+ use the in-memory scenario helpers for slice behavior through the Arc/Chronicle pipeline, which
32
+ cost milliseconds. The per-artifact table is in
32
33
  [`specs.scenarios.csharp.md`](./specs.scenarios.csharp.md); the universal base is in
33
34
  [`specs.md`](./specs.md).
35
+ - **[convention] Hosts, kernels, containers and browsers prove only contracts this repository
36
+ owns:** storage format, wire protocol, migration, generated proxy or package, deploy image, or a
37
+ real third-party integration. Never start one to re-prove Arc or Chronicle behavior. Build it once
38
+ per class or collection, never per fact, and keep it out of the default pull-request lane unless
39
+ that contract changed.
40
+ - **[contract] Consumer routing/e2e and service-boundary regression tests stay in the
41
+ pull-request lane.** A consumer's test of its own routing, or of a boundary between its services,
42
+ protects a contract the repository owns; the previous bullet is not a reason to move it off pull
43
+ requests or retire it.
44
+ - **[contract] Retiring a consumer assertion needs a named upstream spec** in the owning
45
+ repository that fails when the consumer behavior breaks. Without that mapping the assertion
46
+ stays.
34
47
 
35
48
  A cold full-suite run under a minute is the target for a repository's spec gate. It is a budget to
36
49
  protect, not a reason to delete coverage.
@@ -292,6 +292,7 @@ and one phase skill, then the construct skill needed for syntax.
292
292
  | `cratis-screenplay-slice-design` | Commands, refusals, views, field lineage and slice boundaries |
293
293
  | `cratis-screenplay-streams-and-consistency` | Business identities, atomic invariants, concurrency, evolution and ownership |
294
294
  | `cratis-screenplay-automations-and-translations` | Follow-up work, external data to our facts, recovery and deduplication |
295
+ | `cratis-screenplay-availability` | `audience`, `available`, `provide` |
295
296
  | `cratis-screenplay-scenario-coverage` | Coverage matrix, rejection, denial, lifecycle and external-failure scenarios |
296
297
  | `cratis-screenplay-model-review` | Independent critique, evidence checklist and business-question explanation |
297
298
  | `cratis-screenplay-legacy-extraction` | Evidence-led extraction, expert verification and loss report |
@@ -0,0 +1,2 @@
1
+ Copyright (c) Cratis. All rights reserved.
2
+ Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: cratis-screenplay-availability
3
+ description: Use when a Screenplay model must decide whether a module, feature or slice exists for a tenant, user or system, or when it provides ambient `$context` values. Not for who may act; use cratis-screenplay-command-surface for `authorize`.
4
+ license: MIT
5
+ ---
6
+
7
+ # Availability, audiences and context values
8
+
9
+ Read [preferred syntax](../cratis-screenplay-toolchain/references/preferred-syntax.md) when writing or reviewing `.play`.
10
+ Product facts come from Screenplay `availability.md`, `context.md`, `personas.md`
11
+ and `policies.md` under `Documentation/screenplay/`; run examples at the pinned
12
+ compiler before relying on them.
13
+
14
+ ## Pick the right mechanism
15
+
16
+ | Question | Use |
17
+ | --- | --- |
18
+ | Is this part there at all for this tenant, user or system (a package, a rollout, an incident switch)? | `audience`, `availability`, `available` |
19
+ | May this caller do it, given who they are and what they can prove? | `policy` and `authorize` ([command surface](../cratis-screenplay-command-surface/SKILL.md)) |
20
+ | Is this input acceptable? | `rule` and validation on the command |
21
+ | Does a gate or code need a value that is not in the request (the vessel viewed, the project worked in)? | `provide` and `$context.<name>` |
22
+ | Which tenant-level commercial module is bought? | Box Office module entitlements; outside the model |
23
+
24
+ Availability is decided **before** `authorize`. A part that is not available is refused as
25
+ `NotAvailable`, which a client can tell apart from not allowed, so it can hide an entry or
26
+ explain the package. Do not model a package, rollout or kill switch as a policy, and do not
27
+ model a role check as an audience.
28
+
29
+ ## The forms
30
+
31
+ ```screenplay excerpt
32
+ audience Plus
33
+ description "Customers on the Plus commercial package"
34
+
35
+ audience Preview
36
+ description "Tenants taking part in the preview"
37
+
38
+ availability DataQuality
39
+ description "Sold with Plus, once the vessel has reported"
40
+ for Plus
41
+ when $context.vessel.hasReported == true
42
+
43
+ module Fleet
44
+ feature DataQuality
45
+ available with DataQuality
46
+
47
+ slice StateView QualityScores
48
+ available for Plus or Preview
49
+ ```
50
+
51
+ - `audience <Name>` is a named group with a `description` and nothing else. The model
52
+ never says who is in it; membership is granted at runtime, so nothing ships as an accidental entitlement.
53
+ - `availability <Name>` is a reusable rule. Its `for`, `when` and `with` lines must all hold;
54
+ `with` builds on another availability. A `with` cycle is PLAY1137.
55
+ - `available for <audiences>`, `available when <condition>`, `available with <Availability>`.
56
+ `for` and `with` combine names with `and`, `or` and parentheses. A `when` is one condition with its own
57
+ `and`/`or`. One line holds one form; to mix forms, name them in an `availability` and use `with`.
58
+ Several `available` lines on one construct all have to hold.
59
+ - A gate is allowed on a module, feature, slice, command, query and screen. Gates AND down the
60
+ path from module to construct. Gate at the highest level that is true for everything beneath it.
61
+ - The runtime context carries `$context.audiences`, the union of the tenant's, user's and
62
+ system caller's audiences. Withdrawing a grant removes it from its own level only.
63
+
64
+ ## Rules the language holds
65
+
66
+ - **Unknown never opens a gate.** A missing audience, a missing value, an unresolved condition or an
67
+ undecided result leaves the part unavailable. An undeclared audience or availability is a warning
68
+ (PLAY1135, PLAY1136), not an error, and the gate stays closed.
69
+ - **Failure is not denial.** A lookup that errors fails the request as a retryable error; it is never
70
+ reported as `NotAvailable`.
71
+ - **Specifications always run with everything available.** They verify behavior, not entitlement. There is
72
+ no `given availability` form; do not invent one, and do not write a specification to prove a gate.
73
+ - **Events and observers are unaffected.** A reaction that produces into an unavailable slice is fine and
74
+ projections keep running, so switching a part on needs no replay. A reaction is never gated and runs with
75
+ the tenant's and system's audiences, never a user's.
76
+ - **Persona `audience` lines are authoring only.** `audience Plus` under a `persona` tells the board, Studio
77
+ and docs which audiences the persona is in. It changes nothing at runtime and is not in the executable model.
78
+ - **Cross-slice warning (PLAY1139).** A screen action, form or reaction that `invokes` a command whose audiences
79
+ can be off while the invoker's are on can be refused as not available. Align the audiences, or accept and say
80
+ why. `when` conditions are opaque and skipped, never guessed.
81
+
82
+ ## Three things called audience
83
+
84
+ | Name | Is |
85
+ | --- | --- |
86
+ | Screenplay `audience` | Who a part of the application is available to; membership granted at runtime |
87
+ | Chronicle routing audience | An event-routing label in event options; never an event field of the model |
88
+ | Token `aud` claim | Who a token is for; read as `$context.identity.claims.aud` |
89
+
90
+ They are unrelated. Never use `aud` to decide availability by name-matching an audience.
91
+ A gate needing both an audience and a Box Office entitlement reads a host value
92
+ (`provide entitlements from host`) in `available when`.
93
+
94
+ ## Provided context values
95
+
96
+ `provide <name> <Type>[ optional] from <source>` adds `$context.<name>` for everything beneath the level it
97
+ is written at: application, module, feature (features nest) or slice.
98
+
99
+ ```screenplay excerpt
100
+ module Fleet
101
+ provide region String from "Nordics"
102
+
103
+ feature DataQuality
104
+ slice StateView Vessels
105
+ provide vessel Vessel optional from query VesselByKey by $context.arguments.vesselId
106
+ ```
107
+
108
+ - **Sources:** `query <Query> [by <expression>, ...]` (a declared, keyed, snapshot, non-observable query whose
109
+ result type equals the provided type), `host`, a literal, an expression over other `$context` values,
110
+ or a `file`/inline code body under the line (not both with `from`).
111
+ - **Levels:** the nearest declaration of a name wins and must keep the type (PLAY1125). The same name twice at one level
112
+ is PLAY1123. Resolved once per request, lazily.
113
+ - **Reserved names:** `tenant`, `identity`, `causedBy`, `causation`, `occurred`, `audiences`, `command`, `arguments`
114
+ cannot be provided (PLAY1124).
115
+ - **State the key per job at the slice.** A slice states `$context.command.<key>` for a command and
116
+ `$context.arguments.<key>` for a query. A feature-level provider cannot do both; override at the slice.
117
+ - **Required versus optional.** Without `optional` the value is required: when absent, the request is refused with a
118
+ clear reason. With `optional`, code sees `null` and a gate reading it denies.
119
+ - **Absence versus failure.** Absence (no key, no row, host did not supply) is unknown, not an error. Failure (store down,
120
+ body throws, timeout) fails the request as a retryable error, never a denial.
121
+ - Code reads `context.Values.<Name>` or `ValuesAs<T>()` on `CommandContext`, `QueryContext`, `RuleContext`,
122
+ `PolicyContext` and `ProvideContext`.
123
+ - `host`, inline code and `file` sources are opaque: the reference evaluator reports a gate that reads one as
124
+ unsupported, never allowed or denied. Executing `provide` reports PLAY0268 until the toolchain admits it; model
125
+ it, review it, do not promise it runs.
126
+ - **Identity stays out of rules by default.** `RuleContext` sees `CausedBy`, not `Identity`; roles and claims belong in a
127
+ `policy`. A `provide` derived from `$context.identity` makes that value readable in a rule, so write it
128
+ only deliberately and say why.
129
+
130
+ ## A complete model
131
+
132
+ Read [complete example](references/complete-example.md) for a model that compiles with gates, an availability, a persona audience and a provided value.
133
+
134
+ ## Who owns what
135
+
136
+ Read [runtime ownership](references/runtime-ownership.md) when a request asks where a gate is enforced, how
137
+ audiences are granted, or whether application code can check one. Applications never call these directly.
138
+
139
+ ## Review checks
140
+
141
+ Read [review checks](references/review-checks.md) before accepting a model that uses `available` or `provide`.
142
+
143
+ ## Diagnostics
144
+
145
+ PLAY1119-1129 are `provide` (line shape, source, body, duplicates, reserved names, type override, query source, cycle).
146
+ PLAY1130-1141 are `audience`, `availability` and `available` (shape, duplicates, undeclared, cycle, unprovided value,
147
+ cross-slice invocation, gate tokens and parentheses). The full table is in the toolchain
148
+ [diagnostics](../cratis-screenplay-toolchain/references/diagnostics.md).
149
+ Fix by changing the model: declare the audience, name the availability, provide the value or correct the key; never remove a
150
+ gate to silence a warning.
@@ -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.