@cratis/pi 7.51.3 → 7.51.4

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 (168) hide show
  1. package/package/corpus/harnesses/copilot/instructions/authoring-skills.instructions.md +1 -1
  2. package/package/corpus/rules/authoring-skills.md +1 -1
  3. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +4 -55
  4. package/package/corpus/skills/cratis-application-slice-specifications/references/command-result-assertions.md +36 -0
  5. package/package/corpus/skills/cratis-application-slice-specifications/references/reading-play-specifications.md +30 -0
  6. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +4 -69
  7. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +8 -0
  8. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +9 -0
  9. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +19 -0
  10. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/identity-endpoints.md +40 -0
  11. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/local-development.md +7 -0
  12. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/product-sources.md +11 -0
  13. package/package/corpus/skills/cratis-arc-command/SKILL.md +8 -99
  14. package/package/corpus/skills/cratis-arc-command/references/causation-details.md +26 -0
  15. package/package/corpus/skills/cratis-arc-command/references/client-contract.md +16 -0
  16. package/package/corpus/skills/cratis-arc-command/references/event-source-id-details.md +13 -0
  17. package/package/corpus/skills/cratis-arc-command/references/generation-boundaries.md +8 -0
  18. package/package/corpus/skills/cratis-arc-command/references/product-sources.md +16 -0
  19. package/package/corpus/skills/cratis-arc-command/references/provide-example.md +19 -0
  20. package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +8 -0
  21. package/package/corpus/skills/cratis-arc-command/references/return-shape-examples.md +24 -0
  22. package/package/corpus/skills/cratis-arc-command-kotlin/SKILL.md +3 -61
  23. package/package/corpus/skills/cratis-arc-command-kotlin/references/artifacts.md +16 -0
  24. package/package/corpus/skills/cratis-arc-command-kotlin/references/authorization-override-example.md +17 -0
  25. package/package/corpus/skills/cratis-arc-command-kotlin/references/project-setup.md +40 -0
  26. package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +4 -105
  27. package/package/corpus/skills/cratis-arc-command-typescript/references/parameter-binding.md +26 -0
  28. package/package/corpus/skills/cratis-arc-command-typescript/references/project-setup.md +89 -0
  29. package/package/corpus/skills/cratis-arc-query-typescript/SKILL.md +3 -74
  30. package/package/corpus/skills/cratis-arc-query-typescript/references/product-sources.md +11 -0
  31. package/package/corpus/skills/cratis-arc-query-typescript/references/scenario-example.md +23 -0
  32. package/package/corpus/skills/cratis-arc-query-typescript/references/storage-examples.md +52 -0
  33. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +3 -63
  34. package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +28 -0
  35. package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +47 -0
  36. package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +3 -80
  37. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/connection-options.md +61 -0
  38. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/lifecycle.md +30 -0
  39. package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +8 -101
  40. package/package/corpus/skills/cratis-chronicle-client-elixir/references/client-options.md +43 -0
  41. package/package/corpus/skills/cratis-chronicle-client-elixir/references/idioms-and-inspection.md +35 -0
  42. package/package/corpus/skills/cratis-chronicle-client-elixir/references/product-sources.md +10 -0
  43. package/package/corpus/skills/cratis-chronicle-client-elixir/references/reactor-example.md +33 -0
  44. package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +7 -88
  45. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/annotations-and-handlers.md +32 -0
  46. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/append-concurrency.md +9 -0
  47. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-string.md +27 -0
  48. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/event-type-annotations.md +9 -0
  49. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/product-sources.md +13 -0
  50. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/read-models-and-projections.md +29 -0
  51. package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +3 -103
  52. package/package/corpus/skills/cratis-chronicle-client-typescript/references/connection-options.md +52 -0
  53. package/package/corpus/skills/cratis-chronicle-client-typescript/references/lifecycle.md +31 -0
  54. package/package/corpus/skills/cratis-chronicle-client-typescript/references/project-setup.md +36 -0
  55. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +1 -21
  56. package/package/corpus/skills/cratis-chronicle-projection/references/definition-changes.md +27 -0
  57. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +5 -110
  58. package/package/corpus/skills/cratis-chronicle-reactor/references/cross-service-events.md +13 -0
  59. package/package/corpus/skills/cratis-chronicle-reactor/references/filtering.md +34 -0
  60. package/package/corpus/skills/cratis-chronicle-reactor/references/read-model-injection.md +29 -0
  61. package/package/corpus/skills/cratis-chronicle-reactor/references/return-event-metadata.md +51 -0
  62. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +7 -92
  63. package/package/corpus/skills/cratis-chronicle-reducer/references/filtering.md +36 -0
  64. package/package/corpus/skills/cratis-chronicle-reducer/references/instance-reducer-example.md +20 -0
  65. package/package/corpus/skills/cratis-chronicle-reducer/references/product-sources.md +8 -0
  66. package/package/corpus/skills/cratis-chronicle-reducer/references/replay-hooks-and-definition-changes.md +35 -0
  67. package/package/corpus/skills/cratis-chronicle-reducer/references/specification-example.md +15 -0
  68. package/package/corpus/skills/cratis-components-styling/SKILL.md +1 -15
  69. package/package/corpus/skills/cratis-components-styling/references/renderer-adapters.md +21 -0
  70. package/package/corpus/skills/cratis-governed-release-methodology/SKILL.md +1 -24
  71. package/package/corpus/skills/cratis-governed-release-methodology/references/lifecycle-phases.md +30 -0
  72. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +2 -15
  73. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/neighbouring-skills.md +12 -0
  74. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/product-sources.md +11 -0
  75. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +3 -93
  76. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +37 -0
  77. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-declaration.md +48 -0
  78. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +16 -0
  79. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +5 -97
  80. package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +9 -0
  81. package/package/corpus/skills/cratis-screenplay-command-surface/references/constraints-produces-concurrency.md +89 -0
  82. package/package/corpus/skills/cratis-screenplay-command-surface/references/routes-and-external-operations.md +21 -0
  83. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +5 -38
  84. package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +14 -0
  85. package/package/corpus/skills/cratis-screenplay-discovery/references/neighbouring-skills.md +14 -0
  86. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +9 -0
  87. package/package/corpus/skills/cratis-screenplay-discovery/references/product-sources.md +16 -0
  88. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +6 -74
  89. package/package/corpus/skills/cratis-screenplay-event-modeling/references/facilitation-stance.md +12 -0
  90. package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +19 -0
  91. package/package/corpus/skills/cratis-screenplay-event-modeling/references/modeling-reasoning.md +13 -0
  92. package/package/corpus/skills/cratis-screenplay-event-modeling/references/neighbouring-skills.md +16 -0
  93. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +33 -0
  94. package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +6 -0
  95. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +2 -17
  96. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +18 -0
  97. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/neighbouring-skills.md +12 -0
  98. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +5 -89
  99. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +6 -0
  100. package/package/corpus/skills/cratis-screenplay-model-authoring/references/layout.md +30 -0
  101. package/package/corpus/skills/cratis-screenplay-model-authoring/references/repairs.md +42 -0
  102. package/package/corpus/skills/cratis-screenplay-model-authoring/references/state-and-recovery.md +30 -0
  103. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +10 -42
  104. package/package/corpus/skills/cratis-screenplay-model-review/references/baseline-comparison.md +7 -0
  105. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +11 -0
  106. package/package/corpus/skills/cratis-screenplay-model-review/references/interview-batch.md +14 -0
  107. package/package/corpus/skills/cratis-screenplay-model-review/references/model-inventory-report.md +8 -0
  108. package/package/corpus/skills/cratis-screenplay-model-review/references/neighbouring-skills.md +12 -0
  109. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +21 -0
  110. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +15 -68
  111. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/completeness-self-check.md +12 -0
  112. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +15 -0
  113. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +9 -0
  114. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/independent-review.md +10 -0
  115. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/neighbouring-skills.md +10 -0
  116. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/per-turn-protocol.md +5 -0
  117. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/product-sources.md +9 -0
  118. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +12 -0
  119. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +25 -0
  120. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +8 -0
  121. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -67
  122. package/package/corpus/skills/cratis-screenplay-projections/references/joins.md +41 -0
  123. package/package/corpus/skills/cratis-screenplay-projections/references/variants.md +41 -0
  124. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -31
  125. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +9 -0
  126. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/neighbouring-skills.md +11 -0
  127. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/product-sources.md +23 -0
  128. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +11 -75
  129. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/interview-batch.md +16 -0
  130. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/neighbouring-skills.md +10 -0
  131. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/public-event-coverage.md +12 -0
  132. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/quality-checklist.md +17 -0
  133. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/review-questions.md +9 -0
  134. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +28 -0
  135. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/version-skew.md +14 -0
  136. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +18 -94
  137. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +25 -0
  138. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +9 -0
  139. package/package/corpus/skills/cratis-screenplay-slice-design/references/identity-edits.md +14 -0
  140. package/package/corpus/skills/cratis-screenplay-slice-design/references/model-reasoning.md +9 -0
  141. package/package/corpus/skills/cratis-screenplay-slice-design/references/neighbouring-skills.md +10 -0
  142. package/package/corpus/skills/cratis-screenplay-slice-design/references/product-sources.md +9 -0
  143. package/package/corpus/skills/cratis-screenplay-slice-design/references/public-boundaries-and-keys.md +16 -0
  144. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +36 -0
  145. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +17 -0
  146. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +5 -63
  147. package/package/corpus/skills/cratis-screenplay-specifications/references/examples-and-routes.md +6 -0
  148. package/package/corpus/skills/cratis-screenplay-specifications/references/outcome-comparison.md +33 -0
  149. package/package/corpus/skills/cratis-screenplay-specifications/references/vocabulary.md +40 -0
  150. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +11 -77
  151. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +21 -0
  152. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +18 -0
  153. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/interview-batch.md +20 -0
  154. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/neighbouring-skills.md +12 -0
  155. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/product-sources.md +12 -0
  156. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/review-questions.md +13 -0
  157. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-id-rules.md +15 -0
  158. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +1 -8
  159. package/package/corpus/skills/cratis-screenplay-toolchain/references/neighbouring-skills.md +12 -0
  160. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +6 -99
  161. package/package/corpus/skills/cratis-screenplay-ui-composition/references/file-references.md +38 -0
  162. package/package/corpus/skills/cratis-screenplay-ui-composition/references/layout-arrangement.md +31 -0
  163. package/package/corpus/skills/cratis-screenplay-ui-composition/references/localized-strings.md +15 -0
  164. package/package/corpus/skills/cratis-screenplay-ui-composition/references/screen-composition-contract.md +6 -0
  165. package/package/corpus/skills/cratis-screenplay-ui-composition/references/ui-profile-and-theme.md +34 -0
  166. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +1 -10
  167. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/neighbouring-skills.md +14 -0
  168. package/package.json +1 -1
@@ -32,7 +32,7 @@ An explicit trigger clause (`Use when`, `Load when`, `Read when` or an equivalen
32
32
 
33
33
  ## 3. Budget and progressive disclosure
34
34
 
35
- Target at most 400 body lines and 16,000 characters; the hard limits remain 500 lines and 20,000 characters. A warning starts at 18,000 characters to leave editing and compaction headroom; characters only approximate tokens.
35
+ Target at most 400 body lines and 16,000 characters; the hard limits remain 500 lines and 20,000 characters. A warning starts above the 16,000-character target, so a body that outgrows it is split before it nears the hard limit; characters only approximate tokens.
36
36
 
37
37
  Keep decision rules, the core workflow and pre-action traps in `SKILL.md`. Move conditional detail to `references/`, with a direct `Read references/x.md when…` pointer for every file, including assets and scripts. `LICENSE`, `NOTICE` and `verification.json` are exempt as licensing/verifier metadata; existing reasoned asset exceptions fail when stale. Direct pointers prevent partial nested reads from hiding required context. References over 100 lines open with generated `## Contents`; a single fenced example with an early introduction is exempt because it has no sections to navigate. Use forward-slash paths for portability.
38
38
 
@@ -31,7 +31,7 @@ An explicit trigger clause (`Use when`, `Load when`, `Read when` or an equivalen
31
31
 
32
32
  ## 3. Budget and progressive disclosure
33
33
 
34
- Target at most 400 body lines and 16,000 characters; the hard limits remain 500 lines and 20,000 characters. A warning starts at 18,000 characters to leave editing and compaction headroom; characters only approximate tokens.
34
+ Target at most 400 body lines and 16,000 characters; the hard limits remain 500 lines and 20,000 characters. A warning starts above the 16,000-character target, so a body that outgrows it is split before it nears the hard limit; characters only approximate tokens.
35
35
 
36
36
  Keep decision rules, the core workflow and pre-action traps in `SKILL.md`. Move conditional detail to `references/`, with a direct `Read references/x.md when…` pointer for every file, including assets and scripts. `LICENSE`, `NOTICE` and `verification.json` are exempt as licensing/verifier metadata; existing reasoned asset exceptions fail when stale. Direct pointers prevent partial nested reads from hiding required context. References over 100 lines open with generated `## Contents`; a single fenced example with an early introduction is exempt because it has no sections to navigate. Use forward-slash paths for portability.
37
37
 
@@ -80,30 +80,7 @@ you did.
80
80
 
81
81
  ### Reading a `.play` specification
82
82
 
83
- Read the actual assignments, not a prose retelling; syntax and supported forms belong to
84
- `cratis-screenplay-specifications`.
85
- - `given <Event>` becomes prior facts seeded with `Given.ForEventSource(...).Events(...)`.
86
- `given readmodel <Type>` becomes a pinned complete `.ReadModel(...)` instance, including its
87
- key: the contract deliberately makes event history irrelevant here. Protected decisions still
88
- need event-backed guards (Step 5); report a pin that cannot witness the required enforcement.
89
- - `when <Command>` assignments fill that command; `given caller` supplies the scenario's caller,
90
- not an invented default role. Use the matching scenario for append, query or reaction actions.
91
- - `then <Event>` assignments become the appended-event predicate;
92
- `then readmodel` assignments become instance assertions. Assert every named value and honor
93
- `exactly`, ordering and absence where stated. Do not assert an unmentioned generated identifier
94
- or timestamp; still use required source identities to select the result. A broader property
95
- coverage gap goes back to the contract owner rather than adding a new business assertion.
96
- - `description` and slice `documentation` provide context for a name or XML summary, not extra
97
- setup, assertions or inferred rules. Explicit realization requirements still bind delivery;
98
- reconcile them with executable parts through `cratis-application-slice-conformance`.
99
- - A `parameter`/`case` table yields independent examples by substituting each `case.<parameter>`
100
- value. The reference runner identifies each row as `<Specification>_<Case>`; retain that name
101
- in the specification map, while C# uses the repository's `when_.../and_<case>` convention.
102
- Name parity is a mapping requirement, not a requirement to rename C# classes.
103
- - `then error` requires unsuccessful execution plus the named validation/constraint reason where
104
- stated (Step 6). A specified message must be checked, using equality when exact wording is
105
- contracted. `then denied` instead requires unsuccessful execution and `ShouldNotBeAuthorized()`;
106
- it is not a validation error. Keep every other rule satisfied so the named refusal is witnessed.
83
+ Read the actual assignments, not a prose retelling; `given` seeds events or a pinned read model, `when` fills the command, `then` becomes the appended-event predicate or an instance assertion, and `then denied` is `ShouldNotBeAuthorized()`, not a validation error. Read [references/reading-play-specifications.md](references/reading-play-specifications.md) when translating a `.play` specification, including `parameter`/`case` tables, into a specification class.
107
84
 
108
85
  ## Step 1 — Place the files
109
86
 
@@ -200,13 +177,8 @@ public class and_name_is_unique : Specification
200
177
  #endif
201
178
  ```
202
179
 
203
- The scenario's own surface is `Services`, `Context`, `Execute(command[, ct])`,
204
- `Validate(command)` (runs the filters without the handler), `LastResult`,
205
- `Operations` and the three operation assertions
206
- (`ShouldHaveExecutedOperation<T>()`, `ShouldHaveCompensatedOperation<T>()`,
207
- `ShouldHaveNoOperationInvocations()`); it is `IDisposable`/`IAsyncDisposable`.
208
- Seeding (`Given`), the event log and the event assertions arrive as extension
209
- members from the Chronicle integration.
180
+ The scenario's surface (`Execute`, `Validate`, `LastResult`, `Operations`) is listed in [references/command-result-assertions.md](references/command-result-assertions.md); `Given` and the event assertions are extension members from the Chronicle integration.
181
+
210
182
 
211
183
  ## Step 5 — Seed prior state through `Given`
212
184
 
@@ -261,30 +233,7 @@ is named after: build the command valid in every other respect. Otherwise
261
233
  rule, and always run the "remove the rule, see it go red" check under *How it is
262
234
  proven*.
263
235
 
264
- `CommandResult` assertions, from `Cratis.Arc.Testing.Commands`, throwing
265
- `CommandResultAssertionException`:
266
-
267
- | Assertion | Says |
268
- | --- | --- |
269
- | `ShouldBeSuccessful()` / `ShouldNotBeSuccessful()` | Authorized, valid, no exceptions — or not |
270
- | `ShouldBeValid()` | Validation only; it checks neither authorization nor exceptions |
271
- | `ShouldHaveValidationErrors()` | At least one validation error |
272
- | `ShouldHaveValidationErrorFor(message)` | A validation error whose message **contains** that text (a substring match; compare messages for equality when exact wording is specified) |
273
- | `ShouldHaveValidationErrorBecauseOf(reason)` | A validation error with that `ValidationResultReason` |
274
- | `ShouldBeAuthorized()` / `ShouldNotBeAuthorized()` | The authorization outcome |
275
- | `ShouldHaveExceptions()` / `ShouldNotHaveExceptions()` | Whether the handler threw |
276
- | `ShouldHaveConstraintViolationFor(name)` | A constraint violation surfaced on the command result |
277
-
278
- `ShouldHaveValidationErrorBecauseOf(reason)` is the message-free way to say
279
- *which kind* of rejection happened — `ValidationResultReason.ConstraintViolation`,
280
- `ConcurrencyViolation`, `ValidatorFailed`, `Rule`. Prefer it over
281
- `ShouldHaveValidationErrorFor(message)`, which pins presentation text.
282
-
283
- Authorization failures are different in kind: an unauthorized result carries
284
- **no** validation errors, so assert `ShouldNotBeAuthorized()`. Adding an
285
- authorization attribute to an existing command therefore breaks both its
286
- happy-path and its validation-failure specifications — switch the assertions
287
- rather than patching around them.
236
+ Read [references/command-result-assertions.md](references/command-result-assertions.md) when choosing a `CommandResult` assertion: `ShouldHaveValidationErrorBecauseOf(reason)` is the message-free way to say which kind of rejection happened, and an unauthorized result carries no validation errors, so assert `ShouldNotBeAuthorized()`.
288
237
 
289
238
  ## Step 7 — Assert what was appended
290
239
 
@@ -0,0 +1,36 @@
1
+ # CommandResult assertions
2
+
3
+ This reference holds the CommandResult assertion table and the authorization-versus-validation distinction.
4
+
5
+ `CommandResult` assertions, from `Cratis.Arc.Testing.Commands`, throwing
6
+ `CommandResultAssertionException`:
7
+
8
+ | Assertion | Says |
9
+ | --- | --- |
10
+ | `ShouldBeSuccessful()` / `ShouldNotBeSuccessful()` | Authorized, valid, no exceptions — or not |
11
+ | `ShouldBeValid()` | Validation only; it checks neither authorization nor exceptions |
12
+ | `ShouldHaveValidationErrors()` | At least one validation error |
13
+ | `ShouldHaveValidationErrorFor(message)` | A validation error whose message **contains** that text (a substring match; compare messages for equality when exact wording is specified) |
14
+ | `ShouldHaveValidationErrorBecauseOf(reason)` | A validation error with that `ValidationResultReason` |
15
+ | `ShouldBeAuthorized()` / `ShouldNotBeAuthorized()` | The authorization outcome |
16
+ | `ShouldHaveExceptions()` / `ShouldNotHaveExceptions()` | Whether the handler threw |
17
+ | `ShouldHaveConstraintViolationFor(name)` | A constraint violation surfaced on the command result |
18
+
19
+ `ShouldHaveValidationErrorBecauseOf(reason)` is the message-free way to say
20
+ *which kind* of rejection happened — `ValidationResultReason.ConstraintViolation`,
21
+ `ConcurrencyViolation`, `ValidatorFailed`, `Rule`. Prefer it over
22
+ `ShouldHaveValidationErrorFor(message)`, which pins presentation text.
23
+
24
+ Authorization failures are different in kind: an unauthorized result carries
25
+ **no** validation errors, so assert `ShouldNotBeAuthorized()`. Adding an
26
+ authorization attribute to an existing command therefore breaks both its
27
+ happy-path and its validation-failure specifications — switch the assertions
28
+ rather than patching around them.
29
+
30
+ The scenario's own surface is `Services`, `Context`, `Execute(command[, ct])`,
31
+ `Validate(command)` (runs the filters without the handler), `LastResult`,
32
+ `Operations` and the three operation assertions
33
+ (`ShouldHaveExecutedOperation<T>()`, `ShouldHaveCompensatedOperation<T>()`,
34
+ `ShouldHaveNoOperationInvocations()`); it is `IDisposable`/`IAsyncDisposable`.
35
+ Seeding (`Given`), the event log and the event assertions arrive as extension
36
+ members from the Chronicle integration.
@@ -0,0 +1,30 @@
1
+ # Reading a .play specification
2
+
3
+ This reference holds the mapping from `.play` specification assignments to scenario setup and assertions.
4
+
5
+ ### Reading a `.play` specification
6
+
7
+ Read the actual assignments, not a prose retelling; syntax and supported forms belong to
8
+ `cratis-screenplay-specifications`.
9
+ - `given <Event>` becomes prior facts seeded with `Given.ForEventSource(...).Events(...)`.
10
+ `given readmodel <Type>` becomes a pinned complete `.ReadModel(...)` instance, including its
11
+ key: the contract deliberately makes event history irrelevant here. Protected decisions still
12
+ need event-backed guards (Step 5); report a pin that cannot witness the required enforcement.
13
+ - `when <Command>` assignments fill that command; `given caller` supplies the scenario's caller,
14
+ not an invented default role. Use the matching scenario for append, query or reaction actions.
15
+ - `then <Event>` assignments become the appended-event predicate;
16
+ `then readmodel` assignments become instance assertions. Assert every named value and honor
17
+ `exactly`, ordering and absence where stated. Do not assert an unmentioned generated identifier
18
+ or timestamp; still use required source identities to select the result. A broader property
19
+ coverage gap goes back to the contract owner rather than adding a new business assertion.
20
+ - `description` and slice `documentation` provide context for a name or XML summary, not extra
21
+ setup, assertions or inferred rules. Explicit realization requirements still bind delivery;
22
+ reconcile them with executable parts through `cratis-application-slice-conformance`.
23
+ - A `parameter`/`case` table yields independent examples by substituting each `case.<parameter>`
24
+ value. The reference runner identifies each row as `<Specification>_<Case>`; retain that name
25
+ in the specification map, while C# uses the repository's `when_.../and_<case>` convention.
26
+ Name parity is a mapping requirement, not a requirement to rename C# classes.
27
+ - `then error` requires unsuccessful execution plus the named validation/constraint reason where
28
+ stated (Step 6). A specified message must be checked, using equality when exact wording is
29
+ contracted. `then denied` instead requires unsuccessful execution and `ShouldNotBeAuthorized()`;
30
+ it is not a validation error. Keep every other rule satisfied so the named refusal is witnessed.
@@ -13,13 +13,7 @@ told about them. Each has its own extension point.
13
13
 
14
14
  ## Verified product sources
15
15
 
16
- | Package | Purpose |
17
- | --- | --- |
18
- | `Cratis.Arc.Core` | `Cratis.Arc.Identity`, `Cratis.Arc.Authorization`, `Cratis.Arc.Authentication`, `Cratis.Arc.Tenancy` |
19
- | `Cratis.Arc` | ASP.NET Core hosting, `AddMicrosoftIdentityPlatformIdentityAuthentication` |
20
- | `@cratis/arc` | `IdentityProvider`, `IIdentity` |
21
- | `@cratis/arc.react` | `IdentityProvider` component, `useIdentity`, `RequireRole` |
22
- | Cratis AuthProxy (`cratis/authproxy`) | the trusted ingress described in [AuthProxy](references/authproxy.md) |
16
+ Read [references/product-sources.md](references/product-sources.md) when you need the owning package for an identity type.
23
17
 
24
18
  Authorization capabilities arrived over time: named policies, schemes, fallback baselines, guest policies and Microsoft-attribute enforcement all need a recent Arc. [authorization](references/authorization.md) lists the requirements; check them if you run an older version.
25
19
 
@@ -87,41 +81,10 @@ public class <Name>IdentityDetailsProvider : IProvideIdentityDetails<<Details>>
87
81
 
88
82
  ### The endpoints
89
83
 
90
- | Route | What it does |
91
- | --- | --- |
92
- | `GET /.cratis/me` | The current identity. 401 when not authenticated, 403 when the provider says not authorized, otherwise the principal-derived identity JSON |
93
- | `GET /.cratis/identity-details/schema` | The JSON schema of the details type (`{}` without a details provider) |
94
- | `GET /.cratis/users` | Development tooling — aggregates every `ICanProvideUsers` |
95
- | `GET /.cratis/tenants` | Development tooling — aggregates every `ICanProvideTenants` |
96
- | `GET /.cratis/commands`, `GET /.cratis/queries` | Introspection catalogs of operation names, types and routes (`MapIntrospectionEndpoints()`) |
84
+ Read [references/identity-endpoints.md](references/identity-endpoints.md) when choosing what discovery routes a host exposes or how `/.cratis/me` and its caching behave.
97
85
 
98
86
  Requires Arc 22.45.0 for authenticated discovery by default. On an older Arc the discovery routes are anonymous in every environment, so do not expose such a host.
99
87
 
100
- Discovery is anonymous only when the host's
101
- `IHostEnvironment.IsDevelopment()` is true. Elsewhere it requires authentication;
102
- if the host cannot authenticate callers, the routes are not mapped (404) and a
103
- warning is logged. `RequireAuthentication` unset selects that environment default;
104
- explicit `true` requires authentication everywhere (startup fails if unavailable);
105
- explicit `false` exposes discovery anonymously everywhere, warning outside
106
- Development. `Roles` implies authentication and cannot combine with explicit
107
- `false`. `Enabled=false` removes the two catalogs; `IdentityDiscovery=false`
108
- removes users, tenants and the details schema. Setting both removes all discovery
109
- without authentication checks; `/.cratis/me` remains. `[ExcludeFromDiscovery]`
110
- hides commands, read models, queries and controllers from catalogs/OpenAPI, **not
111
- from invocation or authorization**. These are .NET settings, not a JVM contract.
112
- Source: [secure defaults](https://github.com/Cratis/Arc/blob/main/Documentation/upgrading/secure-defaults.mdx).
113
-
114
- `/.cratis/me` derives identity only from the authenticated request principal,
115
- never from `.cratis-identity`. The details provider runs for each authenticated
116
- identity request; `ModifyDetails` changes only the current response. Arc no
117
- longer writes the readable identity cookie (it expires a legacy one). Identity
118
- responses carry `Cache-Control: no-store, private` and `Vary: Cookie`.
119
- Stop reading the cookie; use `IdentityProvider.getCurrent()`/`refresh()` and
120
- `clearCache()` on logout. The frontend caches in memory, with a warned legacy
121
- cookie fallback **only after a 404**, never after 401/403.
122
- Sources: [IdentityProvider.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Identity/IdentityProvider.cs),
123
- [IdentityProvider.ts](https://github.com/Cratis/Arc/blob/main/Source/JavaScript/Arc/identity/IdentityProvider.ts).
124
-
125
88
  ## Authorization — what Arc evaluates
126
89
 
127
90
  Arc's attributes live in `Cratis.Arc.Authorization`:
@@ -176,11 +139,7 @@ Current behavior:
176
139
  a query `QueryResult.Unauthorized(...)`; mapped Arc denials are 403, middleware may
177
140
  answer 401 or another shape.
178
141
 
179
- `ARC0011` warns when a `[Roles]` argument is a string literal: use
180
- `nameof(<RoleEnum>.<Member>)` so a rename is a compile error rather than a silent
181
- authorization failure. `ARC0019` flags `[AllowAnonymous]` with `[Authorize]`/`[Roles]`,
182
- `ARC0020` flags an ASP.NET Core attribute that is not enforced without Arc's ASP.NET
183
- Core integration, and `ARC0021` flags `AuthenticationSchemes` on the Core host.
142
+ `ARC0011` warns on a `[Roles]` string literal (use `nameof`); the `ARC0019`–`ARC0021` diagnostics are explained in [authorization](references/authorization.md#analyzer-diagnostics).
184
143
 
185
144
  ### Observable queries and revocation
186
145
 
@@ -217,11 +176,6 @@ filters, and system-execution.
217
176
  Implement it and it is discovered — there is **no** `IArcBuilder` extension and
218
177
  **no** options type for authentication.
219
178
 
220
- `AuthenticationResult` is
221
- `record (ClaimsPrincipal? Principal = default, AuthenticationFailure? Failure = default)`
222
- with `Anonymous`, `Succeeded(principal)` and `Failed(reason)`, and
223
- `IsAuthenticated => Principal is not null`.
224
-
225
179
  Arc ships `MicrosoftIdentityPlatformAuthenticationHandler` in `Arc.Core`, which
226
180
  reads the forwarded principal. See
227
181
  [authentication](references/authentication.md) for the exact header contract,
@@ -248,21 +202,7 @@ namespace isolation — that is separate guidance.
248
202
 
249
203
  ## Frontend
250
204
 
251
- ```tsx
252
- import { Arc } from '@cratis/arc.react';
253
-
254
- <Arc detailsType={<Details>}>{children}</Arc>
255
- ```
256
-
257
- `<Arc>` renders the `IdentityProvider` context for you. Inside it:
258
-
259
- ```tsx
260
- import { useIdentity, RequireRole } from '@cratis/arc.react/identity';
261
-
262
- const identity = useIdentity(<Details>, <defaultDetails>);
263
- // identity.id, .name, .roles, .details, .isSet, .isInRole(role)
264
- // identity.isLoading, identity.clearIdentity()
265
- ```
205
+ Read [references/frontend.md](references/frontend.md#identity-hook-examples) when you need the `<Arc>` provider and `useIdentity`/`RequireRole` examples.
266
206
 
267
207
  `useIdentity` has two overloads: `(type, defaultDetails?)` for type-safe details
268
208
  and `(defaultDetails?)` without. The default details stand in whenever there are
@@ -291,11 +231,6 @@ implements as `ICanProvideUsers` and `ICanProvideTenants`.
291
231
  To run locally with an identity, supply the forwarded headers yourself — see
292
232
  [local development](references/local-development.md).
293
233
 
294
- Those endpoints follow the discovery exposure settings above. Return development
295
- fixtures from development providers; test deployed discovery access explicitly.
296
- Forwarded headers sent locally require the host-wide trust opt-in too; do not
297
- carry that shortcut into a directly reachable deployed host.
298
-
299
234
  ## Verify
300
235
 
301
236
  - Exactly one non-default `IProvideIdentityDetails` implementation exists, and it
@@ -9,6 +9,7 @@
9
9
  - Forwarded headers, ingress requirements and protected introspection
10
10
  - What is not here
11
11
  - The security boundary, stated plainly
12
+ - AuthenticationResult
12
13
 
13
14
  Source: `Cratis.Arc.Core` and `Cratis.Arc`. Types are in
14
15
  `Cratis.Arc.Authentication` and `Cratis.Arc.Identity`.
@@ -198,3 +199,10 @@ sent it. Any caller that can reach the application can author the entire
198
199
  serialized principal, including the fields Arc reads. Trust it exactly as far as
199
200
  you trust that your ingress is the only thing that can set it — which means the
200
201
  application must not be reachable any other way.
202
+
203
+ ## AuthenticationResult
204
+
205
+ `AuthenticationResult` is
206
+ `record (ClaimsPrincipal? Principal = default, AuthenticationFailure? Failure = default)`
207
+ with `Anonymous`, `Succeeded(principal)` and `Failed(reason)`, and
208
+ `IsAuthenticated => Principal is not null`.
@@ -14,6 +14,7 @@
14
14
  - Direct calls bypass authorization
15
15
  - The principal and system actors
16
16
  - Protected decisions and validators
17
+ - Analyzer diagnostics
17
18
 
18
19
  Source: `Cratis.Arc.Core` and `Cratis.Arc`. Everything below is in `Cratis.Arc.Authorization` unless stated.
19
20
 
@@ -330,3 +331,11 @@ factory-supplied or altered rules fail closed. Keep static/service-locator state
330
331
  out of them too: certification is not proof of input purity. Validators that
331
332
  read decision state are a known limitation.
332
333
  Source: [protected validator boundary](https://github.com/Cratis/Arc/blob/main/Documentation/backend/csharp/chronicle/read-models/injecting-into-commands.md).
334
+
335
+ ## Analyzer diagnostics
336
+
337
+ `ARC0011` warns when a `[Roles]` argument is a string literal: use
338
+ `nameof(<RoleEnum>.<Member>)` so a rename is a compile error rather than a silent
339
+ authorization failure. `ARC0019` flags `[AllowAnonymous]` with `[Authorize]`/`[Roles]`,
340
+ `ARC0020` flags an ASP.NET Core attribute that is not enforced without Arc's ASP.NET
341
+ Core integration, and `ARC0021` flags `AuthenticationSchemes` on the Core host.
@@ -6,6 +6,7 @@
6
6
  - `@cratis/arc.react/identity`
7
7
  - `RequireRole`
8
8
  - MVVM
9
+ - Identity hook examples
9
10
 
10
11
  Source: `@cratis/arc` and `@cratis/arc.react`.
11
12
 
@@ -115,3 +116,21 @@ server, where the decision cannot be edited.
115
116
  `@cratis/arc.react.mvvm` has **no** identity hook, provider, context, or type. It
116
117
  registers `IIdentityProvider` → `IdentityProvider` in its container so a view
117
118
  model can constructor-inject it. That is the whole integration.
119
+
120
+ ## Identity hook examples
121
+
122
+ ```tsx
123
+ import { Arc } from '@cratis/arc.react';
124
+
125
+ <Arc detailsType={<Details>}>{children}</Arc>
126
+ ```
127
+
128
+ `<Arc>` renders the `IdentityProvider` context for you. Inside it:
129
+
130
+ ```tsx
131
+ import { useIdentity, RequireRole } from '@cratis/arc.react/identity';
132
+
133
+ const identity = useIdentity(<Details>, <defaultDetails>);
134
+ // identity.id, .name, .roles, .details, .isSet, .isInRole(role)
135
+ // identity.isLoading, identity.clearIdentity()
136
+ ```
@@ -0,0 +1,40 @@
1
+ # Identity and discovery endpoints
2
+
3
+ This reference holds the `/.cratis` endpoint table, discovery exposure settings and identity response behavior.
4
+
5
+ ## The endpoints
6
+
7
+ | Route | What it does |
8
+ | --- | --- |
9
+ | `GET /.cratis/me` | The current identity. 401 when not authenticated, 403 when the provider says not authorized, otherwise the principal-derived identity JSON |
10
+ | `GET /.cratis/identity-details/schema` | The JSON schema of the details type (`{}` without a details provider) |
11
+ | `GET /.cratis/users` | Development tooling — aggregates every `ICanProvideUsers` |
12
+ | `GET /.cratis/tenants` | Development tooling — aggregates every `ICanProvideTenants` |
13
+ | `GET /.cratis/commands`, `GET /.cratis/queries` | Introspection catalogs of operation names, types and routes (`MapIntrospectionEndpoints()`) |
14
+
15
+ ## Discovery exposure and identity responses
16
+
17
+ Discovery is anonymous only when the host's
18
+ `IHostEnvironment.IsDevelopment()` is true. Elsewhere it requires authentication;
19
+ if the host cannot authenticate callers, the routes are not mapped (404) and a
20
+ warning is logged. `RequireAuthentication` unset selects that environment default;
21
+ explicit `true` requires authentication everywhere (startup fails if unavailable);
22
+ explicit `false` exposes discovery anonymously everywhere, warning outside
23
+ Development. `Roles` implies authentication and cannot combine with explicit
24
+ `false`. `Enabled=false` removes the two catalogs; `IdentityDiscovery=false`
25
+ removes users, tenants and the details schema. Setting both removes all discovery
26
+ without authentication checks; `/.cratis/me` remains. `[ExcludeFromDiscovery]`
27
+ hides commands, read models, queries and controllers from catalogs/OpenAPI, **not
28
+ from invocation or authorization**. These are .NET settings, not a JVM contract.
29
+ Source: [secure defaults](https://github.com/Cratis/Arc/blob/main/Documentation/upgrading/secure-defaults.mdx).
30
+
31
+ `/.cratis/me` derives identity only from the authenticated request principal,
32
+ never from `.cratis-identity`. The details provider runs for each authenticated
33
+ identity request; `ModifyDetails` changes only the current response. Arc no
34
+ longer writes the readable identity cookie (it expires a legacy one). Identity
35
+ responses carry `Cache-Control: no-store, private` and `Vary: Cookie`.
36
+ Stop reading the cookie; use `IdentityProvider.getCurrent()`/`refresh()` and
37
+ `clearCache()` on logout. The frontend caches in memory, with a warned legacy
38
+ cookie fallback **only after a 404**, never after 401/403.
39
+ Sources: [IdentityProvider.cs](https://github.com/Cratis/Arc/blob/main/Source/DotNET/Arc.Core/Identity/IdentityProvider.cs),
40
+ [IdentityProvider.ts](https://github.com/Cratis/Arc/blob/main/Source/JavaScript/Arc/identity/IdentityProvider.ts).
@@ -86,3 +86,10 @@ Any local mechanism that lets the caller author its own principal is exactly the
86
86
  production risk described in [authentication](authentication.md). Keep it behind
87
87
  an environment check, and make sure the deployed application is unreachable
88
88
  except through the ingress that owns those headers.
89
+
90
+ ## Development fixtures
91
+
92
+ Those endpoints follow the discovery exposure settings above. Return development
93
+ fixtures from development providers; test deployed discovery access explicitly.
94
+ Forwarded headers sent locally require the host-wide trust opt-in too; do not
95
+ carry that shortcut into a directly reachable deployed host.
@@ -0,0 +1,11 @@
1
+ # Product sources
2
+
3
+ This reference holds the packages and types Arc identity and authorization guidance relies on.
4
+
5
+ | Package | Purpose |
6
+ | --- | --- |
7
+ | `Cratis.Arc.Core` | `Cratis.Arc.Identity`, `Cratis.Arc.Authorization`, `Cratis.Arc.Authentication`, `Cratis.Arc.Tenancy` |
8
+ | `Cratis.Arc` | ASP.NET Core hosting, `AddMicrosoftIdentityPlatformIdentityAuthentication` |
9
+ | `@cratis/arc` | `IdentityProvider`, `IIdentity` |
10
+ | `@cratis/arc.react` | `IdentityProvider` component, `useIdentity`, `RequireRole` |
11
+ | Cratis AuthProxy (`cratis/authproxy`) | the trusted ingress described in [AuthProxy](authproxy.md) |
@@ -24,19 +24,7 @@ or a combination.
24
24
 
25
25
  ## Verified product sources
26
26
 
27
- | Package | Purpose |
28
- | --- | --- |
29
- | `Cratis.Arc.Core` | `Cratis.Arc.Commands.ModelBound.CommandAttribute`, `CommandResult`, `CommandValidator<T>` |
30
- | `Cratis.Arc.Chronicle` | event append handling, `Cratis.Arc.Chronicle.Commands.NotAuditedAttribute` |
31
- | `Cratis.Arc.ProxyGenerator.Build` | `CratisProxiesOutputPath` MSBuild integration |
32
- | `Cratis.Fundamentals` | `Cratis.Monads.Result<TResult, TError>` |
33
- | `Cratis.Chronicle` | `EventTypeAttribute`, `EventForEventSourceId`, `ICanProvideEventSourceId` |
34
- | `@cratis/arc` | `ICommand`, `CommandResult`, `ValidationResult` |
35
-
36
-
37
- Fundamentals:
38
- [`Result<TResult, TError>`](https://github.com/Cratis/Fundamentals/blob/main/Source/DotNET/Fundamentals/Monads/Result%7BTResult,TError%7D.cs):
39
- success is first, error second, with implicit conversions from both types.
27
+ Read [references/product-sources.md](references/product-sources.md) for the owning packages and `Result`.
40
28
 
41
29
  Arc without Chronicle is a
42
30
  supported setup; everything on this page that appends events needs Chronicle.
@@ -145,26 +133,7 @@ Two consequences worth knowing before writing the first command:
145
133
  - **Events never carry their own event source.** Cross-stream writes use
146
134
  `EventForEventSourceId`; they are not expressed by a property on the event.
147
135
 
148
- ```csharp
149
- [Command]
150
- public record Register<Thing>(<ConceptType> <Name>)
151
- {
152
- public (<ThingId>, <ThingRegistered>) Handle([GeneratedValue("thing")] <ThingId> id) =>
153
- (id, new(<Name>));
154
- }
155
- ```
156
-
157
- ```csharp
158
- [Command]
159
- public record Transfer(<AccountId> From, <AccountId> To, <Money> Amount)
160
- {
161
- public IEnumerable<object> Handle() =>
162
- [
163
- new EventForEventSourceId(From, new <Withdrawn>(Amount)),
164
- new EventForEventSourceId(To, new <Deposited>(Amount)),
165
- ];
166
- }
167
- ```
136
+ Read [references/return-shape-examples.md](references/return-shape-examples.md) for create and cross-stream examples.
168
137
 
169
138
  ## Generate a server-owned new identifier
170
139
 
@@ -187,10 +156,7 @@ is shown there.
187
156
 
188
157
  ## When not to generate
189
158
 
190
- Keep client-owned IDs as inputs. Generation is not authorization, tenant
191
- isolation, idempotency, freshness or gapless invoice numbering. Credentials need
192
- explicit entropy, `[NotAudited]`, authorized delivery and hash storage; never
193
- log captures or persist plaintext authentication keys. See [boundaries](references/shop-generation.md#when-not-to-generate).
159
+ Read [references/generation-boundaries.md](references/generation-boundaries.md) when deciding whether to generate.
194
160
 
195
161
  ## Where the event source id comes from
196
162
 
@@ -206,11 +172,6 @@ Chronicle resolves the command's event source id in this order:
206
172
  Two or more candidates raise `ARCCHR0002` (`[Key]` does not silence it); Arc
207
173
  silently takes the first declared. Implement `ICanProvideEventSourceId`.
208
174
 
209
- `[Key]` on a positional record's primary-constructor parameter is recognized
210
- and counted once. Child-only/nested read-model types are not standalone
211
- command-scoped models. `[EventSource<TSource>(stream)]` supplies source type and
212
- stream metadata on commands and aggregate roots.
213
-
214
175
  Read [decisions and routing](references/decisions-and-routing.md) when a command
215
176
  needs guarded state, stream-id templates, definition-backed routes, event tags or
216
177
  post-commit `CompleteStream`. Plain read-model injection remains advisory;
@@ -218,10 +179,7 @@ post-commit `CompleteStream`. Plain read-model injection remains advisory;
218
179
  [choosing how a rule holds](../cratis-chronicle-decision-reads/references/choosing-how-a-rule-holds.md).
219
180
  A returned `EventForEventSourceId` route wins over command context.
220
181
 
221
- Two attributes are spelled `[Key]`. Chronicle reads `Cratis.Chronicle.Keys.KeyAttribute`.
222
- Marking `System.ComponentModel.DataAnnotations.KeyAttribute` in an application
223
- that uses Chronicle compiles, resolves nothing, and silently invents a new event
224
- source id for every command — `ARCCHR0008` reports it.
182
+ Read [references/event-source-id-details.md](references/event-source-id-details.md) when marking `[Key]` (two attributes share the name; `ARCCHR0008`) or using `[EventSource<TSource>]`.
225
183
 
226
184
  ## Fetch what the handler needs with `Provide()`
227
185
 
@@ -229,21 +187,7 @@ source id for every command — `ARCCHR0008` reports it.
229
187
  is to keep IO out of `Handle`: it fetches or computes values, and Arc binds them
230
188
  to `Handle`'s parameters by type.
231
189
 
232
- ```csharp
233
- [Command]
234
- public record Open<Thing>(<ThingId> Id, <OwnerId> OwnerId)
235
- {
236
- public async Task<Result<<Owner>, ValidationResult>> Provide(IReadModels readModels)
237
- {
238
- var owner = await readModels.GetInstanceById<<Owner>>((EventSourceId)OwnerId);
239
- return owner is null
240
- ? ValidationResult.Error("Owner must exist.")
241
- : owner;
242
- }
243
-
244
- public <ThingOpened> Handle(<Owner> owner) => new(owner.Id);
245
- }
246
- ```
190
+ Read [references/provide-example.md](references/provide-example.md) for a worked `Provide()` example.
247
191
 
248
192
  - Short-circuit with `ValidationResult.Error(...)`; do not throw for a rejection
249
193
  the user can act on. A thrown exception surfaces as `HasExceptions` and HTTP
@@ -275,28 +219,7 @@ property is added.
275
219
 
276
220
  A retained operational secret needs **both** `[Encrypted]` and `[NotAudited]`; either alone leaves a gap. A credential used for authentication (password, token) is marked `[NotAudited]` on the command and reaches an event only as a hash or a reference, never encrypted. Never combine `[PII]` with `[Encrypted]` (`CHR0053`).
277
221
 
278
- ```csharp
279
- [Command]
280
- public record Change<Secret>(
281
- <UserId> User,
282
- [property: NotAudited] string Old<Secret>,
283
- [property: NotAudited] string New<Secret>)
284
- {
285
- public <SecretChanged> Handle(I<Hasher> hasher) => new(hasher.Hash(New<Secret>));
286
- }
287
- ```
288
-
289
- `[NotAudited]` applies to a class, struct, property, or parameter. On the type it
290
- withholds every property at once. Marking the concept type instead makes it
291
- travel to every command that takes that value. The command is still named on the
292
- chain either way; only the values are withheld.
293
-
294
- `ARCCHR0009` warns when a property's *name* reads like a secret and is unmarked.
295
- It cannot see a secret whose name does not say so, so a clean build means
296
- "nothing obvious was missed", not "no secrets are recorded". When the name only
297
- reads like a secret and the value is safe to record, the framework's own guidance
298
- is to mark it `[NotAudited]` anyway or rename the property — the value is written
299
- either way, so the reading is all a reviewer has to go on.
222
+ Read [references/causation-details.md](references/causation-details.md) when marking an input `[NotAudited]` or reading `ARCCHR0009`.
300
223
 
301
224
  ## Generate the TypeScript proxy
302
225
 
@@ -313,28 +236,14 @@ either way, so the reading is all a reviewer has to go on.
313
236
  file path. When configuring proxy generation or diagnosing missing or stale output, read [proxy generation](references/proxy-generation.md) for the full
314
237
  set of MSBuild knobs and the common failures.
315
238
 
316
- `[BlockOnValidationSeverity(ValidationResultSeverity.Warning)]` declares the
317
- lowest blocking severity for validation, `Provide` and execution. Caller
318
- `allowedSeverity`/`X-Allowed-Severity` can only make it stricter; `Unknown` blocks.
319
- The proxy carries `blockOnValidationSeverity` and honors it client-side.
239
+ Read [references/proxy-generation.md](references/proxy-generation.md#blocking-severity) when a command declares `[BlockOnValidationSeverity]`.
320
240
 
321
241
  ## The generated client contract
322
242
 
323
243
  The generated proxy is a `Command` from `@cratis/arc`. Its members are the same
324
244
  whatever renders it:
325
245
 
326
- | Member | What it does |
327
- | --- | --- |
328
- | `route` | The generated route, including the configured API prefix |
329
- | `roles` | The roles the command declares; empty when it declares none |
330
- | `<property>` | Get or set one value; setting raises `propertyChanged` |
331
- | `hasChanges` | True when any value differs from the initial values |
332
- | `execute(allowedSeverity?, ignoreWarnings?)` | Sends the command; resolves to `CommandResult` |
333
- | `validate()` | Runs authorization and validation on the server without the handler |
334
- | `validateClientSide()` | Runs only the extracted rules locally; never touches the network |
335
- | `setInitialValues(values)` | Sets the change-tracking baseline |
336
- | `setInitialValuesFromCurrentValues()` | Rebaselines onto the current values |
337
- | `revertChanges()` / `clear()` | Restore the baseline / reset everything |
246
+ Read [references/client-contract.md](references/client-contract.md) for the generated proxy members.
338
247
 
339
248
  Read `references/command-result.md` when branching on a command result or matching validation failures to fields. Branch on the specific flag, not only on `isSuccess`. The exact `CommandResult`
340
249
  and `ValidationResult` shapes are in
@@ -0,0 +1,26 @@
1
+ # Causation details
2
+
3
+ This reference holds a worked `[NotAudited]` example and how `[NotAudited]` and `ARCCHR0009` behave.
4
+
5
+ ```csharp
6
+ [Command]
7
+ public record Change<Secret>(
8
+ <UserId> User,
9
+ [property: NotAudited] string Old<Secret>,
10
+ [property: NotAudited] string New<Secret>)
11
+ {
12
+ public <SecretChanged> Handle(I<Hasher> hasher) => new(hasher.Hash(New<Secret>));
13
+ }
14
+ ```
15
+
16
+ `[NotAudited]` applies to a class, struct, property, or parameter. On the type it
17
+ withholds every property at once. Marking the concept type instead makes it
18
+ travel to every command that takes that value. The command is still named on the
19
+ chain either way; only the values are withheld.
20
+
21
+ `ARCCHR0009` warns when a property's *name* reads like a secret and is unmarked.
22
+ It cannot see a secret whose name does not say so, so a clean build means
23
+ "nothing obvious was missed", not "no secrets are recorded". When the name only
24
+ reads like a secret and the value is safe to record, the framework's own guidance
25
+ is to mark it `[NotAudited]` anyway or rename the property — the value is written
26
+ either way, so the reading is all a reviewer has to go on.
@@ -0,0 +1,16 @@
1
+ # The generated client contract
2
+
3
+ This reference holds the members of the generated `Command` proxy.
4
+
5
+ | Member | What it does |
6
+ | --- | --- |
7
+ | `route` | The generated route, including the configured API prefix |
8
+ | `roles` | The roles the command declares; empty when it declares none |
9
+ | `<property>` | Get or set one value; setting raises `propertyChanged` |
10
+ | `hasChanges` | True when any value differs from the initial values |
11
+ | `execute(allowedSeverity?, ignoreWarnings?)` | Sends the command; resolves to `CommandResult` |
12
+ | `validate()` | Runs authorization and validation on the server without the handler |
13
+ | `validateClientSide()` | Runs only the extracted rules locally; never touches the network |
14
+ | `setInitialValues(values)` | Sets the change-tracking baseline |
15
+ | `setInitialValuesFromCurrentValues()` | Rebaselines onto the current values |
16
+ | `revertChanges()` / `clear()` | Restore the baseline / reset everything |