@cratis/pi 7.14.1 → 7.14.3

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 (197) hide show
  1. package/package/corpus/agents/security-reviewer.md +2 -1
  2. package/package/corpus/rules/concepts.md +13 -7
  3. package/package/corpus/rules/glossary.md +2 -1
  4. package/package/corpus/rules/vertical-slices.md +5 -4
  5. package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +11 -2
  6. package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
  7. package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
  8. package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
  9. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
  10. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
  11. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
  12. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
  13. package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
  14. package/package/corpus/skills/cratis-arc-command/SKILL.md +24 -16
  15. package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
  16. package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
  17. package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
  18. package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
  19. package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
  20. package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
  21. package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
  22. package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
  23. package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
  24. package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
  25. package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
  26. package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
  27. package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
  28. package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
  29. package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
  30. package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
  31. package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
  32. package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
  33. package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
  34. package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
  35. package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
  36. package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
  37. package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
  38. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
  39. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
  40. package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
  41. package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
  42. package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
  43. package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
  44. package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
  45. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
  46. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
  47. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
  48. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
  49. package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
  50. package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
  51. package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
  52. package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
  53. package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +11 -2
  54. package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +2 -2
  55. package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
  56. package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
  57. package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
  58. package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
  59. package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
  60. package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
  61. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
  62. package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
  63. package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
  64. package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
  65. package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
  66. package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
  67. package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
  68. package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
  69. package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
  70. package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
  71. package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
  72. package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
  73. package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
  74. package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
  75. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
  76. package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
  77. package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
  78. package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
  79. package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
  80. package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
  81. package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +4 -4
  82. package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
  83. package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
  84. package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
  85. package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
  86. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
  87. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
  88. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
  89. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
  90. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
  91. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
  92. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
  93. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
  94. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
  95. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
  96. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +70 -221
  97. package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
  98. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
  99. package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
  100. package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
  101. package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
  102. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
  103. package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
  104. package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
  105. package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
  106. package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
  107. package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
  108. package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
  109. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
  110. package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
  111. package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
  112. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
  113. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
  114. package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
  115. package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
  116. package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
  117. package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
  118. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
  119. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
  120. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
  121. package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
  122. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
  123. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
  124. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
  125. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
  126. package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
  127. package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
  128. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +16 -1
  129. package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
  130. package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
  131. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
  132. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
  133. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
  134. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
  135. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
  136. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
  137. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
  138. package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
  139. package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
  140. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
  141. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
  142. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
  143. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +1 -1
  144. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
  145. package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
  146. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
  147. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
  148. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
  149. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
  150. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
  151. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
  152. package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
  153. package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
  154. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
  155. package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
  156. package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
  157. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
  158. package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
  159. package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
  160. package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
  161. package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
  162. package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
  163. package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
  164. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +23 -3
  165. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
  166. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +3 -3
  167. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
  168. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
  169. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
  170. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
  171. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +1 -1
  172. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +12 -2
  173. package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
  174. package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +2 -2
  175. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +1 -1
  176. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
  177. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
  178. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +15 -5
  179. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
  180. package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
  181. package/package/corpus/skills/cratis-security-review/SKILL.md +13 -8
  182. package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
  183. package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
  184. package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
  185. package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
  186. package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
  187. package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
  188. package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
  189. package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
  190. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
  191. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
  192. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
  193. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
  194. package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
  195. package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
  196. package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
  197. package/package.json +1 -1
@@ -11,6 +11,28 @@ Chronicle server. It is not a browser library and it is not the Arc TypeScript
11
11
  proxy layer — an Arc frontend calls generated command and query proxies over
12
12
  HTTP and never sees this package.
13
13
 
14
+ ## Common pitfalls
15
+
16
+ | Pitfall | Why it bites |
17
+ | --- | --- |
18
+ | Naming a reactor method after the handler's purpose | Dispatch is by the camelCase event class name; a mismatch is silently never called |
19
+ | `instanceof` on the event inside a handler | It is a `JSON.parse`d plain object, not your class |
20
+ | Event class with no default constructor values under `tsx` | No decorator metadata is emitted, so the schema comes out empty |
21
+ | Two `@eventType()` classes sharing a class name | The id defaults to the class name and they collide |
22
+ | Deploying compiled `dist/*.js` with default discovery | The default glob matches `**/*.ts`; nothing is discovered |
23
+ | Omitting a side-effect import of an artifact module | Its decorator never runs, so it is never registered |
24
+ | Forgetting `import 'reflect-metadata'` at the entry point | Decorators do not work at runtime |
25
+ | Forgetting to install `@cratis/fundamentals` | It is a peer dependency and is not installed for you |
26
+ | Importing `ChronicleConnectionString` | There is no `./connection` export; pass a string |
27
+ | Expecting single `append()` to set a stream or subject | Those fields are hardcoded; use the `EventForEventSourceId[]` overload |
28
+ | A connection string with no credentials | Silently falls back to the development client credentials |
29
+ | Shipping the default TLS behavior | `skipTlsValidation` defaults to `true` |
30
+ | Constructor-injecting a dependency into a reactor | There is no DI; the client constructs it |
31
+ | Carrying a `3.x` example forward | Tags, the reducer context parameter, and two RPC names changed in `4.0.0` |
32
+ | Reading `result.sequenceNumber` as a number | It is a `bigint` behind `.value` |
33
+ | A `@globalFor` mapping targeting a property one variant lacks | `GlobalHandlerPropertyNotOnVariant` when the group is built, not a silently skipped mapping |
34
+ | Expecting a `@globalFor`-only class to appear as a projection | It is never registered on its own; it is merged into its variants |
35
+
14
36
  ## Verified product sources
15
37
 
16
38
  This skill was written against `Cratis/Chronicle.TypeScript` at tag `v4.0.0`
@@ -295,91 +317,15 @@ Restrict an observer to tagged events with `@filterEventsByTag(value)` —
295
317
 
296
318
  ### Read models and projections
297
319
 
298
- `store.readModels` — `Source/readModels/IReadModels.ts`: `getInstanceById(type, key, sessionId?)`
299
- (`:38`), `getInstances(type, eventCount?)` (`:46`), `getSnapshotsById` (`:54`),
300
- `watch(type): AsyncIterable<ReadModelChangeset<T>>` (`:61`), plus `materialized`
301
- for paged access.
302
-
303
- Two projection styles:
320
+ Read models are read through `store.readModels`; projections are model-bound (decorators) or declarative (`@projection`), and constraints are class-plus-builder only.
304
321
 
305
- - **Model-bound** — decorators on the read model, from
306
- `@cratis/chronicle/projections`: `fromEvent`, `fromEvery`, `fromAll`, `setFrom`,
307
- `setFromContext`, `setValue`, `join`, `addFrom`, `subtractFrom`, `increment`,
308
- `decrement`, `count`, `childrenFrom`, `nested`, `clearWith`, `removedWith`,
309
- `removedWithJoin`, `noAutoMap`, `notRewindable`, `passive`.
310
- - **Declarative** — `@projection(id?, readModelType?, eventSequenceId?)` on a class
311
- implementing `IProjectionFor<TReadModel>` with
312
- `define(builder: IProjectionBuilderFor<TReadModel>): void`.
313
-
314
- Constraints are `@constraint()` on a class implementing `IConstraint` with a
315
- `define(builder)`; the builder gives `unique(...)`, `uniqueFor(...)`,
316
- `perEventSourceType`, `perEventStreamType`, `perEventStreamId`. **There are no
317
- model-bound constraint decorators in this client** — the class-plus-builder form
318
- is the only one.
322
+ Read [references/read-models-and-projections.md](references/read-models-and-projections.md) when reading a read model instance, choosing a projection style, or declaring a constraint.
319
323
 
320
324
  ### Variants — mutually exclusive read models for one entity's lifecycle
321
325
 
322
- > Requires `@cratis/chronicle` `6.2.0` or later — newer than this skill's
323
- > `5.1.0` baseline (`Source/projections/VariantReclassifier.ts` and siblings).
324
- > Reverify before claiming support; take the version from npm.
325
-
326
- Some entities do not have one shape for their whole lifetime — a work item is a
327
- backlog entry until a pull request exists for it, then it is a pull request
328
- until it merges. **Model-bound** — `@variantOf(identity, key)` and
329
- `@entersOn(eventType, key?)`, alongside the ordinary `@fromEvent`/`@setFrom`
330
- decorators:
331
-
332
- ```typescript
333
- class WorkItem {} // anchors the group; not itself a read model
334
-
335
- @variantOf(WorkItem, 'id')
336
- @entersOn(IssueCreated)
337
- @fromEvent(IssueCreated)
338
- @readModel()
339
- class BacklogItem {
340
- id = '';
341
- @setFrom(IssueCreated, 'title') title = '';
342
- }
343
-
344
- @variantOf(WorkItem, 'id')
345
- @entersOn(PullRequestCreated)
346
- @fromEvent(PullRequestCreated)
347
- @fromEvent(BuildCompleted) // not the entering event -> update-only join
348
- @readModel()
349
- class PullRequestItem {
350
- id = '';
351
- @setFrom(PullRequestCreated, 'pullRequestUrl') pullRequestUrl = '';
352
- @setFrom(BuildCompleted, 'buildStatus') buildStatus = '';
353
- }
354
- ```
355
-
356
- `entersOn` is repeatable (a variant may enter on more than one event) and its
357
- `key` argument names an *event* property, defaulting to the event source id. A
358
- mapping shared by every variant of an identity goes on a class decorated
359
- `@globalFor(identity)` instead of being repeated on each variant — every
360
- variant it targets must actually declare the property it maps, or
361
- `GlobalHandlerPropertyNotOnVariant` is thrown when the group is built. A class
362
- carrying only `@globalFor` is never itself registered as a projection.
363
-
364
- **Declarative** — `variantOf` and `entersOn` are members of
365
- `IProjectionBuilderFor<TReadModel>` itself:
366
-
367
- ```typescript
368
- @projection()
369
- class PullRequestItemProjection implements IProjectionFor<PullRequestItem> {
370
- define(builder: IProjectionBuilderFor<PullRequestItem>): void {
371
- builder
372
- .variantOf(WorkItem, m => m.id)
373
- .entersOn(PullRequestCreated)
374
- .from(BuildCompleted); // update-only, same reason
375
- }
376
- }
377
- ```
326
+ One entity with mutually exclusive lifecycle shapes is modeled as variants, with `@variantOf`/`@entersOn`/`@globalFor` or the fluent `.variantOf()`/`.entersOn()`; every variant needs an entering event.
378
327
 
379
- **A variant that declares no `@entersOn`/`entersOn(...)` throws
380
- `VariantMustDeclareEntersOnEvent`** when the group is built — a variant that
381
- could never be entered could never be written to at all, since every other
382
- handler on it is update-only.
328
+ Read [references/variants.md](references/variants.md) when a read model for one entity changes shape over its lifecycle, or when you meet `VariantMustDeclareEntersOnEvent` or `GlobalHandlerPropertyNotOnVariant`.
383
329
 
384
330
  ## Discovery is a runtime file glob — this is the biggest difference
385
331
 
@@ -427,28 +373,6 @@ There is none, and none is planned in the source: no container integration, no
427
373
  and seeders are instantiated by the client itself, so **constructor injection does
428
374
  not work**. Use module-scope collaborators, as the shipped sample does.
429
375
 
430
- ## Common pitfalls
431
-
432
- | Pitfall | Why it bites |
433
- | --- | --- |
434
- | Naming a reactor method after the handler's purpose | Dispatch is by the camelCase event class name; a mismatch is silently never called |
435
- | `instanceof` on the event inside a handler | It is a `JSON.parse`d plain object, not your class |
436
- | Event class with no default constructor values under `tsx` | No decorator metadata is emitted, so the schema comes out empty |
437
- | Two `@eventType()` classes sharing a class name | The id defaults to the class name and they collide |
438
- | Deploying compiled `dist/*.js` with default discovery | The default glob matches `**/*.ts`; nothing is discovered |
439
- | Omitting a side-effect import of an artifact module | Its decorator never runs, so it is never registered |
440
- | Forgetting `import 'reflect-metadata'` at the entry point | Decorators do not work at runtime |
441
- | Forgetting to install `@cratis/fundamentals` | It is a peer dependency and is not installed for you |
442
- | Importing `ChronicleConnectionString` | There is no `./connection` export; pass a string |
443
- | Expecting single `append()` to set a stream or subject | Those fields are hardcoded; use the `EventForEventSourceId[]` overload |
444
- | A connection string with no credentials | Silently falls back to the development client credentials |
445
- | Shipping the default TLS behavior | `skipTlsValidation` defaults to `true` |
446
- | Constructor-injecting a dependency into a reactor | There is no DI; the client constructs it |
447
- | Carrying a `3.x` example forward | Tags, the reducer context parameter, and two RPC names changed in `4.0.0` |
448
- | Reading `result.sequenceNumber` as a number | It is a `bigint` behind `.value` |
449
- | A `@globalFor` mapping targeting a property one variant lacks | `GlobalHandlerPropertyNotOnVariant` when the group is built, not a silently skipped mapping |
450
- | Expecting a `@globalFor`-only class to appear as a projection | It is never registered on its own; it is merged into its variants |
451
-
452
376
  ## Verify
453
377
 
454
378
  - The installed version is the one you intended, taken from npm, and
@@ -0,0 +1,23 @@
1
+ ## Read models and projections
2
+
3
+ `store.readModels` — `Source/readModels/IReadModels.ts`: `getInstanceById(type, key, sessionId?)`
4
+ (`:38`), `getInstances(type, eventCount?)` (`:46`), `getSnapshotsById` (`:54`),
5
+ `watch(type): AsyncIterable<ReadModelChangeset<T>>` (`:61`), plus `materialized`
6
+ for paged access.
7
+
8
+ Two projection styles:
9
+
10
+ - **Model-bound** — decorators on the read model, from
11
+ `@cratis/chronicle/projections`: `fromEvent`, `fromEvery`, `fromAll`, `setFrom`,
12
+ `setFromContext`, `setValue`, `join`, `addFrom`, `subtractFrom`, `increment`,
13
+ `decrement`, `count`, `childrenFrom`, `nested`, `clearWith`, `removedWith`,
14
+ `removedWithJoin`, `noAutoMap`, `notRewindable`, `passive`.
15
+ - **Declarative** — `@projection(id?, readModelType?, eventSequenceId?)` on a class
16
+ implementing `IProjectionFor<TReadModel>` with
17
+ `define(builder: IProjectionBuilderFor<TReadModel>): void`.
18
+
19
+ Constraints are `@constraint()` on a class implementing `IConstraint` with a
20
+ `define(builder)`; the builder gives `unique(...)`, `uniqueFor(...)`,
21
+ `perEventSourceType`, `perEventStreamType`, `perEventStreamId`. **There are no
22
+ model-bound constraint decorators in this client** — the class-plus-builder form
23
+ is the only one.
@@ -0,0 +1,63 @@
1
+ ## Variants — mutually exclusive read models for one entity's lifecycle
2
+
3
+ > Requires `@cratis/chronicle` `6.2.0` or later — newer than this skill's
4
+ > `5.1.0` baseline (`Source/projections/VariantReclassifier.ts` and siblings).
5
+ > Reverify before claiming support; take the version from npm.
6
+
7
+ Some entities do not have one shape for their whole lifetime — a work item is a
8
+ backlog entry until a pull request exists for it, then it is a pull request
9
+ until it merges. **Model-bound** — `@variantOf(identity, key)` and
10
+ `@entersOn(eventType, key?)`, alongside the ordinary `@fromEvent`/`@setFrom`
11
+ decorators:
12
+
13
+ ```typescript
14
+ class WorkItem {} // anchors the group; not itself a read model
15
+
16
+ @variantOf(WorkItem, 'id')
17
+ @entersOn(IssueCreated)
18
+ @fromEvent(IssueCreated)
19
+ @readModel()
20
+ class BacklogItem {
21
+ id = '';
22
+ @setFrom(IssueCreated, 'title') title = '';
23
+ }
24
+
25
+ @variantOf(WorkItem, 'id')
26
+ @entersOn(PullRequestCreated)
27
+ @fromEvent(PullRequestCreated)
28
+ @fromEvent(BuildCompleted) // not the entering event -> update-only join
29
+ @readModel()
30
+ class PullRequestItem {
31
+ id = '';
32
+ @setFrom(PullRequestCreated, 'pullRequestUrl') pullRequestUrl = '';
33
+ @setFrom(BuildCompleted, 'buildStatus') buildStatus = '';
34
+ }
35
+ ```
36
+
37
+ `entersOn` is repeatable (a variant may enter on more than one event) and its
38
+ `key` argument names an *event* property, defaulting to the event source id. A
39
+ mapping shared by every variant of an identity goes on a class decorated
40
+ `@globalFor(identity)` instead of being repeated on each variant — every
41
+ variant it targets must actually declare the property it maps, or
42
+ `GlobalHandlerPropertyNotOnVariant` is thrown when the group is built. A class
43
+ carrying only `@globalFor` is never itself registered as a projection.
44
+
45
+ **Declarative** — `variantOf` and `entersOn` are members of
46
+ `IProjectionBuilderFor<TReadModel>` itself:
47
+
48
+ ```typescript
49
+ @projection()
50
+ class PullRequestItemProjection implements IProjectionFor<PullRequestItem> {
51
+ define(builder: IProjectionBuilderFor<PullRequestItem>): void {
52
+ builder
53
+ .variantOf(WorkItem, m => m.id)
54
+ .entersOn(PullRequestCreated)
55
+ .from(BuildCompleted); // update-only, same reason
56
+ }
57
+ }
58
+ ```
59
+
60
+ **A variant that declares no `@entersOn`/`entersOn(...)` throws
61
+ `VariantMustDeclareEntersOnEvent`** when the group is built — a variant that
62
+ could never be entered could never be written to at all, since every other
63
+ handler on it is update-only.
@@ -63,6 +63,14 @@ well-known `ComplianceMetadataType`. Chronicle has no `[Redact]`, `[Erase]`,
63
63
  `[Anonymize]`, `[Encrypt]`, or `[NotAudited]` attribute; do not write one into
64
64
  an example. Redaction is an API call, not an annotation.
65
65
 
66
+ `[Encrypted]` (`Cratis.Chronicle.ProtectedValues`, Chronicle 19.32.0+) is a
67
+ security marker, not a compliance category: it encrypts an operational secret
68
+ (API key, token, a company's bank account number) at rest with no data subject
69
+ and no erasure. Never put it on a value that is also `[PII]` (analyzer
70
+ **CHR0053**, which `[PII]` alone already covers), nor on an event source id
71
+ (**CHR0052**). Arc's `[NotAudited]` is not a Chronicle attribute either; a secret
72
+ that is also a command property takes both `[Encrypted]` and `[NotAudited]`.
73
+
66
74
  Mark only genuinely personal values. Business metadata, identifiers of
67
75
  non-persons, and amounts stay unmarked — every marked value costs an encryption
68
76
  round trip and becomes unreadable the moment the subject is erased.
@@ -232,8 +240,9 @@ storage, configured under `Cratis:Chronicle:Compliance:Encryption`.
232
240
  - Bearer tokens, magic links, and signed URLs are secrets, not durable facts.
233
241
  Store a keyed hash or an opaque reference. Chronicle has no attribute that
234
242
  withholds a secret from the log (Arc's `[NotAudited]` keeps a *command
235
- property* out of the causation chain — see **cratis-arc-command** — but a
236
- secret placed in an event payload is in the log for good).
243
+ property* out of the causation chain — see **cratis-arc-command**), and a
244
+ secret placed in an event payload is in the log for good; `[Encrypted]`
245
+ protects it at rest but it stays recoverable, so prefer a hash or reference.
237
246
  - **Erasure is wider than the event log.** Crypto-shredding removes readability
238
247
  of `[PII]` values in events and read models. It does nothing for a copy that
239
248
  left Chronicle: an exported CSV, a generated PDF, a search index, an email
@@ -124,8 +124,8 @@ operates on the subject and the subject follows the stream.
124
124
  - Set `[Subject]` only when the person is not the event source. A stored
125
125
  read-model document carries one subject — do not mix several people's personal
126
126
  data into one document.
127
- - Never place `[PII]` on an event-source id: Chronicle cannot encrypt it, and
128
- analyzer `CHR0034` rejects it. When the natural identifier is itself
127
+ - Never place `[PII]` or `[Encrypted]` on an event-source id: Chronicle cannot encrypt it, and
128
+ analyzers `CHR0034` and `CHR0052` reject them. When the natural identifier is itself
129
129
  sensitive, model a surrogate stream id and carry the sensitive value as a
130
130
  `[PII]` property.
131
131
  - Do not place `[Key]` or `[Subject]` on an `EventSourceId<T>` value — it is
@@ -16,6 +16,19 @@ events.
16
16
  > event types and change schemas freely. A migration written too early is dead
17
17
  > code that hides the real schema in the history.
18
18
 
19
+ ## Route near misses
20
+
21
+ - An accepted `.play` model under the model root covers the behavior, or the
22
+ repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
23
+ `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
24
+ output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
25
+ `cratis-screenplay-modeling-lifecycle`): change the model first with
26
+ `cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
27
+ say so and do not author `.play` from memory.
28
+ Edit code here only for infrastructure, clients, adapters, Screenplay code
29
+ attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
30
+ never edit Stage-managed output.
31
+
19
32
  ## Verified product sources
20
33
 
21
34
  This skill is verified against these exact sources:
@@ -220,19 +233,6 @@ is expected, since the prior generation records history rather than new intent.
220
233
  | Splitting one event into two inside `Upcast` | a migration produces one event; model a split as a reactor or a command |
221
234
  | Adding a new generation for a renamed enum member | not needed; only removal or renumbering requires one |
222
235
 
223
- ## Route near misses
224
-
225
- - An accepted `.play` model under the model root covers the behavior, or the
226
- repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
227
- `mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
228
- output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
229
- `cratis-screenplay-modeling-lifecycle`): change the model first with
230
- `cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
231
- say so and do not author `.play` from memory.
232
- Edit code here only for infrastructure, clients, adapters, Screenplay code
233
- attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
234
- never edit Stage-managed output.
235
-
236
236
  ## Verify
237
237
 
238
238
  - The current record carries the bumped `[EventType(generation: N)]`.
@@ -18,7 +18,7 @@ contract is unverified, so every tool and prompt remains evidence-blocked.
18
18
  Read the generated classifications before answering:
19
19
 
20
20
  - [Observational guidance](references/observational-tools.md) records subjects
21
- admitted for bounded read-only guidance. It is currently empty.
21
+ admitted for bounded read-only guidance. The admitted observational inventory is empty.
22
22
  - [Blocked guidance](references/blocked-tools.md) records the deny-all boundary.
23
23
 
24
24
  Do not invoke, simulate, install, configure, or provide an invocation payload
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-chronicle-projection
3
- description: Add Chronicle projection behavior to an existing read model - model-bound attributes first, the fluent IProjectionFor<T> builder when they cannot express the shape. Covers AutoMap, keys, children and nested types, counters, event-sequence selection, variants ([VariantOf<T>]/.VariantOf<T>() and [EntersOn<T>]/.EntersOn<T>()) for an entity with mutually exclusive lifecycle shapes such as a work item that is a backlog entry then a pull request then closed, and the startup-crash traps. Use when populating a read model from events; do not use to create the read model and its query surface, and do not reach for a reducer before exhausting these options.
3
+ description: Add Chronicle projection behavior to an existing read model - model-bound attributes first, the fluent IProjectionFor builder when they cannot express the shape. Covers AutoMap, keys, children and nested types, counters, event-sequence selection, variants (VariantOf and EntersOn, as attributes or fluent calls) for an entity with mutually exclusive lifecycle shapes such as a work item that is a backlog entry then a pull request then closed, and the startup-crash traps. Use when populating a read model from events; do not use to create the read model and its query surface, and do not reach for a reducer before exhausting these options.
4
4
  license: MIT
5
5
  ---
6
6
 
@@ -26,6 +26,15 @@ Reverify product sources before claiming support for another version.
26
26
  > target needs no `[ReadModel]` at all — that attribute is what gives it an Arc
27
27
  > query surface.
28
28
 
29
+ ## What makes a type a model-bound projection
30
+
31
+ Chronicle treats a type as a model-bound projection when the class, its primary
32
+ constructor parameters, or its public instance properties carry an
33
+ `[EventSequence]` attribute or any projection annotation — **except
34
+ `[Passive]`**, which is deliberately excluded. `[Passive]` on its own therefore
35
+ does not make a read model a projection; it changes how an existing projection
36
+ is registered.
37
+
29
38
  ## Model-bound projections — the default
30
39
 
31
40
  Put the projection on the read model with attributes. No separate class.
@@ -47,7 +56,7 @@ except inside a scope where you disabled it.
47
56
  `[Key]` is `Cratis.Chronicle.Keys.KeyAttribute`. It has no arguments and targets
48
57
  a property or a record constructor parameter, never the class.
49
58
 
50
- Read [references/model-bound-attributes.md](references/model-bound-attributes.md)
59
+ When authoring a model-bound projection, read [references/model-bound-attributes.md](references/model-bound-attributes.md)
51
60
  for the complete attribute list with exact arities, parameter names, and valid
52
61
  targets. Two things there are worth knowing before you write anything:
53
62
 
@@ -78,7 +87,7 @@ public class <ReadModelName>Projection : IProjectionFor<<ReadModelName>>
78
87
  the interface** — do not add one. Use `[Projection(id: "<id>")]` when the
79
88
  identity must be explicit.
80
89
 
81
- Read [references/fluent-builder.md](references/fluent-builder.md) for the real
90
+ When attributes cannot express the shape and you use the fluent builder, read [references/fluent-builder.md](references/fluent-builder.md) for the real
82
91
  member list. The trap that costs the most time: **`UsingKey`, `UsingParentKey`,
83
92
  `UsingCompositeKey`, and `UsingConstantKey` are not on the projection builder.**
84
93
  They live on the per-event builder that `From<TEvent>` hands to your callback.
@@ -171,7 +180,7 @@ join, so an out-of-order or replayed event can never resurrect a variant the
171
180
  entity has since left. A variant that declares no entering event at all throws
172
181
  `VariantMustDeclareEntersOnEvent` at startup.
173
182
 
174
- Read [references/variants.md](references/variants.md) for the complete group
183
+ When declaring a variant group or shared variant mappings, read [references/variants.md](references/variants.md) for the complete group
175
184
  declaration, the update-only reclassification in full, `[GlobalFor<T>]` rules
176
185
  and its declaration-error trap, and best practices for picking an identity
177
186
  type.
@@ -1,5 +1,15 @@
1
1
  # The fluent projection builder
2
2
 
3
+ ## Contents
4
+
5
+ - The interfaces
6
+ - `IProjectionBuilderFor<TReadModel>` — its own members
7
+ - Inherited from `IProjectionBuilder<TReadModel, TBuilder>`
8
+ - Keys live on the per-event builder
9
+ - `Set(...).To(...)`
10
+ - When the fluent form is the only option
11
+ - AutoMap default
12
+
3
13
  Verified against `Cratis.Chronicle` `18.3.0`, namespace
4
14
  `Cratis.Chronicle.Projections`.
5
15
 
@@ -1,5 +1,18 @@
1
1
  # Model-bound projection attributes
2
2
 
3
+ ## Contents
4
+
5
+ - Namespaces that are not `Projections.ModelBound`
6
+ - Source and shape
7
+ - Setting values
8
+ - Counters
9
+ - Variants
10
+ - Relationships
11
+ - Source selection
12
+ - Labels, not filters
13
+ - What makes a type a model-bound projection
14
+ - AutoMap
15
+
3
16
  Verified against `Cratis.Chronicle` `18.3.0`.
4
17
 
5
18
  Unless noted, every attribute below lives in
@@ -116,12 +129,7 @@ for reducers and reactors.
116
129
 
117
130
  ## What makes a type a model-bound projection
118
131
 
119
- Chronicle treats a type as a model-bound projection when the class, its primary
120
- constructor parameters, or its public instance properties carry an
121
- `[EventSequence]` attribute or any projection annotation — **except
122
- `[Passive]`**, which is deliberately excluded. `[Passive]` on its own therefore
123
- does not make a read model a projection; it changes how an existing projection
124
- is registered.
132
+ See "What makes a type a model-bound projection" in SKILL.md.
125
133
 
126
134
  ## AutoMap
127
135
 
@@ -1,5 +1,14 @@
1
1
  # Variants — mutually exclusive read models for one entity
2
2
 
3
+ ## Contents
4
+
5
+ - Declaring a group — model-bound
6
+ - Declaring a group — fluent (`IProjectionFor<T>`)
7
+ - Only the entering event can create a variant
8
+ - Sharing handlers across variants
9
+ - Startup-crash trap
10
+ - Best practices
11
+
3
12
  Verified against `Cratis.Chronicle` `19.1.0` (first version carrying this
4
13
  feature; the skill's own baseline in `SKILL.md` is `18.3.0` — variants need at
5
14
  least `19.1.0`).
@@ -348,23 +348,9 @@ whole observer.
348
348
 
349
349
  ### Domain failures must leave a visible state
350
350
 
351
- A recorded failure fact is not complete handling if the user-facing workflow
352
- still looks running indefinitely. Give each terminal failure a reliable owner
353
- that transitions the affected attempt/workflow promptly to failed, retryable, or
354
- another explicit outcome, and project a safe reason for the reader. Keep secrets
355
- and raw provider payloads out of public failure details.
356
-
357
- This is an application reliability convention, **not** a requirement for a
358
- separate failure reactor. An existing reliable state machine that consumes the
359
- failure event and owns the transition is sufficient; adding another consumer can
360
- race or duplicate it. Add a reactor only when the transition/effect has no owner.
361
- Use a watchdog for missing signals or lost work, not as the normal consumer of a
362
- failure already known. Distinguish domain failure from an observer partition
363
- failure: the latter also needs operational monitoring and recovery.
364
-
365
- Specify failure-to-visible-state, repeated delivery, stale failure from an older
366
- attempt, and recovery/retry behavior. Prove the normal failure transition without
367
- waiting for the watchdog timeout.
351
+ A recorded failure fact is not complete handling while the user-facing workflow still looks running. Give each terminal failure a reliable owner that moves the workflow to an explicit failed or retryable state; do not add a failure reactor when a state machine already owns the transition.
352
+
353
+ Read [references/domain-failures.md](references/domain-failures.md) when handling a domain failure event or deciding whether a failure needs its own reactor or watchdog.
368
354
 
369
355
  ## Keep the reactor stateless
370
356
 
@@ -375,37 +361,9 @@ when they serve that concern.
375
361
 
376
362
  ## Specifications
377
363
 
378
- Start with `Specification` plus a direct call for pure reactor decisions,
379
- passing the trigger and supplied values explicitly and asserting the returned
380
- command or event. Add `ReactorScenario<TReactor>` only where invocation,
381
- dependency wiring or side effects contribute proof. In those scenarios, drive
382
- events with a service provider of substitutes and assert on the substitutes for
383
- non-event side effects; for handlers that return events, assert the resulting
384
- appends through the scenario's event store. Cover the replay path separately
385
- when the reactor has `[OnceOnly]` or `[Replay]` handlers.
386
-
387
- Specify the contract, not only the happy path:
388
-
389
- - **Field lineage.** For each returned command or event, a specification asserts
390
- every field value against the trigger event, the injected read model, or the
391
- mapping the contract states. Use distinct values per source so a swapped or
392
- defaulted field fails.
393
- - **Contract-authorized filtering.** A reactor skips an event only for a
394
- condition the contract states. Give each stated condition a specification
395
- that shows the skip, and one showing the neighbouring case that does act. Do
396
- not add a skip nobody specified.
397
- - **Repeated delivery.** Recovery re-delivers the same event even with
398
- `[OnceOnly]`, so specify what the reactor does the second time (one effect, an
399
- idempotent write, or a receipt keyed by `ReactorDelivery`). The scenario gives
400
- every event it delivers its own sequence number, so firing the same event twice
401
- through `Given` is two deliveries, not a re-delivery; to prove the
402
- re-delivery guard, call the handler twice with the same `ReactorDelivery`, or
403
- assert it on the collaborator that holds the receipt.
404
- - **Unrelated events.** `WithStrictEventSubscription()` belongs to
405
- `ReadModelScenario<T>` and only fails a specification that *seeds* an event the
406
- projection does not subscribe to; it does not prove a subscription set, and
407
- `ReactorScenario<T>` has no equivalent. For a reactor, show with a
408
- specification that an event outside its handlers causes no effect.
364
+ Start with `Specification` plus a direct call for pure reactor decisions; add `ReactorScenario<TReactor>` only where invocation, dependency wiring or side effects contribute proof. Specify the contract, not only the happy path: field lineage, contract-authorized filtering, repeated delivery, and unrelated events.
365
+
366
+ Read [references/specifications.md](references/specifications.md) when writing or reviewing reactor specifications.
409
367
 
410
368
  ## Verify
411
369
 
@@ -435,4 +393,4 @@ Specify the contract, not only the happy path:
435
393
 
436
394
  ## Lineage
437
395
 
438
- The specification checklist (field lineage, contract-authorized filtering, repeated delivery) follows an idea from Martin Dilger and Nebulit GmbH's reactor build checklist, credited in `references/provenance.md`.
396
+ The specification checklist (field lineage, contract-authorized filtering, repeated delivery) follows an idea from Martin Dilger and Nebulit GmbH's reactor build checklist, credited in `references/provenance.md`. Read `references/provenance.md` when checking checklist attribution or the verification sources for scenario behavior.
@@ -0,0 +1,19 @@
1
+ ## Domain failures must leave a visible state
2
+
3
+ A recorded failure fact is not complete handling if the user-facing workflow
4
+ still looks running indefinitely. Give each terminal failure a reliable owner
5
+ that transitions the affected attempt/workflow promptly to failed, retryable, or
6
+ another explicit outcome, and project a safe reason for the reader. Keep secrets
7
+ and raw provider payloads out of public failure details.
8
+
9
+ This is an application reliability convention, **not** a requirement for a
10
+ separate failure reactor. An existing reliable state machine that consumes the
11
+ failure event and owns the transition is sufficient; adding another consumer can
12
+ race or duplicate it. Add a reactor only when the transition/effect has no owner.
13
+ Use a watchdog for missing signals or lost work, not as the normal consumer of a
14
+ failure already known. Distinguish domain failure from an observer partition
15
+ failure: the latter also needs operational monitoring and recovery.
16
+
17
+ Specify failure-to-visible-state, repeated delivery, stale failure from an older
18
+ attempt, and recovery/retry behavior. Prove the normal failure transition without
19
+ waiting for the watchdog timeout.
@@ -0,0 +1,33 @@
1
+ ## Specifications
2
+
3
+ Start with `Specification` plus a direct call for pure reactor decisions,
4
+ passing the trigger and supplied values explicitly and asserting the returned
5
+ command or event. Add `ReactorScenario<TReactor>` only where invocation,
6
+ dependency wiring or side effects contribute proof. In those scenarios, drive
7
+ events with a service provider of substitutes and assert on the substitutes for
8
+ non-event side effects; for handlers that return events, assert the resulting
9
+ appends through the scenario's event store. Cover the replay path separately
10
+ when the reactor has `[OnceOnly]` or `[Replay]` handlers.
11
+
12
+ Specify the contract, not only the happy path:
13
+
14
+ - **Field lineage.** For each returned command or event, a specification asserts
15
+ every field value against the trigger event, the injected read model, or the
16
+ mapping the contract states. Use distinct values per source so a swapped or
17
+ defaulted field fails.
18
+ - **Contract-authorized filtering.** A reactor skips an event only for a
19
+ condition the contract states. Give each stated condition a specification
20
+ that shows the skip, and one showing the neighbouring case that does act. Do
21
+ not add a skip nobody specified.
22
+ - **Repeated delivery.** Recovery re-delivers the same event even with
23
+ `[OnceOnly]`, so specify what the reactor does the second time (one effect, an
24
+ idempotent write, or a receipt keyed by `ReactorDelivery`). The scenario gives
25
+ every event it delivers its own sequence number, so firing the same event twice
26
+ through `Given` is two deliveries, not a re-delivery; to prove the
27
+ re-delivery guard, call the handler twice with the same `ReactorDelivery`, or
28
+ assert it on the collaborator that holds the receipt.
29
+ - **Unrelated events.** `WithStrictEventSubscription()` belongs to
30
+ `ReadModelScenario<T>` and only fails a specification that *seeds* an event the
31
+ projection does not subscribe to; it does not prove a subscription set, and
32
+ `ReactorScenario<T>` has no equivalent. For a reactor, show with a
33
+ specification that an event outside its handlers causes no effect.
@@ -24,8 +24,8 @@ This skill is verified against these exact sources:
24
24
  | Package | Version | Purpose |
25
25
  | --- | --- | --- |
26
26
  | `Cratis.Chronicle` | `18.3.0` | `Cratis.Chronicle.Events`, `Cratis.Chronicle.Keys`, `Cratis.Chronicle.ReadModels` |
27
- | `Cratis.Arc.Core` | current | `Cratis.Arc.Queries.ModelBound.ReadModelAttribute` and `PathAttribute` |
28
- | `Cratis.Arc.MongoDB` | current | the `Observe` family of `IMongoCollection<T>` extensions |
27
+ | `Cratis.Arc.Core` | `22.16.0` | `Cratis.Arc.Queries.ModelBound.ReadModelAttribute` and `PathAttribute` |
28
+ | `Cratis.Arc.MongoDB` | `22.16.0` | the `Observe` family of `IMongoCollection<T>` extensions |
29
29
 
30
30
  Reverify product sources before claiming support for another version. Confirm
31
31
  the exact Arc package version in the consuming project before citing one.
@@ -1,5 +1,16 @@
1
1
  # Read-model queries
2
2
 
3
+ ## Contents
4
+
5
+ - Where the pieces live
6
+ - Discovery rules
7
+ - Snapshot queries
8
+ - Observable queries
9
+ - The `Observe` family — exact signatures
10
+ - Cost and composition
11
+ - Custom routes
12
+ - Reading without a query surface
13
+
3
14
  Verified against `Cratis.Arc.Core` and `Cratis.Arc.MongoDB` as checked out
4
15
  alongside `Cratis.Chronicle` `18.3.0`. Confirm the exact Arc package version in
5
16
  the consuming project before citing one.
@@ -204,6 +204,7 @@ one, derive it from the projection and say so. Then check each line:
204
204
  ## Lineage
205
205
 
206
206
  Step 6 is adapted in our own words from ideas recorded in `references/provenance.md`.
207
+ Read `references/provenance.md` when checking attribution or the origin of Step 6’s coverage inventory.
207
208
 
208
209
  ## What breaks
209
210
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-chronicle-reducer
3
- description: Write a Chronicle IReducerFor<T> when model-bound projection attributes and the fluent IProjectionFor<T> builder cannot express a read-model state transition. Covers the admission test, the exact accepted method signatures, the nullable-current requirement, deletion, passivity and event filtering. Use only after the projection options are genuinely exhausted; do not use for ordinary event-to-property mapping.
3
+ description: Write a Chronicle IReducerFor reducer when model-bound projection attributes and the fluent IProjectionFor builder cannot express a read-model state transition. Covers the admission test, the exact accepted method signatures, the nullable-current requirement, deletion, passivity and event filtering. Use only after the projection options are genuinely exhausted; do not use for ordinary event-to-property mapping.
4
4
  license: MIT
5
5
  ---
6
6