@cratis/pi 8.4.1 → 8.6.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 (286) hide show
  1. package/package/corpus/harnesses/copilot/instructions/ai-distribution.instructions.md +2 -1
  2. package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +1 -1
  3. package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +5 -3
  4. package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -1
  5. package/package/corpus/harnesses/copilot/instructions/reactors.instructions.md +3 -1
  6. package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +2 -1
  7. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +6 -3
  8. package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +5 -2
  9. package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +131 -9
  10. package/package/corpus/rules/ai-distribution.md +2 -1
  11. package/package/corpus/rules/exit-codes-and-wrappers.md +1 -1
  12. package/package/corpus/rules/glossary.md +5 -3
  13. package/package/corpus/rules/react.md +3 -1
  14. package/package/corpus/rules/reactors.md +3 -1
  15. package/package/corpus/rules/scripting.md +2 -1
  16. package/package/corpus/rules/specs.csharp.md +6 -3
  17. package/package/corpus/rules/vertical-slices.md +5 -2
  18. package/package/corpus/skills/cratis-application-growth/SKILL.md +1 -2
  19. package/package/corpus/skills/cratis-application-growth/references/csharp.md +1 -3
  20. package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +1 -2
  21. package/package/corpus/skills/cratis-application-growth/references/rename-window.md +1 -3
  22. package/package/corpus/skills/cratis-application-growth/references/service-and-delivery.md +3 -2
  23. package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
  24. package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +3 -3
  25. package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +47 -3
  26. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +18 -3
  27. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
  28. package/package/corpus/skills/cratis-arc-authorize-request/references/typescript.md +2 -0
  29. package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -0
  30. package/package/corpus/skills/cratis-arc-connect-storage/references/elixir.md +9 -2
  31. package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
  32. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +47 -8
  33. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-controller.md +3 -1
  34. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +6 -3
  35. package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +38 -11
  36. package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
  37. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-abilities.md +2 -2
  38. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-recovery.md +6 -4
  39. package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +2 -2
  40. package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
  41. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +29 -7
  42. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/java.md +1 -1
  43. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/kotlin.md +1 -1
  44. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp-diagnose-tool-call.md +9 -7
  45. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +52 -1
  46. package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +4 -2
  47. package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +36 -10
  48. package/package/corpus/skills/cratis-arc-expose-query/references/go.md +2 -2
  49. package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +6 -3
  50. package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
  51. package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +55 -6
  52. package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +9 -0
  53. package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
  54. package/package/corpus/skills/cratis-arc-host-application/references/csharp-configuration.md +54 -0
  55. package/package/corpus/skills/cratis-arc-host-application/references/csharp-deployment.md +98 -0
  56. package/package/corpus/skills/cratis-arc-host-application/references/csharp-http.md +9 -1
  57. package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +87 -4
  58. package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +9 -0
  59. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp-extensions.md +4 -0
  60. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
  61. package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +19 -2
  62. package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +4 -2
  63. package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
  64. package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +33 -36
  65. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +18 -3
  66. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +94 -19
  67. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +29 -5
  68. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-instant-feedback.md +81 -0
  69. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +80 -0
  70. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +103 -0
  71. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +41 -2
  72. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-structure.md +117 -0
  73. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +8 -4
  74. package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +3 -3
  75. package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +27 -6
  76. package/package/corpus/skills/cratis-arc-testing-typescript/references/typescript.md +2 -2
  77. package/package/corpus/skills/cratis-arc-validate-command/references/csharp-rules.md +23 -2
  78. package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +28 -2
  79. package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +1 -0
  80. package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +136 -0
  81. package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +125 -0
  82. package/package/corpus/skills/cratis-authproxy-configure/references/aspire.md +154 -0
  83. package/package/corpus/skills/cratis-authproxy-configure/references/operations.md +122 -0
  84. package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +114 -0
  85. package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +126 -0
  86. package/package/corpus/skills/cratis-authproxy-configure/references/sign-in-providers.md +116 -0
  87. package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +135 -0
  88. package/package/corpus/skills/cratis-choreography-run-workflow/SKILL.md +117 -0
  89. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp-chronicle.md +164 -0
  90. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp.md +354 -0
  91. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +6 -6
  92. package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +11 -3
  93. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +50 -0
  94. package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +17 -3
  95. package/package/corpus/skills/cratis-chronicle-cli-operations/references/setup-and-target.md +8 -2
  96. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-services.md +13 -2
  97. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +12 -0
  98. package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -0
  99. package/package/corpus/skills/cratis-chronicle-connect-application/references/python.md +2 -2
  100. package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
  101. package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +9 -2
  102. package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +35 -3
  103. package/package/corpus/skills/cratis-chronicle-constrain-append/references/go.md +1 -1
  104. package/package/corpus/skills/cratis-chronicle-constrain-append/references/operations.md +70 -0
  105. package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +6 -3
  106. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +113 -16
  107. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/container-and-kubernetes.md +293 -0
  108. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +16 -9
  109. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +60 -7
  110. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +124 -2
  111. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +36 -1
  112. package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
  113. package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
  114. package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +15 -5
  115. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +9 -8
  116. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/go.md +2 -2
  117. package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
  118. package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +1 -1
  119. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +2 -2
  120. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +15 -4
  121. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +4 -1
  122. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +5 -2
  123. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +23 -0
  124. package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +1 -0
  125. package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +2 -1
  126. package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +3 -1
  127. package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +4 -3
  128. package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +3 -1
  129. package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +3 -1
  130. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +41 -4
  131. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +22 -4
  132. package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +7 -0
  133. package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +9 -1
  134. package/package/corpus/skills/cratis-chronicle-protect-decision/references/java.md +8 -0
  135. package/package/corpus/skills/cratis-chronicle-protect-decision/references/kotlin.md +9 -0
  136. package/package/corpus/skills/cratis-chronicle-protect-decision/references/typescript.md +7 -0
  137. package/package/corpus/skills/cratis-chronicle-protect-personal-data/SKILL.md +1 -1
  138. package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +28 -3
  139. package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +7 -6
  140. package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
  141. package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md +3 -3
  142. package/package/corpus/skills/cratis-chronicle-publish-contract/references/webhook-signature-wire-format.md +82 -0
  143. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +19 -1
  144. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-outputs.md +3 -1
  145. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-pages.md +1 -1
  146. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +37 -4
  147. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/elixir.md +11 -0
  148. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +2 -1
  149. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
  150. package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +3 -3
  151. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-coordination.md +31 -2
  152. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-history.md +21 -4
  153. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +20 -2
  154. package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
  155. package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +1 -1
  156. package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -0
  157. package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +2 -1
  158. package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +3 -1
  159. package/package/corpus/skills/cratis-chronicle-reduce-state/references/java.md +10 -1
  160. package/package/corpus/skills/cratis-chronicle-reduce-state/references/kotlin.md +10 -1
  161. package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +27 -5
  162. package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +18 -0
  163. package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +21 -1
  164. package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +13 -0
  165. package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +15 -0
  166. package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +15 -0
  167. package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +16 -0
  168. package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +1 -1
  169. package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +4 -3
  170. package/package/corpus/skills/cratis-ci-pipeline-performance/references/publish-pipelines.md +19 -4
  171. package/package/corpus/skills/cratis-code-review/SKILL.md +6 -2
  172. package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
  173. package/package/corpus/skills/cratis-code-review/references/csharp.md +4 -4
  174. package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +6 -38
  175. package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +2 -0
  176. package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-labels-and-release.md +5 -4
  177. package/package/corpus/skills/cratis-commits-and-pull-requests/references/workflow-inputs.md +39 -0
  178. package/package/corpus/skills/cratis-components-accessibility/SKILL.md +6 -8
  179. package/package/corpus/skills/cratis-components-accessibility/references/typescript.md +32 -14
  180. package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +4 -3
  181. package/package/corpus/skills/cratis-components-build-canvas/references/typescript-props.md +1 -1
  182. package/package/corpus/skills/cratis-components-build-canvas/references/typescript.md +4 -2
  183. package/package/corpus/skills/cratis-components-choose-control/SKILL.md +13 -7
  184. package/package/corpus/skills/cratis-components-choose-control/references/from-primereact.md +116 -0
  185. package/package/corpus/skills/cratis-components-choose-control/references/menu.md +90 -0
  186. package/package/corpus/skills/cratis-components-choose-control/references/typescript-composition.md +48 -0
  187. package/package/corpus/skills/cratis-components-choose-control/references/typescript.md +2 -2
  188. package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +2 -1
  189. package/package/corpus/skills/cratis-components-compose-toolbar/references/floating-toolbar.md +146 -0
  190. package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +102 -0
  191. package/package/corpus/skills/cratis-components-display-list/SKILL.md +10 -10
  192. package/package/corpus/skills/cratis-components-display-list/references/typescript-custom-panel.md +74 -0
  193. package/package/corpus/skills/cratis-components-display-list/references/typescript-datatables.md +2 -7
  194. package/package/corpus/skills/cratis-components-display-list/references/typescript.md +3 -2
  195. package/package/corpus/skills/cratis-components-submit-form/SKILL.md +6 -6
  196. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +21 -1
  197. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +72 -2
  198. package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +7 -5
  199. package/package/corpus/skills/cratis-components-theme-application/SKILL.md +17 -15
  200. package/package/corpus/skills/cratis-components-theme-application/references/localization.md +166 -0
  201. package/package/corpus/skills/cratis-components-theme-application/references/typescript.md +18 -14
  202. package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +141 -0
  203. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +2 -0
  204. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-domain-philosophy.md +31 -3
  205. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-fundamentals-helpers.md +119 -0
  206. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp.md +4 -0
  207. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +72 -1
  208. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +9 -0
  209. package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +2 -1
  210. package/package/corpus/skills/cratis-fundamentals-concept/references/java-json.md +3 -2
  211. package/package/corpus/skills/cratis-fundamentals-concept/references/kotlin-json.md +3 -2
  212. package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +41 -2
  213. package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -7
  214. package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
  215. package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +3 -3
  216. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +8 -0
  217. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp.md +2 -2
  218. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/go-dependency-injection.md +3 -0
  219. package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +6 -4
  220. package/package/corpus/skills/cratis-modeling-design-event-model/references/command-inventory.md +7 -1
  221. package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +13 -1
  222. package/package/corpus/skills/cratis-modeling-design-event-model/references/review-one-slice.md +6 -0
  223. package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +6 -6
  224. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/csharp-aspire.md +116 -28
  225. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/docker-compose.md +2 -2
  226. package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +46 -0
  227. package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +4 -2
  228. package/package/corpus/skills/cratis-platform-build-application/SKILL.md +8 -0
  229. package/package/corpus/skills/cratis-platform-build-application/references/cratis-identity.md +71 -0
  230. package/package/corpus/skills/cratis-platform-build-application/references/studio-repository.md +96 -0
  231. package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +14 -8
  232. package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +167 -3
  233. package/package/corpus/skills/cratis-platform-deliver-slice/references/eventual-consistency.md +150 -0
  234. package/package/corpus/skills/cratis-platform-deliver-slice/references/typescript.md +14 -1
  235. package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
  236. package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +8 -8
  237. package/package/corpus/skills/cratis-platform-prepare-release-pr/references/product-release-checks.md +16 -2
  238. package/package/corpus/skills/cratis-platform-start-application/SKILL.md +21 -0
  239. package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +77 -3
  240. package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +118 -0
  241. package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +117 -0
  242. package/package/corpus/skills/cratis-platform-upgrade-application/references/java.md +53 -0
  243. package/package/corpus/skills/cratis-platform-upgrade-application/references/kotlin.md +53 -0
  244. package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +71 -0
  245. package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
  246. package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +6 -3
  247. package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +34 -3
  248. package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +84 -3
  249. package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +7 -11
  250. package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +8 -4
  251. package/package/corpus/skills/cratis-screenplay-declare-slice/references/projections.md +2 -0
  252. package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +29 -1
  253. package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +2 -1
  254. package/package/corpus/skills/cratis-screenplay-edit-workspace/references/mcp-tools.md +1 -1
  255. package/package/corpus/skills/cratis-screenplay-handoff-slice/references/csharp.md +13 -1
  256. package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +1 -1
  257. package/package/corpus/skills/cratis-screenplay-model-translation/references/boundary-diagnostics.md +1 -1
  258. package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +30 -51
  259. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/cli.md +19 -2
  260. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md +87 -0
  261. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/studio.md +5 -0
  262. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/typescript.md +13 -0
  263. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md +5 -0
  264. package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +8 -12
  265. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/running-mcp.md +12 -0
  266. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenarios.md +2 -2
  267. package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
  268. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md +101 -0
  269. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +4 -2
  270. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +1 -0
  271. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +7 -0
  272. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +7 -4
  273. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +18 -5
  274. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +4 -2
  275. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +35 -2
  276. package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
  277. package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +4 -2
  278. package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +1 -1
  279. package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md +10 -3
  280. package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +22 -4
  281. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
  282. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +40 -0
  283. package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +6 -0
  284. package/package/corpus/skills/cratis-stage-render-slice/references/semantic-conformance.md +64 -0
  285. package/package/profile-catalog.json +15 -0
  286. package/package.json +1 -1
@@ -57,6 +57,11 @@ the application.
57
57
  records and runners. It holds the work and the organization's knowledge, never the event model. An agent
58
58
  reaches it through the Direct MCP server.
59
59
 
60
+ Code Studio generates is committed to a repository Studio keeps, without pull requests, until the
61
+ application's repository (its own, or else the project's) is a connected one. Even then nothing is pushed
62
+ until a person selects Publish: read [Where Studio commits generated code](references/studio-repository.md)
63
+ when Studio produces the code or no pull request appears.
64
+
60
65
  The three combine. A common arrangement is: model on a Studio board, export the slice's context to the
61
66
  local repository, implement there, and let Direct record the journey and its gates.
62
67
 
@@ -181,6 +186,9 @@ Five servers can be present. They answer different questions; pick by the questi
181
186
  | Chronicle | The Chronicle MCP server, a separate product next to a running store | Inspect a running event store while diagnosing; use observational tools by default | Implicit mutations: stopping, resuming or deleting a job requires the mutation profile and a specific request | `cratis-chronicle-mcp-inspection` |
182
187
  | The application's own | An Arc application that opts chosen commands and queries in as MCP tools (C#-only) | Giving agents governed access to the product's own operations, when the product owner wants that | Inspecting the application during development; use `cratis arc` for that | `cratis-arc-expose-mcp-operation` |
183
188
 
189
+ Cratis Identity signs people in to the Cratis tools; it is not sign-in or user management for your
190
+ application. Read [Cratis Identity](references/cratis-identity.md) when someone proposes it for that.
191
+
184
192
  Rules that hold for all of them:
185
193
 
186
194
  - A server acts with a person's or a token's authority. Read first; make a change only when the request
@@ -0,0 +1,71 @@
1
+ # Cratis Identity: when it is the right component
2
+
3
+ ## Contents
4
+
5
+ - What it is
6
+ - An application does not need it
7
+ - When it is in the picture
8
+ - Local development profile
9
+ - Anti-patterns
10
+
11
+ Read this when someone proposes Cratis Identity for an application's sign-in or user management, or when a
12
+ tool signs in "through Cratis Identity" and you must know what that means for the application.
13
+
14
+ ## What it is
15
+
16
+ Cratis Identity is the OAuth authorization server for the Cratis products and the programs that call them:
17
+ the `cratis` CLI and MCP clients reaching Studio or Direct. It signs a person in, asks them to approve the
18
+ client and choose a tenant, and issues short-lived access tokens bound to one resource.
19
+
20
+ It keeps the accounts people use to sign in to the Cratis products. It is not your application's user store,
21
+ user-management screen or sign-in service.
22
+
23
+ ## An application does not need it
24
+
25
+ The default for an application built on Cratis:
26
+
27
+ - People sign in through AuthProxy with the organization's own identity provider. See
28
+ `cratis-authproxy-configure` (`references/sign-in-providers.md`).
29
+ - The application reads who the caller is, and adds its own details about that person, through Arc. See
30
+ `cratis-arc-host-application` (`references/csharp-identity.md`) and `cratis-arc-react-bind-slice`
31
+ (`references/typescript-identity.md`).
32
+ - What a person may do is decided in the application. See `cratis-arc-authorize-request`.
33
+
34
+ Users, roles and memberships the business cares about are application data: model them as slices like any
35
+ other behaviour.
36
+
37
+ Do not add a Cratis Identity package to an application or host your own Cratis Identity for it.
38
+
39
+ ## When it is in the picture
40
+
41
+ | Situation | What to do |
42
+ | --- | --- |
43
+ | An agent or the CLI uses the Studio or Direct MCP server | The tool signs the person in through Cratis Identity. Nothing is configured in the application |
44
+ | A program must call a route of a Cratis product with a token Cratis Identity issued | That product's AuthProxy has a bearer route naming Cratis Identity as issuer. See `cratis-arc-authorize-request` (`references/authproxy.md`) for bearer routes |
45
+ | Your own programs (a CLI, an agent, another service) call your application's API | A bearer route with **your** authorization server as issuer. Same reference |
46
+
47
+ An access token Cratis Identity issued, accepted on a bearer route, says who the person is, which tenant they
48
+ chose and which scopes the client was granted. It never decides what the person may do: the receiving
49
+ application still checks that against its own roles and the tenant.
50
+
51
+ A personal access token is different. On a route that accepts them, AuthProxy only recognizes the token's
52
+ shape and forwards it: there is no authenticated person and no tenant yet. The backend must authenticate the
53
+ token itself and authorize the request, including tenant and resource access.
54
+
55
+ AuthProxy also has a `CratisIdentity` sign-in provider type. It is for a deployment that signs people in
56
+ through a Cratis Identity realm; an application with its own identity provider uses the provider types in
57
+ `cratis-authproxy-configure` instead.
58
+
59
+ ## Local development profile
60
+
61
+ Cratis Identity has an opt-in local development profile, used when working on Cratis products so a local
62
+ tool can sign in to a local Studio or Direct MCP server. It runs only in the Development environment, uses a
63
+ loopback issuer with its own keys, and its tokens are accepted by no deployed service. It is never a way to
64
+ reach or stand in for a deployed environment.
65
+
66
+ ## Anti-patterns
67
+
68
+ - Using Cratis Identity as the application's user database or user-management feature.
69
+ - Pointing an application's sign-in at Cratis Identity because the Cratis tools use it.
70
+ - Treating a scope in a token as permission; scopes say what the client may attempt, the application decides.
71
+ - Enabling the local development profile outside a developer machine.
@@ -0,0 +1,96 @@
1
+ # Where Studio commits generated code
2
+
3
+ ## Contents
4
+
5
+ - The default: a repository Studio keeps
6
+ - Connect the team's repository
7
+ - One application in its own repository or folder
8
+ - Which arrangement when
9
+ - Anti-patterns
10
+
11
+ Read this when Studio generates the code (step 4 of the route) and you must know where that code lands, or
12
+ why no pull request appears. It does not apply when you render or write code in a local repository yourself.
13
+
14
+ ## The default: a repository Studio keeps
15
+
16
+ Every Studio project has a repository. Until a person connects one, it is a local repository kept by Studio.
17
+ Generating code works there: the work is committed to a work-session branch and merged into the project's
18
+ default branch when a person accepts it. Studio cannot publish branches or open pull requests from it.
19
+
20
+ Use it to try a model. Connect a repository before a team relies on the generated code.
21
+
22
+ What decides is the repository the application uses, not the project alone. An application follows the
23
+ project's repository unless it has a separate one (see below): an application with its own GitHub repository
24
+ publishes even when the project is local only, and an application set to a local repository does not publish
25
+ even when the project is connected. Check the application's setting first, then the project's.
26
+
27
+ ## Connect the team's repository
28
+
29
+ Two steps, each with its own permission. One person who holds both can do both:
30
+
31
+ 1. **Once per GitHub account that holds code.** A maintainer of the Studio organization connects GitHub
32
+ under Organization settings, Integrations, Source Control. This installs the Studio GitHub App on the
33
+ GitHub organization or account that holds the code, so that maintainer must be allowed to install GitHub
34
+ Apps there, or must ask its GitHub owner to approve the installation. Code in several GitHub
35
+ organizations or accounts needs one connection each. Which repositories an installation can reach is
36
+ decided on GitHub.
37
+ 2. **Per project.** A person who may change the project's settings opens Project Settings, Source control,
38
+ chooses GitHub as the provider, then the installation and the repository, and selects Connect repository.
39
+
40
+ Connecting does not make generation publish by itself. A generation run commits to a work-session branch
41
+ and stops at **Ready to publish**; nothing is on GitHub yet. A person reviews the work in Studio and selects
42
+ **Publish**. Only then does Studio push the branch and, by default, open a pull request. Never report
43
+ generated work as pushed, or a pull request as open, before a person has published it.
44
+
45
+ An application whose publication mode (Application Settings) is "Push a branch only" gets the branch and no
46
+ pull request when it is published: the work stays ready for review until a person completes or abandons it
47
+ in Studio. The mode applies to new work sessions only. The same connection lets a board keep
48
+ its model in step with the repository (`cratis-screenplay-onboard-workspace`, `references/studio.md`).
49
+
50
+ Studio works through the GitHub App installation. It keeps no personal access token and no Git credentials of
51
+ its own, so never ask a person for a token to give to Studio.
52
+
53
+ When a repository is missing from the list, check in this order before asking for anything on GitHub:
54
+
55
+ 1. Is the right installation selected? An organization can have several, each for another GitHub account.
56
+ 2. Did Studio list the installation's repositories at all? The picker shows the same "no repositories"
57
+ message when the listing failed as when it returned nothing, so the message alone proves neither. Studio
58
+ refuses to list for an installation that is not connected to this Studio organization, whatever GitHub
59
+ allows. Confirm that the installation is listed under this organization's Source Control and that the
60
+ person may change the project's settings. Connecting GitHub again does not help when the installation
61
+ belongs to another Studio organization: Studio will not take it over.
62
+ 3. Only when the listing succeeded and the repository is absent: a GitHub owner widens the installation's
63
+ repository access on GitHub.
64
+
65
+ When the project reports that the installation must be reapproved
66
+ or is no longer available, that is also fixed on GitHub (or by reconnecting), not in the model or the code.
67
+
68
+ Disconnecting returns the project to its local repository; what was already pushed stays on GitHub.
69
+
70
+ ## One application in its own repository or folder
71
+
72
+ A project's applications use the project's repository by default. Per application, in Application Settings:
73
+
74
+ - **Base path** (Repository tab): the folder inside the repository where the application lives. Set it when
75
+ several applications share one repository.
76
+ - **A separate repository** (Source control tab): give one application its own repository. Studio refuses
77
+ the change while the application has active work sessions; complete or abandon them first.
78
+
79
+ ## Which arrangement when
80
+
81
+ | Situation | Arrangement |
82
+ | --- | --- |
83
+ | Trying a model, no team review yet | The repository Studio keeps (no connection) |
84
+ | A team reviews and merges generated code | Connect GitHub and choose the project's repository. The default for real work |
85
+ | Several applications in one repository | One project repository, a base path per application |
86
+ | One application is owned or released apart from the others | A separate repository for that application |
87
+ | The code is hosted on GitLab or Azure DevOps | Edge case, not fully supported yet. The repository can be named in the project from a connection the organization made, but Studio cannot push generated code, open merge requests, sync boards or run builds there. Say so; do not plan on pull requests from Studio |
88
+
89
+ ## Anti-patterns
90
+
91
+ - Expecting a pull request from an application whose repository is local, whose publication mode is
92
+ branch only, or whose generated work no person has published yet. Judging this from the project's setting without checking the application's.
93
+ - Handing Studio a personal access token, or storing one in the repository, to make publishing work.
94
+ - Changing the repository or base path of an application while it has open work sessions.
95
+ - Asking a GitHub owner for wider repository access before checking that the right installation is selected
96
+ and that Studio could list its repositories.
@@ -19,8 +19,8 @@ description: Use when implementing one accepted slice by hand in a Cratis applic
19
19
  ## What a slice is
20
20
 
21
21
  A slice is one behaviour of the event model delivered as one vertical unit: the backend that decides or
22
- serves it, the specifications that prove it, and any client or screen that uses it. Its type decides
23
- what you build.
22
+ serves it, the specifications that prove it, and any client or screen that uses it. Its type, chosen
23
+ in the model (`cratis-modeling-design-event-model`), decides what you build.
24
24
 
25
25
  | Type | At runtime | You build | Skills |
26
26
  | --- | --- | --- | --- |
@@ -54,7 +54,8 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
54
54
  earlier batches can stay committed after a later failure; verify what committed before retrying.
55
55
  - **Read model.** Projections and reducers are observers. They update the stored read model after the
56
56
  append, so a query made immediately afterwards can return older state. An observable query pushes the
57
- change to an open screen when it lands.
57
+ change to an open screen when it lands. What each kind of reader can rely on after a write is in
58
+ [eventual consistency](references/eventual-consistency.md).
58
59
  - **Reactor.** It runs after commit and can receive the same event again. Report unexpected handler
59
60
  or follow-up failures so the observer can recover, and make effects idempotent for redelivery and
60
61
  replay. Follow-up commands go through the same authorization and validation as a caller's; see Reactions
@@ -104,9 +105,13 @@ compilation when the SDK needs them.
104
105
  follow the order in your language reference. **Gate:** the generated commands and queries match
105
106
  the backend's names and shapes; run the SDK's drift check where available.
106
107
  4. **Frontend, if present.** Submit the command once and show the state from the query rather than also
107
- inserting the row into local state. Wire the screen using the project's stack (`cratis-arc-react-bind-slice`
108
- for React) and register it in its composition page and route. **Gate:** applicable frontend lint and
109
- build checks pass, plus frontend specifications where screen behaviour changed.
108
+ inserting the row into local state; the one exception, a gesture that must show its result in the same
109
+ frame, is in `cratis-arc-react-bind-slice`, `references/typescript-instant-feedback.md`. Wire the screen
110
+ using the project's stack. For React (`cratis-arc-react-bind-slice`): export the screen from the slice
111
+ folder, mount it in the feature's composition page, and add a route for the feature only when it has
112
+ none yet, as with a new feature or one getting its first screen. Where each React file goes is in that
113
+ skill's `references/typescript-structure.md`. Another stack follows its own language reference. **Gate:** applicable
114
+ frontend lint and build checks pass, plus frontend specifications where screen behaviour changed.
110
115
  5. **See it work.** In the bound running application, exercise the slice once with fresh data as an
111
116
  authorized caller. Check exact appends for a State Change, fresh query results for a State View, and
112
117
  the start-up check below for a reactor. If the slice has a live screen, observe the change without
@@ -128,8 +133,9 @@ its SDK does not support.
128
133
  slice sit together or mirror the same path, as Layout in your language reference shows.
129
134
  - Shared concept — an identifier or value type that several slices use lives at feature level, not inside
130
135
  one slice.
131
- - Composition page — the feature page that mounts each slice's screen and its route; it is the only code
132
- that knows every slice of the feature.
136
+ - Composition page (React) — the feature page that mounts each slice's screen; it is the only code that
137
+ knows every slice of the feature, and the feature, not the slice, has the route. Another stack places
138
+ screens and routes as its own language reference shows.
133
139
 
134
140
  **Deciding (State Change)**
135
141
 
@@ -25,25 +25,43 @@ Names are illustrative (a parking office issuing permits); use the application's
25
25
  events, projections, reducers, reactors and read models, `Cratis.Concepts` and FluentValidation. Add
26
26
  `using Cratis.Chronicle.Keys;` for `[Key]`, `using Cratis.Arc.Chronicle.Reactors;` for `Invoke`,
27
27
  `Refused` and `[ExecuteCommandsAsSystem]`, and `using Cratis.Monads;` for `Result<,>`.
28
- - Specifications live in a separate test project that references the application,
29
- `Cratis.Arc.Chronicle.Testing` and `Cratis.Specifications.XUnit.v3`; the template has none.
28
+ - Specifications have two placements. Use the one the application already has; never add a second.
29
+ - Default, for an application created from the template: a separate `<App>.Specs` project that
30
+ references the application, `Cratis.Arc.Chronicle.Testing` and `Cratis.Specifications.XUnit.v3`. Its
31
+ folders mirror the slice path. The template has no such project; add it.
32
+ - An application that already keeps specifications beside its slices (a Stage-rendered application
33
+ does): add the spec folder beside the slice and keep the project's Debug-only setup. See
34
+ `cratis-specifications-exercise-backend`, `references/csharp-colocated.md`.
30
35
 
31
36
  ## Layout
32
37
 
33
38
  The slice folder sits under the application project and holds backend, generated client and screen
34
- together; the namespace mirrors the path. A shared identity lives at feature level.
39
+ together. The namespace is the project's `RootNamespace` followed by the folder path; the project's
40
+ folder name plays no part. A shared identity lives at feature level.
35
41
 
36
42
  ```text
37
43
  Permits/Issuing/PermitId.cs shared identity of the feature
38
44
  Permits/Issuing/Issue/Issue.cs command, validator, event type
39
45
  Permits/Issuing/Issue/Issue.ts generated from Issue.cs - never edit
40
46
  Permits/Issuing/Issue/IssueDialog.tsx screen part of the slice
47
+ Permits/Issuing/Issue/index.ts exports the proxies (generated lines) and the screen (your line)
41
48
  Permits/Issuing/Active/Active.cs read model, projection, query
42
49
  Permits/Issuing/Active/Active.ts generated
43
50
  Permits/Issuing/Active/ActivePage.tsx
44
51
  Permits/Issuing/Issuing.tsx composition page mounting both screens
52
+ Permits/Issuing/index.ts exports the composition page
53
+ App.tsx one route per feature, to its composition page
45
54
  ```
46
55
 
56
+ - Name a screen for its role (`IssueDialog.tsx`, `ActivePage.tsx`), never `<Slice>.tsx`: `<Slice>.ts` is
57
+ the generated proxy, so `./Issue` would be ambiguous.
58
+ - The application shell lives in root-level `Layout/` and components used by several features in
59
+ `Components/<Group>/`. Neither holds a slice's behaviour.
60
+ - Where every frontend file goes, and how a screen is exported, mounted and routed:
61
+ `cratis-arc-react-bind-slice`, `references/typescript-structure.md`.
62
+ - The template's sample Registration slice contains a reactor that only logs, as a demonstration. Do not
63
+ copy it into a new slice: a state change needs no reactor.
64
+
47
65
  The template configures this: proxies are written into the project directory, the root namespace is
48
66
  skipped, one `.ts` is generated per `.cs` file, and existing files are not deleted. A folder's `index.ts`
49
67
  is a merge target: the generator adds exports for generated files and keeps yours.
@@ -160,6 +178,152 @@ public class PermitNotifications : IReactor
160
178
  - Received facts from another event store: `cratis-chronicle-publish-contract`. A job, import or webhook
161
179
  executing an existing command: `cratis-arc-invoke-command`.
162
180
 
181
+ ### Returning commands or injecting the pipeline
182
+
183
+ - Default: return the commands, as above. Chronicle tracks the delivery, and a failed command fails the
184
+ partition, which recovery retries within its retry budget.
185
+ - Inject `ICommandPipeline` only when the handler must act on each command's result, as when it drains a
186
+ list in which one refused item must not stop the others. A returned batch cannot do that: it stops at
187
+ the first refusal, including one that `.Acknowledge(...)` or `.OnRefused(...)` handled.
188
+ - With an injected pipeline the handler owns the outcome. Check every `CommandResult` and throw for a
189
+ result that must not pass silently; a result nobody checks is a lost failure.
190
+
191
+ ### Draining a to-do list
192
+
193
+ An automation that acts on everything that is due keeps a read model of pending work and sweeps it when
194
+ its trigger arrives. `PermitValiditySet(DateTimeOffset ValidUntil)` is the event that gives a permit its
195
+ end date.
196
+
197
+ ```csharp
198
+ [ReadModel]
199
+ [FromEvent<PermitValiditySet>]
200
+ [RemovedWith<PermitRevoked>]
201
+ [RemovedWith<PermitExpired>]
202
+ public record PermitDueForExpiry(PermitId Id, DateTimeOffset ValidUntil);
203
+
204
+ [ReadModel]
205
+ [Passive]
206
+ [FromEvent<PermitValiditySet>]
207
+ [RemovedWith<PermitRevoked>]
208
+ [RemovedWith<PermitExpired>]
209
+ public record PendingPermit(PermitId Id, DateTimeOffset ValidUntil);
210
+
211
+ [Command]
212
+ public record ExpirePermit(PermitId Permit, DateTimeOffset AsOf)
213
+ {
214
+ public const string NothingToExpire = nameof(NothingToExpire);
215
+ public const string StillValid = nameof(StillValid);
216
+
217
+ public Result<PermitExpired, ValidationResult> Handle(PendingPermit? permit)
218
+ {
219
+ if (permit is null)
220
+ return ValidationResult.Error("There is no permit to expire", reasonDetail: NothingToExpire);
221
+ if (permit.ValidUntil > AsOf)
222
+ return ValidationResult.Error("The permit is still valid", reasonDetail: StillValid);
223
+ return new PermitExpired();
224
+ }
225
+ }
226
+
227
+ public class PermitExpiry(IMongoCollection<PermitDueForExpiry> due, ICommandPipeline commands) : IReactor
228
+ {
229
+ [OnceOnly]
230
+ public async Task Sweep(DayStarted @event)
231
+ {
232
+ var permits = await due.Find(permit => permit.ValidUntil <= @event.OccurredAt).ToListAsync();
233
+ foreach (var permit in permits)
234
+ {
235
+ var result = await commands.Execute(new ExpirePermit(permit.Id, @event.OccurredAt));
236
+ if (!result.IsSuccess && !IsNoLongerDue(result)) throw new PermitExpiryFailed(permit.Id);
237
+ }
238
+ }
239
+
240
+ static bool IsNoLongerDue(CommandResult result) =>
241
+ result.IsAuthorized && !result.HasExceptions &&
242
+ result.ValidationResults.All(validation =>
243
+ validation.Reason == ValidationResultReason.Rule &&
244
+ validation.ReasonDetail is ExpirePermit.NothingToExpire or ExpirePermit.StillValid);
245
+ }
246
+
247
+ public class PermitExpiryFailed(PermitId permit) : Exception($"Could not expire permit '{permit}'.");
248
+ ```
249
+
250
+ - The to-do read model is opened by one event and removed by every event that closes the work. Miss one
251
+ closing event and finished work stays on the list.
252
+ - The list only nominates candidates. It can lag, and a retried sweep meets items it already handled. The
253
+ command decides again from its own decision read (`PendingPermit`) and refuses what is gone or not due.
254
+ - The command takes the cutoff from the clock event (`AsOf`) and never reads the wall clock, so the list
255
+ and the decision use the same cutoff. A permit whose end date moved past that cutoff is refused on this
256
+ sweep even when the sweep runs late.
257
+ - A permit the list did not yet contain when the sweep ran is not expired by it. It waits for the next
258
+ clock event.
259
+ - Only those two refusals mean "nothing to do". The command marks each with its own `reasonDetail`, and
260
+ the reactor continues only when every validation result is one of them; it matches the marker, never the
261
+ message.
262
+ - Throw on every other unsuccessful result, so the partition fails and stays visible. That
263
+ includes a decision read that changed under the command, a constraint violation, a failed validator, an
264
+ unauthorized result and an exception. A changed read and a constraint violation arrive as validation
265
+ results too, so "not valid" alone does not mean stale.
266
+ - Recovery retries a failed sweep within its retry budget, and a retried sweep runs from the start.
267
+ Commands that already succeeded are not rolled back, which is why the recheck in the command is
268
+ required. A partition that keeps failing at the same event is quarantined and is not retried again
269
+ until an operator clears it (`cratis-chronicle-inspect-observer`).
270
+ - `[OnceOnly]` keeps a replay from sweeping again for every historical trigger.
271
+ - The reactor has no caller. If the command requires a role, an injected pipeline does not get one from
272
+ `[ExecuteCommandsAsSystem]`; give it a trusted principal as described in `cratis-arc-invoke-command`.
273
+ - The list is read from the store that holds the read model; use the application's own read for a store
274
+ other than MongoDB.
275
+
276
+ ### Time
277
+
278
+ Time passing is not an event, and a reactor does not create a timer.
279
+
280
+ - Default: the host's scheduler (a hosted background service or an external job) appends an
281
+ application-owned clock event, an `[EventType]` such as `DayStarted(DateTimeOffset OccurredAt)`, and
282
+ the reactor handles it. Nothing runs until that event is appended.
283
+ - The reactor selects due work by comparing stored deadlines with the event's time, never with the wall
284
+ clock, and passes that same time to the command that decides, so a late or retried delivery uses the
285
+ same cutoff in both places.
286
+ - Work that became due between two clock events waits for the next one, and so does work a lagging list
287
+ did not yet show. Choose the interval from how late the work may be.
288
+
289
+ ### Translation
290
+
291
+ A translation slice turns a fact owned by another system into a command in the application's own
292
+ language. It has its own folder, holding the outside event type and the translator.
293
+
294
+ ```csharp
295
+ [EventType]
296
+ public record RegistryVehicleAdded(string RegistryNumber, string Plate, string Status);
297
+
298
+ public class VehicleImport(ICommandPipeline commands) : IReactor
299
+ {
300
+ [OnceOnly]
301
+ public async Task Translate(RegistryVehicleAdded @event)
302
+ {
303
+ if (@event.Status != "ACTIVE") return;
304
+
305
+ var result = await commands.Execute(new RegisterVehicle(@event.Plate));
306
+ if (!result.IsSuccess) throw new VehicleImportFailed();
307
+ }
308
+ }
309
+
310
+ public class VehicleImportFailed() : Exception("Vehicle registration failed.");
311
+ ```
312
+
313
+ - The outside event type mirrors the payload with primitive fields. The slice is the only place that knows
314
+ the other system's names and codes: the event type carries them and the translator interprets them.
315
+ - Filter, map, execute the local command, and throw when the result is not successful: a refused import
316
+ must stay visible, not be acknowledged as done.
317
+ - Nothing else consumes the outside event. Read models project the application's own events, here the one
318
+ `RegisterVehicle` produces.
319
+ - Declaring the event type connects nothing. An adapter in the host (a webhook or a broker consumer)
320
+ receives the message, validates sender and payload, appends the outside event under a stable event
321
+ source id, checks the append result, and only then acknowledges upstream.
322
+ - A retry after a failure executes the command again. If the command creates a new identity on each
323
+ execution, the retry creates a second entity or is refused by a uniqueness constraint. Keep a durable
324
+ mapping from the outside key to the local identity, and decide what a repeated message means. Never
325
+ parse an outside key as the local identity or treat equal names as the same entity.
326
+
163
327
  ## Specifications
164
328
 
165
329
  ```csharp
@@ -0,0 +1,150 @@
1
+ # Eventual consistency: what a read can rely on after a write
2
+
3
+ ## Contents
4
+
5
+ - The rule
6
+ - Choose by who reads next
7
+ - A screen
8
+ - A command that decides
9
+ - Backend code that reads its own append
10
+ - A reactor
11
+ - Passive read models
12
+ - Avoid
13
+
14
+ This is the single guide for "the write succeeded, what can the next read rely on". It is language-neutral;
15
+ the skill named in each row gives the form for your SDK.
16
+
17
+ ## The rule
18
+
19
+ A command that succeeded and committed has its events stored. It does not mean any read model contains
20
+ them.
21
+
22
+ - A command executed inside another command's handler joins the outer command's transaction (Arc in C#)
23
+ or batch (the Arc TypeScript backend) when it is eligible to share it. Its success then means the
24
+ events it returned are staged, not stored: they are stored when the outer command succeeds and commits,
25
+ and that commit can still fail. Only events the commands return are staged. An event a handler appends
26
+ directly through the Chronicle client is stored at once and is not part of it.
27
+
28
+ - Projections, reducers and reactors are observers. Each one handles a stored event on its own, after the
29
+ append, and there is no upper bound on the delay: a failed partition or a replay delays a view for as
30
+ long as it lasts.
31
+ - A stored read model has no synchronous or "immediate" mode. A read model that includes the latest event
32
+ is either computed when it is read (passive) or read after an explicit wait.
33
+ - Two stored read models are never guaranteed to reflect the same event at the same moment.
34
+ - A reactor and a projection that handle the same event run independently. Neither runs first.
35
+
36
+ ## Choose by who reads next
37
+
38
+ | Who reads next | Default | Use instead when |
39
+ | --- | --- | --- |
40
+ | A screen | An observable query on the stored read model; the change is pushed when it lands | The gesture must show its result in the same frame: see A screen |
41
+ | The same screen, opening the item it just created | Return the identity from the command and bind an observable single-item query; no data is pending only until the item has first appeared | - |
42
+ | A following command that decides on that state | A decision read or a constraint | - |
43
+ | Backend code that appended through the Chronicle client | Wait for observer completion on the append result, check the outcome, then read | Almost every read needs the latest event: a passive read model |
44
+ | A reactor | The data of the event that triggered it | It needs state the event does not carry: a passive read model |
45
+
46
+ ## A screen
47
+
48
+ - Submit the command once and render from the query. Do not insert the row into local state, and do not
49
+ re-query when the command returns: a snapshot taken then can still be the old state.
50
+ - Make the query observable when the screen must follow changes, in particular changes its own commands
51
+ cause (`cratis-arc-expose-query`). A report or a one-off read stays a snapshot.
52
+ - A screen that opens an item straight after creating it gets the identity from the command result and
53
+ observes that one item. The item is pushed when the projection has handled the event. Read the result
54
+ in this order:
55
+ - Not ready: the query has not answered yet. Show loading. A source that has emitted nothing is not
56
+ ready; it has not said "no data".
57
+ - Denied or unsuccessful: show the failure. Never read it as pending.
58
+ - Successful with no data: no row matches now. That is pending only while the screen has not yet seen
59
+ the item it just created. Remember when it has appeared; no data after that means the item was removed
60
+ or left the filter.
61
+ - When a screen needs several facts to agree, build one read model that carries them. Two queries on two
62
+ read models can show different moments.
63
+ - Edge case: a drop, paste or canvas gesture that must show its result in the same frame. See
64
+ `cratis-arc-react-bind-slice`, `references/typescript-instant-feedback.md`. A dialog that creates a
65
+ record does not qualify.
66
+
67
+ ## A command that decides
68
+
69
+ Reading a read model and then appending leaves a gap in which another writer can change the state the
70
+ decision rested on. A wait or a passive read does not close that gap. Use the protection that matches the
71
+ rule:
72
+
73
+ - A unique value or a create-once rule: a constraint (`cratis-chronicle-constrain-append`).
74
+ - A rule over state, such as "only an open order can be cancelled": a decision read
75
+ (`cratis-chronicle-protect-decision`). That is a read the framework guards, so the append is refused when
76
+ the state changed after the read.
77
+ - A read model handed to the command is a decision read only where the SDK guards it, as Arc in C# does
78
+ with read protection on. Where it is a plain lookup (the Arc TypeScript backend, or C# with read
79
+ protection off) it is a snapshot and guards nothing: use a guarded read or an explicit append scope.
80
+
81
+ ## Backend code that reads its own append
82
+
83
+ For a job, an import or a test against a running Chronicle kernel that appends through the Chronicle
84
+ client and then reads a stored read model:
85
+
86
+ 1. Append.
87
+ 2. Check that the append succeeded. A rejected append has nothing to wait for, and its completion can
88
+ report success.
89
+ 3. Wait for observer completion on the append result, with a timeout.
90
+ 4. Check the completion: it can report success, a timeout or failed observers, and in some clients a
91
+ timeout rejects the call instead of returning a result, so handle both. Only on success have the
92
+ observers the wait covers caught up for that append.
93
+ 5. Read.
94
+
95
+ - An in-process test surface runs no observers, so there is nothing to wait for and the wait fails there.
96
+ Assert through that test surface directly; use a kernel-backed test to check observer completion.
97
+
98
+ - The wait exists in the .NET, TypeScript, Go and Elixir clients. The Kotlin and Java clients have none:
99
+ use an observable query or a passive read model.
100
+ - A timeout or a failed observer does not undo the append. The events are stored; do not repeat a
101
+ non-idempotent write because the wait failed.
102
+ - An Arc command in C# has no option that waits for read models before it answers. The Arc TypeScript
103
+ backend has one: a completion timeout set on the `withChronicle` registration, which applies to every
104
+ command, or on one command written with `defineChronicleCommand`. A model-bound command has no
105
+ setting of its own. A command whose wait fails reports an error although its events are stored. It
106
+ waits on the command's last append only.
107
+ Prefer the observable query in both.
108
+ - The wait is not limited to the read model you are about to read. The .NET client waits for the
109
+ observers that handle the appended event types; the TypeScript and Elixir clients wait for the tail of
110
+ the append without narrowing by event type, so an observer the read does not need can make the wait time
111
+ out.
112
+ - Which observers the wait covers and how to read its result: `cratis-chronicle-inspect-observer`.
113
+
114
+ ## A reactor
115
+
116
+ - Decide from the triggering event. It is the one fact the reactor is certain to have.
117
+ - A stored read model that the same event updates may or may not contain the event when the handler runs.
118
+ When the reactor needs state, read a passive read model, or put the needed values on the event.
119
+ - A stored read model used as a to-do list only nominates candidates. The command the reactor issues
120
+ checks the state again and refuses what is no longer due (Reactions in your language reference).
121
+ - Rules for effects and redelivery: `cratis-chronicle-react-to-fact`.
122
+
123
+ ## Passive read models
124
+
125
+ A passive read model is not stored. Each read replays, from the start, the events that the read model
126
+ handles for the requested key within its declared scope, so the result reflects every such event stored
127
+ so far. It does not reflect events of other keys or outside that scope (`cratis-chronicle-project-view`).
128
+
129
+ Use it when:
130
+
131
+ - the instance is read by the key that is its event source, and
132
+ - its history is short enough to replay on every read.
133
+
134
+ Keep the read model stored when:
135
+
136
+ - it joins events from other event sources or uses a key other than the event source: a passive read by
137
+ identity only sees the events of that one source;
138
+ - it backs a list, a search, paging or sorting;
139
+ - instances have long histories or are read often.
140
+
141
+ A passive read is still not a guard for a later append: see A command that decides.
142
+
143
+ ## Avoid
144
+
145
+ - Sleeping, or polling with a fixed delay, after a command.
146
+ - Reading the stored read model in the same request that appended and trusting the result.
147
+ - Making a read model passive only to hide a slow or failing projection. Find out why it lags
148
+ (`cratis-chronicle-inspect-observer`).
149
+ - Checking a rule in a query on a stored read model and then sending the command.
150
+ - Building read-model state on the client to stand in for the server's.
@@ -55,6 +55,17 @@ const application = await builder.build();
55
55
  override configuration). `builder.withChronicle({...})` is the same after `import '@cratis/arc.chronicle'`.
56
56
  Options: `completionTimeoutMs` waits for observers after each append; `readModelNamingPolicy` (Arc-owned
57
57
  client only); `activateArtifactsInScopes` resolves reactors/reducers per delivery from Arc's container.
58
+ The wait does not narrow observers by appended event type: it counts every observer on that event log
59
+ in the command's event store and namespace (except kernel-owned reactors not subscribed there) and
60
+ waits for each to reach the tail of the append. One exception: when the append ends at sequence zero
61
+ (the log's first event), a currently subscribed observer with tag, event source type or event stream
62
+ type filters is skipped unless that event matches both its filters and its subscribed event types. A counted observer without a failed partition that stays behind the tail — for
63
+ example one that does not handle the last appended event — holds the wait until the timeout. A failed
64
+ partition ends the wait as soon as no other counted observer is outstanding. A timeout or a failed
65
+ partition makes the command report an exception; the append is not rolled back. Cancelling the command
66
+ after the append stops Arc's wait without reporting an error; the completion request already sent to
67
+ Chronicle is not cancelled. Set it only when every counted observer reaches the tail; otherwise
68
+ let the client tolerate read-model lag.
58
69
 
59
70
  **Generated metadata is required for idiomatic code.** TypeScript erases parameter types; the generator
60
71
  records them so `handle(service: Svc)` and `@query()` bind without explicit descriptors. Arc refuses to
@@ -127,7 +138,9 @@ export class OnePermitPerPlate implements IConstraint {
127
138
  key; personal data takes `@pii()` (`@cratis/chronicle/compliance`) instead. Do not rely on
128
139
  secret-looking field names being skipped.
129
140
  - Command operation: return `tuple(event, new MyOperation())` (`CommandOperation` with `execute` and
130
- `compensate`); operations run first and are compensated only on a known rejection of the batch.
141
+ `compensate`); operations run first. If the command then fails, they are compensated in reverse order
142
+ unless the append's outcome is unknown. A failed or timed-out completion wait also compensates them,
143
+ although the events stay appended.
131
144
 
132
145
  ## Serving
133
146
 
@@ -168,7 +168,7 @@ Chronicle reads take `--server`; store-scoped reads use `-e|--event-store`, and
168
168
  **Application (Arc)**
169
169
 
170
170
  - `cratis arc commands list`: hints from `/.cratis/commands` when checking command discovery on a trusted development endpoint only.
171
- - `cratis arc queries list`: hints from `/.cratis/queries` for query discovery under the same restriction. The CLI skips TLS certificate validation and sends no credentials. Named groups or operations excluded from discovery can be callable; configured routes can differ. Catalog absence, including `401`, `403` or `404`, is not registration evidence.
171
+ - `cratis arc queries list`: hints from `/.cratis/queries` for query discovery under the same restriction. The CLI sends no credentials and accepts any server certificate: it works against a local development certificate, and a successful call does not prove the certificate is valid. Named groups or operations excluded from discovery can be callable; configured routes can differ. Catalog absence, including `401`, `403` or `404`, is not registration evidence.
172
172
  - `--url <app-url>`: point Arc CLI at the specific dev host; otherwise it checks `ARC_URL`, launch settings, then the local default.
173
173
  - Command result: read `isSuccess`, then `isAuthorized`/`authorizationFailureReason`, `isValid`/`validationResults`, `hasExceptions`/`exceptionMessages`, and `correlationId`. Correlate effects rather than inferring rollback.
174
174