@cratis/pi 7.29.1 → 7.31.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 (68) hide show
  1. package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +14 -0
  2. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/pinned-generation-delivery.md +92 -0
  3. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +24 -2
  4. package/package/corpus/skills/cratis-chronicle-event-type-migration/references/pinned-generations.md +114 -0
  5. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +9 -4
  6. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +4 -2
  7. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +3 -3
  8. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +5 -2
  9. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/public-events-and-direction.md +137 -0
  10. package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +5 -1
  11. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +15 -16
  12. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/invocation-identity.md +4 -4
  13. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/product-sources.md +15 -0
  14. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +3 -1
  15. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +8 -9
  16. package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +1 -1
  17. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +4 -4
  18. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +2 -2
  19. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +1 -1
  20. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +2 -2
  21. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +4 -4
  22. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +7 -1
  23. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +7 -2
  24. package/package/corpus/skills/cratis-screenplay-model-authoring/references/screen-authoring-workflow.md +5 -3
  25. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +1 -1
  26. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +10 -11
  27. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +1 -1
  28. package/package/corpus/skills/cratis-screenplay-model-review/references/public-keys-and-routes.md +32 -0
  29. package/package/corpus/skills/cratis-screenplay-model-review/verification.json +1 -0
  30. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +11 -0
  31. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +19 -16
  32. package/package/corpus/skills/cratis-screenplay-read-surface/references/named-keys.md +122 -0
  33. package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +3 -0
  34. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +9 -6
  35. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +3 -3
  36. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +1 -1
  37. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +11 -0
  38. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +2 -2
  39. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +32 -9
  40. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +20 -13
  41. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +12 -10
  42. package/package/corpus/skills/cratis-screenplay-specifications/references/examples-and-routes.md +3 -2
  43. package/package/corpus/skills/cratis-screenplay-specifications/references/source-notes.md +16 -0
  44. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +2 -2
  45. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -2
  46. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +2 -2
  47. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +1 -1
  48. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +19 -10
  49. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +12 -1
  50. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +55 -3
  51. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +7 -4
  52. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +30 -10
  53. package/package/corpus/skills/cratis-screenplay-toolchain/references/production-routes-and-filters.md +119 -0
  54. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +8 -1
  55. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +11 -5
  56. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +813 -0
  57. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  58. package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +7 -5
  59. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +6 -6
  60. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +6 -5
  61. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +56 -28
  62. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +7 -1
  63. package/package/corpus/skills/cratis-screenplay-ui-composition/references/screen-composition-contract.md +4 -3
  64. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +11 -12
  65. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +14 -3
  66. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/case-tables-and-whole-numbers.md +8 -6
  67. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +3 -1
  68. package/package.json +1 -1
@@ -204,6 +204,20 @@ from `string` (`:158`) and a `Redacted` form for logging (`:152`).
204
204
 
205
205
  Read [references/hosting.md](references/hosting.md) when wiring Chronicle into a worker or ASP.NET Core host, or when `AddCratisChronicle` or a namespace resolver does not resolve.
206
206
 
207
+ ## Pin event generations for delivery
208
+
209
+ `ChronicleOptions.EventGenerationDelivery` defaults to `Compatibility`. Opt in
210
+ with `EventGenerationDelivery.Pinned` (`Cratis.Chronicle.Observation`) **before
211
+ connecting**. Reactors and reducers then receive their handler's CLR event
212
+ generation (Chronicle **19.41.0+**); typed materialized projections use each
213
+ clause's declared CLR event generation (**19.48.0+**). These additions are
214
+ verified separately against those release tags, not the baseline above.
215
+
216
+ Read [references/pinned-generation-delivery.md](references/pinned-generation-delivery.md)
217
+ for compiling standalone/host configuration, registration constraints, and the
218
+ Compatibility-only surfaces. For migration, PDL pin persistence, and integration
219
+ test requirements, use **cratis-chronicle-event-type-migration**.
220
+
207
221
  ## The client and the server check each other
208
222
 
209
223
  The client runs the server-side compatibility check automatically inside `Connect()`; a genuine mismatch throws `IncompatibleServerException`, while a transport error is logged and ignored by design.
@@ -0,0 +1,92 @@
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
+ # Pin event generations before connecting
5
+
6
+ Requires Chronicle **19.41.0+** for client reactors/reducers and **19.48.0+** for
7
+ typed materialized projections. Upgrade every kernel silo before enabling the
8
+ option. `Compatibility` remains the default; adding a generation alone does not
9
+ opt consumers in.
10
+
11
+ ## Standalone client
12
+
13
+ This configuration excerpt uses `Cratis.Chronicle` **19.48.0** and a running
14
+ local development kernel. Keep the client alive for observation; supply logging
15
+ and a service provider when the application's observers need them (see the main
16
+ skill's standalone checklist).
17
+
18
+ ```csharp
19
+ using Cratis.Chronicle;
20
+ using Cratis.Chronicle.Connections;
21
+ using Cratis.Chronicle.Observation;
22
+
23
+ var options = new ChronicleOptions(ChronicleConnectionString.Development)
24
+ {
25
+ EventGenerationDelivery = EventGenerationDelivery.Pinned
26
+ };
27
+ using var client = new ChronicleClient(options);
28
+ var eventStore = await client.GetEventStore("People");
29
+ ```
30
+
31
+ ## Host integration
32
+
33
+ `AddCratisChronicle` extends `IHostApplicationBuilder` (an `IHostBuilder`
34
+ overload also exists), **not** `IServiceCollection`. Its `ChronicleClientOptions` inherits the delivery option.
35
+ This worker-host configuration excerpt uses `Cratis.Chronicle` **19.48.0** and
36
+ `Microsoft.Extensions.Hosting`; add the application's hosted worker and start
37
+ the host as usual.
38
+
39
+ ```csharp
40
+ using Cratis.Chronicle.Observation;
41
+ using Microsoft.Extensions.Hosting;
42
+
43
+ var builder = Host.CreateApplicationBuilder();
44
+ builder.AddCratisChronicle(options =>
45
+ {
46
+ options.EventStore = "People";
47
+ options.EventGenerationDelivery = EventGenerationDelivery.Pinned;
48
+ });
49
+ ```
50
+
51
+ ## Scope and registration
52
+
53
+ - Reactors and reducers pin the generation of the handler's CLR event type.
54
+ Typed materialized projections (fluent, model-bound, or explicitly registered)
55
+ pin each clause's declared CLR event generation. Live, catch-up, and replay
56
+ (and, for reactors and reducers, partition retry) use kernel generation
57
+ selection and schema-guided release.
58
+ - Projection pins cover `From`, `Join`, children, nested objects, removals,
59
+ event-content keys, and parent keys. Stored join/parent-event lookups select
60
+ and release through the same boundary as incoming events.
61
+ - **One generation per event identifier per observer/projection**, across every
62
+ handler or clause, including children and nested objects. Different
63
+ identifiers may pin different generations. Client validation throws
64
+ `Cratis.Chronicle.Observation.MultipleGenerationsOfEventTypeInObserver` for
65
+ conflicting pins; the kernel rejects them with
66
+ `ObserverPinsMultipleGenerationsOfEventType`. Kernel observer subscription
67
+ rejects an unregistered generation with
68
+ `EventTypeGenerationNotRegisteredForObserver`; projection schema resolution
69
+ can reject an unavailable pin with `PinnedEventTypeGenerationUnavailable`.
70
+ - Immediate/passive and wildcard (`all`/`FromAll`) projections stay
71
+ `Compatibility` when built through the .NET client. A definition explicitly
72
+ submitted as both wildcard and `Pinned` is unsupported and rejected by the
73
+ kernel with `EventGenerationDeliveryNotSupported`; the option does not make
74
+ wildcard pinning work.
75
+ - Ad-hoc queries/event reads are not opted in. Neither are webhooks, captures,
76
+ or event-store subscriptions. Do not generalize this option to every read
77
+ path, or to unreleased generation-delivery work.
78
+
79
+ For delivery-time migration, persisted PDL pins, and testing limits, read
80
+ [the migration reference](../../cratis-chronicle-event-type-migration/references/pinned-generations.md).
81
+
82
+ ## Product sources
83
+
84
+ Verified at `Cratis/Chronicle` **v19.48.0**:
85
+ `Source/Clients/DotNET/ChronicleOptions.cs`,
86
+ `Observation/EventGenerationDelivery.cs`,
87
+ `ChronicleHostApplicationBuilderExtensions.cs`,
88
+ `Projections/ProjectionGenerationDeliveryValidation.cs`, and
89
+ `Source/Kernel/Core/Projections/Engine/ProjectionFactory.cs`.
90
+ The option and reactor/reducer validation also exist at **v19.41.0**.
91
+
92
+ See [Chronicle's pinned observer delivery documentation](https://github.com/Cratis/Chronicle/blob/v19.48.0/Documentation/concepts/event-type-migrations.mdx#opt-in-to-pinned-observer-delivery).
@@ -51,8 +51,9 @@ public sealed class EventTypeAttribute(string id = "", uint generation = 1) : At
51
51
 
52
52
  `id` defaults to the CLR type name and `generation` starts at `1`. The attribute
53
53
  is not repeatable, so two generations are always two distinct CLR types.
54
- Chronicle routes a stored event through the migration chain before delivering it
55
- to observers:
54
+ Chronicle chains adjacent migrations to produce another generation. This is a
55
+ possible upcast path, **not a promise that every observer receives the latest
56
+ generation**; delivery policy is described below:
56
57
 
57
58
  ```text
58
59
  Generation 1 (stored) -> Migration 1->2 -> Migration 2->3 -> Current (Generation 3)
@@ -212,6 +213,23 @@ Migrations are discovered by convention — nothing is registered. They are
212
213
  activated through the service provider, so a migration may take constructor
213
214
  dependencies.
214
215
 
216
+ ## Choose the generation an observer receives
217
+
218
+ `Compatibility` remains the default. With
219
+ `ChronicleOptions.EventGenerationDelivery = EventGenerationDelivery.Pinned`,
220
+ reactors and reducers receive the generation of their handler's CLR event type
221
+ (verified at **19.41.0**). Typed materialized projection clauses receive the
222
+ generation they declare (verified at **19.48.0**), including joins, children,
223
+ removals, and event-content keys on live, catch-up, and replay.
224
+
225
+ Read [references/pinned-generations.md](references/pinned-generations.md) for
226
+ missing-generation migration, release and revision behavior, registration
227
+ rejections, persisted PDL pins, and testing limits. Configure the opt-in through
228
+ **cratis-chronicle-client-dotnet**; do not invent generation-qualified Screenplay
229
+ syntax. `ReadModelScenario` and `ReactorScenario` do **not** emulate the kernel's
230
+ pinned-generation migration and release; prove delivery with real-client
231
+ integration, not a scenario-only assertion.
232
+
215
233
  ## Do not model absence with a nullable property
216
234
 
217
235
  **CHR0012** (warning) flags a nullable property on an `[EventType]` record.
@@ -246,3 +264,7 @@ is expected, since the prior generation records history rather than new intent.
246
264
  outstanding.
247
265
  - Old-generation events replay into the current shape through the read-model
248
266
  specifications for the affected observers.
267
+ - With `EventGenerationDelivery.Pinned`, real-client integration also verifies
268
+ old-generation events on live delivery, catch-up, and replay into each
269
+ observer's pinned generation; in-process read-model/reactor scenarios alone
270
+ do not prove kernel migration and release.
@@ -0,0 +1,114 @@
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
+ # Migrations and pinned delivery
5
+
6
+ ## Contents
7
+
8
+ - What a pinned consumer receives
9
+ - PDL pins are resolved once, when saved
10
+ - Verify delivery through a real client
11
+ - Product sources
12
+
13
+ Verified against Chronicle **v19.48.0**. Reactor/reducer opt-in shipped in
14
+ **19.41.0**; typed materialized projection opt-in shipped in **19.48.0**.
15
+ Configure `ChronicleOptions.EventGenerationDelivery` before connecting; see
16
+ [standalone and host examples](../../cratis-chronicle-client-dotnet/references/pinned-generation-delivery.md).
17
+
18
+ ## What a pinned consumer receives
19
+
20
+ The kernel selects the pinned generation's content and hash, and releases
21
+ protected values using **that generation's schema**. A reactor or reducer pins
22
+ its handler's CLR event generation. A typed materialized projection uses the
23
+ CLR generation each clause declares, including joins, children, nested objects,
24
+ removals, event-content keys, and parent keys. Incoming live, catch-up, and replay
25
+ events and stored join/parent-event lookups use the same release boundary.
26
+
27
+ `EventContext.EventType.Generation` is the delivered generation;
28
+ `EventContext.AppendedGeneration` is the original append generation, or null for
29
+ legacy events where it is unknown. Do not infer the append generation from the
30
+ handler type.
31
+
32
+ If the pinned generation's content is missing from storage, Chronicle releases
33
+ the known appended generation (or the highest stored generation for legacy
34
+ events), then runs the adjacent `EventTypeMigration` upcast/downcast chain to the
35
+ pin **for this delivery only**. It neither persists that result nor caches
36
+ plaintext. The delivered hash is `EventHash.NotSet` because no durable hash
37
+ exists for that migrated content. Erased PII stays erased through migration.
38
+ An unavailable registered pin or an unreachable migration target fails with
39
+ `PinnedEventTypeGenerationUnavailable`, rather than silently substituting a
40
+ schema.
41
+
42
+ Revised events use their **latest revision**, migrating it to the pin when
43
+ needed. The revision's stored hash is retained only when its generation already
44
+ matches the pin; otherwise the delivered hash is `EventHash.NotSet`. SQL
45
+ revisions from before this release cannot be distinguished from original
46
+ content and retain existing generation-selection behavior until revised again.
47
+
48
+ Every observer/projection may pin **only one generation per event identifier**
49
+ across all handlers/clauses, including children and nested objects. Different
50
+ identifiers may pin different generations. See the client reference for the
51
+ client and kernel registration exception names. Changing a reactor/reducer's
52
+ pin or delivery mode does not itself trigger replay; request replay when prior
53
+ state needs rebuilding.
54
+
55
+ ## PDL pins are resolved once, when saved
56
+
57
+ For a PDL definition saved with `GenerationDelivery = Pinned`, a bare reference
58
+ such as `from PersonRegistered` resolves to the **highest registered generation
59
+ at registration time**. The definition persists that resolved pin. Join and
60
+ removal references, including children and nested references, follow the same
61
+ rule.
62
+
63
+ Registering a later generation does **not** advance an existing saved pin.
64
+ Re-saving the declaration resolves bare names again against the generations
65
+ registered at that time. Keep this distinction when deploying migrations: a
66
+ saved declaration is not a moving "latest" subscription.
67
+
68
+ PDL is owned by Screenplay and has **no generation-qualified event reference
69
+ syntax**. Never invent `PersonRegistered+2` or `Event+N`. When an explicit pin is
70
+ needed, use .NET fluent or model-bound builders with that generation's CLR event
71
+ type: for example, a `From<TEvent>` clause or `[FromEvent<TEvent>]` whose
72
+ `TEvent` carries the intended `[EventType]` or `[EventTypeGenerationFor<T>]`.
73
+ Do not mix two generations of the same identifier in different clauses.
74
+
75
+ Compatibility PDL retains bare-name generation **1** and identifier-only
76
+ dispatch. Immediate/passive and wildcard projections remain Compatibility;
77
+ ad-hoc queries are not opted in by this change. Do not use their results as
78
+ proof of pinned delivery.
79
+
80
+ ## Verify delivery through a real client
81
+
82
+ `ReadModelScenario` and `ReactorScenario` do **not** emulate kernel pinned
83
+ migration and protected-value release. The projection scenario preserves a
84
+ seeded event's generation, but that is not the kernel selecting or migrating
85
+ stored content. A scenario that feeds the desired CLR type only proves local
86
+ handling/mapping for that type.
87
+
88
+ Keep local decision/mapping specifications, and add **real-client integration**
89
+ against a matching kernel to prove generation delivery:
90
+
91
+ - Register both generations and their adjacent migration; use one pin per
92
+ identifier. Assert that conflicting pins are rejected.
93
+ - Append another generation and assert delivered content and
94
+ `EventContext.EventType.Generation` on reactors/reducers, plus projected state
95
+ for typed materialized projections. Check `AppendedGeneration` separately.
96
+ - Cover live delivery, catch-up, and replay; exercise contributing joins,
97
+ children, removals, and event-content/parent keys when the projection uses
98
+ them. Include missing stored generations and protected values when relevant.
99
+ - For saved PDL, verify that adding a generation preserves the old pin and that
100
+ re-saving resolves the bare reference anew.
101
+
102
+ Kernel specs provide product-level proof; in-process application scenarios are
103
+ not a replacement for real-client integration of this option.
104
+
105
+ ## Product sources
106
+
107
+ `Source/Kernel/Core/Events/EventGenerationRelease.cs` selects stored content,
108
+ releases with the selected schema, and migrates missing/revised generations.
109
+ `Source/Kernel/Core/Projections/ProjectionGenerationDeliveryValidation.cs`
110
+ validates all clauses; `Engine/DefinitionLanguage/ProjectionEventTypeReference.cs`
111
+ resolves PDL bare names. `Source/Clients/Testing/ReadModels/ProjectionReadModelProcessor.cs`
112
+ and `Reactors/ReactorScenario.cs` define the scenario boundary.
113
+
114
+ See [Chronicle's event type migration documentation](https://github.com/Cratis/Chronicle/blob/v19.48.0/Documentation/concepts/event-type-migrations.mdx#opt-in-to-pinned-observer-delivery).
@@ -12,9 +12,13 @@ guarantees. Then write it as `Automation` and `Translate` slices that say truthf
12
12
  protected, what is only recorded, and who acts. Grammar depth is in
13
13
  `cratis-screenplay-captures-and-reactions`; this skill owns the decisions.
14
14
 
15
- **One meaning of Translation:** outside data becomes our facts (a `capture` or a translator
16
- reaction over an imported event, in a `Translate` slice). Our own event-to-event follow-up is an
15
+ **Translation crosses an application boundary:** inbound turns outside data or foreign
16
+ public events into private local facts; outbound publishes private facts as one local public
17
+ event type. Declare `direction inbound|outbound` when public metadata is used; omission
18
+ preserves historical inbound for legacy translations. Private-to-private follow-up is an
17
19
  Automation (`produces` or `invokes`), even when a Chronicle reactor realizes it.
20
+ Read [public events and direction](references/public-events-and-direction.md) for released
21
+ ESM v9 forms, event-target folds, publication specifications and the Unsupported capture limit.
18
22
 
19
23
  Work in the model first. Code appears only where it is truly needed: the external call, the
20
24
  source adapter, the trusted actor, and everything Stage cannot render (below). Session and
@@ -35,8 +39,9 @@ identity, effect and pending-work contract at that point; do not postpone it to
35
39
  (`references/realization-and-gap-fill.md`).
36
40
  - Reaction `runs as system role "<Role>"` declares an invocation actor (ESM v10).
37
41
  Without it the invoke has no caller. Historical CLI 3.41.0's 4.114.0 compiler
38
- rejected the syntax (PLAY0137); current CLI 3.46.1 instead refuses ESM v10
39
- at render admission (CLI-RENDER-004). Checked model/diagnostics: captures-and-reactions
42
+ rejected the syntax (PLAY0137); previous CLI 3.46.1 refused ESM v10
43
+ at render admission (CLI-RENDER-004). CLI 3.50.0 reaches Stage 4.67.0's
44
+ construct admission, which still refuses reaction identity (STAGE-ESM-034). Checked model/diagnostics: captures-and-reactions
40
45
  `references/invocation-identity.md`.
41
46
 
42
47
  ## Effect guarantees and recovery traps
@@ -11,8 +11,10 @@ technique: partial work stays visible and nothing is skipped because it looked r
11
11
 
12
12
  Result is `complete` only when every column is filled or says why it does not apply (for example
13
13
  "direct effect: immediate, internal, cannot fail"). `open` names the unresolved decision and who
14
- answers. `blocked` names the actual capability gap (for example current CLI
15
- 3.46.1 refuses ESM v10 at render admission with CLI-RENDER-004) with intended behavior.
14
+ answers. `blocked` names the actual capability gap with intended behavior. For example,
15
+ CLI 3.50.0 admits ESM v10 to Stage 4.67.0 construct checks, where reaction identity
16
+ is refused with STAGE-ESM-034. Previous CLI 3.46.1 refused v10 at the version gate
17
+ with CLI-RENDER-004; do not report that historical refusal as the current gap.
16
18
 
17
19
  ## Per translation (capture or translator reaction)
18
20
  | Source and type | Location | Correlation | Field dispositions | Target fields traced | Dedup and ordering | Trust boundary | Recovery owner | Named cases | Result |
@@ -72,9 +72,9 @@ Screenplay 4.125.0 declares the actor with reaction-level `runs as system role
72
72
  "<Role>"` (ESM v10); without it a gated invocation has no caller and denies.
73
73
  `given caller` is not an invocation actor. Role requirements remain enforced;
74
74
  claim conditions for this system principal remain unknown. Historical CLI 3.41.0's
75
- older compiler rejected the syntax (PLAY0137). Current CLI 3.46.1 bundles
76
- Screenplay 4.130.0 / Stage 4.52.0 and refuses v10 at render admission
77
- (CLI-RENDER-004; toolchain `references/versions.md`).
75
+ older compiler rejected the syntax (PLAY0137). CLI 3.50.0 bundles Screenplay 4.131.0 / Stage 4.67.0 and reaches v10
76
+ construct admission, but reaction identity still refuses STAGE-ESM-034.
77
+ Previous CLI 3.46.1 refused v10 at its version gate; see toolchain `references/versions.md`.
78
78
  Use the checked model in captures-and-reactions `references/invocation-identity.md`.
79
79
  Arc gap-fill uses `[ExecuteCommandsAsSystem("<role>")]` for returned commands,
80
80
  not identity inferred from prose or an imperative pipeline call.
@@ -44,5 +44,8 @@ binds); tool-qualified verdict text; the trusted-actor text now names `[ExecuteC
44
44
  `reactions.md`, `ReactionIdentityParser.cs`, `ReactionRefusalValidator.cs` and the
45
45
  binder's v10 selection; the checked scenario passed reference execution. CLI
46
46
  3.41.0's older parser and Stage 4.51.3's v7 planner were historical target limits.
47
- Current CLI 3.46.1 bundles Screenplay 4.130.0 / Stage 4.52.0 and still refuses
48
- v10 at render admission (CLI-RENDER-004; toolchain `references/versions.md`).
47
+ Previous CLI 3.46.1 refused v10 at its version gate. CLI 3.50.0 bundles
48
+ Screenplay 4.131.0/Stage 4.67.0, reaches v10 construct checks, and still refuses
49
+ reaction identity with STAGE-ESM-034; see toolchain `references/versions.md`.
50
+ Public/direction forms and routes/filters follow Screenplay v4.135.0 decisions
51
+ 0049–0051 and 0060–0066, not the older inbound-only translation scope.
@@ -0,0 +1,137 @@
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
+ # Public events and translation direction (released ESM v9)
5
+
6
+ ## Contents
7
+
8
+ - Choose the boundary and direction
9
+ - Outbound publication and specifications
10
+ - Inbound event captures
11
+ - Admission and evidence
12
+
13
+ ## Choose the boundary and direction
14
+
15
+ Events are private by default. `public event X` declares a local public contract;
16
+ `event X from "store"` declares a foreign public event's shape locally. The quoted
17
+ origin is an opaque store name, not a path or declaration reference. Nothing checks
18
+ that the local shape matches the other application's contract. A public/foreign
19
+ `import Qualified.X from "store"` has no local shape and remains PLAY0268.
20
+
21
+ `direction inbound` and `direction outbound` belong directly inside a Translate
22
+ slice. Omission preserves historical inbound behavior for translations with no
23
+ public metadata. A translation declaring or using public metadata needs explicit
24
+ direction (PLAY0614), not a guess from its name.
25
+
26
+ - Inbound: accept public foreign events or outside data and produce private local
27
+ facts. Use `capture` or a translating reaction. Correlation, deduplication,
28
+ enrichment and recovery still need the method skill's decisions.
29
+ - Outbound: consume private local facts and publish exactly one local public event
30
+ type through a reaction or event-target projection/reducer. No capture belongs
31
+ here. A private-to-private follow-up is an Automation, not an outbound Translate.
32
+ - A command never produces a public event (PLAY0607), and a foreign public event
33
+ is never produced locally (PLAY0613). Export only the intended contract fields;
34
+ public visibility does not authorize exposing personal data or secrets.
35
+
36
+ ## Outbound publication and specifications
37
+
38
+ `projection P => PublicEvent` resolves its target as an event rather than a read
39
+ model. Keep read-model and event names distinct. The outbound slice owns exactly
40
+ one local public event type; its builders target that event only. Event-target
41
+ reducers have the same boundary but opaque transitions: the reference evaluator
42
+ returns typed Unsupported when a transition is reached, not a successful fold.
43
+
44
+ An event-target projection holds one folded instance per event source id, not a
45
+ read-model key. It publishes when the folded instance is complete and differs from
46
+ the last published instance for that id. An identical repeated private fact emits
47
+ nothing; changed state emits a new public instance, never rewrites the old fact.
48
+ The reference fold admits only root-property set/clear from literals or event
49
+ properties; other mappings block planning. Publication is unrouted and reactions
50
+ can observe the new public fact. A route filter therefore cannot select publication.
51
+
52
+ This complete source uses the released publication specification form:
53
+
54
+ ```screenplay
55
+ domain Contracts
56
+ concept OrderId : Uuid
57
+ concept OrderStatus : String
58
+ module Integration
59
+ feature Translation
60
+ slice StateChange PackOrder
61
+ command PackOrder
62
+ orderId OrderId identifier
63
+ carrier String
64
+ produces OrderPacked
65
+ for orderId
66
+ carrier = carrier
67
+ event OrderPacked
68
+ carrier String
69
+ slice Translate PublishOrderShipped
70
+ direction outbound
71
+ public event OrderShipped
72
+ carrier String
73
+ status OrderStatus
74
+ projection OrderShippedPublisher => OrderShipped
75
+ from OrderPacked
76
+ status = "packed"
77
+ specification PublishingAPackedOrder
78
+ when append OrderPacked
79
+ for "3fa85f64-5717-4562-b3fc-2c963f66afa6"
80
+ carrier = "DHL"
81
+ then OrderShipped
82
+ carrier = "DHL"
83
+ status = "packed"
84
+ ```
85
+
86
+ `when append <PrivateEvent>` commits the input; the `then <PublicEvent>` list
87
+ contains only the follow-up publications, exhaustive and ordered. Also specify
88
+ incomplete state, unchanged repeat, changed state and independent event source ids.
89
+ An expected public instance is not a `then readmodel` assertion.
90
+
91
+ ## Inbound event captures
92
+
93
+ The foreign declaration must carry a quoted origin. `source events` has one or
94
+ more distinct `from <ForeignEvent>` children; no URL, table or other setting is
95
+ allowed in that block. It is valid only in an explicitly inbound Translate slice.
96
+
97
+ ```screenplay
98
+ domain Contracts
99
+ concept OrderId : Uuid
100
+ module Integration
101
+ feature Tracking
102
+ slice Translate TrackShipments
103
+ direction inbound
104
+ event ShipmentDispatched from "shipping"
105
+ orderId OrderId
106
+ event OrderDispatched
107
+ orderId OrderId
108
+ capture ShipmentTracking
109
+ source events
110
+ from ShipmentDispatched
111
+ key orderId
112
+ append OrderDispatched
113
+ orderId = $.orderId
114
+ ```
115
+
116
+ This compiles and binds as ESM v9. Evaluating the events-source capture returns
117
+ typed Unsupported: the event-payload-to-working-record contract is not admitted.
118
+ Do not equate binding with a passing capture specification or invent that mapping.
119
+ Keep correlation and resulting private events in the model and report the runtime gap.
120
+
121
+ ## Admission and evidence
122
+
123
+ ESM v9 shipped in Screenplay 4.117.0 and is selected only by use of public events,
124
+ origins, direction, event-target builders or events-source captures. At 4.135.0,
125
+ publication reference scenarios execute; imported shapes still refuse binding.
126
+ Stage 4.52.0 (previous CLI 3.46.1) audits only through v7: CLI-RENDER-004 precedes
127
+ its STAGE-ESM-016 version refusal. CLI 3.50.0/Stage 4.67.0 reaches construct
128
+ admission through v10 but still refuses publication (STAGE-ESM-032), foreign
129
+ events/events-source captures (STAGE-ESM-033); source admission is not rendering.
130
+
131
+ Source: Screenplay `v4.135.0:Documentation/screenplay/fixtures/public-events.play`,
132
+ `events.md`, `slices.md`, `captures.md`, decisions 0049–0051 and
133
+ `Source/DotNET/Screenplay.CanonicalCorpus/PublicEventsCorpus.cs`.
134
+ Renderer source: Stage `v4.52.0:Source/Rendering.Cratis/Semantics/SemanticCratisAdmission.cs`
135
+ and `v4.67.0:Source/Rendering.Cratis/Semantics/SemanticVersionFeatures.cs`.
136
+ Diagnostics and repairs: toolchain `references/diagnostics.md`; version allocation:
137
+ toolchain `references/versions.md`.
@@ -3,12 +3,16 @@
3
3
  "input": "Our payment provider sends webhooks when invoices are paid or refunded, and we must email a receipt afterwards. Model the integration and the follow-up in the Screenplay model.",
4
4
  "fixtures": [],
5
5
  "assertions": [
6
+ { "kind": "skill-contains", "value": "direction outbound", "file": "references/public-events-and-direction.md" },
7
+ { "kind": "skill-contains", "value": "source events", "file": "references/public-events-and-direction.md" },
8
+ { "kind": "skill-contains", "value": "then OrderShipped", "file": "references/public-events-and-direction.md" },
9
+ { "kind": "skill-contains", "value": "typed Unsupported", "file": "references/public-events-and-direction.md" },
6
10
  { "kind": "play-compiles" },
7
11
  { "kind": "skill-contains", "value": "`[ExecuteCommandsAsSystem(\"<role>\")]`" },
8
12
  { "kind": "skill-contains", "value": "ESM v10" },
9
13
  { "kind": "skill-contains", "value": "STAGE-ESM-024" },
10
14
  { "kind": "skill-contains", "value": "runs as system role" },
11
- { "kind": "skill-contains", "value": "**One meaning of Translation:**" },
15
+ { "kind": "skill-contains", "value": "**Translation crosses an application boundary:**" },
12
16
  { "kind": "skill-contains", "value": "complete, open or blocked" },
13
17
  { "kind": "skill-contains", "value": "never write a mapping" },
14
18
  { "kind": "skill-contains", "value": "run-specifications" },
@@ -6,9 +6,8 @@ license: MIT
6
6
 
7
7
  # Captures and reactions
8
8
 
9
- The two slice types that run without anyone pressing a button. A `capture` in a
10
- `Translate` slice turns outside data into events; a `reaction` in an `Automation`
11
- slice runs when something happens.
9
+ `capture` accepts outside data; `reaction` responds to an occurrence.
10
+ Translate slices cross public boundaries; Automation slices cause private follow-up.
12
11
 
13
12
  ## Locate the model
14
13
 
@@ -26,16 +25,9 @@ source is the single flow model.
26
25
 
27
26
  ## Verified product sources
28
27
 
29
- | Package | Version | Purpose |
30
- | --- | --- | --- |
31
- | `Cratis.Screenplay` | `4.31.0` | CDL parser, reaction and trigger parsers, diagnostics, semantic binder |
32
- | `Cratis.Screenplay` | main `fd18129` | Command-only inline event boundary |
33
- | `Cratis.Screenplay` | `4.66.0` (`c89198b`) | ESM v6: reactions, clock, trigger and capture specifications bind; `invokes` caller rule; probed with the standalone tool and its MCP server |
34
-
35
- The table records historical examples/probes; they are not reclassified as
36
- current execution evidence. Refusal/redelivery guidance follows released
37
- v4.125.0 `reactions.md`/`specifications.md`. Current pins are in toolchain
38
- `references/versions.md`; reverify before promoting an old probe to that version.
28
+ Read [product sources](references/product-sources.md) for retained historical
29
+ parser/binder probes and refusal/redelivery evidence. Current pins are in toolchain
30
+ `references/versions.md`; historical examples are not current execution evidence.
39
31
 
40
32
  ⚠️ **Which tool admits them depends on its Screenplay version.** The ESM level
41
33
  decides, not the slice type:
@@ -57,6 +49,13 @@ them. Read `cratis-screenplay-toolchain` (`references/versions.md`) when selecti
57
49
  Method (the four-part automation test, loops, translations versus automations):
58
50
  `cratis-screenplay-automations-and-translations`.
59
51
 
52
+ ## Public boundaries and observer selection
53
+
54
+ Read [ESM v9 translation](../cratis-screenplay-automations-and-translations/references/public-events-and-direction.md)
55
+ for `direction`, `source events`/`from`, and its typed Unsupported evaluation.
56
+ Read [v10 filters](../cratis-screenplay-toolchain/references/production-routes-and-filters.md)
57
+ for reaction/reducer `from Source[.Stream]`; unrouted facts never match.
58
+
60
59
  ## Specify what sets them off
61
60
 
62
61
  A specification names what sets the automation off: `when clock`, `when trigger`
@@ -76,9 +75,9 @@ Read [invocation identity](references/invocation-identity.md) for the checked
76
75
  scenario, claim/unknown semantics and PLAY0647–0652/0557 diagnostics.
77
76
 
78
77
  Historical CLI 3.41.0's 4.114.0 compiler rejected this source with PLAY0137.
79
- Current CLI 3.46.1 bundles Screenplay 4.130.0 / Stage 4.52.0; its render version
80
- gate still admits only through v7 (CLI-RENDER-004 for v10). Target realization is gap-fill,
81
- using Arc `[ExecuteCommandsAsSystem]` for returned commands. Without that attribute
78
+ Previous CLI 3.46.1 refused v10 (CLI-RENDER-004); CLI 3.50.0 reaches
79
+ Stage 4.67.0's construct admission, still refusing identity (STAGE-ESM-034).
80
+ Target realization is gap-fill, using Arc `[ExecuteCommandsAsSystem]` for returned commands. Without that attribute
82
81
  Arc supplies no principal and `[Authorize]`/`[Roles]` deny. Each invoked command
83
82
  is atomic, not the whole cascade; earlier accepted facts remain after a later refusal.
84
83
 
@@ -71,10 +71,10 @@ module Work
71
71
 
72
72
  Historical CLI 3.41.0 bundled Screenplay 4.114.0, which did not parse `runs as`:
73
73
  the example's `cratis screenplay validate --executable --warnings-as-errors`
74
- returned PLAY0137, exit 5. This is not a current parser claim. Current CLI 3.46.1
75
- bundles Screenplay 4.130.0 but its render gate still admits only through v7
76
- (CLI-RENDER-004 for v10); bundled Stage 4.52.0's direct planner audits through
77
- v7 and refuses v10 with STAGE-ESM-016 (`references/versions.md` in toolchain).
74
+ returned PLAY0137, exit 5. This is not a current parser claim. CLI 3.50.0 bundles
75
+ Screenplay 4.131.0/Stage 4.67.0 and reaches v10 construct admission, but
76
+ reaction identity still refuses STAGE-ESM-034. Previous CLI 3.46.1/Stage 4.52.0
77
+ audited through v7 only (`references/versions.md` in toolchain).
78
78
  Clock/application-trigger identities have no Stage Arc realization either.
79
79
  Use authorized gap-fill with the model as contract; returned-command Arc identity
80
80
  uses `[ExecuteCommandsAsSystem]`, never permission inferred from a model header.
@@ -0,0 +1,15 @@
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
+ # Retained product-source evidence
5
+
6
+ | Package | Version | Purpose |
7
+ | --- | --- | --- |
8
+ | `Cratis.Screenplay` | `4.31.0` | CDL parser, reaction and trigger parsers, diagnostics, semantic binder |
9
+ | `Cratis.Screenplay` | main `fd18129` | Command-only inline event boundary |
10
+ | `Cratis.Screenplay` | `4.66.0` (`c89198b`) | ESM v6: reactions, clock, trigger and capture specifications bind; `invokes` caller rule; probed with the standalone tool and its MCP server |
11
+
12
+ The table records historical examples/probes, not current execution evidence.
13
+ Refusal/redelivery guidance follows released v4.125.0 `reactions.md`/`specifications.md`.
14
+ Current pins live in toolchain `references/versions.md`; reverify before promoting
15
+ an old probe to that version.
@@ -3,10 +3,12 @@
3
3
  "input": "Translate external data into events and declare a reaction.",
4
4
  "fixtures": [],
5
5
  "assertions": [
6
+ { "kind": "skill-contains", "value": "unrouted facts never match" },
7
+ { "kind": "skill-contains", "value": "source events" },
6
8
  { "kind": "play-compiles" },
7
9
  {
8
10
  "kind": "skill-contains",
9
- "value": "main `fd18129`"
11
+ "value": "main `fd18129`", "file": "references/product-sources.md"
10
12
  },
11
13
  {
12
14
  "kind": "skill-contains",
@@ -260,14 +260,13 @@ produces when isProForma == true
260
260
 
261
261
  ## Routes and external operations
262
262
 
263
- Named event sources/streams and command routes bind as ESM v8 (verified at 4.125.0);
264
- CLI 3.46.1 render rejects models above v7. A routed command's identifier and
265
- known event destinations must match the source's nominal identifier type
266
- (PLAY0504, error). Allocation uses the generated identifier's type, or without
267
- one requires a UUID-based source. Composite `streamId` routes map every named
268
- part exactly once; scalar `streamId T` and `streamId = x` remain valid. The complete checked route example
269
- and nested `streamId =` form are in `cratis-screenplay-toolchain`
270
- `references/sources-and-streams.md`.
263
+ Routes bind as ESM v8; production `stream Source.Stream` overrides
264
+ select v10. Read toolchain [routes](../cratis-screenplay-toolchain/references/production-routes-and-filters.md)
265
+ and [source/stream declarations](../cratis-screenplay-toolchain/references/sources-and-streams.md).
266
+ `public event X` is a local export; `event X from "store"` is a locally declared,
267
+ unverified foreign shape. Commands never produce public events. Read
268
+ [translation direction](../cratis-screenplay-automations-and-translations/references/public-events-and-direction.md)
269
+ for the released ESM v9 boundary and quoted opaque origins.
271
270
 
272
271
  Use `system`, `uses` and inline/standalone `operation` declarations to state
273
272
  external work in the authored production sequence, with execute/compensate phase
@@ -369,7 +368,7 @@ Four contexts, and **what each omits is load-bearing** — when writing a code b
369
368
  ## Verify
370
369
 
371
370
  - [ ] Validate the complete model root with warnings as errors; name the tool,
372
- version and result. Current pins: standalone 4.131.0 / CLI 3.46.1; bundle
371
+ version and result. Current pins: standalone 4.135.0 / CLI 3.50.0; bundle
373
372
  compatibility and execution are separate checks.
374
373
  - [ ] No unintended `PLAY0478` or `PLAY0479` information remains.
375
374
  - [ ] At most one command property carries `identifier`, and no event property does.