@cratis/pi 7.6.5 → 7.7.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 (212) hide show
  1. package/package/corpus/agents/backend-developer.md +14 -0
  2. package/package/corpus/agents/code-reviewer.md +16 -0
  3. package/package/corpus/agents/coordinator.md +17 -0
  4. package/package/corpus/agents/frontend-developer.md +17 -0
  5. package/package/corpus/agents/orchestrator.md +18 -0
  6. package/package/corpus/agents/planner.md +24 -0
  7. package/package/corpus/agents/screenplay-modeler.md +57 -0
  8. package/package/corpus/agents/screenplay-renderer.md +42 -0
  9. package/package/corpus/agents/screenplay-reviewer.md +45 -0
  10. package/package/corpus/agents/slice-implementer.md +32 -5
  11. package/package/corpus/agents/spec-writer.md +16 -3
  12. package/package/corpus/prompts/add-reactor.prompt.md +5 -3
  13. package/package/corpus/prompts/new-vertical-slice.prompt.md +16 -5
  14. package/package/corpus/prompts/write-specs.prompt.md +12 -6
  15. package/package/corpus/rules/application-profile.md +7 -3
  16. package/package/corpus/rules/general.md +8 -3
  17. package/package/corpus/rules/glossary.md +1 -1
  18. package/package/corpus/rules/profiles.md +42 -4
  19. package/package/corpus/rules/reactors.md +30 -22
  20. package/package/corpus/rules/vertical-slices.md +3 -1
  21. package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +13 -0
  22. package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +2 -0
  23. package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +173 -0
  24. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +66 -0
  25. package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +49 -0
  26. package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +23 -0
  27. package/package/corpus/skills/cratis-application-slice-conformance/references/worked-example.md +91 -0
  28. package/package/corpus/skills/cratis-application-slice-conformance/verification.json +14 -0
  29. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +57 -1
  30. package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +16 -0
  31. package/package/corpus/skills/cratis-arc-command/SKILL.md +10 -0
  32. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +10 -0
  33. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -0
  34. package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -0
  35. package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +10 -0
  36. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +68 -8
  37. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +199 -0
  38. package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -0
  39. package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +10 -0
  40. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +38 -10
  41. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -0
  42. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -0
  43. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +58 -6
  44. package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +9 -0
  45. package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +13 -0
  46. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +47 -0
  47. package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +11 -0
  48. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +13 -0
  49. package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +13 -0
  50. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +35 -16
  51. package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +28 -0
  52. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +166 -0
  53. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +31 -0
  54. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +139 -0
  55. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +69 -0
  56. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +88 -0
  57. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +64 -0
  58. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +37 -0
  59. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +34 -0
  60. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +208 -0
  61. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +126 -0
  62. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +93 -0
  63. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/worked-integration.md +98 -0
  64. package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +15 -0
  65. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +267 -50
  66. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +185 -0
  67. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +60 -12
  68. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +42 -12
  69. package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +30 -0
  70. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +229 -0
  71. package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +37 -0
  72. package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +64 -0
  73. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +62 -0
  74. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +222 -0
  75. package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +66 -0
  76. package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +152 -0
  77. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +111 -0
  78. package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +37 -0
  79. package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +119 -0
  80. package/package/corpus/skills/cratis-screenplay-discovery/references/worked-session.md +87 -0
  81. package/package/corpus/skills/cratis-screenplay-discovery/verification.json +15 -0
  82. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +140 -77
  83. package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +51 -0
  84. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +114 -28
  85. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +50 -0
  86. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +28 -3
  87. package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +31 -0
  88. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +239 -0
  89. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/chronicle-observations.md +25 -0
  90. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +79 -0
  91. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +48 -0
  92. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +75 -0
  93. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +164 -0
  94. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +88 -0
  95. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +47 -0
  96. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +147 -0
  97. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +10 -0
  98. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +36 -0
  99. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +126 -0
  100. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -0
  101. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +52 -0
  102. package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +17 -0
  103. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +77 -57
  104. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +50 -20
  105. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +211 -0
  106. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +44 -6
  107. package/package/corpus/skills/cratis-screenplay-model-authoring/references/provenance.md +13 -0
  108. package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +64 -10
  109. package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +34 -0
  110. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +209 -0
  111. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +89 -0
  112. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +128 -0
  113. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +176 -0
  114. package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +36 -0
  115. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +149 -0
  116. package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +59 -0
  117. package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +255 -0
  118. package/package/corpus/skills/cratis-screenplay-model-review/verification.json +13 -0
  119. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +32 -0
  120. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +239 -0
  121. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/code-reading-and-tokens.md +55 -0
  122. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +124 -0
  123. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +84 -0
  124. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/opt-in.md +48 -0
  125. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phase-report-inventories.md +25 -0
  126. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +162 -0
  127. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +53 -0
  128. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +63 -0
  129. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +31 -0
  130. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +31 -0
  131. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +46 -0
  132. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +204 -0
  133. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +55 -0
  134. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +86 -0
  135. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +16 -0
  136. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +14 -3
  137. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +15 -1
  138. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +2 -0
  139. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +179 -0
  140. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +99 -0
  141. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +67 -0
  142. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +72 -0
  143. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +27 -0
  144. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +56 -0
  145. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +124 -0
  146. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +14 -0
  147. package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +31 -0
  148. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +200 -0
  149. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +579 -0
  150. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/chronicle-verification.md +24 -0
  151. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +102 -0
  152. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +41 -0
  153. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +196 -0
  154. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +102 -0
  155. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +71 -0
  156. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +91 -0
  157. package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +13 -0
  158. package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +30 -0
  159. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +236 -0
  160. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +107 -0
  161. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +130 -0
  162. package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +20 -0
  163. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +201 -0
  164. package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +23 -0
  165. package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +41 -0
  166. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +122 -0
  167. package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +305 -0
  168. package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +43 -0
  169. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +217 -36
  170. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +28 -4
  171. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +33 -0
  172. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +191 -0
  173. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +154 -0
  174. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +54 -0
  175. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +191 -0
  176. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +70 -0
  177. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +65 -0
  178. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +13 -0
  179. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +128 -0
  180. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +378 -0
  181. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +14 -0
  182. package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +2 -0
  183. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +177 -0
  184. package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +121 -0
  185. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +319 -0
  186. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +96 -0
  187. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +107 -0
  188. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +48 -0
  189. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +113 -0
  190. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +148 -0
  191. package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +267 -0
  192. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +51 -0
  193. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +88 -0
  194. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +51 -0
  195. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +134 -0
  196. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +134 -0
  197. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +15 -0
  198. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +53 -5
  199. package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +56 -0
  200. package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +13 -0
  201. package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +65 -0
  202. package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
  203. package/package/corpus/skills/cratis-specification-by-example/SKILL.md +44 -1
  204. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +10 -0
  205. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +186 -219
  206. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +177 -0
  207. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +150 -0
  208. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +87 -0
  209. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +98 -0
  210. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +19 -0
  211. package/package/profile-catalog.json +11 -0
  212. package/package.json +1 -1
@@ -1,245 +1,212 @@
1
1
  ---
2
2
  name: cratis-stage-rendering-and-sandbox
3
- description: Understand what Cratis Stage actually does with a Screenplay `.play` model today — the deterministic artifact render plan and the narrow model shape it admits, the disposable `cratis/stage` sandbox container, and the `cratis/stage-specrunner` model-level specification job. Use when deciding whether Stage can render a model, when interpreting a blocked render plan, or when running the sandbox. Do not use for authoring the `.play` model itself.
3
+ description: "What Cratis Stage and `cratis render` actually do with a Screenplay `.play` model today: the narrow model shape Stage 4.24 admits and refuses (STAGE-ESM-*), what it emits (C# Arc/Chronicle backend, React/Vite scaffold, Debug specifications), managed publication, `--force` and recovery, the unmanaged `Customizations/` seam, and the `cratis/stage` sandbox and `cratis/stage-specrunner` job. Use when deciding whether Stage can render a model, reading a blocked render, re-rendering safely, or running the sandbox. Not for: authoring the model (use `cratis-screenplay-model-authoring`) or the render and gap-fill workflow (use `cratis-screenplay-render-and-gap-fill`)."
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # What Stage renders, and what it refuses
8
8
 
9
- Stage turns a Screenplay `.play` model into Cratis Arc + Chronicle application
10
- source. It ships three things: a **renderer** exposed as a .NET library, a
11
- **disposable runtime sandbox** container, and a **specification runner**
12
- container.
9
+ Stage turns a Screenplay `.play` model into a Cratis Arc + Chronicle application. It
10
+ ships a **renderer** (a .NET library, driven from a terminal by `cratis render`), a
11
+ disposable **sandbox** container (`cratis/stage`, started by `cratis run`) and a
12
+ **specification runner** container (`cratis/stage-specrunner`).
13
13
 
14
- ⚠️ **Stage is experimental, and its admitted model shape is very small.** The
15
- renderer accepts one command per state-change slice, one produced event,
16
- `not empty` validation only, one read model with one projection, and at most one
17
- by-identifier snapshot query. Anything richer produces **no artifacts at all**,
18
- not thinner ones. Read the admission rules below before promising a model can be
19
- rendered.
14
+ Stage is experimental and its admitted model shape is small. A model it cannot render
15
+ exactly produces **no artifacts at all**, never thinner ones. Read the admission rules
16
+ before promising that a model can be rendered, and render it to find out: the source
17
+ reading in this skill is not a render result.
20
18
 
21
19
  ## Verified product sources
22
20
 
23
- | Artifact | Version | What it is |
21
+ | Source | Pin | Notes |
24
22
  | --- | --- | --- |
25
- | `Cratis.Stage.Contracts` | `3.15.1` | `ArtifactRenderPlan`, `EventModelLoader`, specification-result contracts |
26
- | `Cratis.Stage.Rendering.Cratis` | `3.15.1` | The one rendering target and the `CratisRendering` facade |
27
- | `Cratis.Stage.Rendering.Cratis.Scaffolding` | `3.15.1` | Scaffolds the Cratis project a rendered application is placed into |
28
- | `Cratis.Stage` | `3.15.1` | The partial direct runtime engine |
29
- | `cratis/stage` | `3.15.1`, `latest` | Disposable HTTP host plus an in-memory Chronicle kernel |
30
- | `cratis/stage-specrunner` | `3.15.1`, `latest` | Run-to-completion specification job |
31
-
32
- Behavior below is read from the repository at tag `v3.15.1`. Packing is opt-in
33
- per project (`<IsPackable>true</IsPackable>` on `Contracts`, `Rendering.Cratis`,
34
- `Rendering.Cratis.Scaffolding` and `Stage`); `Cratis.Stage.Host` and
35
- `Cratis.Stage.SpecRunner` never opt in and exist only as the two container
36
- images.
37
-
38
- ## Input
39
-
40
- The authoritative input is Screenplay source: a folder of `.play` files,
41
- compiled recursively over `**/*.play` and merged into one model. There is no
42
- other supported entry format — an `event-model.json` file is **not** the current
43
- startup or rendering contract, and the loader cannot read one.
44
-
45
- ## The renderer
46
-
47
- There is **no CLI, no dotnet tool, and no container for rendering.** The entry
48
- point is a static facade in `Cratis.Stage.Rendering.Cratis`:
49
-
50
- ```csharp
51
- var options = new CratisRenderingOptions("Projects", "Projects");
52
- var scope = new ArtifactRenderScope(ArtifactRenderScopeKind.Application, model.Application.Id);
53
- var plan = CratisRendering.Plan(model, executionPlan, scope, options);
54
- ```
23
+ | Stage | `v4.24.0` (`fa48546`) | Renderer, sandbox host, spec runner; pins Screenplay 4.60.0 |
24
+ | cratis CLI | `v3.27.1` (`a327e89`) | `cratis render`, `cratis run`; bundles Stage 4.24.0 and Screenplay 4.60.1 |
25
+ | Rendered applications | Arc `22.25.0`, Chronicle `19.8.1`, .NET 10 | The scaffold profile; frontend Components 4.14.0, Scene 4.2.0 |
55
26
 
56
- ⚠️ Two things make this harder than it looks:
57
-
58
- 1. It takes a Screenplay `ExecutableSemanticModel` and a `SemanticExecutionPlan`,
59
- **not** a folder path. Stage ships no helper that turns `.play` files into
60
- those — `EventModelLoader` produces the other, syntax-shaped model that the
61
- renderer does not accept. Producing the semantic model is the caller's job,
62
- using `Cratis.Screenplay`'s `SemanticModelCompiler` and
63
- `SemanticExecutionPlan.Compile`.
64
- 2. The intended callers are the Cratis CLI and Studio. Rendering from a terminal
65
- today means writing C# against this facade.
66
-
67
- Callers pass only a project name and a root namespace. The facade owns every
68
- target, renderer, profile, package and runtime version itself; do not
69
- reconstruct or modify the profile — the planner rejects changed identities,
70
- versions, input rosters, bytes and hashes.
71
-
72
- `Plan` performs no file-system, process, network, environment, clock or random
73
- access. It returns an `ArtifactRenderPlan` holding normalized relative paths,
74
- exact bytes and a SHA-256 per artifact, plus typed diagnostics. **Publish only
75
- when `plan.Success` is true; a failed plan carries diagnostics and no candidate
76
- artifacts.**
77
-
78
- ### What it admits
79
-
80
- Every rule below is enforced, and each failure is a blocking `STAGE-ESM-0xx`
81
- diagnostic that stops the whole plan. Before these per-slice rules run, three
82
- admission diagnostics reject the model outright — `STAGE-ESM-001` (a slice kind
83
- other than `StateChange`/`StateView`), `STAGE-ESM-002` (concept values or
84
- validation the renderer cannot express) and `STAGE-ESM-003` (an unresolved
85
- property type) — and `STAGE-ESM-011` rejects a specification the runtime cannot
86
- execute.
87
-
88
- For a `StateChange` slice:
89
-
90
- - exactly one `command` (`STAGE-ESM-004`);
91
- - exactly one `produces` on it, no optional event properties, and validation
92
- limited to `not empty` with no operand (`STAGE-ESM-005`);
93
- - an unconditional `produces` whose destination is a command identifier property
94
- and whose mappings match the event's properties one for one
95
- (`STAGE-ESM-006`).
96
-
97
- For a `StateView` slice:
98
-
99
- - exactly one `readmodel`, exactly one `projection`, at most one `query`
100
- (`STAGE-ESM-007`);
101
- - one resolvable read-model transition on that projection (`STAGE-ESM-008`);
102
- - an affected-instance cardinality of one, keyed by an event property, carrying
103
- the event-source identity (`STAGE-ESM-009`);
104
- - if a query is present: an optional (`ZeroOrOne`) snapshot lookup by the read
105
- model's single identifier (`STAGE-ESM-010`).
106
-
107
- Screenplay's own executable semantic model already rejects `Automation` and
108
- `Translate` slices before Stage sees them, so those never reach the renderer at
109
- all.
110
-
111
- ### What it emits
112
-
113
- At application scope, exactly eight deterministic backend scaffold files:
114
- `Directory.Build.props`, `Directory.Build.targets`, `Directory.Packages.props`,
115
- the `.csproj`, the `.slnx`, `Program.cs`, `appsettings.json` and
116
- `docker-compose.yml`. The generated `Program.cs` is the whole application host:
117
-
118
- ```csharp
119
- using Cratis.Arc.MongoDB;
120
-
121
- var builder = WebApplication.CreateBuilder(args);
122
- builder.Services.AddHealthChecks();
123
- builder.AddCratis(
124
- configureArcBuilder: arc => arc.WithMongoDB(),
125
- configureChronicleBuilder: chronicle => chronicle.WithCamelCaseNamingPolicy());
126
-
127
- var app = builder.Build();
128
- app.UseCratis();
129
- app.MapHealthChecks("/healthz");
130
-
131
- await app.RunAsync();
132
- ```
27
+ Everything below was read at those tags (`Source/Rendering.Cratis/**`, `README.md`,
28
+ `Documentation/**` in Stage; `Source/Cli/Commands/Render/**` and
29
+ `Documentation/reference/screenplay.md` in the CLI), and the vertical in
30
+ [references/render-example.md](references/render-example.md) was rendered, built and
31
+ tested with cratis 3.27.1. The full version table (Screenplay 4.64.0, Arc 22.50.5,
32
+ Chronicle 19.32.0 and the tool split) is in the `cratis-screenplay-toolchain` skill,
33
+ `references/versions.md`. Rendered apps are on Arc 22.25.0, so `[ProtectedDecision]`
34
+ (Arc 22.39.0 and later) is not available in code written into one.
133
35
 
134
- Per model, it emits concept types (`ConceptAs<T>` and `EventSourceId<T>`), a file
135
- per state-change slice holding the `[Command]` record with its `Handle()`, the
136
- `[EventType]` record it produces and a `CommandValidator<T>`, a file per
137
- state-view slice holding the `[FromEvent<T>] [ReadModel]` record and its static
138
- query method, and one xunit specification file per modeled `specification`,
139
- wrapped in `#if DEBUG`.
140
-
141
- The profile pins .NET 10, Cratis/Arc `22.3.0`, and the Chronicle image
142
- `16.35.3-development` in the generated compose file. It emits **no frontend** —
143
- screens, layouts and forms are outside the current backend milestone — and no
144
- `.gitignore`, repository marker, floating version or random identifier.
145
-
146
- The generated compose binds local ports `27017` and `35000`. Start it with
147
- `docker compose up --detach`, run the generated project, and probe `/healthz`.
148
-
149
- ⚠️ There is **no committed generated output anywhere in the repository** — no
150
- golden files, no approval snapshots, no sample `.play` fixtures. Every claim
151
- about output is proven instead by a specification that plans the frozen
152
- `RegisterProject` corpus, writes the bytes to a temporary directory, runs
153
- `dotnet build`, `dotnet test` and `dotnet build -c Release` over them with zero
154
- warnings, and — when Docker is available — boots the result against a real
155
- Chronicle container and polls `/healthz`. That is a genuine end-to-end proof, for
156
- exactly one model.
157
-
158
- ### "Reviewable" means deterministic, not reviewed
159
-
160
- The plan is destination-independent, ordered, hashed, LF-normalized and UTF-8
161
- without a BOM, and re-planning the same input produces identical paths, hashes
162
- and bytes. That is what lets a caller diff a plan.
163
-
164
- ⚠️ **No review, diff, approval or staged-commit mechanism is implemented.** Safe
165
- staged publication and stale-file removal are explicitly deferred to work outside
166
- this repository. Do not describe Stage as reviewing or approving anything.
167
-
168
- The older syntax-based `IRenderer` and the optional
169
- `Cratis.Stage.Rendering.Cratis.Scaffolding` package cover more of the language
170
- but write straight to disk, and the repository is blunt about them: direct
171
- rendering has no managed staging or safe stale-file removal, and a failure can
172
- leave its target **unsafe and incomplete**. Treat them as legacy compatibility
173
- only.
174
-
175
- ## The sandbox
36
+ ## Model-first rule
176
37
 
177
- ```bash
178
- docker run --rm \
179
- -p 9090:9090 \
180
- -p 35000:35000 \
181
- -v "$PWD":/eventmodel \
182
- cratis/stage:latest
183
- ```
38
+ The `.play` model is the source of truth; Stage-managed output is derived from it.
39
+
40
+ - Change the model, then render again. Never edit a file listed in `.cratis-render.json`:
41
+ the next render replaces it or refuses.
42
+ - Hand-written code goes in `Customizations/` (unmanaged), in a separate project, or in
43
+ an explicitly authorized gap-fill for scope Stage cannot render (`cratis-screenplay-render-and-gap-fill`).
44
+ - A customization never makes a rejected model renderable, and never weakens modeled
45
+ authorization, validation or `@pii` to get past a refusal.
46
+ - Never claim a whole-application result from a subset of the model.
184
47
 
185
- The image pairs the Stage host with an in-memory Chronicle kernel and reads the
186
- model from the fixed `/eventmodel` directory (mount your folder there; the
187
- entrypoint takes no arguments — passing a folder is a documented override form). The Stage API is on `9090`, the Chronicle
188
- Workbench on `35000`. Deployment configuration is read from `cratis-stage.json`,
189
- overridable through the `STAGE_CONFIG` environment variable — not from
190
- `appsettings.json`.
191
-
192
- ⚠️ It is a **partial** runtime, not a generated application. Commands evaluate
193
- their modeled `produces` mappings, append the facts to Chronicle and echo the
194
- payload; **modeled validation and authorization are not enforced on this path.**
195
- Modeled queries are **served without authorization**: the query performer's
196
- `IsAuthorized` returns `true` unconditionally, and `Perform` reads the projected
197
- documents (by id when the query declares one, otherwise all instances). There is
198
- no executable query authorization contract in Screenplay yet, so a sandbox
199
- query answering is not evidence that the model's authorization is right —
200
- it is evidence that Stage does not enforce it. (Earlier Stage releases returned
201
- nothing from every query; that is no longer the case at 3.15.1.)
202
-
203
- ## Modeled specifications
48
+ ## Rendering with `cratis render`
204
49
 
205
50
  ```bash
206
- docker run --rm \
207
- -v /path/to/screenplays:/model \
208
- -v /path/to/results:/output \
209
- cratis/stage-specrunner:latest
51
+ cratis render ./model --name Marina --destination ./out
52
+ cratis render --workspace ./application.workspace.json --destination ./out
210
53
  ```
211
54
 
212
- A run-to-completion job: it compiles the `.play` files, checks the modeled
213
- specifications against the model, writes `results.json` and exits. It accepts
214
- `--model <folder>` and `--output <file>`, plus optional `--slice <guid>` and
215
- `--spec <guid>` filters, and defaults to `/model` and `/output/results.json`.
216
-
217
- ⚠️ Verification is **model-level**. It checks that the modeled facts and
218
- expectations are consistent; it does not execute each slice against a live
219
- runtime. A green `results.json` is not a passing integration test.
55
+ | Option | Meaning |
56
+ | --- | --- |
57
+ | `[PATH]` | A `.play` file or a folder (all `**/*.play`, one application). Defaults to the current directory; exclusive with `--workspace` |
58
+ | `--workspace <FILE>` | Canonical workspace envelope (Screenplay MCP `export-workspace`, at most 32 MiB). Keeps its application name and identities |
59
+ | `--name <NAME>` | **Required for plain source**, a C# identifier; sets the application identity (Chronicle event store, MongoDB database). With `--workspace` optional, and it must equal the workspace name |
60
+ | `--destination <DIR>` | Publication directory, default `./out`. It never defines identity |
61
+ | `--target` | Only `cratis` is bundled |
62
+ | `--project-name`, `--root-namespace` | Rendering overrides (dot-separated C# identifiers); do not change identity |
63
+ | `--force` | See "Publication and recovery" |
64
+
65
+ Order of events: recover any interrupted earlier publication, compile, bind, build the
66
+ execution plan, plan the target (Stage admission), validate artifacts, then publish.
67
+ Exit `0` is a published render, `5` is a refusal with nothing published (diagnostics are
68
+ printed), `1` is a missing input. Add `-o json` for the counts and the publication
69
+ receipt.
70
+
71
+ Facts that surprise:
72
+
73
+ - **Binding uses the CLI's bundled Screenplay 4.60.1** (ESM up to v5), not the standalone
74
+ 4.64.0 tool. Anything above ESM v5 (v6 constructs) fails binding first; a model that
75
+ binds only on the standalone tool is not renderable.
76
+ - **Render never builds, tests or runs** the output. A published render is admission and
77
+ publication only; build and tests are separate results (see "Verify"). Admission can be
78
+ green while a rendered Debug test fails (the example hit this with a query assertion).
79
+ - **Implementation attachments are read from the model root**: the folder, or the single
80
+ file's parent directory. Use a dedicated model folder. A required body that is missing
81
+ or changed blocks the render with `STAGE-ESM-020`. A workspace envelope has no
82
+ attachment root, so `file` references there fail the same way.
83
+ - `cratis render` and `cratis screenplay validate` are different gates: a model can
84
+ validate and still refuse here.
85
+
86
+ ## What Stage 4.24 admits
87
+
88
+ Whole-model admission needs ESM schema v1 to v3; anything else is `STAGE-ESM-016`. Event
89
+ generations (v4) also fail the CLI pre-check `CLI-RENDER-003`. The admitted vertical:
90
+
91
+ - concepts, composite types, collections and optional values;
92
+ - `StateChange` slices with exactly one command and an unconditional `produces` whose
93
+ `for` is the command identifier, with portable validation;
94
+ - `StateView` slices with exactly one projection (or reducer) per read model: a flat
95
+ `from` block, or a scoped projection (several `from`, `remove with`, root `join`,
96
+ one-level `children`, `nested`), keyed by the event source or an event property; and
97
+ any number of optional snapshot queries by the read-model identifier;
98
+ - declarative authorization (including query authorization) that requires authentication;
99
+ - unique constraints, and modeled specifications that fit the shapes in the reference;
100
+ - reducers whose bodies pass the **pure** allowlist (Roslyn analysis).
101
+
102
+ Not rendered: `Automation` and `Translate` slices (Stage#79, open: the whole automation
103
+ is gap-fill), reactions and captures, list, observable, filtered and scoped queries,
104
+ `produces when`, command `handler`s, code validation and opaque policies (they refuse),
105
+ composite-key projections, `all`, and compliance attributes (`@pii`, `@sensitive`, which
106
+ already fail binding with `PLAY0268`). Any one blocking diagnostic fails the whole plan.
107
+ A refusal is not a licence to weaken the model: drop no specification, event generation
108
+ or protection to get a render; keep the model, record the capability gap and gap-fill.
109
+ The code table, the projection and specification rules and three refusals reproduced while
110
+ building the example are in [references/admission.md](references/admission.md); the exhaustive ledger
111
+ is `references/renderable-subset.md` in `cratis-screenplay-toolchain`.
112
+
113
+ Descriptions and documentation are never rendered, so a rule that exists only in prose
114
+ is not enforced in the generated code.
115
+
116
+ ## What it emits
117
+
118
+ At application scope the plan holds the scaffold plus the modeled artifacts, for the
119
+ example 30 files: a `.csproj` and `.slnx`, `Program.cs`, `appsettings.json`,
120
+ `docker-compose.yml`, the Directory props files, a policy registration and generated
121
+ policies, `Common/<Concept>.cs`, one `<Module>/<Feature>/<Slice>/` folder per slice with
122
+ the `[Command]` record and `Handle()`, the `[EventType]` event, the validator and the
123
+ `[ReadModel]` with its query, `scene.json`, and a React/Vite frontend scaffold
124
+ (`.frontend/`, `package.json`, `tsconfig.json`, `.gitignore`). Per-file detail, the
125
+ scaffold pins and the `Customizations/` contract are in
126
+ [references/rendered-application.md](references/rendered-application.md).
127
+
128
+ Modeled specifications become xunit classes compiled in **Debug only**
129
+ (`IsTestProject` when Debug): a command spec `when_<snake>` in namespace
130
+ `<slice namespace>.when_<snake>` (so `when_x.when_x`), queries `when_<snake>_is_queried`,
131
+ read models `when_<snake>_is_projected`.
132
+
133
+ ## Publication and recovery
134
+
135
+ Ownership is the destination's **`.cratis-render.json`** manifest (semantic revision,
136
+ identity, path and SHA-256 per artifact); there are no in-file markers. Interrupted
137
+ commits are journaled in the **`.cratis-render/`** control directory (journal, staging,
138
+ backups). Never stage `.cratis-render/` in git; commit the manifest with the output.
139
+
140
+ - An unmanaged file at a planned path is refused, even with `--force`.
141
+ - A user-modified managed file is refused unless it is still active **and** `--force` is
142
+ given; `--force` replaces it. It never overwrites unmanaged files and never deletes a
143
+ modified stale file. A stale managed file is removed only if its bytes still match.
144
+ - Recovery runs before planning, even when planning then fails. **`recovered: true` in the
145
+ result means stop and reconcile**: the receipt does not describe what recovery changed.
146
+ - An unchanged re-render writes nothing (`unchanged` equals the artifact count).
147
+ - Use exclusive access to the destination; a receipt is a filesystem result, not a Git
148
+ commit, and the command creates no branch, commit or PR.
149
+ - Drift: compare successive manifests' `semanticRevision` for renders with the same
150
+ `--name` and inputs. Do not compare the MCP `modelRevision` with the manifest: their
151
+ application identities can differ.
152
+
153
+ ## Sandbox and specification runner
154
+
155
+ `cratis run [PATH]` (Docker required) starts `cratis/stage` on the folder or file: Stage
156
+ API on `9090`, Chronicle Workbench on `https://localhost:35000`. It is a **partial,
157
+ disposable runtime**, not a generated application. The default engine appends modeled
158
+ `produces` facts and echoes the payload but enforces no modeled validation or
159
+ authorization and no query authorization; `Stage__Runtime__Engine=semantic` opts in to
160
+ an engine that does, and refuses what it cannot execute (HTTP 501). Callers are built
161
+ from unsigned headers, so authorization there is not a security boundary.
162
+
163
+ `cratis/stage-specrunner` checks modeled specifications and writes a results file. The
164
+ default `structural` engine is deprecated and model-level only; `--engine semantic`
165
+ executes admitted specs through Arc's in-memory pipeline and reports `Passed`, `Failed`,
166
+ `Unsupported` or `Cancelled`. A green result is Stage semantic-engine evidence: not V4 and not a rendered Debug test run. Commands,
167
+ the semantic report schema and limits: [references/sandbox-and-specrunner.md](references/sandbox-and-specrunner.md).
220
168
 
221
169
  ## Verify
222
170
 
223
- - The model reaches the renderer as an `ExecutableSemanticModel` plus a
224
- `SemanticExecutionPlan`, not as a folder path.
225
- - `plan.Success` is true before any byte is written; a blocked plan's
226
- `STAGE-ESM-00x` diagnostics name the construct to simplify.
227
- - Every state-change slice has one command, one `produces`, and only
228
- `not empty` validation; every state-view slice has one read model, one
229
- projection, and at most a by-id snapshot query.
230
- - Re-planning the same input yields identical hashes.
231
- - Expectations about the sandbox account for unenforced validation and
232
- authorization and for queries that return nothing.
233
- - No claim is made that Stage reviewed, staged or approved anything.
171
+ - `cratis render` exits 0 and reports `recovered: false`, with `written + unchanged`
172
+ equal to the artifact count; otherwise the render is not a result.
173
+ - Report V5 as separate results, each a result or "not run": admission, publication,
174
+ Debug build (`dotnet build <destination>/<Project>.csproj -c Debug`), Debug tests
175
+ (`dotnet test` on the same project) and runtime. Render alone is the first two.
176
+ - A refusal is kept verbatim as reported: `PLAY*` (compile or bind), `PLAN-*` (execution
177
+ plan), `STAGE-*` (admission), `CLI-RENDER-*`, or a plain ownership error for a managed
178
+ file. The fix is an intent-preserving model change or a recorded gap, never an edit of
179
+ managed output and never a weakened model.
180
+ - No file under `.cratis-render/` is staged; managed files carry no local edits.
181
+ - No claim that Stage reviewed, staged or approved anything; its plan is deterministic
182
+ (same input, same bytes and hashes), which is not a review.
183
+ - Sandbox expectations account for unenforced validation, authorization and query
184
+ authorization on the default engine.
234
185
 
235
186
  ## Route near misses
236
187
 
237
- - Writing or verifying the `.play` model itself: `cratis-screenplay-model-authoring`
238
- for the compiler and the admitted set, `cratis-screenplay-event-modeling` for the
239
- modeling method, and the per-surface `cratis-screenplay-*` skills for the
240
- constructs — command surface, projections, read surface, UI composition,
241
- captures and reactions, specifications.
242
- - Understanding the generated Arc command, validator or read model as C#:
243
- `cratis-arc-command` and the Chronicle read-model guidance.
244
- - Inspecting the Chronicle store the sandbox writes into: the Chronicle CLI or
245
- Workbench guidance.
188
+ - Writing or checking the `.play` model: `cratis-screenplay-model-authoring` (compiler and
189
+ MCP), `cratis-screenplay-event-modeling` (method), and the per-surface
190
+ `cratis-screenplay-*` skills.
191
+ - Which tool says what, versions and diagnostics: `cratis-screenplay-toolchain`.
192
+ - Running the render workflow end to end, gap-fill and the field ledger:
193
+ `cratis-screenplay-render-and-gap-fill`.
194
+ - Understanding the generated command, validator or read model as C#: `cratis-arc-command`
195
+ and `cratis-chronicle-read-model`; checking hand-written code against its slice:
196
+ `cratis-application-slice-conformance`.
197
+ - Inspecting the Chronicle store the sandbox writes into: `cratis-chronicle-cli-operations`
198
+ and `cratis-chronicle-web-workbench`.
199
+
200
+ ## Legacy direct-write rendering
201
+
202
+ The syntax-based `IRenderer` and the optional `Cratis.Stage.Rendering.Cratis.Scaffolding`
203
+ package write directly to disk, with no managed staging and no safe stale-file removal; a
204
+ failure can leave the target unsafe and incomplete. They are legacy compatibility only.
205
+ Use `cratis render` (journaled, recoverable publication) instead.
206
+
207
+ ## Lineage
208
+
209
+ Rewritten for #493. The earlier version described Stage 3.15.1 (no CLI, eight-file
210
+ backend scaffold, `not empty`-only validation, no frontend, Arc 22.3.0); each claim was
211
+ re-verified at Stage 4.24.0 and cli 3.27.1 and replaced. See
212
+ [references/admission.md](references/admission.md) for source disagreements.
@@ -0,0 +1,177 @@
1
+ # Stage 4.24 admission: codes, specification rules and observed refusals
2
+
3
+ Read at Stage `v4.24.0` (`Source/Rendering.Cratis/CratisArtifactRenderPlanner.cs`,
4
+ `Semantics/SemanticCratisAdmission*.cs`, `SemanticSpecificationAdmission*.cs`,
5
+ `PureTransitionAdmission.cs`, `SemanticImplementationAdmission.cs`) and cli `v3.27.1`
6
+ (`Commands/Render/ScreenplayPlanning.cs`). Items marked *observed* were reproduced with
7
+ `cratis render` 3.27.1 while building [render-example.md](render-example.md). Anything else
8
+ is a reading of source: render the model before claiming it.
9
+
10
+ One blocking diagnostic fails the **whole** plan and nothing is published (exit 5).
11
+ Informational diagnostics (`PLAY0270` authoring metadata, `PLAY0469`, `STAGE-ESM-023`) do not.
12
+
13
+ A refusal can come from four layers, and the code tells you which: compilation and binding
14
+ (`PLAY*`, from the CLI's bundled Screenplay 4.60.1), execution planning (`PLAN-*`), Stage
15
+ admission (`STAGE-*`) and the CLI itself (`CLI-RENDER-*`). A publication conflict (a
16
+ modified managed file, an unmanaged file at a planned path, a manifest from another
17
+ target or renderer) is a plain ownership error with no code. Keep the actual diagnostic or
18
+ error text; do not translate it into a `STAGE-*` code.
19
+
20
+ **A refusal is never a reason to weaken the model.** The fixes below are the ones that
21
+ keep the modeled intent. When the only way past a refusal is to drop a specification,
22
+ an event generation, authorization, a rule or a slice, keep the complete model, record
23
+ the capability gap, and route that scope to authorized gap-fill or a fully hand-written
24
+ delivery (`cratis-screenplay-render-and-gap-fill`). Changing the requirement itself is the
25
+ model owner's decision.
26
+
27
+ ## Diagnostic codes
28
+
29
+ | Code | Meaning | Usual fix |
30
+ | --- | --- | --- |
31
+ | `STAGE-ESM-001` | Slice kind other than `StateChange` / `StateView` (Automation, Translate; Stage#79) | Gap-fill the automation; the model stays the contract |
32
+ | `STAGE-ESM-002`, `-003` | Concept values or validation Stage cannot express; unresolved property type | Simplify the concept; fix the type |
33
+ | `STAGE-ESM-004` | A `StateChange` slice without exactly one command | One command per slice |
34
+ | `STAGE-ESM-005` | Code validation or rule predicate bodies; or a command beyond the first capability (optional event property, event revision other than the first, validation or requirement that cannot be rendered, no `produces`) | Use declarative validation; non-initial event generations are not rendered |
35
+ | `STAGE-ESM-006` | `produces` that cannot render without changing its destination or mappings (`produces when`, literal or computed mappings, `for` not a command identifier, mappings not one-to-one with event properties, duplicate tags) | Map properties one to one; conditional outcomes (`produces when`) are a different behavior, so gap-fill unless the owner accepts splitting them into commands |
36
+ | `STAGE-ESM-007`, `-008`, `-009` | Projection count per read model (exactly one projection or reducer each); unresolvable properties or no single read-model transition (**flat** projections only); affected instance not one, not keyed by an event property, or not the event-source identity (flat projections only) | One projection per read model; see "Projections" below |
37
+ | `STAGE-ESM-010` | A query is not an optional snapshot lookup by the read-model identifier (or its argument concept has validation); each query is checked on its own, so several such queries are admitted | Keyed `XById => X optional` queries; lists, observable and filtered queries are gap-fill |
38
+ | `STAGE-ESM-011` | A specification cannot render (see the rules below) | Reshape it only if the assertion keeps its meaning; otherwise keep the specification, record the gap, and gap-fill with the specification as the oracle. Never weaken or delete it to get a render |
39
+ | `STAGE-ESM-012` | Generated C# names collide (properties, types, namespaces, constraints) | Rename |
40
+ | `STAGE-ESM-013` | An event-context value other than `$context.occurred` mapped in `produces` | Map a command property when that preserves the meaning; otherwise gap-fill |
41
+ | `STAGE-ESM-014` | A constraint Chronicle cannot reproduce (kind, scope, message; multi-claim in one command; optional or composite targets) | A different constraint is a requirement change for the model owner; otherwise gap-fill |
42
+ | `STAGE-ESM-015` | Authorization Stage cannot render exactly: opaque (code) policy, role-claim URI, expression not requiring authentication, claim compared with a non-text value, authorized command without exactly one identifier | `require authenticated and ...`; text-backed claim targets |
43
+ | `STAGE-ESM-016` | Model language or semantic version is not ESM v1 to v3 (event generations are v4; v5 and v6 constructs also raise the version) | Not fixable by editing: the model needs a newer renderer. Keep the model, record the gap, gap-fill |
44
+ | `STAGE-ESM-017` | Read model or projection cannot render (property names that collide with Chronicle paths or expression syntax, mappings that overwrite the key or child identity, composite keys, `all`, the refused scope shapes below) | Reshape the projection without changing what it records, or record the gap |
45
+ | `STAGE-ESM-018` | `$strings.` key missing in the default locale or containing formatting characters | Fix the strings |
46
+ | `STAGE-ESM-019` | Reducer structure or body not admitted (outside a `StateView`, impure, does not compile) | An equivalent pure body, or gap-fill |
47
+ | `STAGE-ESM-020` | Implementation body missing, changed (hash differs) or refused by the loader | Provide the body inside the model root |
48
+ | `STAGE-ESM-021`, `-022` | Reducer typed-context or analysis failure; a construct outside the pure allowlist, or a generated name shadowing a reducer type | An equivalent pure body, or gap-fill |
49
+ | `STAGE-ESM-023` | Information: transition bodies analysed | none |
50
+ | `STAGE-CRATIS-001` to `-005` | Profile or `scene.json` not the package-owned shape; unrecognized or missing scaffold input; artifact path collision; a modeled module or feature that would render into the reserved `Customizations/` | Rename the module or feature (005) |
51
+ | `STAGE-AUTH-001` | Authorization cannot be rendered faithfully | As `STAGE-ESM-015` |
52
+ | `CLI-RENDER-001`, `-002`, `-003` | Unknown target; invalid rendering name; event generations (ESM v4) | Fix the option, or the model |
53
+
54
+ `STAGE-CRATIS-FILE-001`, `-INLINE-001`, `-QUERY-001`, `-KEY-001`, `-KEY-002`,
55
+ `-PROJECTION-001` and `STAGE-EVENT-001` come from the legacy syntax renderer and the direct
56
+ runtime route, not from `cratis render`.
57
+
58
+ **Legacy direct-write paths.** The syntax-based `IRenderer` and the optional
59
+ `Cratis.Stage.Rendering.Cratis.Scaffolding` package write straight to disk. Stage's README
60
+ states that direct rendering has no managed staging or safe stale-file removal and that a
61
+ failure can leave the target **unsafe and incomplete**. They are legacy compatibility
62
+ only; new rendering goes through `CratisRendering` and `cratis render`, whose managed
63
+ publication is journaled and recoverable.
64
+
65
+ ## Projections
66
+
67
+ Stage renders two projection forms; the restrictions differ.
68
+
69
+ - **Identity and key rule** (the one place the full rule lives; other files point here).
70
+ 1. The identifier always equals the projection's effective key: the inline `key`, else the
71
+ `from` block `key`, else the event source. An event-source key (default or
72
+ `key $eventSourceId`) makes the identifier the event source; an event-property or literal
73
+ key makes it that key. Stage refuses a literal key (`STAGE-ESM-017`; scoped keys are an
74
+ event property or the event source, `SemanticScopedProjectionSupport.KeySupported`). Never map `$eventSourceId` onto the identifier when the key is
75
+ something else (`from PaymentRecorded key invoiceId`): the runtime fails with "affected key
76
+ disagrees with read-model identifier" (Screenplay v4.64.0
77
+ `SemanticScopedProjection.State.cs:182-184`, `SemanticEvaluator.cs:733-736`).
78
+ 2. Executable model. A flat-bound projection must map the identifier like any required
79
+ property (the flat evaluator does not seed it): `xId = <keyProperty>`. A scoped projection
80
+ needs no mapping: `RootDocument` seeds the identifier from the key when it creates the
81
+ instance (`SemanticScopedProjection.cs:279-290`). Mapping it from its key (`xId =
82
+ $eventSourceId` for an event-source key, `xId = <keyProperty>` for an event-property key)
83
+ is also valid.
84
+ 3. Renderable model (Stage v4.24.0). Binding flat (Screenplay `SemanticModelBinder.Projections.cs`
85
+ `IsFlat`: every block is a `from` - no `remove`, join, children, nested, `every` or `all` -
86
+ none has a parent key, every `from` is keyed by a top-level event property, and every
87
+ mapping is a plain set to a declared top-level read-model property from a top-level event
88
+ property or a non-null literal; `IsFlatSource`, `IsFlatProperty`) is not Stage admission.
89
+ Every other shape binds scoped, including a `= null` clear or a dotted target.
90
+ - **Flat admission** (`SemanticCratisAdmission.StateView.cs:94-114`) holds only when all of these
91
+ are true: one `from` naming one event (`STAGE-ESM-008`); every read-model property, optional
92
+ ones included, is mapped from an event property (auto-map counts, and flat auto-map matches exact names only; a literal is refused,
93
+ `STAGE-ESM-009`, `SemanticFlatProjectionSupport.MappingsMatch`); and the key property is an
94
+ identifier concept that every producing command's `for` fills (`UsesEventSourceIdentity`).
95
+ Anything else that binds flat is refused. When the key is the event source, drop the explicit
96
+ key and the projection is scoped, which admits literals.
97
+ - **Scoped** (`SemanticScopedProjectionSupport.cs`, fixture `when_rendering_scoped_projections`):
98
+ every other projection, including a plain single `from E` with the default or
99
+ `$eventSourceId` key. Forms: several distinct `from` blocks, `remove with`, root
100
+ `join ... on`, `children` with an identified element (one level, no children or joins
101
+ inside a child; `remove with` and `remove via join` inside a child are admitted, fixture
102
+ `when_executing_re_admitted_scoped_projections`, `children.RemovedWithJoin`), `nested` over
103
+ an optional composite property, and `every` with set-from-event-source mappings. Keys are
104
+ an event property or the event source. The key establishes the identifier, so it must end up
105
+ unmapped: `Rejection` refuses a mapping onto it unless it copies the key's own event property
106
+ (`MatchesKey`, `SemanticScopedProjectionSupport.cs:104-110, 360-363`), so an event-source key
107
+ admits no mapping at all (`STAGE-ESM-017`). Auto-map counts as a mapping
108
+ (Screenplay `SemanticModelBinder.ProjectionValues.cs` `AutoMapped`, which does not skip the
109
+ identifier): if the event carries a property with the identifier's name and type, declare
110
+ `no automap` and map the other properties explicitly. `from E` and `from E key
111
+ $eventSourceId` render when the identifier ends up unmapped, whether or not the event repeats
112
+ the identifier.
113
+ - Refused in a scope (`STAGE-ESM-017`): composite keys; `all` (FromAll); `every` with
114
+ children included beside children or nested blocks; root `remove via join`; joins,
115
+ children or join removals inside `nested`; a `clear` inside `nested`; recursive children
116
+ and joins inside a child; duplicate event contracts among `from`, join or
117
+ removal blocks; event or read-model property names that collide with Chronicle syntax.
118
+ Several of these are tracked upstream (Chronicle#4125, #4166).
119
+ - A scope cannot also carry flat transitions.
120
+
121
+ The example in [render-example.md](render-example.md) uses a scope (`from` plus `remove with`).
122
+ Read-only reading of the source: a projection shape outside both forms is gap-fill, but
123
+ render it before saying so.
124
+
125
+ ## Pure reducer bodies
126
+
127
+ Stage 4.24 renders a reducer only when each transition body passes a Roslyn analysis
128
+ against an audited allowlist: a complete statement block, pure operations over the typed
129
+ context, no directives, no writes to statics, `throw` limited to
130
+ `InvalidOperationException(string)` or `ArgumentException(string)`, LINQ lambdas that are
131
+ pure expressions, and no generated type shadowing a referenced one. Anything else is
132
+ `STAGE-ESM-019`, `-021` or `-022`. A reducer needs a `StateView` slice, its read model in the
133
+ same slice, a required Guid or text identifier and a matching keyed query. Code validation
134
+ (`STAGE-ESM-005`) and opaque policies (`STAGE-ESM-015`) are refused outright, and a command
135
+ `handler` never binds (`PLAY0268`). Reducer rendering was read, not run, for this skill.
136
+
137
+ ## Specification rules (`STAGE-ESM-011`)
138
+
139
+ From `SemanticSpecificationAdmission*.cs`; the first rule was also observed.
140
+
141
+ - A specification needs a `when <Command>` of its own slice (`PLAY0273` otherwise), and
142
+ its `then` events must be as many as the command `produces` (observed: a `then query`
143
+ spec failed until it also asserted the event).
144
+ - A `given caller` with a role-claim URI is refused; `role "X"` is accepted. `then denied`
145
+ needs an authorized command and a `given caller`; a `then query` on a protected query
146
+ needs a `given caller`.
147
+ - Admitted outcomes: `then <Event>` (ordered, or any order; duplicate contracts in any
148
+ order are admitted for command-only assertions with compatible destinations, but not
149
+ when a read-model or reducer expectation must replay them, which needs distinct
150
+ contracts), `then readmodel`, `then query` (one result, scalar key), `then error` naming a
151
+ rendered constraint or an authored message, `then denied`.
152
+ - Refused: `then no readmodel`, `when append`, composite values, `given readmodel` beside a
153
+ command, error codes that name no rendered constraint, a `$context.occurred` mapping
154
+ asserted without a supplied time, a query on a reducer-built read model, a protected
155
+ query whose fixtures use streams other than the queried key.
156
+ - A when-less specification is admitted only as `then denied` on an authorized keyed
157
+ query, or `given readmodel` plus `then query` on an unprotected query.
158
+ - Descriptions, comments and prose are never rendered.
159
+
160
+ ## Observed refusals
161
+
162
+ Each came from the first draft of the example model, rendered with cratis 3.27.1:
163
+
164
+ | Draft | Diagnostic | Fix that rendered |
165
+ | --- | --- | --- |
166
+ | `policy` with only `require role "HarbourMaster"` | `STAGE-ESM-015` | `require authenticated and role "HarbourMaster"` (two `require` lines are `PLAY0441`) |
167
+ | Projection `from BerthReserved` with `berthId = $eventSourceId` (mapping the identifier) | `STAGE-ESM-017`: mappings cannot overwrite the key | Do not map the identifier; the key establishes it, so map only the other properties. `from E key $eventSourceId` plus the same mapping was also refused |
168
+ | A `then query` spec in the view slice, then one without `then <Event>` | `PLAY0273`, then `STAGE-ESM-011` | Put the spec in the command slice with `given caller`, `when`, the `then` event and `then query` |
169
+
170
+ ## Source disagreements (trust the code)
171
+
172
+ | Source says | Code at the tag says |
173
+ | --- | --- |
174
+ | Stage README: application scope adds "exactly eight" backend files | The scaffold creates nine (adds `GeneratedPolicyRegistration.cs`), plus the frontend scaffold |
175
+ | cli reference: bodied reducers are unsupported (`STAGE-ESM-019`) | `PureTransitionAdmission` admits pure allowlisted bodies |
176
+ | Stage customization guide: an Automation slice blocks with `STAGE-ESM-001`; Stage pins Screenplay 4.35.0 | With cli 3.27.1 an Automation or Translate slice fails binding (`PLAY0268`) first; Stage pins Screenplay 4.60.0 |
177
+ | An earlier version of this skill: Stage has no authorization contract for queries | Query authorization is admitted and rendered; an unauthorized query renders `[AllowAnonymous]` (observed) |