@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
@@ -43,6 +43,8 @@ public interface ICartService { CartLineId AddItem(CartId cart, Sku sku, Quantit
43
43
  ```
44
44
 
45
45
  - The record's properties are the request body; use concepts (`ConceptAs<T>`) rather than primitives. Arc serializes a concept as its underlying value.
46
+ - `Handle` is a public instance method on the command itself. There is no separate handler class: a public instance `Handle` on a type without `[Command]` that takes a `[Command]` type as a parameter is an analyzer error (static classes and types named `*Extensions`, `*Helper` or `*Helpers` are skipped), and a static or non-public `Handle` on the command does not count.
47
+ - Coming from a request and handler pair, merge them: the request becomes the command record, the handler body becomes `Handle`, constructor dependencies become `Handle` parameters, and pipeline behaviours become command filters. Do not keep a handler class that `Handle` forwards to.
46
48
  - `Handle` may be synchronous or return `Task`, `Task<T>` or `ValueTask<T>`. Follow the collaborator's actual signature: call a synchronous method synchronously, and `await` only what returns a task. Do not invent an asynchronous overload or a `CancellationToken` parameter the collaborator does not declare.
47
49
  - Parameters of `Handle` are resolved from the command's service scope; register the services in the host as usual.
48
50
  - One command type has exactly one handler; a second fails startup with `MultipleCommandHandlersForSameCommandType`.
@@ -60,13 +62,29 @@ To record events instead of calling a service, read [Chronicle commands](csharp-
60
62
 
61
63
  ## What `Handle` may return
62
64
 
65
+ Pick the return type from what the caller and the system need:
66
+
67
+ | The command must | `Handle` returns |
68
+ | --- | --- |
69
+ | Change state through a service; the caller needs nothing back | `void` or `Task` |
70
+ | Give the caller one value | `T`: the identity or a value the decision produced |
71
+ | Record a fact (Chronicle) | The event, or a collection of events |
72
+ | Record a fact and give the caller a value | A tuple `(event, value)` |
73
+ | Either succeed or refuse | `Result<TSuccess, ValidationResult>`, or `ValidationResult` alone when success carries nothing |
74
+ | Refuse as unauthorized from data the decision loaded | `Result<TSuccess, AuthorizationResult>` |
75
+ | Perform a further side effect | A tuple with an `ICommandOperation`, or `CommandOperations` for several |
76
+
77
+ To refuse a command, return a single `ValidationResult` for a business rule, or an `AuthorizationResult` that is not authorized. Give the `ValidationResult` error severity whenever the return also carries an operation: there a result below the command's blocking severity does not refuse. A response value handler can fail the command too: a failed aggregate commit result does, and so can a custom handler. An error DTO, a nullable event, an empty collection of events and a collection of `ValidationResult` do not refuse: the command succeeds.
78
+
63
79
  The pipeline classifies the returned value. Values it consumes on the server never reach the caller.
64
80
 
65
81
  | `Handle` returns | What the pipeline does |
66
82
  | --- | --- |
67
83
  | `void`, `Task` | No response. |
68
84
  | `T`, `Task<T>`, `ValueTask<T>` | A value no handler consumes becomes `CommandResult<T>.Response`. |
69
- | One `ValidationResult` (`Cratis.Arc.Validation`) | Makes the ordinary handler result invalid, even at warning or information severity. A collection is not a supported refusal. |
85
+ | One `ValidationResult` (`Cratis.Arc.Validation`) | On an ordinary return, makes the result invalid, even at warning or information severity. When the return also carries an operation, Arc applies the command's validation severity threshold instead: a result below the blocking severity (a warning, by default) is dropped, the command succeeds and the operation runs. Use error severity for a refusal. |
86
+ | `ValidationResult[]`, `IEnumerable<ValidationResult>` | Not a refusal: no built-in handler consumes a collection, so it becomes the response and the command succeeds. In a tuple it counts as the unconsumed value, and a second one is a declaration fault. When the return also carries an operation, the collection is left out of the response and still does not refuse. Return one `ValidationResult`, or put the rules in a validator. |
87
+ | `AuthorizationResult` (`Cratis.Arc.Authorization`) | Not authorized: the command is refused as unauthorized. Authorized: consumed, and the command succeeds. Use it only when the verdict depends on data the decision loaded; otherwise declare the policy on the command. |
70
88
  | `ICommandOperation` | Executed on the server after `Handle`; never the response (`cratis-arc-declare-operation` skill). |
71
89
  | `CommandOperations` | An explicit ordered batch of operations, possibly empty. |
72
90
  | An event, a collection of events, `EventForEventSourceId` | Appended by the Chronicle integration (see [Chronicle commands](csharp-chronicle.md)). |
@@ -102,11 +120,13 @@ public record EmptyCart(CartId CartId)
102
120
 
103
121
  `ICommandOperation` is in `Cratis.Arc.Commands`; `Execute` takes its services as parameters and follows their signatures (`cratis-arc-declare-operation` skill). Use a response value handler instead only when many commands return the same server-consumed type (see "Consume a returned value on the server").
104
122
 
105
- - A single `ValidationResult` on the ordinary response path refuses the command. An error-named record in a `Result` is plain response data and leaves the command successful.
123
+ - A single `ValidationResult` on the ordinary response path refuses the command; beside an operation only one at a blocking severity does. An error-named record in a `Result` is plain response data and leaves the command successful.
106
124
  - With a compiler supporting native unions, `public readonly union DiscountOutcome(DiscountApplied, ValidationResult);` can be the declared return type. Only the active case is processed; declare nameable closed alternatives so the generator can emit metadata and the typed accessor. This does not enable union request binding or native-union `Provide`.
107
125
  - Return `new CommandOperations([reserveStock, notifyWarehouse])` for two ordered `ICommandOperation` values, not a bare array. With operations present, validation collections are control values rather than response candidates.
108
126
  - Two unconsumed tuple elements produce an exception-bearing result (`MultipleUnhandledTupleValues`), not a two-field response: return one record.
109
127
  - A `null` return supplies no response. Never return `null` or an empty collection to signal a refusal.
128
+ - A result that is not successful never carries a response: Arc clears it. Do not design an error payload as the response type; report the failure as a `ValidationResult`.
129
+ - Do not return the read model the command affects. A returned read-model instance is plain response data: nothing refreshes it or keeps it in step with what queries serve. Return the identity or a value the decision produced, and let the caller query or observe the view.
110
130
  - `ValidationResult.Information(...)`, `.Warning(...)` and `.Error(...)` take a message and optional member names.
111
131
 
112
132
  ## Dependencies and `Provide`
@@ -140,6 +160,8 @@ When nothing can be missing, return the value directly (`public ShippingRate Pro
140
160
  - `CancellationToken` is supplied by Arc in both methods, never from dependency injection: the request-aborted token over HTTP, or the token the in-process caller passed.
141
161
  - `Provide` prepares input; it is not a response and not a place for writes. Keep the write in `Handle`, in a returned operation or in a returned event.
142
162
  - A provided value that no `Handle` parameter consumes is a mistake.
163
+ - Each provided value is consumed once: a parameter takes the first unconsumed value its type is assignable from. Arc binds parameters in declaration order, except that the Chronicle integration binds a parameter another one depends on first (the source of a `[LookUpBy]`, for example). Two parameters of one type therefore bind by binding order and by the order the values were provided. Give each provided value its own record or concept type so order never decides.
164
+ - A `Handle` parameter is filled in this order: a `[GeneratedValue]` capture, the cancellation token, a provided value, then a parameter resolver or the service container. A provided value never fills a `[GeneratedValue]` parameter or the cancellation token. A provided value that matches a caller-keyed read-model parameter (`[LookUpBy<TKeyProvider>]`) is always refused with `InvalidLookUpBy`. When the command declares a sibling lookup, the source parameter of that lookup and every parameter carrying `[LookUpBy]` are acquired by the resolver even when a provided value fits. Without a sibling lookup, a matching provided value fills a parameter with a property-based `[LookUpBy]` and the lookup does not run, so do not provide a value of a type you also look up.
143
165
  - For a value many commands need, register a scoped service and take it as a parameter instead of repeating `Provide`.
144
166
 
145
167
  ## Current state as a parameter
@@ -157,15 +179,15 @@ public record ChangeQuantity([property: Key] CartLineId Id, Quantity Quantity)
157
179
  ```
158
180
 
159
181
  - **Command key.** Mark one property with `[Key]` from `System.ComponentModel.DataAnnotations`, or implement `ICanProvideKeyForCommand.GetKey()` for a computed key. A property named `Id` alone is not a key. Only the first `[Key]` property is used. An event-sourced command selects its event source differently (see [Chronicle commands](csharp-chronicle.md)).
160
- - **Absence.** A nullable parameter receives `null` for a valid key with no record. A non-nullable parameter makes the state required: a missing record refuses the command as invalid before the code runs.
161
- - **Another key.** `[LookUpBy(nameof(MoveLine.TargetCartId))]` on the parameter (`Cratis.Arc.Commands`) loads that model by the named command property instead of the command key. For state owned by the caller rather than named in the request, use `[LookUpBy<CallerSubject>]` (the caller's `sub` claim). For another claim derive from the abstract `CallerClaim`, e.g. `public sealed class CallerTenant() : CallerClaim("tenant_id");`, and use `[LookUpBy<CallerTenant>]`: the key is the single distinct nonempty value of that exact claim type; an anonymous or system caller, or no value, counts as missing, and several distinct values as ambiguous. For any other source implement a stateless `IReadModelKeyProvider` whose `Resolve(ReadModelKeyContext)` returns `ReadModelKeyLookup.Found(key)`, `Missing` or `Ambiguous`. Never invent a client-supplied property for it.
182
+ - **Absence.** A nullable parameter receives `null` for a valid key with no record. A non-nullable parameter makes the state required: a missing record refuses the command as invalid before the code runs. Under Chronicle read protection `On`, a nullable parameter also receives `null` (when neither the parameter nor its read model type is marked `[Unprotected]`), with no read and no guard, when its key comes from a command property that is not an event-source candidate (an `EventSourceId`, a type deriving from `EventSourceId<T>`, or a property carrying Chronicle's `[Key]`) and that value is null, empty or whitespace-only: treat that `null` as "no key supplied" as well as "not found", or reject blank values before invocation. A parameter or read model type marked `[Unprotected]` gets no such shortcut. A malformed non-blank key is still refused. With Chronicle, a public settable non-nullable concept property of the command that arrives `null` is refused as required ("The value is required.") during command validation. Only the first event-source candidate property is exempt, even when `ICanProvideEventSourceId` supplies the event source ID; get-only properties are not checked.
183
+ - **Another key.** `[LookUpBy(nameof(MoveLine.TargetCartId))]` on the parameter (`Cratis.Arc.Commands`) loads that model by the named command property instead of the command key. For state owned by the caller rather than named in the request, use `[LookUpBy<CallerSubject>]` (the caller's `sub` claim). Caller-derived lookups (`[LookUpBy<TKeyProvider>]`) are supported only on a Chronicle read model that is not per-stream. Elsewhere, including Entity Framework Core and MongoDB state, Arc refuses the lookup with `InvalidLookUpBy` when it resolves that parameter; a parameter Arc binds itself, such as `CancellationToken`, silently ignores the attribute. For another claim derive from the abstract `CallerClaim`, e.g. `public sealed class CallerTenant() : CallerClaim("tenant_id");`, and use `[LookUpBy<CallerTenant>]`: the key is the single distinct nonempty value of that exact claim type; an anonymous or system caller, or no value, counts as missing, and several distinct values as ambiguous. For any other source implement `IReadModelKeyProvider` whose `Resolve(ReadModelKeyContext)` returns `ReadModelKeyLookup.Found(key)`, `Missing` or `Ambiguous`. A provider sees only the caller and the target read-model type. Arc shares one instance, so it needs a public parameterless constructor and must be stateless and thread-safe, with no services, dependency injection or IO; if the key needs those, a provider does not fit, so have sign-in issue the key as a claim instead. Never invent a client-supplied property for it. A missing or ambiguous key or a throwing provider refuses the command as unauthorized (`ReadModelKeyResolutionDenied`: `IsAuthorized` false, HTTP 403) before `Handle` runs, never as a validation failure. Arc never falls back to a client key, even for a nullable parameter; the absence rules above apply only once a key is found.
162
184
  - To contribute an integration-wide key convention, implement `ICanResolveKeyForCommand.Resolve(object command)`, e.g. `command is MoveLine move ? move.LineId.ToString() : null`. Custom resolvers precede the default; first nonempty key wins.
163
- - Under effective Chronicle read protection `On`, `[LookUpBy(nameof(line), nameof(CartLine.CartId))] Cart cart` takes its key from the sibling protected `CartLine line` parameter. Both reads are guarded. Use `[ProtectedDecision]` on a command that requires guarded decision reads; mark an advisory parameter `[Unprotected("display only")]` only if it cannot affect the decision.
185
+ - Under effective Chronicle read protection `On`, `[LookUpBy(nameof(line), nameof(CartLine.CartId))] Cart cart` takes its key from the sibling protected `CartLine line` parameter. Arc reads the source parameter first, whatever the declaration order. When the target is read, both reads guard the command's append. A nullable target is `null`, with no target read and no guard for it, when a nullable source is absent or the source's relationship value is null, empty or whitespace-only. A non-nullable source with no record refuses the command before the target is bound, whatever the target's nullability. The relationship property's type must exactly match the target model's key type (a nullable wrapper is allowed). A cycle, an unknown sibling name, an `[Unprotected]` or per-stream model, or an effective `Off` or `Measure` mode is refused with `InvalidLookUpBy` before Arc acquires arguments for that member. A sibling lookup always needs the Arc source generator's metadata for the relationship property and the target key type, even when `ReadProtection:RequireGeneratedMetadata` is `false`; without it the lookup is refused with `InvalidLookUpBy`. Use `[ProtectedDecision]` on a command that requires guarded decision reads; mark an advisory parameter `[Unprotected("display only")]` only if it cannot affect the decision.
164
186
  - Which store loads the parameter is decided by the integration that owns the read model type (Chronicle, Entity Framework Core, MongoDB); nothing is registered per command. Only when writing an integration for another store, implement `ICanResolveReadModelForCommand` (`ReadModelTypes`, `Ownership`, `Resolve(Type readModelType, CommandContext commandContext)` returning `null` when nothing exists for the key) and register it with `services.AddReadModelsForCommand(resolver)`. `ReadModelForCommandOwnership.Declared` claims its types even when another provider resolves them; `Fallback` claims only types nothing else resolves.
165
187
  - Never return `null` or a nullable event to express "the record is missing": check the nullable parameter and return a `ValidationResult` failure instead.
166
188
  - Sharing the instance is not a lock or a freshness guarantee. Protect a rule that must hold under concurrent writes with a storage constraint, a conditional write, or the Chronicle decision guard (`cratis-chronicle-protect-decision` skill).
167
189
 
168
- Failures when the state cannot be loaded. The first two are client-input failures (HTTP 400, reason `ValidationResultReason.DependencyUnavailable`, a generic message that does not name the read model type); the rest are defects in the application and surface as server errors.
190
+ Failures when the state cannot be loaded. A refused caller-derived key (`[LookUpBy<TKeyProvider>]`) is not one of them: it is the authorization failure above, and application exception mappers do not change it. By default, of the table rows, the first two are client-input failures (HTTP 400, reason `ValidationResultReason.DependencyUnavailable`, a generic message that does not name the read model type), and the rest are defects in the application and surface as server errors. During command execution an `ICommandExceptionMapper` (`Cratis.Arc.Commands`) can replace these outcomes; a validation-only call does not consult it, and an `IExceptionResponseMapper` does not replace the built-in validation failures.
169
191
 
170
192
  | Failure | Cause | Fix |
171
193
  | --- | --- | --- |
@@ -174,8 +196,8 @@ Failures when the state cannot be loaded. The first two are client-input failure
174
196
  | `CannotResolveCommandDependency` | A non-nullable `Handle` or `Provide` parameter that is not a registered read model resolved to nothing. | Register the service, or make the parameter nullable. |
175
197
  | `CannotResolveValidatorDependency` | The same for a validator constructor parameter. | Register the service, or make the parameter nullable. |
176
198
  | `AmbiguousReadModelLookup` | Chronicle read model: several command properties have the model's key type. | Select one with `[LookUpBy(nameof(...))]`. |
177
- | `InvalidLookUpBy` | `[LookUpBy]` names a missing property, sits on a non-read-model parameter, combines the property and provider forms, or `Provide` supplies a value for a caller-keyed parameter. | Use exactly one lookup form on a read-model parameter and let Arc load it. |
178
- | `CommandReadModelKeysMissing` | Chronicle read model: the generated key metadata for the command or read model is absent while generated metadata is required. That is the default, and always the case where dynamic code is unavailable. | Enable the Arc source generator in the project that declares the type. Setting `ReadProtection:RequireGeneratedMetadata` to `false` instead falls back to reflection with a warning, only on a runtime that supports dynamic code. |
199
+ | `InvalidLookUpBy` | `[LookUpBy]` names a missing property, sits on a non-read-model parameter, combines the property and provider forms, puts a caller-derived lookup on a resolved parameter other than a non-per-stream Chronicle read model, or `Provide` supplies a value for a caller-keyed parameter. | Use exactly one lookup form on a read-model parameter and let Arc load it. |
200
+ | `CommandReadModelKeysMissing` | Chronicle read model: the generated key metadata for the command or read model is absent while generated metadata is required. That is the default, and always the case where dynamic code is unavailable. | Enable the Arc source generator in the project that declares the type. Setting `ReadProtection:RequireGeneratedMetadata` to `false` instead falls back to reflection with a warning, only on a runtime that supports dynamic code; sibling lookups (`[LookUpBy(nameof(line), …)]`) get no fallback. |
179
201
  | `ReadCannotBeProtected` | Chronicle read protection `On`: the parameter's read model has a shape the decision guard cannot cover (a reducer with constructor dependencies or an event filter, joins or children, a key taken from an event property, a key whose read-model schema is neither a string without a format nor a `Guid` with format `guid` or `uuid` (the CLR type alone does not decide this), another event sequence, pinned generation delivery), or the parameter is an `IMongoCollection<T>` of a Chronicle read model. | Apply the fix the message names for that parameter: inject the read model itself, or read a source-keyed model without those features. Mark the parameter `[Unprotected("why")]` only if it cannot affect the decision. Under `Measure` or `On`, analyzer `ARCCHR0024` warns for the refused shapes visible in source; `ARCCHR0026` reports the `IMongoCollection<T>` parameter (a warning under `On`). |
180
202
  | `ProtectedReadModelKeyAccessorMissing` | Chronicle read protection: a key is a custom record or class (not a scalar, concept or tuple) that the source generator could not describe, for example a partial or external type. | Before the host starts, call `ProtectedReadModelKeyAccessors.Register<WarehouseKey>(new(nameof(WarehouseKey.Warehouse), key => key.Warehouse), new(nameof(WarehouseKey.Section), key => key.Section))` (`Cratis.Arc.Chronicle.ReadModels`) with every public readable instance property, once per concrete type. Prefer a concept or scalar key. |
181
203
 
@@ -261,7 +283,7 @@ public record ScheduleDelivery(CartId CartId, [property: ExplicitOffset] DateTim
261
283
  | `CorrelationId` | Identifies the execution; also on the result. |
262
284
  | `Type`, `Command` | The command type and instance. |
263
285
  | `ReceivedAt` | When the command was received. Use it instead of reading the clock. |
264
- | `AuthorizedPrincipal` | The principal the pipeline authorized. |
286
+ | `AuthorizedPrincipal` | Set only when scheme authentication selected an authenticated principal that differs from the original caller; otherwise `null`, even when a scheme selected an equivalent principal. Read the caller from `ICurrentPrincipalAccessor.Current` (`Cratis.Arc.Authorization`), not from this. |
265
287
  | `Dependencies` | Resolved `Provide` values and handler arguments; empty during filters. |
266
288
  | `Values` | Case-insensitive extension values, shared across the execution. |
267
289
  | `GeneratedValues` | Captures of `[GeneratedValue]` parameters. |
@@ -271,6 +293,8 @@ public record ScheduleDelivery(CartId CartId, [property: ExplicitOffset] DateTim
271
293
  | `Response` | The selected response; available only after `Handle`. |
272
294
  | `ServiceProvider`, `CancellationToken` | The command's scope and token. |
273
295
 
296
+ `context.GetResolvedKey()` returns the command key Arc resolved for state lookup. It is `null` or empty when the command carries no usable key (Chronicle supplies an empty string for an unspecified event source ID), so check with `string.IsNullOrEmpty`. Use it in a filter or execution scope that needs the command's target.
297
+
274
298
  Contribute values with `ICommandContextValuesProvider`; it is discovered automatically.
275
299
 
276
300
  ```csharp
@@ -316,11 +340,12 @@ public class StockAdjustmentHandler(IStock stock) :
316
340
 
317
341
  - Put `[Authorize(Policy = "ManageCarts")]` from `Cratis.Arc.Authorization` on the model-bound command, or `[AllowAnonymous]` for a deliberately public command. Use `cratis-arc-authorize-request` for the policy. Do not substitute availability for authorization.
318
342
  - With typed availability configured (`services.AddArcAvailability()`), `[Available<CartManagement>]` requires a block, `[AvailableFor<Staff>]` an audience, and `[AvailableWhen<WarehouseOpen>]` a condition. Separate attributes must all pass.
319
- - Validation normally blocks errors. `[BlockOnValidationSeverity(ValidationResultSeverity.Warning)]` on the command or the assembly makes warnings block too. `[TreatWarningsAsErrors]` applies to controller actions only and has no effect on a model-bound command. `[AllowCallerValidationSeverity(ValidationResultSeverity.Warning)]` opts the command into caller-selected strictness up to that limit. These govern validation, not a refusal returned by `Handle`.
343
+ - Validation normally blocks errors. `[BlockOnValidationSeverity(ValidationResultSeverity.Warning)]` on the command or the assembly makes warnings block too. `[TreatWarningsAsErrors]` applies to controller actions only and has no effect on a model-bound command. `[AllowCallerValidationSeverity(ValidationResultSeverity.Warning)]` opts the command into caller-selected strictness up to that limit. These govern validation and a `ValidationResult` returned beside an operation, not a `ValidationResult` returned on its own by `Handle`.
320
344
  - For infrastructure-supplied parameters implement a parameter resolver (`Cratis.Arc.DependencyInjection`); it is discovered, so no registration is needed. The first resolver that owns a parameter wins; if none owns it, the container resolves the type. A null for a non-nullable parameter fails as an unresolvable dependency whether a resolver or the container supplied it; a nullable one receives null.
321
345
  - Synchronous lookup: implement `ICanResolveParameterDependency.TryResolve(IServiceProvider services, ParameterInfo parameter, out object? dependency)`; return `true` for parameters you own and `false` for the rest.
322
346
  - Asynchronous lookup: implement `IAsyncParameterDependencyResolver` and `ValueTask<ParameterDependencyResolution> Resolve(IServiceProvider, ParameterInfo)`. Await the lookup and return `ParameterDependencyResolution.Resolved(value)` for every parameter you own (also when the value is null), `NotResolved` otherwise. `Handle()` and `Provide()` binding awaits `Resolve`. The interface extends `ICanResolveParameterDependency`, and consumers that cannot await, such as validator constructors, still call `TryResolve`. Keep the same ownership rule there: return `true` for owned parameters (with a synchronously obtained value, or null) and `false` only for parameters you do not own.
323
347
  - Use `IAvailabilityCommandFilter` for availability, `IAuthorizationCommandFilter` for access, `ICommandFilter` for ordinary pre-execution checks. For example, an access filter's `Task<CommandResult> OnExecution(CommandContext context)` can return `Task.FromResult(allowed ? CommandResult.Success(context.CorrelationId) : CommandResult.Unauthorized(context.CorrelationId))` using its computed verdict. An exception result isn't an authorization denial.
348
+ - Filters run in three groups: availability, then authorization, then the ordinary filters, which include validation. Execution stops at the first blocking result. Over HTTP a failed command answers with the first status that applies: 403 not authorized, 400 not valid (including a malformed body, or a required read model with no record for a usable key), 503 retryable, otherwise 500 (including a required dependency that resolved to nothing for any other reason); an exception response mapping can replace the status.
324
349
  - To bracket execution (ambient state, commit on success, release resources) implement an execution scope (`Cratis.Arc.Commands`); `cratis-arc-invoke-command` covers the lifecycle.
325
350
  - To turn a known exception type escaping any command into a different failure, such as a validation finding, implement `ICommandExceptionMapper` (`Cratis.Arc.Commands`); `cratis-arc-invoke-command` covers the contract. `IExceptionResponseMapper` only sets an HTTP status, an error code and optional headers (such as a retry delay) and cannot produce member findings.
326
351
 
@@ -331,8 +356,10 @@ public class StockAdjustmentHandler(IStock stock) :
331
356
 
332
357
  ## Analyzers
333
358
 
334
- `ARC0005` flags a `Provide` value that `Handle` does not consume. `ARC0006` flags a non-nullable read-model dependency so that "required" is a deliberate choice.
359
+ `ARC0002` warns about a command-shaped type without `[Command]`, `ARC0003` reports a public instance `Handle` that takes a `[Command]` type as a parameter on a type without `[Command]` (static classes and types named `*Extensions`, `*Helper` or `*Helpers` are skipped), and `ARC0004` reports a command without a public instance `Handle`. `ARC0005` flags a `Provide` value that `Handle` does not consume. `ARC0006` flags a non-nullable read-model dependency so that "required" is a deliberate choice. Generated-value diagnostics are in `cratis-fundamentals-name-value`; the full list is in `cratis-code-review`.
335
360
 
336
361
  ## Not supported in this SDK
337
362
 
363
+ - No separate handler class for a model-bound command: the handler is the command's own `Handle`.
364
+ - No multi-command batch API: nothing submits several commands as one atomic unit. Declare one command for the whole decision and return all its events and operations. With Chronicle, a command executed inside another command's `Handle` shares the outer transaction (see [Chronicle commands](csharp-chronicle.md)); that is nesting, not a batch.
338
365
  - No schema-first descriptor alternative to a model-bound command: declare the input and response as CLR types, or retain MVC binding for an existing controller API.
@@ -95,7 +95,7 @@ func (c ShipParcel) Handle(ctx context.Context, parcel Parcel) (string, error) {
95
95
  err := commands.Register[ShipParcel](builder, commands.WithProvide(ShipParcel.Provide, ShipParcel.Handle))
96
96
  ```
97
97
 
98
- `WithProvide` passes one typed payload to `Handle` after authorization and input validation; put several prepared values in one struct. Use `WithPreparation` when `Provide` must return a control: `commands.Provided(value)` continues, `commands.ProvidedWith(value, control)` adds a verdict, and `commands.StopProviding[P](control)` always skips `Handle`. `commands.Prepare` is the `Invocation`-receiving form. Validate-only execution invokes neither stage.
98
+ `WithProvide` passes one typed payload to `Handle` after authorization and input validation; put several prepared values in one struct. Use `WithPreparation` when `Provide` must return a control: `commands.Provided(value)` continues, `commands.ProvidedWith(value, control)` adds a verdict, and `commands.StopProviding[P](control)` always skips `Handle`. Always return one of these three: a zero `commands.Preparation` fails the command with `commands.ErrInvalidPreparation`. `commands.Prepare` is the `Invocation`-receiving form. Validate-only execution invokes neither stage.
99
99
 
100
100
  ## What `Handle` may return
101
101
 
@@ -25,6 +25,6 @@ public record AllocateDispatch(ReservationId Id) : ICommandOperation
25
25
  }
26
26
  ```
27
27
 
28
- Register `builder.Services.AddScoped<IDispatch, Dispatch>();` and supply the host's `IAbilityInvoker` (Arc supplies none). Its `Task<AbilityInvocationResult> Invoke(AbilityInvocation invocation, CancellationToken cancellationToken)` dispatches `System`, `Ability` and `Inputs` to the provider with `IdempotencyKey` and `Causation`. Return `AbilityInvocationResult.ReturnedWith()` (or pass a return value) for success and `AbilityInvocationResult.FailedWith(reason)` for a declared failure. The adapter turns a failed result into `AbilityInvocationFailed`; a thrown invoker exception propagates. Do not use returned data as an operation receipt.
28
+ Register `builder.Services.AddScoped<IDispatch, Dispatch>();` and supply the host's `IAbilityInvoker` (Arc supplies none). Its `Task<AbilityInvocationResult> Invoke(AbilityInvocation invocation, CancellationToken cancellationToken)` dispatches `System`, `Ability` and `Inputs` to the provider with `IdempotencyKey` and `Causation`. Return `AbilityInvocationResult.ReturnedWith()` (or pass a return value) when the ability did its work, and `AbilityInvocationResult.FailedWith(reason)` only when it could not. A `failed` outcome makes the adapter throw `AbilityInvocationFailed`, and a thrown invoker exception propagates. Let either escape `Execute` to fail the command; compensation then follows the commit disposition. If either escapes `Compensate`, Arc records a failed compensation; it does not replace the original failure, and Arc still attempts the remaining eligible compensators within the budget. Catching and swallowing it inside `Compensate` records the compensation as completed and hides the failure. `FailedWith` reports that the invocation failed, not that the provider made no change, so keep the reversal safe to run anyway. Report any other declared business outcome as `new AbilityInvocationResult("<outcome>")`: `Invoke` returns it instead of throwing, so have the adapter method return it. The operation can inspect it and act (for example, throw to fail the command); that works at runtime, but Screenplay then cannot extract that phase as `invokes`. Do not use returned data as an operation receipt.
29
29
 
30
- `Invoke` requires an active execute or compensate phase. Its key distinguishes the correlation, operation index/type, phase, system/ability and call ordinal; a retry as another command still needs the business reservation ID. Causation includes `command`, `correlationId`, `operation` and `phase`. To reverse an allocation, expose a separate release ability and call it in `Compensate` with the original ID. For Screenplay discovery keep each statement a direct call on an `ISystemAbilities` parameter using operation inputs. Test the adapter with a recording invoker to check the input map, causation and distinct execution/reversal keys.
30
+ Call `Invoke` only from an operation's `Execute` or `Compensate`; when no operation phase is running it throws `InvalidCommandOperation`. Its key distinguishes the correlation, operation index/type, phase, system/ability and call ordinal; a retry as another command still needs the business reservation ID. Causation includes `command`, `correlationId`, `operation` and `phase`. To reverse an allocation, expose a separate release ability and call it in `Compensate` with the original ID. For Screenplay discovery keep each statement of a phase a direct (optionally awaited or returned) call on an `ISystemAbilities` parameter using operation inputs; any other statement, such as a branch on a result, leaves that phase unextracted. Test the adapter with a recording invoker to check the input map, causation and distinct execution/reversal keys.
@@ -14,7 +14,7 @@ public Task Compensate(ISeatHolds holds, CommandOperationFailure failure, Cancel
14
14
 
15
15
  Use `failure.InvocationIndex` to identify the entry, `InvocationCompleted` to distinguish returned executions, and `IsFailingInvocation` to identify the failing one. `Source` classifies the original failure (`Planning`, `ResponseHandling`, `Execution`, `Cancellation`, `ScopeCompletion`); `CommitDisposition` and `ExceptionMessages` describe its observed commit facts and errors. Planning failures before entry have nothing to compensate.
16
16
 
17
- Recovery has its own token. For example, `builder.Services.Configure<CommandOperationOptions>(o => o.CompensationTimeout = TimeSpan.FromSeconds(12));` changes the shared budget (default 30 seconds; positive, at most 4294967294 ms). An expired budget prevents new callbacks, not a running callback that ignores cancellation. A thrown compensator is recorded; earlier entries are still attempted within budget. Cleanup errors do not replace the original error.
17
+ Recovery has its own token. For example, `builder.Services.Configure<CommandOperationOptions>(o => o.CompensationTimeout = TimeSpan.FromSeconds(12));` changes the shared budget (default 30 seconds; positive, at most 4294967294 ms). The budget is cooperative. Before entering each available callback Arc checks the token; once it has expired, Arc skips that callback and records it as `BudgetExpired`. A callback that already started is awaited to the end, even past expiry. It is recorded as `Failed` if it threw (including an `OperationCanceledException` from honouring the token) or Arc detected a nested command attempt through the same host, and otherwise as `Completed`. Size the budget for the whole reverse chain; passing `CancellationToken.None` to a provider only stops that call observing Arc's budget, and later callbacks are still skipped once it has expired. A thrown compensator is recorded; earlier entries are still attempted within budget. There are no automatic retries. Cleanup errors do not replace the original error.
18
18
 
19
19
  ## Pipeline specs
20
20
 
@@ -29,13 +29,15 @@ result.ShouldHaveCompensatedOperation<HoldSeat>();
29
29
 
30
30
  Assert the provider released **that ID** and the original failure remains. For success, use `result.ShouldHaveExecutedOperation<HoldSeat>()` (completed, not merely entered). For rejected validation or failed preflight use `result.ShouldHaveNoOperationInvocations()`. Scenario methods with the same names assert on its last result; `scenario.Operations` exposes its outcomes. `Validate` alone does not execute operations.
31
31
 
32
- `result.Recovery` is a nullable `CommandRecoverySummary`. Inspect its `CommitDisposition` and `Status`: `NotNeeded`, `Completed` (callbacks returned), `Incomplete` (some did not), `Suppressed` (known commit), `Indeterminate` (unknown/mixed). Assert `StartedCount`, `CompletedCount`, `CompensatedCount`, `FailedCompensationCount`, `UncompensatedCount` to distinguish entry, acknowledgement and cleanup. In the lost-acknowledgement test expect one started, zero completed and one compensated. For an uncertain commit after entry, expect `CommandRecoveryStatus.Indeterminate` and no release.
32
+ `result.Recovery` is a nullable `CommandRecoverySummary`. Inspect its `CommitDisposition` and `Status`: `NotNeeded`, `Completed` (every started entry's compensation recorded as `Completed`), `Incomplete` (at least one recorded otherwise, for example `Failed`, `NotAvailable` or `BudgetExpired`), `Suppressed` (known commit), `Indeterminate` (unknown/mixed). Assert `StartedCount`, `CompletedCount`, `CompensatedCount`, `FailedCompensationCount`, `UncompensatedCount` to distinguish entry, acknowledgement and cleanup. In the lost-acknowledgement test expect one started, zero completed and one compensated. For an uncertain commit after entry, expect `CommandRecoveryStatus.Indeterminate` and no release.
33
33
 
34
34
  Each `result.OperationOutcomes` entry is a `CommandOperationOutcome` with `InvocationIndex`, `OperationType`, `ExecutionCompleted`, `Compensation` (`NotNeeded`, `Completed`, `Failed`, `NotAvailable`, `BudgetExpired`, `Suppressed`) and optional `CompensationFailure`. Test batch failure by recording provider calls: the throwing entry must be released before earlier ones, and unstarted entries never appear. Neither recovery property is an HTTP response field.
35
35
 
36
+ Arc fills both after every execution scope has completed, so a scope's `Complete` cannot read them. They exist only once Arc has planned the returned operations; if planning fails first (for example a missing `Execute` or `Compensate` dependency), `Recovery` is null and `OperationOutcomes` is empty. An in-process caller of `ICommandPipeline.Execute` gets them on the returned result. For a command received over HTTP, the server-side record is Arc's log: when recovery runs and logging is enabled, Arc attempts an Information entry `Command {CorrelationId} operation recovery: commit {CommitDisposition}, status {RecoveryStatus}, …`, and a Warning for each thrown compensator. That log is best-effort and aggregate, and an HTTP caller can reuse a correlation ID, so use it only for diagnostic correlation. For reliable UI status, execute in process and store `result.Recovery` under an application-owned invocation ID. A record written from inside `Compensate` cannot report `Suppressed`, `Indeterminate`, `NotAvailable` or `BudgetExpired`, because no callback runs in those cases.
37
+
36
38
  ## Custom execution scope
37
39
 
38
- An execution scope used with operations must implement `ICommandOperationExecutionScope`. For a purely observational scope the contract can be as small as:
40
+ When a command's `Handle` return type can contain an operation, Arc checks every discovered execution scope before any scope begins: each must implement `ICommandOperationExecutionScope`, and at most one may report `IsCommitParticipant => true`. Otherwise the command fails with `InvalidCommandOperation` before filters, `Handle` or any operation run. Commands whose `Handle` cannot return an operation are not checked. With Chronicle configured, its transactional scope is already the commit participant, so a scope that commits other storage is neither a valid second participant nor an honest nonparticipant: derive that state from the committed events, or move the write out of the command. For a purely observational scope the contract can be as small as:
39
41
 
40
42
  ```csharp
41
43
  public sealed class ObservationScope : ICommandOperationExecutionScope
@@ -47,4 +49,4 @@ public sealed class ObservationScope : ICommandOperationExecutionScope
47
49
  }
48
50
  ```
49
51
 
50
- For storage, set `IsCommitParticipant` to a stable `true`; at most one scope can coordinate deferred business commit. `Begin` must leave resources cleanable on partial failure without committing. Report `NotCommitted` while deferred; an early committed, mixed or unknown observation can block entry. `Complete` must respect command failure. Even if completion throws, report actual provider facts; a later scope failure cannot erase a known commit. Keep recovery dependencies usable after completion, obtaining fresh provider resources if necessary without losing tenant context. Test known rejection, confirmed commit followed by failure, and ambiguous commit against the real store.
52
+ For the single storage scope, set `IsCommitParticipant` to a stable `true`. `Begin` must leave resources cleanable on partial failure without committing. Report `NotCommitted` while deferred; an early committed, mixed or unknown observation can block entry. `Complete` must respect command failure. Even if completion throws, report actual provider facts; a later scope failure cannot erase a known commit. Keep recovery dependencies usable after completion, obtaining fresh provider resources if necessary without losing tenant context. Test known rejection, confirmed commit followed by failure, and ambiguous commit against the real store.
@@ -46,6 +46,6 @@ Read [recovery, scope contracts and pipeline specs](csharp-recovery.md) when tes
46
46
 
47
47
  ## Not supported in this SDK
48
48
 
49
- - Execution receipts, nested operation workflows and parallel/detached participation — decide the whole flat batch up front; represent a later provider result in a separate decision.
49
+ - Execution receipts, nested commands and parallel/detached participation. A command started through the same host's pipeline from inside `Execute` (for example via `ICommandPipeline`) inherits the active command frame, so it is refused and does not run. When Arc's nesting guard records the attempt, the outer command fails after that operation returns even if the operation ignored the child's result. From `Compensate`, the attempt is recorded as a failed compensation. Instead decide the whole flat batch in `Handle`: take the provider's request key from the command as a caller-supplied business identifier that a retry reuses, pass it into the operation, and return the event and response beside the operation as in the return shapes above. A `[GeneratedValue]` `Handle` parameter shares one value between the event, response and operation within one execution, but a resubmission resolves it again and can get a different value, so do not use it alone as the provider's deduplication key. Represent a provider-assigned result in a separate decision.
50
50
  - Durable compensation, retry or atomicity across arbitrary provider/database writes — reconcile against provider and storage records, or react idempotently to a committed fact.
51
- - Client-visible recovery observations — inspect the backend result by correlation; do not infer a reversal from a failed HTTP call.
51
+ - Client-visible recovery observations — store the backend result under an application-owned invocation ID; do not infer a reversal from a failed HTTP call.
@@ -34,7 +34,7 @@ Python has no Arc application SDK: trace the subscription in the service that ow
34
34
  | Direct WebSocket | Upgrade the query route to compare socket delivery with direct SSE; capture the handshake separately from the first query result. |
35
35
  | WebSocket hub | At `/.cratis/queries/ws`, distinguish an admitted physical connection from a successful `Subscribe` for the intended `queryId` and query name. `Unsubscribe` removes that subscription, not its siblings. |
36
36
  | SSE hub | Open `/.cratis/queries/sse`; POST to its `/subscribe` and `/unsubscribe` controls with the issued connection ID and matching ownership credentials. A silent open stream without a subscribe is expected. |
37
- | Revisions | When the hub advertises subscription revisions, correlate controls and results by connection, query ID and revision; stale controls must not restore a superseded subscription. |
37
+ | Revisions | When the hub advertises subscription revisions, correlate controls and results by connection, query ID and revision. Most hosts block a subscribe at or below the latest revision held for that connection and query ID; Elixir blocks only a lower one, so replaying the cancelling revision reopens the subscription. A blocked subscribe is usually dropped silently but can instead get an `Error`, such as a subscription-limit error. Blocking lasts only while the host keeps the record: some hosts drop a cancelled record after a limited time or count, and then a delayed old subscribe is accepted again. |
38
38
  | Transfer mode | Inspect `transferMode`: full results replace state; delta collection delivery needs an initial baseline before later change sets. Check stable item identities before treating remove/add as a missed update. With no preference, inspect the actual result rather than assuming delta-only frames. |
39
39
  | Admission and delivery errors | Check authentication, authorization, origin and argument validation at opening. After admission distinguish a suppressed candidate (no delivery), terminal denial and source failure from an allowed empty value. Preserve the result and correlation ID without logging credentials. |
40
40
  | Keep-alive | Inspect the advertised interval and idle `Ping` traffic; a ping is not query data. Compare idle disconnect timing with proxy timeouts. |
@@ -1,6 +1,13 @@
1
1
  # C#: trace a missing delivery run on one subscription
2
2
 
3
- Use the application's ASP.NET Core Arc host (`builder.AddCratisArc()`); for sockets put `app.UseWebSockets()` before `app.UseCratisArc()`. Use the generated proxy's actual route and `queryName`, not a name inferred from the URL. Names below are illustrative. Use a test caller, authorized tenant and non-sensitive data; keep real credentials out of transcripts.
3
+ ## Contents
4
+
5
+ - [Establish the baseline](#establish-the-baseline)
6
+ - [Find the first missing identity](#find-the-first-missing-identity)
7
+ - [Compare the hub subscription](#compare-the-hub-subscription)
8
+ - [Distinguish idle, overload and access failures](#distinguish-idle-overload-and-access-failures)
9
+
10
+ Use the application's ASP.NET Core Arc host (`builder.AddCratisArc()`); for sockets put `app.UseWebSockets()` before `app.UseCratisArc()`. Use the generated proxy's route for HTTP probes. For hub controls use the query name the server registered (see below); the proxy's `queryName` is only a starting point, and neither is inferred from the URL. Names below are illustrative. Use a test caller, authorized tenant and non-sensitive data; keep real credentials out of transcripts.
4
11
 
5
12
  ## Establish the baseline
6
13
 
@@ -28,23 +35,23 @@ curl -i -X QUERY "$route" -H 'Content-Type: application/json' \
28
35
  1. Keep direct SSE open after the first ready result. Submit a matching delivery run through the normal command path; check command success and retain its ID. Ensure its sort position falls on the observed page.
29
36
  2. Check the **reader's** resolved tenant database and collection. For example in `mongosh`, use `db.deliveryRuns.findOne({_id: runId})` with the actual BSON identity. If absent, trace persistence or projection catch-up before debugging HTTP.
30
37
  3. If present, start `db.deliveryRuns.watch().next()` on that collection **before** a fresh write. Match `documentKey._id`; change streams require a replica set or sharded cluster. Separately observe the server source for the same arguments. A matching change but no updated source value points to the watcher, the predicate or a one-time materialization instead of `collection.Observe(...)`. A date boundary alone does not cause a database notification.
31
- 4. If the source emits, check caller restrictions and `IGuardObservableQueryEmission.Guard(context)`: `Allow` delivers, `Suppress` skips this candidate, `DenyAndTerminate` ends delivery; a throwing guard fails closed. Distinguish this from a query rejected at opening (arguments, authentication or authorization). Record correlation ID and outcome, not credentials. After an identity/tenant change, establish a fresh subscription.
38
+ 4. If the source emits, check caller restrictions and `IGuardObservableQueryEmission.Guard(context)`: `Allow` delivers, `Suppress` skips this candidate, `DenyAndTerminate` ends delivery as a denial, `Unavailable` ends it as a temporary failure of the check (see the last section). With several guards the caller sees one combined verdict: `DenyAndTerminate` overrides `Unavailable`, which overrides `Suppress`, which overrides `Allow`, so check every registered guard, not only the one you suspect. A throwing guard fails closed as a denial. Distinguish this from a query rejected at opening (arguments, authentication or authorization). Record correlation ID and outcome, not credentials. After an identity/tenant change, establish a fresh subscription.
32
39
  5. Inspect whole SSE `data:` events, not individual chunks. From the skill directory run `node scripts/check-frames.mjs < capture.sse` after stopping capture. It skips not-ready events and requires two successful frames; independently confirm the second contains the test ID. If direct SSE works, follow the actual hub frames before changing the source. For a direct socket comparison, open the same query URL and arguments with `wss:` (or `ws:` for HTTP) using a WebSocket client with the same scope; verify both upgrade and a later result.
33
40
 
34
41
  ## Compare the hub subscription
35
42
 
36
- Open `/.cratis/queries/ws` by WebSocket. `Connected.payload` is the physical connection ID, **not** a subscription. For a revision-capable connection (`supportsSubscriptionRevisions`), a pair of client controls looks like this; replace `queryName` with the exact proxy identifier:
43
+ Open `/.cratis/queries/ws` by WebSocket. `Connected.payload` is the physical connection ID, **not** a subscription. For a revision-capable connection (`supportsSubscriptionRevisions`), a pair of client controls looks like this. Set `queryName` to the exact name the server registered for the query, never the HTTP route. For a model-bound query this is usually the read model's full type name (namespace included), then `.` and the method name; generated query metadata can register a different name. For a controller action it is the full type name of the concrete controller that serves the action, then `.` and the method name. The generated proxy's `queryName` usually matches, but not always. For an action inherited from a base controller, the proxy uses the base class name: that name never selects the derived controller's action, and selects the base controller's own action only if that is registered separately. Use the concrete controller's name instead:
37
44
 
38
45
  ```json
39
- {"type":"Subscribe","queryId":"trace","revision":1,"payload":{"queryName":"DeliveryRuns.Open","arguments":{"depot":"North"},"page":0,"pageSize":20,"sortBy":"departure","sortDirection":"asc","transferMode":"delta"}}
46
+ {"type":"Subscribe","queryId":"trace","revision":1,"payload":{"queryName":"Dispatch.DeliveryRuns.Open","arguments":{"depot":"North"},"page":0,"pageSize":20,"sortBy":"departure","sortDirection":"asc","transferMode":"delta"}}
40
47
  ```
41
48
 
42
- Inspect `QueryResult.payload` on `trace` and revision 1. `Error` or `Unauthorized` is not an empty successful result. When finished send `{"type":"Unsubscribe","queryId":"trace","revision":2}`. A delayed revision 1 subscribe must not reopen `trace`; compare connection as well as query ID and revision after reconnecting.
49
+ Inspect `QueryResult.payload` on `trace` and revision 1. `Error` or `Unauthorized` is not an empty successful result. When finished send `{"type":"Unsubscribe","queryId":"trace","revision":1}`, using the revision you subscribed with. The server ignores a lower unsubscribe revision and accepts an equal or higher one; a higher one also cancels the older work. A subscribe is ignored when its revision is at or below the latest revision the connection still holds for that query ID. A newer active subscription keeps blocking older controls. After an unsubscribe, the connection keeps that record for two minutes, and keeps at most 1,024 such records (the oldest go first); this is an ordering window for delayed controls, not a way to resume a subscription. Once it is dropped and nothing newer has replaced it, a delayed subscribe with an old revision is accepted again. To change arguments, subscribe again on the same `queryId` with a higher revision; it replaces the older subscription. Discard `QueryResult`, `Error`, `Unauthorized` and `Unavailable` frames whose revision is not current; `Connected`, `Ping` and `Pong` carry no revision, so keep them. After reconnecting, compare connection as well as query ID and revision.
43
50
 
44
51
  For SSE hub, keep `GET /.cratis/queries/sse` open. Use the same owner credentials for both controls. Example POST bodies (`application/json`), substituting `Connected.payload` for `issued-id`:
45
52
 
46
- - `/.cratis/queries/sse/subscribe`: `{"connectionId":"issued-id","queryId":"trace","revision":1,"request":{"queryName":"DeliveryRuns.Open","arguments":{"depot":"North"}}}`. Read results on the **open stream**, not the POST response.
47
- - `/.cratis/queries/sse/unsubscribe`: `{"connectionId":"issued-id","queryId":"trace","revision":2}`. Siblings remain subscribed. Invalid control fields can give 400; a missing or unowned connection gives 404.
53
+ - `/.cratis/queries/sse/subscribe`: `{"connectionId":"issued-id","queryId":"trace","revision":1,"request":{"queryName":"Dispatch.DeliveryRuns.Open","arguments":{"depot":"North"}}}`. Read results on the **open stream**, not the POST response.
54
+ - `/.cratis/queries/sse/unsubscribe`: `{"connectionId":"issued-id","queryId":"trace","revision":1}`. Siblings remain subscribed. Invalid control fields can give 400; a missing or unowned connection gives 404.
48
55
 
49
56
  On hub subject collections, `full` sends snapshots only; omitted mode sends snapshots plus change sets when identity supports them. `delta` starts with a full baseline, then can send only `changeSet`. Look for a stable case-insensitive `Id` property; without identity the server sends data instead. An ordered delta that would not reproduce the new order also falls back to a snapshot. Replace state on a snapshot; don't apply patches against a previous connection's baseline. Async enumerable streams do not use `transferMode`.
50
57
 
@@ -64,4 +71,19 @@ Check these host settings under `Cratis:Arc` against what actually happened:
64
71
 
65
72
  As a permitted operator, `curl -sS "$origin/.cratis/queries/health"` before and after subscribing/cancelling. `Cratis.Arc.Queries.QueryHealth.ObserveHealth` exposes `connections`, `totalConnections`, `totalSubscriptions` and `querySubscriptions` grouped by query identifier. Match the subscriber, protocol and `lastDataServedAt`; counts alone do not prove the row arrived.
66
73
 
74
+ An `Unavailable` verdict reports a check that temporarily could not complete, not a denial. The transport reports the combined verdict of all guards for that emission: a caller sees the temporary failure only when at least one guard returns `Unavailable` and none returns `DenyAndTerminate` or fails. No data is sent and that delivery ends. How it shows depends on the transport:
75
+
76
+ | Probe | Temporary guard failure | Denial |
77
+ | --- | --- | --- |
78
+ | Plain HTTP read of the observable query | 503 with `Retry-After: 1` and `isRetryable: true` | 403 |
79
+ | Hub connection opened with `supportsUnavailable=true`, subscribe sent with a revision | `Unavailable` frame for that `queryId` and revision | `Unauthorized` frame |
80
+ | Hub without that opt-in, or a subscribe without a revision | `Unauthorized` frame | `Unauthorized` frame |
81
+ | Direct WebSocket or SSE on the query route | final result with `isAuthorized: false`, then the stream ends | the same |
82
+
83
+ - Opt in on the request that opens the connection: add `supportsUnavailable=true` to the `/.cratis/queries/ws` upgrade URL or to `GET /.cratis/queries/sse`. `Connected.supportsUnavailable` is true only on a connection that opted in; a subscribe POST cannot opt in.
84
+ - To tell the two apart for a caller that sees `Unauthorized`, reproduce the failing emission as that caller on an opted-in hub connection with a revisioned subscribe. A subscription keeps the subscription scope it captured when it was established, and a fresh one can capture a different scope from identical arguments, so first recreate the original subscription's scope and the conditions its guards depend on, then trigger the same kind of change. A replay that succeeds under different conditions does not classify the original failure. Do this before changing permissions.
85
+ - A plain HTTP read classifies only a candidate it actually evaluates. Without `waitForFirstResult=true`, a source with no readable current value answers 202 and no guard runs. With it, the read evaluates later emissions until one produces an answer or the first-result deadline passes (408). A model-bound async enumerable answers 400. A successful first result says nothing about a later emission that is rejected, so do not use it to clear a subscription that fails after its baseline.
86
+ - Both are retryable, in different ways. After a hub `Unavailable` frame, back off, then subscribe again on the same `queryId` with a higher revision; sibling subscriptions keep streaming. After this 503, repeat the same HTTP read once the `Retry-After` time has passed. The Arc TypeScript client opts in on hub connections and retries by itself for hub subscriptions and for polling; a one-shot read returns its result and the caller decides whether to repeat it. A bare 503 status proves neither a guard failure nor a retryable one: an application exception mapping can also answer 503. Treat it as this temporary failure only when the body has `isRetryable: true` and the response carries `Retry-After`.
87
+ - A guard that throws a non-fatal exception, or cannot be constructed, counts as a denial on every transport, and the server logs it at Error. An explicit `Unavailable` verdict is not logged as an error. Cancellation is the exception: when the subscription or request token is already cancelled, an `OperationCanceledException` from the guard, or an `ObjectDisposedException` while the guard is being resolved, writes no guard-failure log. Any other non-fatal exception is still logged at Error. A plain HTTP read that reaches its first-result deadline answers 408, not 403. Guards apply to every observable query, so one guard with an unresolvable constructor dependency denies them all.
88
+
67
89
  **Not supported in this SDK:** `QueryOptions` has no per-owner connection quota, maximum inbound frame size or handshake timeout setting. Inspect the ASP.NET Core host and proxy limits instead. There is no plain HTTP snapshot of a model-bound async enumerable (400) and no subject-style bounded first-result wait for any async enumerable; open SSE or a WebSocket and cancel the probe explicitly.
@@ -37,7 +37,7 @@ On `/.cratis/queries/ws`, `Connected.payload` is the physical connection ID, not
37
37
  {"type":"Unsubscribe","queryId":"probe","revision":2}
38
38
  ```
39
39
 
40
- Match `QueryResult`, `Unauthorized` or `Error` by `queryId` and `revision`. When `supportsSubscriptionRevisions` is advertised use increasing positive safe integers for each ID; replaying revision 1 after revision 2 must not reopen it. `Ping`/`Pong` carry timestamps, not data; compare idle traffic to `Connected.keepAliveIntervalMs`.
40
+ Match `QueryResult`, `Unauthorized` or `Error` by `queryId` and `revision`. When `supportsSubscriptionRevisions` is advertised use increasing positive safe integers for each ID; replaying revision 1 after revision 2 does not reopen it while the host keeps the cancellation record (up to two minutes and 1024 cancelled IDs per connection); after that, it can. `Ping`/`Pong` carry timestamps, not data; compare idle traffic to `Connected.keepAliveIntervalMs`.
41
41
 
42
42
  For the SSE hub keep GET `/.cratis/queries/sse` open. POST JSON to its `/subscribe` control, e.g. `{"connectionId":"<Connected.payload>","queryId":"probe","revision":1,"request":{"queryName":"Dispatch.DeliveryRun.Active"}}`. POST `{"connectionId":"<Connected.payload>","queryId":"probe","revision":2}` to `/unsubscribe`. Use the connection owner's credentials. For both hubs the subscription request takes string argument values and optional `page`, `pageSize`, `sortBy`, `sortDirection` (not the QUERY-body shape).
43
43
 
@@ -31,7 +31,7 @@ curl -NsS -H 'Accept: text/event-stream' "$Q" | tee capture.sse
31
31
  ## Locate a transport or delivery failure
32
32
 
33
33
  - **Direct WebSocket:** upgrade the same route (`ws`/`wss`) with the same arguments. Both direct and hub sockets need `org.springframework.boot:spring-boot-starter-websocket` or `org.springframework:spring-websocket` on the runtime classpath. Look for `Data` with a QueryResult in `data`; distinguish timestamped `Ping`/`Pong` from data. A browser 403 before the upgrade can be an origin mismatch, not a failed query.
34
- - **WebSocket hub:** upgrade `/.cratis/queries/ws`. `Connected` is physical admission only. Send `{"type":"Subscribe","queryId":"d1","revision":1,"payload":{"queryName":"Dispatch.Delivery.Active","arguments":{},"transferMode":"full"}}` using the actual generated query name. Match `QueryResult`, `Error` or `Unauthorized` by `queryId` and revision. Send `{"type":"Unsubscribe","queryId":"d1","revision":2}`; siblings should stay open. With `supportsSubscriptionRevisions`, replaying revision 1 must not resurrect d1. Use safe integer revisions.
34
+ - **WebSocket hub:** upgrade `/.cratis/queries/ws`. `Connected` is physical admission only. Send `{"type":"Subscribe","queryId":"d1","revision":1,"payload":{"queryName":"Dispatch.Delivery.Active","arguments":{},"transferMode":"full"}}` using the actual generated query name. Match `QueryResult`, `Error` or `Unauthorized` by `queryId` and revision. Send `{"type":"Unsubscribe","queryId":"d1","revision":2}`; siblings should stay open. With `supportsSubscriptionRevisions`, replaying revision 1 does not resurrect d1 while the host keeps the cancellation record (up to two minutes and 1024 cancelled IDs per connection); after that, it can. Use safe integer revisions.
35
35
  - **SSE hub:** GET `/.cratis/queries/sse` as an event stream, keep it open, and take the connection ID from `Connected.payload`. POST JSON `{"connectionId":"<id>","queryId":"d1","revision":1,"request":{"queryName":"Dispatch.Delivery.Active","transferMode":"delta"}}` to `/.cratis/queries/sse/subscribe`; POST `{"connectionId":"<id>","queryId":"d1","revision":2}` to `/.cratis/queries/sse/unsubscribe` as the same owner. Results arrive on the stream, not the control response. Read `keepAliveIntervalMs` on `Connected`; idle heartbeats do not establish delivery.
36
36
  - **Collection transfer:** `full` replaces the list; `delta` needs the first delivered full baseline before subsequent change sets. Without a preference expect both snapshot and change set (initially all added). Stable unique keys permit replacements. Missing, null or duplicate keys in explicit delta mode fall back to serialized JSON membership: edits become remove/add, duplicate multiplicity and order-only changes aren't conveyed. Compare in `full` before blaming storage.
37
37
  - **Admission versus delivery:** check argument validation, tenant resolution and query authorization even if the anonymous hub handshake succeeded. Register a `GuardObservableQueryEmission` Spring bean to check each candidate; `guard(context)` returns `CompletionStage<ObservableQueryEmissionVerdict>`. For synchronous checks use e.g. `BlockingObservableQueryEmissionGuard { ctx -> policy.verdict(ctx.principal, ctx.tenantId, ctx.data) }`. `ALLOW` delivers unless another guard is more restrictive; `SUPPRESS` stays open and `isFirstEmission` remains true until delivery; `DENY_AND_TERMINATE` or a guard failure fails closed. Capture correlation ID and verdict, not row contents. An `Unauthorized` ends that subscription. Compare the rendered page, source completion, failure and collector cancellation before assuming a transport drop.
@@ -1,6 +1,6 @@
1
1
  # Diagnose a tool call
2
2
 
3
- Work top to bottom. Steps 3 to 9 follow the order in which Arc checks a request, so the status tells which layer refused. Refusals are JSON bodies of the form `{"error":"<code>"}`. Do not relax authorization to make a probe pass.
3
+ Work top to bottom. Steps 3 to 9 follow the order of MCP admission. The capability gate runs before step 3 and can also return 400 `invalid_request`, 401 `unauthorized` or 403 `forbidden`, with no audit record, so a status alone does not tell which layer refused. Refusals are JSON bodies of the form `{"error":"<code>"}`. Do not relax authorization to make a probe pass.
4
4
 
5
5
  1. **Host fails to start.** Fix the first error:
6
6
  - Capability hosting is not enabled, or its endpoint group has no port assigned.
@@ -17,9 +17,11 @@ Work top to bottom. Steps 3 to 9 follow the order in which Arc checks a request,
17
17
  5. **405 `method_not_allowed`.** A GET or DELETE on the tool path; the response carries `Allow: POST`.
18
18
  6. **413 `request_too_large`.** The body exceeds the configured limit.
19
19
  7. **400 `invalid_request`.** Invalid JSON, a duplicated member at any depth, or a batch array. Send one JSON-RPC object.
20
- 8. **403 `insufficient_scope`.** The caller holds neither the tool's required set nor any complete alternative set. `WWW-Authenticate` lists the required scopes, plus the metadata location when an OAuth caller can step up. A PAT can only hold scopes on the allowed list: add the scope there and issue a new token.
21
- 9. **403 `forbidden`.** A tool authorizer denied the call or threw. No reason is returned.
22
- 10. **Tool absent from the list.** List with the actual caller; the host's catalog is not evidence that this caller can see the tool. Causes: the caller lacks the scopes, an authorizer hides it, the availability gate decides it is unavailable, or it was never exposed. Startup warning `5103` names a tool scope that the PAT allowed scopes lack: no PAT can see that tool until the scope is allowed. Scopes with an `admin` or `approve` segment can never be allowed for a PAT.
20
+ 8. **403 `insufficient_scope`.** The caller holds neither the tool's required set nor any complete alternative set. `WWW-Authenticate` lists the required scopes, plus the metadata location when an OAuth caller can step up. A PAT can only hold scopes on the allowed list: add the scope there and issue a new token. A scope with `*` or an `admin` or `approve` segment can never be added, so no PAT can call a tool that requires one.
21
+ 9. **403 `{"error":"forbidden"}` without a `WWW-Authenticate` header.** Two layers send this body, and neither gives a tool result or a reason. Check both:
22
+ - The capability gate refused the caller before step 3, for example because the tenant membership check denied the person or the caller's principal kind is not allowed. There is no call audit record.
23
+ - A tool authorizer returned `false` or threw at admission, before the MCP server read the request. The call audit records outcome `not_allowed` for the tool. A cancelled request is not refused this way: the cancellation propagates with no record.
24
+ 10. **Tool absent from the list.** List with the actual caller; the host's catalog is not evidence that this caller can see the tool. Causes: the caller lacks the scopes, an authorizer hides it, the availability gate decides it is unavailable, or it was never exposed. Startup warning `5103` names a tool scope that the PAT allowed scopes lack: no PAT can see that tool until the scope is allowed. Scopes with `*` or an `admin` or `approve` segment can never be allowed for a PAT.
23
25
  11. **HTTP 200 but the call failed.** Inspect the tool error flag and the outcome; a tool-level refusal is not a successful write.
24
26
  - Invalid arguments: an argument is missing, mistyped or not in the input schema.
25
27
  - Scope or permission text: the check failed again at dispatch, or the operation's own authorization refused (outcome not authorized).
@@ -37,8 +39,8 @@ Work top to bottom. Steps 3 to 9 follow the order in which Arc checks a request,
37
39
  | `failed` | The tool ran and returned a tool error, such as a validation or authorization failure of the operation. |
38
40
  | `invalid_arguments` | The arguments did not match the input schema. |
39
41
  | `malformed` | A curated tool returned a result that breaks the result rules. |
40
- | `error` | The tool threw or the call was cancelled. |
42
+ | `error` | The tool threw, including a cancellation while the tool ran. |
41
43
  | `insufficient_scope` | A verified caller lacked the tool's scopes (the 403 in step 8). |
42
- | `not_allowed` | A tool authorizer refused a verified caller (the 403 in step 9). |
44
+ | `not_allowed` | A tool authorizer refused a verified caller: at admission (the authorizer 403 in step 9) or at dispatch (a tool error). A capability gate 403 has no record. |
43
45
 
44
- The audit covers catalog tools only. Requests rejected before a tool is identified have no record: a refused origin, no accepted credential, a wrong method, an oversized body or a malformed body. Calls to tools registered directly on the MCP server have no record either and need their own audit.
46
+ The audit covers catalog tools only. Requests rejected before a tool is identified have no record: a capability gate refusal, a refused origin, no accepted credential, a wrong method, an oversized body or a malformed body. Calls to tools registered directly on the MCP server have no record either and need their own audit.
@@ -10,6 +10,7 @@
10
10
  - Scopes
11
11
  - Check the scope boundary
12
12
  - Connect a client
13
+ - Test with MCP Inspector
13
14
  - Receiver options
14
15
  - Curated tools
15
16
  - Tool authorizers
@@ -136,6 +137,8 @@ public record CancelDelivery(Guid DeliveryId)
136
137
 
137
138
  For a command the attribute is read from the command type and its `Handle` method; for a query from the read model, the performer type and the query method. Add each such scope to `PatOptions.AllowedScopes`, or startup logs warning `5103` and no PAT can use the tool.
138
139
 
140
+ `AllowedScopes` can never hold a blank scope, a scope with `*` or a scope with an `admin` or `approve` segment (any letter case; segments split on `:`, `.`, `/` and `-`): adding one throws when PAT support is configured. A blank `[RequiresScope]` fails startup. A tool may require a `*`, `admin` or `approve` scope, but no PAT can then satisfy it; with PAT support installed, startup logs warning `5103` for each scope of a tool that has no required or alternative set fully on the allowed list. Holding every scope is necessary, not sufficient: the operation's own authorization and validation and any tool authorizers still run.
141
+
139
142
  ## Check the scope boundary
140
143
 
141
144
  Pass the token on standard input so it stays out of the process list and shell history:
@@ -178,8 +181,55 @@ Visual Studio Code, in `.vscode/mcp.json`:
178
181
  }
179
182
  ```
180
183
 
184
+ Claude Desktop can connect through the `mcp-remote` bridge, which takes the endpoint URL and the header as arguments and reads the token from its environment:
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "dispatch": {
190
+ "command": "npx",
191
+ "args": [
192
+ "mcp-remote",
193
+ "https://dispatch.example.test:5001/mcp",
194
+ "--header",
195
+ "Authorization: Bearer ${PAT}"
196
+ ],
197
+ "env": { "PAT": "<your token>" }
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ This file then holds the token: keep it in the user's own Claude Desktop configuration, never in a repository.
204
+
181
205
  A hosted connector, where a service calls the endpoint on a user's behalf, cannot be handed a PAT. It needs OAuth: choose `McpProfile.OAuthOnly` or `Combined` and set the public origin, resource and authorization servers in Receiver options. Arc verifies the grants; your own authorization server issues the tokens.
182
206
 
207
+ ## Test with MCP Inspector
208
+
209
+ MCP Inspector is a visual MCP client. Use it to check tool descriptions, input schemas and scope filtering before connecting an agent; use the scripted calls in Check the scope boundary when the check must be repeatable.
210
+
211
+ 1. Start the application with the `PatOnly` or `Combined` profile and PAT verification installed, then issue a PAT holding only the scopes under test through the application's own issuance flow. `OAuthOnly` refuses every PAT, even a valid one, with 401; test that profile with an OAuth grant instead.
212
+ 2. Start the Inspector with `npx @modelcontextprotocol/inspector`.
213
+ 3. Choose the Streamable HTTP transport, enter the endpoint URL (for example `https://dispatch.example.test:5001/mcp`) and add the header `Authorization` with the value `Bearer <token>`.
214
+ 4. Connect and list the tools. With a token holding only the read scope, confirm that command tools are absent.
215
+ 5. Call the mapped query `list_deliveries` and read `outcome` and `data` in the result, not just whether the call returned. A curated tool returns whatever its source defines, so it need not carry an `outcome`.
216
+
217
+ If the Inspector is refused with 403 `origin_not_allowed`, it sent a browser `Origin` header that the receiver does not allow:
218
+
219
+ - Set the `Cratis.Arc.Mcp` log category to Debug. Event `5101` then logs the refused origin and the reason. Do not assume the Inspector's port.
220
+ - Act on the reason. "Origin is not allowed" means one well-formed origin that is not in the list: add it only if it is the Inspector you started and trust. A malformed origin or multiple `Origin` values is a fault in the request: fix the client or the proxy in front of it rather than adding an entry.
221
+ - The log shows the first value only, without control characters and cut at 200 characters. When it may be cut, read the full `Origin` of the request that reaches the endpoint before adding it, and never allowlist a cut value. The browser developer tools show it only when the browser calls the endpoint directly; when the Inspector's proxy sends or rewrites the header, inspect the request the proxy sends to the endpoint instead.
222
+ - Add that single origin for the test run, and remove it when you finish. Production `AllowedOrigins` stays empty unless a real browser client needs an entry.
223
+
224
+ ```csharp
225
+ mcp.Configure(options => options.AllowedOrigins.Add("<the refused origin>"));
226
+ ```
227
+
228
+ - When the Inspector connects through its own proxy process, the proxy makes the request and may send no `Origin` header. A request without one passes the origin check, so no entry is needed; it must still present a valid credential.
229
+ - The capabilities port is a separate listener. With a local development certificate, make the Inspector's process trust it, or test against an `http` loopback URL.
230
+
231
+ The rules for an origin value are under Receiver options.
232
+
183
233
  ## Receiver options
184
234
 
185
235
  Set these in `mcp.Configure(options => ...)`. All are members of `McpOptions`.
@@ -276,7 +326,7 @@ public class PlanAuthorizer(IPlans plans) : IMcpToolAuthorizer
276
326
  arc.WithMcp(mcp => mcp.AddToolAuthorizer<PlanAuthorizer>());
277
327
  ```
278
328
 
279
- Authorizers are scoped services. `McpToolAuthorization` carries `Tool`, `Caller`, `Services`, `CancellationToken` and `Operation` (`McpToolOperation.List` or `Call`). They run only for a caller whose scopes already satisfy the tool, for every catalog tool on each `tools/list` and twice per call, so keep them cheap. All must return `true`; `false` or an exception hides the tool from the list or refuses the call with 403 `forbidden`.
329
+ Authorizers are scoped services. `McpToolAuthorization` carries `Tool`, `Caller`, `Services`, `CancellationToken` and `Operation` (`McpToolOperation.List` or `Call`). They run only for a caller whose scopes already satisfy the tool: on `tools/list` for each listed catalog tool, and on a call at admission and again at dispatch if admission allows it. Keep them cheap. All must return `true`. An exception thrown by `IsAllowed` counts as `false`, except an `OperationCanceledException` while the request is cancelled, which propagates with no audit record. For `List`, `false` only hides the tool; hiding does not stop a direct call. For `Call`, admission checks first: `false` refuses the request with HTTP 403 and body `{"error":"forbidden"}`, with no `WWW-Authenticate` challenge and no reason, before the MCP server reads it. If admission allows the call, the dispatcher checks again before it runs the tool; a refusal there is a tool error (`isError: true`), not a 403.
280
330
 
281
331
  ## Inspect the catalog
282
332
 
@@ -307,3 +357,4 @@ When startup fails, a request is refused, a tool is missing from a caller's list
307
357
  - Approval-required commands as tools: keep them on their approval path.
308
358
  - Streaming or live queries as tools: expose a finite query.
309
359
  - A PAT issuance endpoint: write an application endpoint that calls `IPersonalAccessTokens.Issue` for a signed-in person.
360
+ - A Screenplay capability manifest (`screenplay-capability-manifest/1`) as the tool allowlist: Arc does not load one, so the catalog comes only from what the host declares: the explicit or attributed operation exposures and the registered curated tool sources. When a handoff includes a manifest, `cratis-screenplay-accept-model` (`references/capability-consumption.md`) covers validating it and matching each entry to a registered operation.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-arc-expose-query
3
- description: Use when exposing a read model through Arc as a snapshot or live query, choosing its result shape, or extending query execution. Not for implementing writes, paging an existing query, writing query specs, or diagnosing a stalled live subscription.
3
+ description: Use when exposing a read model through Arc as a snapshot or live query, choosing its result shape or read-after-write consistency, or extending query execution. Not for writes, paging an existing query, query specs, or a stalled live subscription.
4
4
  ---
5
5
 
6
6
  # Expose a read model as a query
@@ -67,7 +67,7 @@ Choose live delivery only when the view must follow changes. Return the provider
67
67
  - **Direct WebSocket:** upgrade the query route for a dedicated connection when supported and enabled by the host.
68
68
  - **Multiplexing:** share subscriptions at `/.cratis/queries/ws` or `/.cratis/queries/sse`; SSE uses companion subscribe/unsubscribe requests because the stream is one-way.
69
69
  - **Transfer mode:** deliver full snapshots or deltas; added, replaced and removed items require stable identity. A change set between deliveries is not an event log.
70
- - **Emission guard:** recheck access at delivery when admission at subscription time is insufficient. Allow delivers, suppress skips one emission, deny-and-terminate ends access.
70
+ - **Emission guard:** recheck access at delivery when admission at subscription time is insufficient. Allow delivers, suppress skips one emission, deny-and-terminate ends access, unavailable ends the operation when the check itself could not run. Only a caller the transport can tell to retry sees unavailable as a retryable failure; every other caller sees it as unauthorized, so return it for a transient fault and never as a softer denial.
71
71
  - **Subscription lifetime:** bind arguments and caller context at open; scope resources to the subscription and clean up on disconnect, cancellation, failure or completion.
72
72
  - **Connection policy:** configure WebSocket enablement, allowed origins, keep-alive, handshake, connection and shutdown timeouts to match the deployment.
73
73
  - **Load limits:** bound connections and subscriptions globally, per caller and per connection; bound inbound/outbound frames, bytes, queued emissions and retained removals. Do not enlarge buffers to hide a stalled consumer.
@@ -78,3 +78,5 @@ Choose live delivery only when the view must follow changes. Return the provider
78
78
  - **Stored view:** a projection or reducer maintains state; declaring an Arc query does not. Prefer a provider query over that stored view for filtering, sorting and paging.
79
79
  - **Keyed read:** ask Chronicle for the instance when the store should remain hidden or the model is computed on demand. Do not assume a keyed model supports listing every instance.
80
80
  - **Observe versus watch:** observe the model when the caller needs its current value and updates; watch individual changes only when the consumer understands change sets.
81
+ - **Read after write:** a stored view follows the write with no bound on delay. For data that a screen's own commands change, expose an observable query; do not look for a setting that makes the write wait for the view (Arc C# commands have none). See `cratis-platform-deliver-slice`, `references/eventual-consistency.md`, for the choice by who reads next.
82
+ - **One read model per screen:** a query that joins two stored read models can return them at different positions in the event log. When the facts must agree, project one read model that carries everything the screen needs.