@cratis/pi 8.5.0 → 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 (217) hide show
  1. package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +5 -3
  2. package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -1
  3. package/package/corpus/harnesses/copilot/instructions/reactors.instructions.md +3 -1
  4. package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +6 -3
  5. package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +5 -2
  6. package/package/corpus/rules/glossary.md +5 -3
  7. package/package/corpus/rules/react.md +3 -1
  8. package/package/corpus/rules/reactors.md +3 -1
  9. package/package/corpus/rules/specs.csharp.md +6 -3
  10. package/package/corpus/rules/vertical-slices.md +5 -2
  11. package/package/corpus/skills/cratis-application-growth/SKILL.md +1 -2
  12. package/package/corpus/skills/cratis-application-growth/references/csharp.md +0 -2
  13. package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +1 -2
  14. package/package/corpus/skills/cratis-application-growth/references/rename-window.md +1 -3
  15. package/package/corpus/skills/cratis-application-growth/references/service-and-delivery.md +3 -2
  16. package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
  17. package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +2 -2
  18. package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +19 -0
  19. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +15 -0
  20. package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
  21. package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
  22. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +46 -7
  23. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-controller.md +3 -1
  24. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +4 -1
  25. package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +31 -4
  26. package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
  27. package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +24 -2
  28. package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +49 -0
  29. package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +3 -1
  30. package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +27 -4
  31. package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
  32. package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +49 -2
  33. package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +9 -0
  34. package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
  35. package/package/corpus/skills/cratis-arc-host-application/references/csharp-configuration.md +54 -0
  36. package/package/corpus/skills/cratis-arc-host-application/references/csharp-deployment.md +98 -0
  37. package/package/corpus/skills/cratis-arc-host-application/references/csharp-http.md +9 -1
  38. package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +84 -2
  39. package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +2 -0
  40. package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
  41. package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +18 -1
  42. package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
  43. package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +18 -16
  44. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +8 -3
  45. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +84 -16
  46. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +22 -2
  47. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-instant-feedback.md +81 -0
  48. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +80 -0
  49. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +103 -0
  50. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +40 -1
  51. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-structure.md +117 -0
  52. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +7 -3
  53. package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +3 -3
  54. package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +27 -6
  55. package/package/corpus/skills/cratis-arc-validate-command/references/csharp-rules.md +23 -2
  56. package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +28 -2
  57. package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +136 -0
  58. package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +125 -0
  59. package/package/corpus/skills/cratis-authproxy-configure/references/aspire.md +154 -0
  60. package/package/corpus/skills/cratis-authproxy-configure/references/operations.md +122 -0
  61. package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +114 -0
  62. package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +126 -0
  63. package/package/corpus/skills/cratis-authproxy-configure/references/sign-in-providers.md +116 -0
  64. package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +135 -0
  65. package/package/corpus/skills/cratis-choreography-run-workflow/SKILL.md +117 -0
  66. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp-chronicle.md +164 -0
  67. package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp.md +354 -0
  68. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +2 -2
  69. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +28 -0
  70. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-services.md +13 -2
  71. package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +12 -0
  72. package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -0
  73. package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
  74. package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +8 -1
  75. package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +35 -3
  76. package/package/corpus/skills/cratis-chronicle-constrain-append/references/go.md +1 -1
  77. package/package/corpus/skills/cratis-chronicle-constrain-append/references/operations.md +70 -0
  78. package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +2 -0
  79. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +27 -0
  80. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/container-and-kubernetes.md +293 -0
  81. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +13 -6
  82. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +45 -0
  83. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +91 -1
  84. package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +9 -0
  85. package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
  86. package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +11 -1
  87. package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +1 -1
  88. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
  89. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +14 -3
  90. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +3 -0
  91. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +3 -2
  92. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +23 -0
  93. package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +1 -0
  94. package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +2 -1
  95. package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +2 -0
  96. package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +1 -0
  97. package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +1 -1
  98. package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +2 -0
  99. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +40 -3
  100. package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +20 -2
  101. package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +7 -0
  102. package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +9 -1
  103. package/package/corpus/skills/cratis-chronicle-protect-decision/references/java.md +8 -0
  104. package/package/corpus/skills/cratis-chronicle-protect-decision/references/kotlin.md +9 -0
  105. package/package/corpus/skills/cratis-chronicle-protect-decision/references/typescript.md +7 -0
  106. package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +24 -1
  107. package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +1 -1
  108. package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
  109. package/package/corpus/skills/cratis-chronicle-publish-contract/references/webhook-signature-wire-format.md +82 -0
  110. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +17 -0
  111. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-outputs.md +3 -1
  112. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +35 -2
  113. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/elixir.md +11 -0
  114. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +1 -0
  115. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
  116. package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +1 -1
  117. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-coordination.md +31 -2
  118. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-history.md +21 -4
  119. package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +20 -2
  120. package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
  121. package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +1 -1
  122. package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -0
  123. package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +2 -1
  124. package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +3 -1
  125. package/package/corpus/skills/cratis-chronicle-reduce-state/references/java.md +10 -1
  126. package/package/corpus/skills/cratis-chronicle-reduce-state/references/kotlin.md +10 -1
  127. package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +27 -5
  128. package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +18 -0
  129. package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +21 -1
  130. package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +13 -0
  131. package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +15 -0
  132. package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +15 -0
  133. package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +16 -0
  134. package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
  135. package/package/corpus/skills/cratis-code-review/references/csharp.md +1 -1
  136. package/package/corpus/skills/cratis-components-accessibility/SKILL.md +6 -8
  137. package/package/corpus/skills/cratis-components-accessibility/references/typescript.md +32 -14
  138. package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +4 -3
  139. package/package/corpus/skills/cratis-components-build-canvas/references/typescript-props.md +1 -1
  140. package/package/corpus/skills/cratis-components-build-canvas/references/typescript.md +4 -2
  141. package/package/corpus/skills/cratis-components-choose-control/SKILL.md +13 -7
  142. package/package/corpus/skills/cratis-components-choose-control/references/from-primereact.md +116 -0
  143. package/package/corpus/skills/cratis-components-choose-control/references/menu.md +90 -0
  144. package/package/corpus/skills/cratis-components-choose-control/references/typescript-composition.md +48 -0
  145. package/package/corpus/skills/cratis-components-choose-control/references/typescript.md +2 -2
  146. package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +2 -1
  147. package/package/corpus/skills/cratis-components-compose-toolbar/references/floating-toolbar.md +146 -0
  148. package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +102 -0
  149. package/package/corpus/skills/cratis-components-display-list/SKILL.md +10 -10
  150. package/package/corpus/skills/cratis-components-display-list/references/typescript-custom-panel.md +74 -0
  151. package/package/corpus/skills/cratis-components-display-list/references/typescript-datatables.md +2 -7
  152. package/package/corpus/skills/cratis-components-display-list/references/typescript.md +3 -2
  153. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +72 -2
  154. package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +5 -3
  155. package/package/corpus/skills/cratis-components-theme-application/SKILL.md +17 -15
  156. package/package/corpus/skills/cratis-components-theme-application/references/localization.md +166 -0
  157. package/package/corpus/skills/cratis-components-theme-application/references/typescript.md +18 -14
  158. package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +141 -0
  159. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +2 -0
  160. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-domain-philosophy.md +31 -3
  161. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-fundamentals-helpers.md +119 -0
  162. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp.md +4 -0
  163. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +70 -0
  164. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +8 -0
  165. package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +1 -0
  166. package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +33 -0
  167. package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
  168. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +5 -0
  169. package/package/corpus/skills/cratis-fundamentals-type-discovery/references/go-dependency-injection.md +3 -0
  170. package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +6 -4
  171. package/package/corpus/skills/cratis-modeling-design-event-model/references/command-inventory.md +7 -1
  172. package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +13 -1
  173. package/package/corpus/skills/cratis-modeling-design-event-model/references/review-one-slice.md +6 -0
  174. package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +6 -6
  175. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/csharp-aspire.md +116 -28
  176. package/package/corpus/skills/cratis-multi-service-local-orchestration/references/docker-compose.md +2 -2
  177. package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +46 -0
  178. package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +4 -2
  179. package/package/corpus/skills/cratis-platform-build-application/SKILL.md +8 -0
  180. package/package/corpus/skills/cratis-platform-build-application/references/cratis-identity.md +71 -0
  181. package/package/corpus/skills/cratis-platform-build-application/references/studio-repository.md +96 -0
  182. package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +14 -8
  183. package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +167 -3
  184. package/package/corpus/skills/cratis-platform-deliver-slice/references/eventual-consistency.md +150 -0
  185. package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
  186. package/package/corpus/skills/cratis-platform-start-application/SKILL.md +21 -0
  187. package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +77 -3
  188. package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +118 -0
  189. package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +117 -0
  190. package/package/corpus/skills/cratis-platform-upgrade-application/references/java.md +53 -0
  191. package/package/corpus/skills/cratis-platform-upgrade-application/references/kotlin.md +53 -0
  192. package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +71 -0
  193. package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +29 -0
  194. package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +82 -1
  195. package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +1 -1
  196. package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +10 -0
  197. package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +5 -4
  198. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/cli.md +19 -2
  199. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md +87 -0
  200. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/typescript.md +13 -0
  201. package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md +5 -0
  202. package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
  203. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md +101 -0
  204. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +3 -1
  205. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +1 -0
  206. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +1 -0
  207. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +4 -2
  208. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +3 -3
  209. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +34 -1
  210. package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
  211. package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +1 -1
  212. package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md +10 -3
  213. package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +22 -4
  214. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
  215. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +40 -0
  216. package/package/profile-catalog.json +15 -0
  217. package/package.json +1 -1
@@ -0,0 +1,141 @@
1
+ # Upgrade Cratis Components from the previous major
2
+
3
+ ## Contents
4
+
5
+ - When this applies
6
+ - Order
7
+ - Run a codemod
8
+ - What each codemod does and refuses
9
+ - Dependencies
10
+ - Removed root namespaces
11
+ - Removed subpaths and symbols
12
+ - Provider and pass-through changes
13
+ - Verify
14
+ - Avoid
15
+
16
+ A one-time task. General package upgrades are in `cratis-platform-upgrade-application`; this reference holds the Components-specific steps. Paths and names in examples are illustrative.
17
+
18
+ ## When this applies
19
+
20
+ The application is on the major of `@cratis/components` that rendered through PrimeReact, and moves to the major that owns its own markup. You recognise the old major by any of these in the application:
21
+
22
+ - Component namespaces imported from the package root: `import { Canvas } from '@cratis/components'` used as `<Canvas.Canvas>`.
23
+ - `styledMode()`, `CratisPreset` or `primeReactStyles` in the provider setup.
24
+ - Imports from `@cratis/components/styled` or `@cratis/components/compatibility`.
25
+
26
+ This is not a version bump: imports, provider configuration, CSS selectors and some callbacks change. "Old major" and "new major" below mean these two.
27
+
28
+ ## Order
29
+
30
+ Work on a branch. A checkpoint is source, package manifest and lockfile together. Save one only when the application's lint, type check, specs and production build pass. Steps 3 to 6 share one checkpoint: the application does not compile between the package upgrade and the fixes that follow it, so errors left by steps 3 to 5 are expected and the checks must pass only at step 6.
31
+
32
+ 1. **Baseline.** Make every check pass on the old major. Save the rollback checkpoint.
33
+ 2. **Root imports, still on the old major.** Preview and apply `cratis-components-remove-root-namespace-imports`. The subpaths it writes exist in both majors. Review the diff and every diagnostic, rerun the checks on the old major and save the import-only checkpoint.
34
+ 3. **Upgrade the package** to the new major. Then, by hand: the stylesheet imports (Default path in this skill), the provider (below), removed presets and symbols (below), and part names in `pt` and CSS. Type errors remain until step 6 is done; do not checkpoint here.
35
+ 4. **Button props.** Preview and apply `cratis-components-button-variant-tone`, then resolve its diagnostics and `TODO(cratis-codemod)` comments.
36
+ 5. **Change handlers.** Preview and apply `cratis-components-change-handler`, then resolve its diagnostics and `TODO(cratis-codemod)` comments. A command form field's `onChange` stays a type error until you move it by hand (below).
37
+ 6. **Run the checks.** When they pass with no diagnostic and no `TODO(cratis-codemod)` left, save the upgrade checkpoint.
38
+ 7. **Replace remaining direct PrimeReact usage** in separate batches (see `cratis-components-choose-control`, `references/from-primereact.md`). Remove PrimeReact packages only when no import, provider, theme or tool still uses them.
39
+
40
+ Steps 4 and 5 produce source for the new major, so they come after step 3. Step 2 comes first because the two later codemods find components through their subpath imports.
41
+
42
+ To abandon a step, return source, manifest and lockfile to the previous checkpoint together, reinstall from that lockfile and rerun its checks.
43
+
44
+ ## Run a codemod
45
+
46
+ All three commands ship in `@cratis/components.migrator`. Run them from the application directory whose installed Components package is being upgraded, with the migrator in the same major as the new Components major. Never use `latest`.
47
+
48
+ ```sh
49
+ # The caret range of the Components major you are upgrading to.
50
+ TOOLING_RANGE='^<new major>.0.0'
51
+
52
+ npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
53
+ cratis-components-remove-root-namespace-imports --check src
54
+ npx --package "@cratis/components.migrator@$TOOLING_RANGE" \
55
+ cratis-components-remove-root-namespace-imports src
56
+ ```
57
+
58
+ - The path argument (`src` here) only selects the files to scan. The installed `@cratis/components` is resolved from the working directory, so run from the application directory rather than passing a path into the app from elsewhere.
59
+ - Replace `<new major>` with the number; the other two commands take the same form. With pnpm use `pnpm dlx --package …`, with Yarn 2 or later `yarn dlx --package …`.
60
+ - `--check` writes nothing. It exits non-zero when a rewrite is pending or a case needs manual review; that exit does not mean the tool failed.
61
+ - An apply run rewrites the safe cases, reports the rest and exits non-zero while any refused case remains.
62
+ - Before scanning, the migrator checks the installed `@cratis/components`. It accepts only the old major or the new major, and otherwise scans and writes nothing.
63
+ - Requires Node.js 20 or later. The codemods bring their own TypeScript, scan `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts` and `.cts` recursively, skip `node_modules` and `dist`, and are safe to rerun.
64
+ - A codemod does not remove imports it leaves unused. Run the formatter and lint afterwards.
65
+
66
+ **Coming from a major older than the old major (edge case):** the migrator refuses the installed package. Change the imports by hand, install the new major, then run the codemods.
67
+
68
+ ## What each codemod does and refuses
69
+
70
+ | Codemod | Rewrites | Leaves for you (reported) |
71
+ | --- | --- | --- |
72
+ | `cratis-components-remove-root-namespace-imports` | `import { X } from '@cratis/components'` to `import * as X from '@cratis/components/<subpath>'`, and `export { X } from '@cratis/components'` to `export * as X from '@cratis/components/<subpath>'`, for every root namespace. Aliases and type-only imports are kept; mixed setup and namespace imports are split. | Whole-package imports (`import * as`, default, `import = require`), dynamic `import()`, `require()`, `export *` re-exports, side-effect imports, unknown symbols, and the `Compatibility` namespace. |
73
+ | `cratis-components-button-variant-tone` | Literal `Button` props: `text` → `variant='ghost'`, `link` → `variant='link'`, `outlined` → `variant='outline'`, `rounded` → `shape='pill'`, and `severity` → `tone` (`secondary`, `contrast` → `neutral`; `info`, `help` → `accent`; `success` → `positive`; `warn` → `caution`; `danger` → `critical`). | Dynamic values, JSX spreads, duplicate props, and a new prop with a non-literal value beside the old prop it replaces. |
74
+ | `cratis-components-change-handler` | A callback that only forwards one event field, on a standalone `Dropdown` `onChange` and on a command form field's `onValueChange`: it now receives the value itself. The field is `event.value` for `Dropdown`, `DropdownField` and `MultiSelectField`, `target.value` for the text, password, text area and color fields, `target.checked` for the checkbox and toggle fields, and `target.valueAsNumber` for the number and slider fields (`currentTarget` likewise). | Callbacks with several statements, several uses of the event, or use of the native event. An `event.value` callback whose parameter is not typed as the old change event, because `.value` may belong to the selected value. `onChange` on a command form field (see below). |
75
+
76
+ - The first codemod keeps namespace access (`Canvas.Canvas` still resolves). Converting to named imports is optional cleanup by hand.
77
+ - When several of `link`, `text` and `outlined` are set, the Button codemod keeps one variant in that order of precedence. A literal new prop (`variant`, `tone`, `shape`) wins over the old prop it replaces.
78
+ - The Button codemod removes an old prop only when discarding its value cannot change what runs: a bare prop or a literal value. When the value is an expression that would no longer be evaluated, as `text` in `<Button link text={record()} />`, the whole prop group stays unchanged and is reported for manual review.
79
+ - A refused case stays unchanged and is reported. The Button and change-handler codemods also mark it with one `TODO(cratis-codemod)` comment, with three exceptions that are reported only: a Button prop that is not safe to remove (above), an untyped `event.value` callback and `onChange` on a command form field.
80
+ - **`onChange` on a command form field** is no longer a prop and fails type checking. Move the side effect to the enclosing `CommandForm`'s `onFieldChange(command, fieldName, oldValue, newValue)`.
81
+ - After the change-handler codemod, remove a `DropdownChangeEvent` type import that is no longer used.
82
+
83
+ ## Dependencies
84
+
85
+ - The new major has no PrimeReact, PrimeIcons or Prime theme dependency. Uninstall those packages only when the application no longer imports them directly; otherwise keep them, with their provider, CSS and license, for the surfaces that still use them.
86
+ - `pixi.js` is now an optional peer. Install it when the application imports from the `Canvas` or `PivotViewer` subpath; keep one resolution of it in the application.
87
+ - `AutoCommandForm` needs an Arc release that honours an explicit field name. Update `@cratis/arc` and `@cratis/arc.react` together, to the same version, inside the range the Components package declares.
88
+ - Add the recommended config of `@cratis/eslint-plugin-components` (same major as Components) after `@cratis/eslint-config`; its `no-root-barrel-import` rule keeps root namespace imports from returning.
89
+
90
+ ## Removed root namespaces
91
+
92
+ The package root is setup-only: provider, configuration and message types. Every component comes from its subpath.
93
+
94
+ | Old root namespace | Subpath |
95
+ | --- | --- |
96
+ | `Canvas`, `Chat`, `CommandDialog`, `CommandForm`, `Common`, `DataPage`, `DataTables`, `Dialogs`, `Display`, `Dropdown`, `Filter`, `Notifications`, `ObjectContentEditor`, `ObjectNavigationalBar`, `PivotViewer`, `SchemaEditor`, `TimeMachine`, `Toolbar` | `@cratis/components/<same name>` |
97
+ | `Types` | `@cratis/components/types` |
98
+ | `CommandStepper` | The codemod maps the namespace to `@cratis/components/CommandDialog`, because the old namespace was that whole module. In new code import the `CommandStepper` component from `@cratis/components/CommandStepper`. |
99
+ | `Compatibility` | None. Replace its contracts with the typed parts of each component, then delete the import. |
100
+
101
+ `@cratis/components/CommandForm/fields` and `@cratis/components/CommandForm` are the same module.
102
+
103
+ ## Removed subpaths and symbols
104
+
105
+ | Removed | Do instead |
106
+ | --- | --- |
107
+ | `@cratis/components/styled`; `styledMode`, `StyledModeOptions`, `CratisPreset`, `primeReactStyles` | Remove the renderer configuration. Import `tokens`, `styles` and optionally `theme`; assign product values to `--cratis-*` tokens directly. |
108
+ | `@cratis/components/compatibility`; the `Compatibility` namespace and its pass-through contract, sentinel and assert helpers | Use each component's typed parts (`DialogParts`, `DataTableParts`, `TablePaginatorParts`, `StepperParts`, `ToolbarParts`) and `data-cratis-part` selectors. |
109
+ | `@cratis/components/primereact-v10-palette` | Map product tokens to `--cratis-*`, or use the baseline theme. |
110
+ | `primeReactCssLayer`, `primeReactCssLayerOrder` | Delete, unless the product still owns direct PrimeReact CSS. Layer order belongs in product CSS. |
111
+ | `cratisDarkModeSelector` | The product's own theme selector, with the matching `--cratis-*` values assigned under it. |
112
+ | `PivotViewerOptimized` | `PivotViewer`. |
113
+ | `CommandStepperContent` | No replacement. Use `CommandStepper` or `StepperCommandDialog`. |
114
+ | Internal helpers that were exported by accident from `Canvas` (`getInitials`, `reactionsExcludingUser`, mention and emoji helpers) and `Filter` (`buildFilterValues`, `buildRangeValues`, `RenderedHistogramBucket`) | No replacement. Inline the logic the application needs. |
115
+
116
+ ## Provider and pass-through changes
117
+
118
+ - `CratisComponentsProvider` takes locale, labels, icons, routing, dialog header actions and the toast region (Provider configuration in this skill). Renderer keys are type errors: `license`, `theme`, `defaults`, `pt`, `ripple`, `unstyled` and z-index settings. Remove them; configure a PrimeReact provider that is still needed on its own.
119
+ - `value.locales` is still accepted for the old paginator and date labels. Move them to `value.messages`.
120
+ - `pt` stays, with new keys and plain HTML attributes as values. `ptOptions` and `unstyled` are accepted and do nothing.
121
+ - Rename pass-through keys to Cratis parts. Dialog: `mask` → `backdrop`, `headerTitle` → `title`, `closeButton` → `close`. DataTable: `thead` → `head`, `tbody` → `body`, `bodyRow` → `row`. Every part is in [parts](parts.md).
122
+ - Replace `.p-*` selectors with `[data-cratis-part='…']` selectors and the state attributes in this skill.
123
+
124
+ ## Verify
125
+
126
+ - No component is imported from the package root, and no `TODO(cratis-codemod)` remains.
127
+ - `tokens` and `styles` load in every host entry.
128
+ - `pt` keys and CSS selectors name Cratis parts.
129
+ - With the keyboard only: open and dismiss a dialog, move through a stepper, filter and page a table, enter a date, pick a dropdown value, act on a toast.
130
+ - Check each scheme the application supports, then run the checks in Verify in this skill.
131
+ - If a changed control loses behaviour the application needs, stay on the last passing checkpoint until it is resolved.
132
+
133
+ ## Avoid
134
+
135
+ - Upgrading the package before the root-import codemod has run and passed on the old major.
136
+ - Running the Button or change-handler codemod before the upgrade.
137
+ - Fetching the migrator with `latest`.
138
+ - Treating a non-zero `--check` exit as a tool failure.
139
+ - Deleting a `TODO(cratis-codemod)` without resolving the case it marks.
140
+ - Uninstalling PrimeReact while a direct import of it remains.
141
+ - Recreating a product → PrimeReact → Cratis token chain. Map product values to `--cratis-*` directly.
@@ -25,6 +25,8 @@ Example names are illustrative.
25
25
  4. Put expected outcomes in the signature; throw a named domain exception for an invariant breach or unrecoverable fault. Log through generated structured messages on the consuming type's logger. If both logging-container and static-class naming diagnostics apply, use the escalation in Logging; no compliant name satisfies both.
26
26
  5. Document the public contract and verify a warning-free Release build for every declared target and passing affected specifications. Stop and report if applying a convention would break a published contract, such as renaming a public type or changing an event or concept shape.
27
27
 
28
+ In C#, read `references/csharp-fundamentals-helpers.md` when about to write a small utility (exception messages, casing, correlation, async gates, reflection, JSON nodes) or when unsure whether a `Cratis.Fundamentals` helper belongs in application code.
29
+
28
30
  Use `cratis-platform-deliver-slice` for end-to-end slice placement, `cratis-fundamentals-concept` for typed domain values, `cratis-fundamentals-type-discovery` for discovered sets, `cratis-fundamentals-telemetry` for generated metrics and spans, or `cratis-observability` for service-wide observability.
29
31
 
30
32
  ## Capability catalog
@@ -1,5 +1,15 @@
1
1
  # Domain philosophy
2
2
 
3
+ ## Contents
4
+
5
+ - CUPID characteristics
6
+ - Cohesion over layers
7
+ - Ubiquitous language
8
+ - Pluralization
9
+ - Twelve-factor operability
10
+ - Frictionless dependencies
11
+ - Immutability and side effects
12
+
3
13
  ## CUPID characteristics
4
14
 
5
15
  Cratis favors the CUPID characteristics over a strict SOLID reading:
@@ -36,13 +46,31 @@ wrapper.
36
46
  # Preferred — cohesive by feature
37
47
  <Feature>/
38
48
  <Behavior>/
39
- <Behavior>.cs ← the backend artifacts for this behavior
40
- <Behavior>.tsx ← its component
49
+ <Behavior>.cs ← the backend artifacts for this behavior
50
+ <Behavior>.ts ← generated from <Behavior>.cs; never edit
51
+ <Behavior>Dialog.tsx ← its screen, named for its role
41
52
  <OtherBehavior>/
42
53
  <OtherBehavior>.cs
43
- <OtherBehavior>.tsx
54
+ <OtherBehavior>.ts
55
+ <OtherBehavior>Page.tsx
44
56
  ```
45
57
 
58
+ Name the screen for what it renders: `<Behavior>Dialog.tsx` for a dialog that
59
+ submits a command, `<Behavior>Page.tsx` for a page that shows a query. Never
60
+ name it `<Behavior>.tsx`. In the application template's setup, proxy generation
61
+ names each generated `.ts` file after the `.cs` file that holds the owning
62
+ type, when the build's portable debug information resolves that file; an
63
+ artifact it cannot resolve gets a file named after the artifact instead. The
64
+ namespace, not the location of the `.cs` file, decides the folder. Artifacts
65
+ therefore share one `.ts` file only when both the resolved file name and the
66
+ namespace-derived folder match: a `.cs` file that declares types in two
67
+ namespaces produces two modules, and the `.ts` sits beside its `.cs` only while
68
+ the namespace matches the folder path. Keep a type in one `.cs` file; for a
69
+ type split across files the name comes from whichever file resolves first. With
70
+ both in place `<Behavior>.ts` already belongs to the generated client, and a
71
+ `.ts` and a `.tsx` file must not share a base name in one folder. `cratis-platform-deliver-slice`
72
+ (`references/csharp.md`, Layout) owns the full slice layout.
73
+
46
74
  Frontend and backend concerns naturally separate into different projects, but
47
75
  each project keeps the cohesive feature structure inside it.
48
76
 
@@ -0,0 +1,119 @@
1
+ # Fundamentals helpers
2
+
3
+ ## Contents
4
+
5
+ - Default
6
+ - Use in application code
7
+ - Use only when the need applies
8
+ - Infrastructure only
9
+ - Never in application code
10
+
11
+ ## Default
12
+
13
+ An application slice needs none of these helpers. Reach for one only when its
14
+ stated need applies, and never re-implement one that fits. All of them ship in
15
+ the `Cratis.Fundamentals` package; the namespace to import is given per group.
16
+
17
+ ## Use in application code
18
+
19
+ | Need | Helper | Notes |
20
+ | --- | --- | --- |
21
+ | Report a failure with its chain of causes | `exception.GetAllMessages()` | Returns the messages along the `InnerException` chain, outermost first. Sibling causes of an `AggregateException` are omitted; only its first inner exception is followed. Global namespace: no `using`. |
22
+ | Read the correlation id of the current call | Inject `ICorrelationIdAccessor` and read `Current` (`Cratis.Execution`) | Arc and the Chronicle client register the accessor. The id is ambient to the current async flow and equals `CorrelationId.NotSet` until something sets it. |
23
+ | Camel-case a name the way Cratis JSON does | `name.ToCamelCase()` (`Cratis.Strings`) | A name that starts with two capitals is returned unchanged (`URLPath` stays `URLPath`); otherwise the leading capital is lowered. |
24
+ | Upper-case the first letter | `name.ToPascalCase()` (`Cratis.Strings`) | Changes the first character only. |
25
+
26
+ ## Use only when the need applies
27
+
28
+ - **Correlation in a host with neither Arc nor Chronicle (`Cratis.Execution`):**
29
+ call `services.AddCorrelationIdSupport()`. It registers `ICorrelationIdAccessor`
30
+ and `ICorrelationIdModifier` as singletons. Set the id for the current async
31
+ flow with `ICorrelationIdModifier.Modify(id)`; create one with
32
+ `CorrelationId.New()`.
33
+ - **Hold work until a signal (`Cratis.Tasks`):** `AsyncManualResetEvent` has
34
+ `WaitAsync()`, `Set()` and `Reset()`. `WaitAsync()` completes once `Set()` has
35
+ been called and keeps completing until `Reset()`. Create it with `new`. Mainly
36
+ for infrastructure and specifications.
37
+ - **Substitutable delays and timers:** `ITaskFactory` (`Cratis.Tasks`: `Run`,
38
+ `Delay`) and `ITimerFactory` (`Cratis.Timers`: `Create`, returning a
39
+ disposable `ITimer`) let a specification replace background work, delays and
40
+ timers. The shipped implementations, `TaskFactory` and `TimerFactory`, wrap
41
+ `Task.Run`, `Task.Delay` and `System.Threading.Timer`. `Cratis.Tasks.TaskFactory`
42
+ shares its name with the one in `System.Threading.Tasks`; qualify it where both
43
+ namespaces are imported.
44
+ - **Reshape a live query result (`Cratis.Reactive`):** return the store's subject
45
+ unchanged by default. Only when each emission must be mapped to another shape:
46
+ - `TransformingSubject<TSource, TResult>.CreateSubscriberScoped(sourceFactory, transform)`
47
+ connects on the first subscriber and disconnects when the last one leaves;
48
+ concurrent subscribers share that one connection. Disposing the last
49
+ subscription returned by `Subscribe` therefore disposes the wrapper's
50
+ upstream subscription to the source; it does not dispose or complete the
51
+ source object itself, and the next subscriber calls the factory again. Use
52
+ it only when the factory returns a cold, restartable source, never an
53
+ already-running subject.
54
+ - `new TransformingSubject<TSource, TResult>(source, transform)` subscribes to
55
+ an existing subject immediately and emits every value transformed. It holds
56
+ its own subscription to the source until the source completes or the
57
+ wrapper is disposed; disposing a subscription returned by `Subscribe` does
58
+ not release it. Arc disposes only that returned subscription when a client
59
+ disconnects, so never return this form from a query on its own: the code
60
+ that creates it must also dispose it or complete the source, or the store
61
+ watcher keeps running.
62
+ - `subject.CompletedBy(cancellationToken)` completes the subject when the token
63
+ is cancelled, for every subscriber. Call it only on a subject that the
64
+ cancelled operation itself created and owns; on a shared subject one
65
+ caller's cancellation ends the stream for everyone.
66
+
67
+ Keep the query's shape either way: declare the return type as
68
+ `ISubject<TReadModel>` or `ISubject<IEnumerable<TReadModel>>`, not as
69
+ `TransformingSubject<,>`, and keep the method on the read model it returns.
70
+ That declared type satisfies only the return-shape check of model-bound query
71
+ discovery. The method must still be a public, static, non-generic method
72
+ without a parameter of the read model's own type, and it must carry `[Query]`
73
+ when the read model sets `RequireQueryAttribute = true`.
74
+ - **Merge lookups (`Cratis.Collections`):** `lookups.Combine()` turns a sequence
75
+ of `ILookup<TKey, TElement>` into one lookup.
76
+ - **Match an existing XOR-derived identity (`Cratis.Guids`):** `a.Xor(b)`
77
+ combines two GUIDs bytewise. Use it only to stay compatible with identities
78
+ already derived that way. For a new derived identity whose input is stable
79
+ and not sensitive, use the name-based UUID in `cratis-fundamentals-name-value`.
80
+ Anyone who knows the namespace and the name can recompute that id, so when
81
+ the input must stay private use an opaque, randomly generated id instead.
82
+
83
+ ## Infrastructure only
84
+
85
+ These exist for framework, tooling and schemaless plumbing. An application slice
86
+ that needs one is usually missing a typed model or a discovered set.
87
+
88
+ - **Reflection (`Cratis.Reflection`):** `HasAttribute<T>()`, `HasInterface<T>()`,
89
+ `ImplementsOpenGeneric(type)`, `IsDerivedFromOpenGeneric(type)`, `IsRecord()`,
90
+ `IsNullable()`, `IsEnumerable()`, `GetEnumerableElementType()`,
91
+ `GetSettableProperties()` and the constructor lookups
92
+ (`HasDefaultConstructor()`, `GetNonDefaultConstructor()`). To find
93
+ implementations or marked types in a slice, use
94
+ `cratis-fundamentals-type-discovery` instead.
95
+ - **JSON nodes (`Cratis.Json`):** `JsonObject.AsExpandoObject()`,
96
+ `JsonValue.ToTargetTypeValue(type)`, `object.ToJsonValue()` and
97
+ `JsonElement.TryGetValue(out value)` map selected JSON nodes and plain
98
+ values onto each other for content without a schema. Each supports its own
99
+ set of types and they are not round-trip converters: `ToJsonValue()` writes a
100
+ boolean, for example, while `TryGetValue` returns `false` for one. A typed
101
+ model never needs them. To copy
102
+ a node, call the `DeepClone()` instance method that `System.Text.Json`
103
+ already provides.
104
+ - **Non-generic sequences (`Cratis.Collections`):** `CountElements()` and
105
+ `ToObjectArray()` work on an untyped `IEnumerable`.
106
+ - **A value that may be a task (`Cratis.Tasks`):**
107
+ `AwaitableHelpers.AwaitIfNeeded(value)` awaits a `Task`, `ValueTask` or their
108
+ generic forms held as `object` and returns `(IsAwaitable, Result)`. `Result` is
109
+ the awaited value, `null` when the task carries none, or the input itself when
110
+ it was not awaitable. For code that invokes methods by reflection.
111
+
112
+ ## Never in application code
113
+
114
+ - **`ForEach` on a sequence (`Cratis.Collections`):** write a `foreach` loop for
115
+ effects.
116
+ - **`TimedLogging`:** writes timing to the console. Log through generated
117
+ messages (see Logging in `csharp-exceptions-logging-and-di.md`).
118
+ - **`AssemblyHelpers` (`Cratis.Types`):** resolves assemblies by name. Use
119
+ `cratis-fundamentals-type-discovery`.
@@ -49,6 +49,10 @@ See [Dependency injection](csharp-exceptions-logging-and-di.md#dependency-inject
49
49
 
50
50
  Prefer abstractions in constructors. `CRARCH0018` exempts abstract classes, `*Options` and `*Settings`, Arc read models, special types (such as strings) and sealed System types; it does not require wrapping these legitimate inputs in interfaces.
51
51
 
52
+ ## Fundamentals helpers
53
+
54
+ See [Fundamentals helpers](csharp-fundamentals-helpers.md) before writing a small utility (exception messages, casing, correlation, async gates, live-result reshaping, reflection, JSON nodes): it says which shipped helper to use and which ones are for infrastructure only.
55
+
52
56
  ## Alternate implementations
53
57
 
54
58
  See [Alternate implementations and stubs](csharp-alternate-implementations.md) to preserve the real filter contract across storage engines and prove parity with a shared spec.
@@ -9,6 +9,8 @@
9
9
  - Dictionaries keyed by an object
10
10
  - Geospatial values
11
11
  - Concepts by reflection
12
+ - Custom converters
13
+ - Custom naming policy
12
14
  - Failures
13
15
 
14
16
  How Cratis Fundamentals writes concepts and the other typed values to JSON, and what to do when a model is polymorphic, keyed by an object or geospatial.
@@ -72,6 +74,8 @@ public record CustomerName(string Value) : ConceptAs<string>(Value);
72
74
  | Dictionary with an object key | JSON object whose property names are the key as JSON text | `ComplexKeyDictionaryJsonConverterFactory` |
73
75
  | Member declared as an interface or base class | Concrete object plus `_derivedTypeId` | `DerivedTypeJsonConverterFactory` (`Cratis.Serialization`) |
74
76
 
77
+ `DateOnly` also reads date-time text that the JSON reader itself accepts as ISO 8601, and keeps only the date as written, silently dropping the time and any offset: `2025-03-01T23:30:00+02:00` reads as `2025-03-01`. Any other text, including ISO-looking text the JSON reader rejects (for example one with more fractional-second digits than it allows), is parsed with the current culture, and when it carries an offset it is shifted to the machine's local time first, so the date can move by a day. Send ISO date-only text, and check upstream when a payload that carries a time must be rejected.
78
+
75
79
  ## Polymorphic members
76
80
 
77
81
  When a member is declared as an interface or base class, mark each concrete class with `[DerivedType]` and a stable identifier. Nothing else is needed: the classes are discovered, the writer adds `_derivedTypeId`, and the reader uses it to pick the class.
@@ -165,9 +169,75 @@ For generic infrastructure that meets a concept only as `object` or `Type` (`Cra
165
169
  | `ConceptFactory.CreateConceptInstance(type, value)` | Build a concept from a raw value, converting it to `T` first |
166
170
  | `types.RegisterTypeConvertersForConcepts()`, `assembly.RegisterTypeConvertersForConcepts()` | Register a `TypeConverter` per concept so it binds from text. Arc and Chronicle already do this; call it only in a host that uses neither |
167
171
  | `Cratis.Conversion.TypeConverters.Register()` | Register text `TypeConverter`s for `DateOnly` and `TimeOnly` |
172
+ | `"text".ParseTo(type)` | Turn text into a primitive or a concept |
173
+ | `Cratis.Types.TypeConversion.Convert(type, value)` | The loose converter that `CreateConceptInstance` applies to the raw value: turn it into the primitive type `type`, unwrapping a concept first |
168
174
 
169
175
  Application code should use the concept's own constructor and `Value` instead.
170
176
 
177
+ The loose conversions hide bad input, so keep them in infrastructure and never use them to read an identity or a date from untrusted input:
178
+
179
+ - `ParseTo` turns text that is not a GUID into `Guid.Empty` (or a concept wrapping it) without an error. Every other target goes through `Convert.ChangeType` with the current culture, so it converts only to the targets that method supports for text; a target such as `DateOnly`, `TimeOnly`, `DateTimeOffset` or `TimeSpan` throws `InvalidCastException`.
180
+ - `TypeConversion.Convert`, and therefore `CreateConceptInstance`, first unwraps a concept and turns a `JsonElement` it cannot read as the target type into its text. When the target is `Guid`, a remaining value that is neither a GUID, text nor a byte array becomes `Guid.Empty`, while text that is not a GUID throws `FormatException`. Text that does not parse as `DateTimeOffset`, `DateOnly`, `TimeOnly` or `TimeSpan` becomes that type's default value.
181
+ - `Convert` returns `null` for a `null` value; `CreateConceptInstance` throws `ArgumentNullException` instead.
182
+
183
+ When the input is untrusted, parse it yourself (`Guid.TryParse`, `DateOnly.TryParseExact`) and construct the concept from the result.
184
+
185
+ ## Custom converters
186
+
187
+ Edge cases; the defaults above cover concepts, enums, polymorphic members and object-keyed dictionaries without any of these.
188
+
189
+ - **Text binding for a value type of your own that is not a concept:** derive from `StringTypeConverterBase<T>` (`Cratis.Conversion`), implement `Parse(string)` and `ToString(T)`, and attach it with `[TypeConverter(typeof(PeriodTypeConverter))]` on the type, or with `TypeDescriptor.AddAttributes(typeof(Period), new TypeConverterAttribute(typeof(PeriodTypeConverter)))` at startup for a type you do not own. A concept never needs this.
190
+ - **A dictionary key with its own text form, in JSON you write and read yourself:** derive from `DictionaryJsonConverter<TKey, TValue>` (`Cratis.Json`), override `GetKeyFromString`, and override `GetKeyString` unless the key's `ToString()` is that text. It converts a member declared exactly as `IDictionary<TKey, TValue>`; attach it to that member with `[JsonConverter(typeof(...))]`. Give the key a delimiter that cannot occur inside a component and split on it when reading; slicing at fixed positions misreads a value wider than expected. Do not use it on commands, queries, events or read models: a key text of your own is known only to your converter, and no client reads it back as the key type. There, rely on the default in Dictionaries keyed by an object only where the serializer uses the full Cratis defaults and every client reads keys written as JSON text; anywhere else, such as an ASP.NET minimal API endpoint, which gets the concept converters but not the object-key one, expose a list of key and value pairs instead.
191
+
192
+ ```csharp
193
+ using System.Globalization;
194
+ using System.Text.Json.Serialization;
195
+ using Cratis.Json;
196
+
197
+ public readonly record struct Period(int Year, int Month)
198
+ {
199
+ public override string ToString() => string.Create(CultureInfo.InvariantCulture, $"{Year}/{Month:D2}");
200
+ }
201
+
202
+ public class RevenueByPeriodConverter : DictionaryJsonConverter<Period, decimal>
203
+ {
204
+ protected override Period GetKeyFromString(string key)
205
+ {
206
+ var parts = key.Split('/');
207
+ return new(int.Parse(parts[0], CultureInfo.InvariantCulture), int.Parse(parts[1], CultureInfo.InvariantCulture));
208
+ }
209
+ }
210
+
211
+ public record RevenueReport([property: JsonConverter(typeof(RevenueByPeriodConverter))] IDictionary<Period, decimal> Revenue);
212
+ ```
213
+
214
+ - **`TypeWithObjectPropertiesJsonConverter<T>`** (with `TypeWithObjectPropertiesJsonConverterFactory<TConverter, T>`) is infrastructure for a type with `object`-typed properties, named by its `ObjectProperties` override. It writes .NET type names into the JSON: `_type` for the object, and `_<name>Type` for each listed property that is serialized and not `null`, where `<name>` is the camel-cased property name. Reading resolves types from those names: an object without `_type`, or whose `_type` no longer resolves, reads as `null`, and a listed property whose tag is missing or no longer resolves is not restored to its original type; it keeps whatever the serializer reads for an `object` member, typically a `JsonElement`. Never use it for JSON from an untrusted source or for a contract a client reads, and expect a renamed or moved type to break stored data. For application models, type the member as an interface and use `[DerivedType]`.
215
+ - **`ICanCreateEnumConverters`** is implemented by the generated type discovery provider when the compilation has enums to generate converters for. Where dynamic code is unavailable (Native AOT), the enum converter factory asks it for the converter first, and constructs one through reflection only when the provider has none for that enum. Application code never implements or calls it.
216
+
217
+ ## Custom naming policy
218
+
219
+ The naming policy names read-model containers and their properties. Which policy to use and where to set it is in `cratis-application-growth`, `references/csharp.md`, "Naming policy": in an Arc or Chronicle host it is set on their builders. Only the shape of a policy of your own is described here.
220
+
221
+ ```csharp
222
+ using System.Text.Json;
223
+ using Cratis.Serialization;
224
+
225
+ public class SnakeCaseNamingPolicy : NamingPolicy
226
+ {
227
+ public override JsonNamingPolicy? JsonPropertyNamingPolicy => JsonNamingPolicy.SnakeCaseLower;
228
+
229
+ protected override string GetReadModelNameImplementation(Type readModelType) =>
230
+ JsonNamingPolicy.SnakeCaseLower.ConvertName(readModelType.Name);
231
+
232
+ protected override string GetPropertyNameImplementation(string name) =>
233
+ JsonNamingPolicy.SnakeCaseLower.ConvertName(name);
234
+ }
235
+ ```
236
+
237
+ - Derive from `NamingPolicy` (`Cratis.Serialization`) and override the three members above. The base returns the name from `[ReadModelName]` (`Cratis.ReadModels`) when the attribute is applied directly to the type, and calls `GetReadModelNameImplementation` when neither the type nor a base class has it. Put the attribute on each read model class itself: a class that only inherits it from a base class makes `GetReadModelName` throw `NullReferenceException`.
238
+ - Implement `INamingPolicy` directly only when `[ReadModelName]` must not take precedence; then `GetReadModelName` and `GetPropertyName` are yours to implement in full.
239
+ - `services.AddDefaultNamingPolicy()`, `AddCamelCaseNamingPolicy()`, `AddNamespaceNamingPolicy(...)` and `AddNamingPolicy<T>()` register a singleton `INamingPolicy` for services of your own to inject in a host that uses neither Arc nor Chronicle. They do not set the policy of the Chronicle or Arc MongoDB builders; in such a host set it on the builder.
240
+
171
241
  ## Failures
172
242
 
173
243
  | Exception | Cause | Fix |
@@ -30,6 +30,14 @@ public record PageCount(int Value) : ConceptAs<int>(Value);
30
30
  - Add the `T` to concept implicit operator only when callers benefit; it is not required by any Cratis surface.
31
31
  - Model absence as a nullable reference (`CustomerName?`). `ConceptAs<Guid?>` violates the `IComparable` constraint.
32
32
  - Add a `NotSet` or `Empty` value only when the domain reserves that backing value.
33
+ - `ToString()` is sealed on the base, so a concept cannot override it. Format for display in the caller.
34
+ - Concepts order by their wrapped value: `<`, `>`, `CompareTo` and `OrderBy` work directly, and a null concept sorts before every value. `<=` and `>=` throw `NullReferenceException` when the left operand is null, so guard or compare `.Value` when a concept may be null. The non-generic `CompareTo(object)` takes a concept with the same wrapped type; a raw value such as a `string` throws `InvalidCastException`.
35
+ - Edge case, a nullable primitive assigned to an optional concept: the operator above throws `ArgumentNullException` for a null input. Declare it nullable-returning instead (it replaces the plain operator; a type cannot declare both) so null yields a null concept. Keep `[return: NotNullIfNotNull]`; without it every assignment of a non-null primitive to a non-nullable concept gets a nullable warning:
36
+
37
+ ```csharp
38
+ [return: NotNullIfNotNull(nameof(value))] // System.Diagnostics.CodeAnalysis
39
+ public static implicit operator CustomerName?(string? value) => value is null ? null : new(value);
40
+ ```
33
41
 
34
42
  ## Event-source identity
35
43
 
@@ -256,6 +256,7 @@ if err == nil {
256
256
  - No implicit conversion. The generators are `concepts.NewUUID` and `chronicle.NewEventSourceID`; strategies are in `cratis-fundamentals-name-value`.
257
257
  - A concept carries no personal-data or encryption marking of its own: classify the event field with a tag, or the type with `events.WithProtection` when registering the event type.
258
258
  - Relational storage is automatic for nothing: only a UUID concept has SQL codecs, and only once forwarded.
259
+ - No codec for map keys written as embedded JSON. A struct that implements the text marshalling methods, such as `concepts.DateOnly`, works as an ordinary text map key, but a C# dictionary with an object key travels as a JSON object whose property names are the keys as JSON text, and Go Fundamentals has nothing that reads or writes that shape. In a contract a Go client reads or writes, expose a list of key and value pairs instead.
259
260
 
260
261
  ## Done when
261
262
 
@@ -10,6 +10,7 @@
10
10
  - Maps keyed by an object
11
11
  - Geospatial values
12
12
  - Custom converters
13
+ - Selecting a property with a callback
13
14
  - Failures
14
15
 
15
16
  How `@cratis/fundamentals` turns JSON into class instances and back: field metadata, the value types it ships, polymorphic members, maps keyed by an object and geospatial shapes.
@@ -94,6 +95,7 @@ Never compare these with `===`: two instances with the same value are different
94
95
  - **`Guid.equals(other)`** compares canonical text: a `Guid` is used as-is, any other argument is converted with `toString()`, so GUID text matches and non-GUID text returns `false`. It throws on `null` or `undefined`, so guard nullable values first. The parameter is typed `object`, so turn text you hold into a `Guid` with `Guid.as(text)` (or declare a typed `@field(Guid)` member) before comparing. `Guid.as` and `Guid.parse` throw on non-GUID text, so check untrusted text with `Guid.isGuid` first.
95
96
  - **`TimeSpan` components and totals:** `days`, `hours`, `minutes`, `seconds` (and `milliseconds`, `microseconds`, `nanoseconds`) are components: `hours` is 0 to 23 and whole days sit in `days`. Components other than `days` are unsigned, so read the sign from `ticks` or a total. `ticks`, `totalDays`, `totalHours`, `totalMinutes`, `totalSeconds` and the other totals are signed aggregates, so compare and threshold on them. `parse` rejects hours above 23 and minutes or seconds above 59, so a duration of a day or more is written with a day part (`1.02:30:00`).
96
97
  - **`TimeSpan` fields are plain and writable:** assigning one recalculates nothing, and the text (`toString()`, `toJSON()`) is formatted from `ticks`. Build a changed duration by parsing new text, never by assigning a field.
98
+ - **A value type of your own:** `IEquatable` (exported from `@cratis/fundamentals`) declares `equals(other: object): boolean`; `Guid` implements it. Implement it on a value type of your own that needs value equality. Nothing calls `equals` for you: `===`, `Array.includes`, `Set`, `Map` and `ValueMap` do not use it, so call it explicitly.
97
99
 
98
100
  ## Polymorphic members
99
101
 
@@ -197,6 +199,37 @@ JsonSerializer.registerConverter(new MoneyJsonConverter());
197
199
 
198
200
  A converter is chosen by exact type, and registering one for a type that already has one replaces it. Converters for the value types and geospatial shapes above are registered already. A concept is never offered to a converter: it is unwrapped to its value first.
199
201
 
202
+ ## Selecting a property with a callback
203
+
204
+ Edge case, for a component or helper of your own that lets the caller name a field. Default to a string when the path is fixed.
205
+
206
+ `PropertyAccessor<T>` is the type of a callback from an instance to one of its properties: `(instance: T) => any`. It checks the property names the caller writes, not the property's type. To learn which property the callback reads, call it with a proxy and read the path from the handler:
207
+
208
+ ```typescript
209
+ import { PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
210
+ import type { PropertyAccessor } from '@cratis/fundamentals';
211
+
212
+ interface Customer {
213
+ name: string;
214
+ }
215
+
216
+ interface Invoice {
217
+ customer: Customer;
218
+ }
219
+
220
+ export function pathOf<T>(accessor: PropertyAccessor<T>): string {
221
+ const handler = new PropertyPathResolverProxyHandler();
222
+ accessor(new Proxy({}, handler) as T);
223
+ return handler.path;
224
+ }
225
+
226
+ pathOf<Invoice>(invoice => invoice.customer.name); // 'customer.name'
227
+ ```
228
+
229
+ - `handler.path` is the dotted path, `handler.segments` the names in order and `handler.property` the first name (`customer` above); take the last entry of `segments` for the leaf name.
230
+ - Create a new handler for every callback: segments accumulate on the handler.
231
+ - The callback must be a plain chain of property reads. The proxy holds no values, so a callback that computes, calls a method or branches on a value does not give a usable path.
232
+
200
233
  ## Failures
201
234
 
202
235
  | Symptom | Cause | Fix |
@@ -47,6 +47,7 @@ public record OrderId(Guid Value) : EventSourceId<Guid>(Value), IGeneratable<Ord
47
47
  - Implement one contract, not both. When both exist, callers, Arc included, use the context form and never call the plain one; the two do not fall back to each other.
48
48
  - Generic code calls the contract: `static T Create<T>() where T : IGeneratable<T> => T.New();`.
49
49
  - A value derived from an input (a name-based UUID, a digest) gets an input-taking factory such as `For(input)` or `From(input)`, never `New()`.
50
+ - Placement: a concept only one slice uses stays in that slice's folder and namespace; it need not sit in the slice's main file. Once it is shared (see "Where a shared value lives" in this skill's `SKILL.md`), move it to the lowest level that all its users share. Give a concept its own file named after it, such as `OrderId.cs`; its `ConceptValidator<T>` may share that file.
50
51
  - Outside a command handler (a reactor, a seeding job) call `OrderId.New()` directly. Inside a model-bound command handler, ask for a generated parameter instead (see Generate in a command handler).
51
52
 
52
53
  ## Generators
@@ -189,7 +190,7 @@ A generated parameter is `GeneratedValueFreshness.Guarded` by default, and `Crat
189
190
  - Supplying another scope for a guarded target (a narrowed scope, a tail revision, `ConcurrencyScope.None`; a whole-source `BeforeFirst` merges) fails with `ConflictingConcurrencyScopes` before anything is appended.
190
191
  - A custom `IUnitOfWork` that cannot register enrollment contributors makes commands with guarded parameters fail with `FreshIdentifierGuardRequiresEnrollmentContributors`.
191
192
  - Let a rejection from `eventLog.Transactional.AppendMany` escape `Handle()`; catching it can commit earlier events.
192
- - Nested commands share the outer command's unit of work, and the outer command owns commit and rollback. A nested handler's own scope cannot narrow an outer generated id's whole-source guard. Propagate a nested rejection: treating it as success can commit events the outer command enrolled earlier. An explicit aggregate `Commit()` can still finalize the shared unit early.
193
+ - Nested commands: a nested handler's own scope cannot narrow an outer generated id's whole-source guard. Its returned events commit when the outer command's pipeline completes normally, so inspect the nested result and propagate a rejection. An explicit aggregate `Commit()` inside a nested handler is the exception: where permitted it completes the shared transaction at once, and a later outer rejection does not roll those events back. It is refused with `NestedEarlyCompletionUnderReadProtection` when the nested command or its parent enforces read protection. Do not commit an aggregate inside a nested command. `cratis-arc-declare-command`, `references/csharp-chronicle.md`, section "Transaction boundary", teaches the boundary.
193
194
  - Once a guarded target is enrolled, the requirement stays on the unit after that invocation ends, so a later unscoped write to the same source inherits it. A value generated by a finished nested invocation but never targeted adds no requirement.
194
195
  - The guard stops identity reuse, not duplicates under different ids. Protect a natural key with a Chronicle constraint.
195
196
 
@@ -7,6 +7,7 @@
7
7
  - Enumeration throws
8
8
  - A plain injected collection is empty
9
9
  - The naming convention bound the wrong class, or none
10
+ - A service has the wrong lifetime
10
11
  - The generator fails the build
11
12
  - Several hosts or serializers disagree
12
13
 
@@ -67,6 +68,10 @@ Binding happens only when all of these hold:
67
68
 
68
69
  With a second implementation there is no binding at all. Either mark the extra implementations `[IgnoreConvention]` or register the intended one explicitly. An existing registration always wins, because the convention skips services that are already registered. Make explicit registrations before the convention setup runs: before `AddCratisArc`, or before `AddBindingsByConvention` in a plain host.
69
70
 
71
+ ## A service has the wrong lifetime
72
+
73
+ When a class carries both `[Singleton]` and `[Scoped]`, singleton wins wherever Cratis derives the lifetime from the markers, for convention binding and self binding alike, and nothing reports the conflict at build time or at startup. Keep only the marker you intend, or remove both for a transient service. A hand-written provider's binding records are different: each is registered with the lifetime the record declares, whatever markers the class carries. The markers apply only to registrations Cratis adds: a service type the application has already registered keeps that registration and its lifetime. The markers themselves are in Lifetimes and markers in [csharp.md](csharp.md).
74
+
70
75
  ## The generator fails the build
71
76
 
72
77
  The generator skips types nested inside a generic type, and it carries through the experimental-diagnostic identifiers of referenced types. If the generated provider fails on either case, the analyzer that ran is not the one from the `Cratis.Fundamentals` package the project references. Align the two first, for example by removing a stale generator project reference. Never edit or suppress errors in the generated provider.
@@ -159,6 +159,9 @@ Arc's generator can write the registrations from `NewX` constructors, with `//cr
159
159
  ## Edge cases
160
160
 
161
161
  - **Your own container:** implement `di.ScopeFactory` (`NewScope(ctx) (di.Scope, error)`), where a `di.Scope` has `Resolve(ctx, di.Key) (any, error)` and `Close(ctx) error`. Arc and Chronicle accept it, and `di.Resolve[T]` validates what it returns. Optionally implement `di.Catalog` (`Contains(di.Key) bool`) so missing services are reported at startup, not at first use.
162
+ - **An application that uses `fx`, `dig` or `samber/do`:** Fundamentals publishes no adapter module for another container. Its repository holds example recipes for these three, which are unpublished: copy the pattern into the application and never add the recipes module as a dependency.
163
+ - **`fx` (prefer this):** keep the Fundamentals container and let `fx` own only its shutdown. Give `fx.Provide` a constructor that takes `fx.Lifecycle` and the configured `*container.Registry`, and returns `(di.Provider, error)`. It calls `registry.Build` with every option the application needs, including `container.WithContextGuard(capture)` when scopes are guarded (a bare `registry.Build()` drops the guard without an error), returns the build error before touching the lifecycle, and only then appends `fx.Hook{OnStop: provider.Close}` and returns the provider. Lifetimes, ownership and cleanup stay as this reference describes. Resolve services from an `OnStart` hook, never while `fx` constructs its graph, and append the hooks that use those services after the provider's hook, so they stop before the provider closes.
164
+ - **`dig` or `samber/do` as the engine:** each bridge creates its own, separate `dig` container or `do` injector and resolves only the bindings passed to it. Copying a recipe does not expose what the application has already registered in its own container: pass the bridge a binding only for a service that outlives the bridge. The bridges accept only borrowed singletons, built with `di.NewBinding(di.Singleton, di.Borrowed, factory, deps...)`, and reject owned, scoped and transient bindings. They never close a resource: cleanup stays with whoever already owns the service, after everything that resolves from the bridge has stopped, so never close a forwarded service a second time. They have no context guards. Such a bridge passes `ditest.RunResolver` only, not `ditest.RunProvider`. When services need scopes, ownership or cleanup, host the Fundamentals container instead.
162
165
  - **Checking a registration:** the registry and the provider implement `Contains(di.KeyFor[T]())`. `key, err := di.KeyOf(reflectType)` builds a key from a runtime type.
163
166
  - **Verifying a custom provider:** in a `_test.go` file, run `ditest.RunProvider` and `ditest.RunDeclaredGraph` from `github.com/cratis/fundamentals.go/dependencyinjection/ditest` with a function that builds your provider from a `ditest.Config`. `ditest.RunResolver` checks lookup only.
164
167
  - **Writing a generator:** `dependencyinjection/bindingtypes` plans registrations from type-checked packages (`ReadDirectives`, `Analyze(pkgs, Config) Plan`) without running code or writing files. An application uses Arc's generator, which is built on it.
@@ -89,7 +89,7 @@ Every building block, with when to reach for it. "Code:" names the skill that re
89
89
  - **Productions** — none, one fact, several facts, conditional facts (only when a condition holds) or facts on several event sources from one decision.
90
90
  - **Stream routing** — a command can direct its facts to a named event source type and stream.
91
91
  - **Custom body** — when values or rules cannot be stated declaratively; it fills fact values and does not replace the declared productions.
92
- - **External system work** — an operation only documents the dependency and never executes; a system ability invoked from a reaction or workflow executes where the target admits it.
92
+ - **External system work** — an operation only documents the dependency and never executes; a system ability invoked from a reaction executes where the target admits it.
93
93
 
94
94
  ### Consistency choices
95
95
 
@@ -97,6 +97,7 @@ Every building block, with when to reach for it. "Code:" names the skill that re
97
97
  - **UI that follows changes** — an observable query.
98
98
  - **Unique value or once-only fact** — a constraint: a unique value across event sources (one or several properties, shared by several event types, released by a later fact, case-insensitive, custom message) or one occurrence of an event type per source. Code-first only: keeping every value a source claimed, and scoping to a source type, stream type or stream. Code: `cratis-chronicle-constrain-append`.
99
99
  - **Rule over prior state while writers race** — a decision read folds decision state from facts and guards the append: a competing matching append makes it fail with nothing written. Code-first only: a concurrency scope narrowing or widening the guard (source, source type, stream type, stream ID, event types). Code: `cratis-chronicle-protect-decision`.
100
+ - **Values that must agree on one screen** — views and instances of a view advance independently; project them into one instance, read once. After a write: `cratis-platform-deliver-slice`, `references/eventual-consistency.md`.
100
101
  - **Rule across two keys** (a course's capacity and a student's limit) — one decision read per key and one atomic append with a fact on each history that changes.
101
102
  - **Editing conflict** — guard with the version the person saw, not a fresh read that hides the intervening change. Code-first only.
102
103
  - **Limit per period or process within one source** — read and guard only that stream (stream type plus stream ID) instead of the whole history; also how to keep a hot, long history cheap. Code-first only.
@@ -121,7 +122,7 @@ Every building block, with when to reach for it. "Code:" names the skill that re
121
122
  - **Effects** — record a fact that needs no state read, invoke a command when a decision remains (it can refuse), or ask an outside system's ability and branch on its answer, failure or declared outcome.
122
123
  - **Run-as identity** — a reaction that invokes an authorization-gated command states the system identity and roles it acts with.
123
124
  - **Refusal handling** — per refusal kind (validation, constraint, a named constraint, authorization, or any validation or constraint refusal): acknowledge and move on, or record a fact.
124
- - **To-do list** — a read model of pending work the automation drains; an item still listed has not been handled.
125
+ - **To-do list** — a read model of pending work the automation drains. The closing fact removes an item once projected, so the list only nominates candidates; the command rechecks current state before acting.
125
126
  - **Repeated delivery** — the same fact can arrive again; the second delivery must not repeat the business effect. Code: `cratis-chronicle-react-to-fact`.
126
127
  - **Background work that is not a fact** — an application trigger stores durable work outside the event log, delivered at least once; an effect receipt makes a repeat return its recorded outcome instead of appending. Not a projection input.
127
128
 
@@ -133,8 +134,9 @@ Every building block, with when to reach for it. "Code:" names the skill that re
133
134
 
134
135
  ### Long-running behavior
135
136
 
136
- - **State machine** — shows where one item is in its lifecycle by following its read model: one initial state, final states, transitions on a fact with an optional condition; entering a state can invoke a command or start a workflow (safe to repeat). It never decides whether a command is allowed. Model-first.
137
- - **Workflow** — a durable process for one subject, started by a fact, a state entry, a schedule or by hand, through actions, decisions, waits, approvals, foreach and join. An unconnected failed, refused, rejected or expired outlet fails the run. Model-first: nodes, what Stage renders and restart recovery are in [model-first](references/model-first.md); call a run durable only after it survives a restart.
137
+ - **Process over time** — Cratis has no saga, process manager or workflow building block for applications. Model a fact per step, reactions between them and a to-do list of open work. A wait for an approval, an answer or a deadline is an open to-do item: the approval, the answer or a recorded expiry is the fact that advances the process and, once projected, removes the item. The list nominates candidates; each command rechecks current state before acting. Code: `cratis-chronicle-react-to-fact`.
138
+ - **Lifecycle status** — show where one item is as a status on its read model, projected from the facts. It never decides whether a command is allowed.
139
+ - **Screenplay state machines and workflows** — tooling behavior, not an application design choice: [model-first](references/model-first.md) says what a model can state and what Stage renders. Prefer the process shape above.
138
140
 
139
141
  ### Specifications
140
142