@cratis/pi 8.7.0 → 8.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +1 -1
  2. package/package/corpus/skills/cratis-arc-host-application/SKILL.md +2 -2
  3. package/package/corpus/skills/cratis-arc-host-application/references/csharp-availability.md +1 -0
  4. package/package/corpus/skills/cratis-arc-migrate-relational-schema/SKILL.md +2 -0
  5. package/package/corpus/skills/cratis-arc-migrate-relational-schema/references/provenance.md +11 -0
  6. package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +4 -0
  7. package/package/corpus/skills/cratis-arc-testing-typescript/SKILL.md +1 -1
  8. package/package/corpus/skills/cratis-arc-testing-typescript/references/typescript.md +17 -0
  9. package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +8 -5
  10. package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +42 -0
  11. package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +66 -2
  12. package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +62 -5
  13. package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +1 -1
  14. package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +52 -3
  15. package/package/corpus/skills/cratis-chronicle-connect-application/references/go.md +1 -1
  16. package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +1 -1
  17. package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +1 -1
  18. package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +7 -1
  19. package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +4 -0
  20. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/provenance.md +15 -0
  21. package/package/corpus/skills/cratis-chronicle-react-to-fact/references/typescript.md +1 -1
  22. package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +1 -0
  23. package/package/corpus/skills/cratis-code-review/SKILL.md +1 -0
  24. package/package/corpus/skills/cratis-components-choose-control/SKILL.md +1 -1
  25. package/package/corpus/skills/cratis-components-choose-control/references/typescript-common.md +1 -1
  26. package/package/corpus/skills/cratis-components-submit-form/SKILL.md +2 -2
  27. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +2 -2
  28. package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +11 -1
  29. package/package/corpus/skills/cratis-components-theme-application/SKILL.md +1 -1
  30. package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +2 -0
  31. package/package/corpus/skills/cratis-event-model-diagram/references/provenance.md +16 -0
  32. package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +3 -1
  33. package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +2 -0
  34. package/package/corpus/skills/cratis-modeling-design-event-model/LICENSE +18 -0
  35. package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +9 -4
  36. package/package/corpus/skills/cratis-modeling-design-event-model/references/modeling-discipline.md +71 -0
  37. package/package/corpus/skills/cratis-modeling-design-event-model/references/provenance.md +39 -0
  38. package/package/corpus/skills/cratis-modeling-discover-timeline/LICENSE +14 -0
  39. package/package/corpus/skills/cratis-modeling-discover-timeline/SKILL.md +8 -2
  40. package/package/corpus/skills/cratis-modeling-discover-timeline/references/discovery-questions.md +28 -0
  41. package/package/corpus/skills/cratis-modeling-discover-timeline/references/provenance.md +22 -0
  42. package/package/corpus/skills/cratis-modeling-discover-timeline/references/story-retelling.md +66 -0
  43. package/package/corpus/skills/cratis-modeling-review-event-model/LICENSE +17 -0
  44. package/package/corpus/skills/cratis-modeling-review-event-model/SKILL.md +11 -0
  45. package/package/corpus/skills/cratis-modeling-review-event-model/references/business-review.md +58 -0
  46. package/package/corpus/skills/cratis-modeling-review-event-model/references/event-log-hygiene.md +1 -1
  47. package/package/corpus/skills/cratis-modeling-review-event-model/references/provenance.md +15 -0
  48. package/package/corpus/skills/cratis-modeling-review-event-model/references/resilience-review.md +27 -2
  49. package/package/corpus/skills/cratis-modeling-review-event-model/references/structural-shapes.md +33 -0
  50. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/LICENSE +11 -0
  51. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/SKILL.md +19 -15
  52. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/provenance.md +18 -0
  53. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/reading-lenses.md +76 -0
  54. package/package/corpus/skills/cratis-modeling-trace-existing-behavior/references/resuming-a-trace.md +12 -0
  55. package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +2 -0
  56. package/package/corpus/skills/cratis-platform-deliver-slice/references/provenance.md +16 -0
  57. package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +1 -1
  58. package/package/corpus/skills/cratis-screenplay-handoff-slice/SKILL.md +2 -0
  59. package/package/corpus/skills/cratis-screenplay-handoff-slice/references/provenance.md +18 -0
  60. package/package/corpus/skills/cratis-screenplay-model-automation/LICENSE +14 -0
  61. package/package/corpus/skills/cratis-screenplay-model-automation/SKILL.md +8 -4
  62. package/package/corpus/skills/cratis-screenplay-model-automation/references/provenance.md +25 -0
  63. package/package/corpus/skills/cratis-screenplay-model-automation/references/reaction-boundaries.md +2 -2
  64. package/package/corpus/skills/cratis-screenplay-model-automation/references/statemachines-and-workflows.md +3 -1
  65. package/package/corpus/skills/cratis-screenplay-model-automation/references/to-do-lists.md +186 -0
  66. package/package/corpus/skills/cratis-screenplay-model-interaction/LICENSE +14 -0
  67. package/package/corpus/skills/cratis-screenplay-model-interaction/SKILL.md +16 -12
  68. package/package/corpus/skills/cratis-screenplay-model-interaction/references/provenance.md +42 -0
  69. package/package/corpus/skills/cratis-screenplay-model-interaction/references/screen-design.md +212 -0
  70. package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +3 -1
  71. package/package/corpus/skills/cratis-screenplay-model-translation/references/provenance.md +14 -0
  72. package/package/corpus/skills/cratis-screenplay-model-translation/references/webhook-contract.md +22 -0
  73. package/package/corpus/skills/cratis-screenplay-recover-intent/LICENSE +11 -0
  74. package/package/corpus/skills/cratis-screenplay-recover-intent/SKILL.md +3 -0
  75. package/package/corpus/skills/cratis-screenplay-recover-intent/references/provenance.md +16 -0
  76. package/package/corpus/skills/cratis-screenplay-recover-intent/references/running-system.md +5 -2
  77. package/package/corpus/skills/cratis-screenplay-specify-outcome/LICENSE +13 -0
  78. package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +10 -5
  79. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/case-questions.md +1 -1
  80. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/coverage-worksheet.md +23 -0
  81. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/provenance.md +15 -0
  82. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenario-discipline.md +126 -0
  83. package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenario-narrative.md +61 -0
  84. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +2 -0
  85. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +18 -0
  86. package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
  87. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +9 -1
  88. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-query-scenario.md +31 -0
  89. package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +15 -0
  90. package/package/corpus/skills/cratis-specifications-exercise-backend/references/provenance.md +15 -0
  91. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
  92. package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +38 -0
  93. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ # Provenance
2
+
3
+ This skill uses material from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://nebulit.de), with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them.
4
+
5
+ Source repository: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`. Skill paths are relative to `eventmodelers-cli/stacks/`.
6
+
7
+ | Source | Idea used | Form |
8
+ |---|---|---|
9
+ | `supabase/templates/.claude/skills/build-webhook` | An inbound webhook verifies the provider's own signature, because the provider cannot obtain an application token. | idea |
10
+ | `supabase/templates/.claude/skills/build-webhook` | The endpoint contract is written for an integrator who cannot read the code: path, payload fields, authentication header and responses, with examples taken from the model only. | idea |
11
+
12
+ An earlier version of this corpus carried the same two ideas in `cratis-screenplay-automations-and-translations`, under the same consent.
13
+
14
+ Not adopted: the function registration, configuration and local-serve mechanics; the OpenAPI block and its type table; generating an identifier when the caller omits one (it breaks the retry identity); the status codes of that stack.
@@ -0,0 +1,22 @@
1
+ # Contract of an inbound webhook
2
+
3
+ Use this when an inbound translation captures records with `source webhook`.
4
+
5
+ ## Verify the provider before capture
6
+
7
+ The adapter that receives the request verifies the provider's own signature or shared secret before it hands a record to the capture. A provider cannot obtain an application user token, so never ask for one.
8
+
9
+ `source webhook` and `path` describe the source. They do not enforce the signature check, the ownership check or the payload shape. Each of those is a requirement on the adapter, with a negative case that asserts no append.
10
+
11
+ ## Publish the endpoint contract
12
+
13
+ The provider's integrator cannot read this codebase. Write the contract of the endpoint for that reader:
14
+
15
+ - **Path.** The route named by `path` in the capture.
16
+ - **Payload.** Exactly the fields the capture's record declares, with their types and which are required. Take examples from the model only; never invent one.
17
+ - **Authentication.** The name of the signature header or the shared secret the provider sends.
18
+ - **Responses.** One for an accepted record, one for a duplicate delivery and one for each refusal. Answer a duplicate delivery as already handled.
19
+
20
+ Keep the provider's occurrence or delivery id as the retry identity. A new id for each delivery defeats deduplication.
21
+
22
+ Keep the contract in the slice's `documentation` block, so it changes with the model.
@@ -0,0 +1,11 @@
1
+ Copyright (c) Cratis. All rights reserved.
2
+ Licensed under the MIT license. See LICENSE file in the canonical Cratis/AI repository for the full license text.
3
+
4
+ Third-party notices
5
+
6
+ The bounded live walk in `references/running-system.md` adapts material from the Eventmodelers
7
+ Build-Kits skills by Martin Dilger and Nebulit GmbH
8
+ (https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits; https://nebulit.de), used with the
9
+ explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to
10
+ Martin Dilger and Nebulit GmbH. The upstream skill and the ideas taken from it are listed in
11
+ `references/provenance.md`.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: cratis-screenplay-recover-intent
3
3
  description: Use when recovering candidate intent for an inherited application from a recording, screenshots, an authorized bounded walk or product documentation without treating the evidence as accepted intent. Not for recovering a model from source code, captured requests or shipped artifacts (use cratis-modeling-trace-existing-behavior), deciding an unsupported rule (use cratis-modeling-discover-timeline) or accepting the model (use cratis-screenplay-accept-model).
4
+ license: LICENSE
4
5
  compatibility: Requires the Screenplay CLI. The Cratis CLI is needed for namespace comparison and the Stage sandbox; the Screenplay MCP server is needed to edit model notes.
5
6
  ---
6
7
 
@@ -174,3 +175,5 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
174
175
  - `cratis-modeling-discover-timeline`: settle open questions with the domain owner before encoding new rules.
175
176
  - `cratis-screenplay-edit-workspace`: notes proposals, identity state and workspace editing.
176
177
  - `cratis-chronicle-cli-operations`: operator-side reading of event stores and namespaces.
178
+
179
+ Read [provenance](references/provenance.md) when checking attribution.
@@ -0,0 +1,16 @@
1
+ # Provenance
2
+
3
+ The practices below come from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`; https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH. They are expressed here as evidence for a Screenplay candidate; the upstream board, screen-upload and build-kit mechanics are not used. The notice is in `LICENSE`.
4
+
5
+ | Source (upstream skill path) | Idea used | Where | Form |
6
+ | --- | --- | --- | --- |
7
+ | `eventmodelers-cli/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md` | Start at the entry and reach each later state by an action; walk one state at a time | `running-system.md`, Bounded live walk | close adaptation |
8
+ | same | The order of what to do next (main sections, the main action, a form with example values, the state that follows) and the skip list (sign-out, external links, destructive actions, administration) | `running-system.md`, Bounded live walk | close adaptation |
9
+ | same | Describe each state three ways: what it shows, how the person got there, what can be done from it, phrased as intent | `running-system.md`, Bounded live walk | close adaptation |
10
+ | same | Capture before and after states; what counts as a new state; one page of a paged list; systematic, not exhaustive | `running-system.md`, Bounded live walk | close adaptation |
11
+ | same | Group the states into journeys of three to twelve; a failed state does not end the walk; a closing account of what was walked | `running-system.md`, Bounded live walk | close adaptation |
12
+ | same | A budget of states and stopping when no new state appears | `running-system.md`, Bounded live walk; `SKILL.md`, Safety and authority | idea |
13
+
14
+ Not taken from `discover-storyboard`: stopping the whole task when no browser tool is available (here it blocks only this evidence source), filling in credentials seen in an address (never guessed or reused here), rebuilding each page as markup (a reconstruction is not evidence), and sign-in or form submission without approval.
15
+
16
+ This skill succeeds the earlier `cratis-screenplay-legacy-extraction` skill, whose credit to Martin Dilger and Nebulit GmbH it carries forward.
@@ -17,11 +17,14 @@
17
17
  Walk one state at a time: open, read, decide the next action.
18
18
 
19
19
  - **Not a gate.** Ask once whether a running instance and a test account exist, then continue with source, documents and people. Without browser tools or access, name what is missing and which evidence it blocks; do not install tools to fill the gap. When access arrives, the walk confirms or corrects what was already derived.
20
+ - **Start at the entry.** Open the agreed start address first and describe that state before acting; it was reached by the initial load. Reach every later state by an action a participant can take from a state already described, so each one has a known way in. Do not open a later screen by its address to save steps.
20
21
  - **What to do next.** Follow the agreed journey closely. With no journey named, visit each main section once, then the main action on the current screen, then a form with approved example values, then the screen that follows. Never submit a form just to see what happens.
21
22
  - **What counts as a state.** A new address, or a major change on the same one: a dialog opens, a form is submitted, a refusal appears. Tell states apart by actor, journey and what is visible, because one address can show a refusal, a dialog and a completion. A tooltip, an opened menu or a spinner is not a state.
22
- - **Sample, do not exhaust.** Follow paging to one example page and sample a repeated layout once unless its differences answer a question. Skip sign-out, external links, destructive actions and administration unless they are in scope.
23
- - **Describe each state three ways:** what it shows, how the participant got there ("clicked New booking"), and what can be done from it, phrased as intent ("the receptionist can book a room") rather than as a label. Add the before and after difference with the exact refusal text, the command, view or event you read into it marked as inference, and the follow-up that would establish the rule or the cause.
23
+ - **Sample, do not exhaust.** Open one page of a paged list, never every page, and sample a repeated layout once unless its differences answer a question. Skip sign-out, external links, destructive actions and administration unless they are in scope.
24
+ - **Describe each state three ways:** what it shows, how the participant got there ("clicked New booking"), and what can be done from it, phrased as intent ("the receptionist can book a room") rather than as a label.
25
+ - **Capture before and after.** Describe the state before an approved action and the state after it as two states, such as the empty Bookings list and the list holding the new booking. The difference between them is the observation; a single after-state cannot show what the action changed. Add the exact refusal text, the command, view or event you read into it marked as inference, and the follow-up that would establish the rule or the cause.
24
26
  - **Stop** at the budget, at the journey's boundary, when no new state appears, or on unexpected production data, an access boundary or an unplanned change. Never guess credentials or reuse a token seen in an address. List the paths left unwalked; never call a walk exhaustive.
27
+ - **Group and account.** After the walk, group the states into journeys by actor and goal: one linear path is one journey, distinct sections are separate ones, and a journey usually holds three to twelve states. A state that fails to load or cannot be read does not end the walk: record it as failed and continue. Report per journey the states observed, skipped, blocked and failed against the budget.
25
28
 
26
29
  ## Documentation-only intake
27
30
 
@@ -0,0 +1,13 @@
1
+ Copyright (c) Cratis. All rights reserved.
2
+ Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ Third-party notices
5
+
6
+ This skill adapts material (the scenario questions, the rule that a scenario's rule lives in its
7
+ steps, the limit to business rules, the example-value practice, the coverage count and the
8
+ business narrative of a slice's scenarios) from the Eventmodelers Build-Kits skills by Martin
9
+ Dilger and Nebulit GmbH (https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits;
10
+ https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted
11
+ material remains credited to Martin Dilger and Nebulit GmbH.
12
+
13
+ See references/provenance.md for the list of adapted material.
@@ -2,6 +2,7 @@
2
2
  name: cratis-screenplay-specify-outcome
3
3
  description: Use when writing, fixing or running Given/When/Then specifications in a Screenplay .play model (command success and refusal, read-model and query results, reactions, clocks, triggers, captures, abilities, graphs, state machines, workflows) with `screenplay test`. Not for declaring the slice (use cratis-screenplay-declare-slice) or testing a running backend or rendered app (use cratis-specifications-exercise-backend or cratis-stage-run-sandbox).
4
4
  compatibility: Requires the Screenplay CLI.
5
+ license: LICENSE
5
6
  ---
6
7
 
7
8
  # Specify outcomes in Screenplay
@@ -20,17 +21,19 @@ compatibility: Requires the Screenplay CLI.
20
21
 
21
22
  A `specification` is a named, concrete scenario declared in the slice it checks, or in a `statemachine` or `workflow`. `given` lines set up history, state, the caller and the clock. A single `when` performs one action. `then` lines state the outcome: the new facts, the read-model or query state, the response, the invocations, or the refusal.
22
23
 
23
- `screenplay test` (or the read-only MCP `run-specifications` tool) binds the model to its executable semantic model and runs the selected executable specifications in memory. The default runner starts no Arc, Chronicle, database or network, and runs no attached code. A specification that calls a query implemented by a performer is omitted with informational diagnostic `PLAY0270`; it does not even appear as unsupported. Each selected scenario ends as one of:
24
+ `screenplay test` (or the read-only MCP `run-specifications` tool) binds the model to its executable semantic model and runs the selected executable specifications in memory. The default runner starts no Arc, Chronicle, database or network, and runs no attached code. A specification that calls a query implemented by a performer is omitted with informational `PLAY0270`; it does not appear as unsupported. Each selected scenario ends as one of:
24
25
 
25
26
  - **passed**: every stated outcome matched.
26
27
  - **failed**: the report shows expected and actual facts, state, response or rows, and each fixture value's origin.
27
28
  - **unsupported**: the scenario reached something the evaluator cannot execute, such as an opaque body, a policy predicate or a generated value nobody pinned. It reports a capability and a reason. An unsupported scenario never counts as a pass, and it never satisfies `then error`.
28
29
 
30
+ Read the [scenario discipline](references/scenario-discipline.md) before writing or reviewing one.
31
+
29
32
  A specification runs **only its own slice's** reactions, captures and outbound publications until no new facts remain. A command invoked in another slice is decided, and its refusal reaches `on refused`, but its events are not kept. Assert the handover with `then invokes`, not the other slice's events (`PLAY0285`).
30
33
 
31
34
  ## When to use it
32
35
 
33
- Use it to verify the slice's modeled command, read and automation contracts before implementation. Use `cratis-specifications-exercise-backend` for real execution (including races, once-only external effects and elapsed time), or `cratis-stage-run-sandbox` for the rendered application.
36
+ Use it to verify a slice's command, read and automation contracts before implementation. Use `cratis-specifications-exercise-backend` for real execution (including races, once-only external effects and elapsed time), or `cratis-stage-run-sandbox` for the rendered application.
34
37
 
35
38
  ## Default path: one success, one refusal, one view
36
39
 
@@ -52,7 +55,7 @@ command ScheduleWorkshop
52
55
  1. If more than one specification uses the same input, declare a typed `example` of it at slice level, next to the specifications.
53
56
  2. Write the accepted case. Put the action under `when`. Under `then <Event>`, state the destination with `for` and every required payload property.
54
57
  3. Write one refusal for each rule the slice promises. Override only the offending input on the `when` line and expect `then error "<the rule's message>"`.
55
- 4. Add `given` facts only for state that the decision actually reads.
58
+ 4. Add `given` facts only for state the decision reads.
56
59
  5. For the view, append the fact and assert both the read model and the query a caller would use.
57
60
  6. Run `screenplay test <model folder>` and require exit code `0` **and** a `passed` result for every intended scenario and case. Zero selected specifications can exit `0`; neither that nor a missing result proves coverage. To run one scenario, add `--filter <Module>.<Feature>.<Slice>.<Specification>`. Add `--format json` to check `results` by address in automation.
58
61
 
@@ -103,7 +106,7 @@ Every line belongs inside a `specification` unless it says otherwise. Value line
103
106
  ### Scenario structure
104
107
 
105
108
  - `specification <Name>`: in a slice, addressed `<Module>.<Feature>.<Slice>.<Name>`; in a `statemachine` or `workflow`, `<Declaration>.<Name>`; a slice's graph specification, `<Slice>.<Name>`.
106
- - `description "<text>"`, or a fenced `text` block: states the rule this scenario witnesses. It is report-only (informational `PLAY0270`).
109
+ - `description "<text>"`, or a fenced `text` block: states the rule this scenario witnesses. It is report-only (`PLAY0270`).
107
110
  - `file <path>`: the repository-relative file that realizes the specification.
108
111
  - `example <Name> : <Command | Event | ReadModel>`: a named, possibly partial fixture holding property values, an optional `for` and optional `generated` values. Declare it at slice, feature, module or document level.
109
112
  - Using an example: put its name where a type name would go in `given`, `given readmodel`, `when`, `when append`, `then` or `then readmodel`. One override can follow on the same line (`when Pottery seats = 0`); further overrides are indented. An override replaces the whole value. Examples cannot supply callers, clocks, query rows, responses, triggers or captures.
@@ -222,7 +225,7 @@ Write these inside the `statemachine` or `workflow`. The full process semantics
222
225
  - **Captures or translation slices:** see `cratis-screenplay-model-translation`.
223
226
  - **The runner reports unsupported.** Leave the outcome unverified and cover it at the first executable boundary; never weaken the assertion to get a pass. Embedding the evaluator to run supported attached bodies is C#-only; see Host body execution in your language reference.
224
227
  - **Finding cases with the owner:** ask the [case questions](references/case-questions.md).
225
- - **Handing off:** see [coverage worksheet](references/coverage-worksheet.md).
228
+ - **Handing off:** [coverage worksheet](references/coverage-worksheet.md); for a business reader, the [scenario narrative](references/scenario-narrative.md).
226
229
 
227
230
  Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed.
228
231
 
@@ -238,3 +241,5 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
238
241
 
239
242
  - `cratis-screenplay-declare-slice`: what these scenarios exercise.
240
243
  - `cratis-screenplay-model-automation`: reactions, state machines, workflows.
244
+
245
+ Read [provenance](references/provenance.md) when checking attribution.
@@ -12,7 +12,7 @@ Names are illustrative: a studio schedules workshops and guests book seats.
12
12
  | Which values would you refuse, and what would you tell the person? | One accepted and one refused example per rule, with the exact message. |
13
13
  | Who can reach this but must not do it? | A denial case per answer. If no gate refuses that caller, record a gap in the model instead of writing a case that cannot fail. |
14
14
  | After which earlier facts must this be refused? | State violations: booking a seat on a cancelled workshop, cancelling twice. These are the cases most often missed. |
15
- | What if it arrives twice? What if two people try at once, and what does the loser see? | Duplicate and competing-claim cases, and the promise the owner needs: once only, harmless repeat, or first one wins. |
15
+ | What if someone does this again when it is already done? What if two people want the last one, and what does the second see? | A repeated business action and a competing claim, each written as a sequence: the first action is a given fact, the second is the action. A request that is delivered twice or two callers racing is not a case here; see [scenario discipline](scenario-discipline.md). |
16
16
  | Which inputs change the result, and what happens on either side of the boundary? | Alternative paths, with a value just inside and just outside each limit. |
17
17
  | Can facts arrive late or out of order? What if the other party refuses or never answers? | Ordering and failure outcomes. Each is an outcome recorded as a fact, not an exception. |
18
18
  | Can this be undone, and what must undoing release? | Compensation. A reversal the business has and the model lacks is a missing event: stop and return to the model. |
@@ -21,3 +21,26 @@ Give each obligation exactly one disposition:
21
21
  | `BookSeat` command | `authorize CanBook` | Executed: `DenyingAGuest` passed |
22
22
  | `SeatsLeft` view | Join isolation | Not applicable: one row per workshop, no joins |
23
23
  | `SeatsLeft` view | `remove with WorkshopCancelled` leaves other workshops intact | Executed: `RemovingACancelledWorkshop` passed |
24
+
25
+ ## Count only meaningful cases
26
+
27
+ A row belongs in the worksheet only when the owner of the behavior would care that the case behaves as specified. Apply the same test to what exists and to what is missing:
28
+
29
+ - Do not add a row for a technical guarantee, and do not report one as missing. The list is in [scenario discipline](scenario-discipline.md).
30
+ - A specification that repeats another, or that can only pass, proves no additional row. Name one specification per row.
31
+ - A case that cannot occur in this business is **Not applicable**, with the reason.
32
+
33
+ ## Report coverage per slice
34
+
35
+ Report coverage for each slice as two counts:
36
+
37
+ - **Derived:** every row of the slice except those marked Not applicable.
38
+ - **Specified:** the derived rows marked Executed.
39
+
40
+ Write it as "4 of 5 cases specified". Open domain questions and target-engine gaps are derived and not specified. Never round up or leave a row out to improve the figure; it tells the owner what to specify next. A slice with no rule and one passing specification for its one outcome is 1 of 1.
41
+
42
+ For each derived row that is not specified, state the missing case in one short sentence each for the given facts, the action and the outcome, in the model's own names. Use a concrete value only when the model or the owner supplies it; leave a part out instead of guessing. List the most important first.
43
+
44
+ | Slice | Specified | Missing case |
45
+ | --- | --- | --- |
46
+ | `BookSeat` | 2 of 3 | Given a cancelled workshop, when a guest books a seat, then the booking is refused. Open domain question for the studio owner: with which message? |
@@ -0,0 +1,15 @@
1
+ # Provenance
2
+
3
+ Parts of this skill adapt work by Martin Dilger and Nebulit GmbH (https://nebulit.de), used with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them.
4
+
5
+ Source: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab0313e1f0d070c6f446b9b19c5890c7b5f423`, skills under `eventmodelers-cli/stacks/modeling-kit/templates/.claude/skills/`.
6
+
7
+ | Source skill | Idea used | Used in | Form |
8
+ | --- | --- | --- | --- |
9
+ | `eventmodeling-elaborating-scenarios/SKILL.md` (scenario types) | The questions that find the cases beyond one success and one failure: validation, state violation, repeated action, alternative path, external failure and compensation, with the number of cases decided by the domain | `case-questions.md` | Close adaptation. Extended with authorization, ordering and view questions |
10
+ | `eventmodeling-elaborating-scenarios/SKILL.md` (examples are the scenario; no bare steps) | A rule belongs in the steps and never only in a note; the state a rule reads is a given; a step is never left without its essential values | `scenario-discipline.md` (The rule lives in the steps) | Close adaptation. The note is the `description` of a specification, and a refusal names its message |
11
+ | `eventmodeling-elaborating-scenarios/SKILL.md` (values essential to the scenario) | Show the values the rule decides on, the identifier that links the steps and the asserted outcome, so a reader sees what the case turns on | `scenario-discipline.md` (Show only the deciding values) | Close adaptation. Screenplay requires every required property on a command or event step, so the other values move into a typed example instead of being left empty |
12
+ | `eventmodeling-elaborating-scenarios/SKILL.md` (business rules, not technical guarantees; error descriptions) | No scenarios for malformed fields, colliding identifiers, retried requests or infrastructure failures; a repeated business action is a case; the refusal reads as the user would read it | `scenario-discipline.md`, `case-questions.md` | Close adaptation. The message is declared on the rule and the specification asserts it exactly |
13
+ | `examples/SKILL.md` | Read the neighboring examples first, keep values short and from the domain, and never overwrite an existing example | `scenario-discipline.md` (Example values) | Idea. Generating example rows on a board is not adopted |
14
+ | `scenario-coverage/SKILL.md` | Count only meaningful cases, both existing and missing; coverage per slice is the meaningful cases specified out of those derived; state each missing case as given, action and outcome without guessing; never round up | `coverage-worksheet.md` | Close adaptation. Reported as two counts in the hand-off, not stored as a percentage on a board |
15
+ | `summarize-scenarios/SKILL.md` | One narrative per slice for a business reader: group instead of transcribing, order it as normal flow, rules, refusals and lifecycle, state each rule with its example, account for every scenario and keep open points out | `scenario-narrative.md` | Close adaptation. Delivered in the reply; kept in the slice's `documentation` only on request |
@@ -0,0 +1,126 @@
1
+ # Scenario discipline
2
+
3
+ ## Contents
4
+
5
+ - The rule lives in the steps
6
+ - Show only the deciding values
7
+ - Business rules, not technical guarantees
8
+ - Refusal messages in domain language
9
+ - Example values
10
+ - Check before reporting
11
+
12
+ Apply this to every specification you write or review. Names are illustrative: a studio schedules workshops and guests book seats. The command `BookSeat` reads the view `SeatsLeft` under `command reads protected` and refuses with "The workshop is full".
13
+
14
+ ## The rule lives in the steps
15
+
16
+ `description` is report-only: the runner never reads it. A rule stated only there is not checked, so put it in `given`, `when` and `then`.
17
+
18
+ This specification passes and proves nothing about seats:
19
+
20
+ ```play
21
+ specification RefusingAFullWorkshop
22
+ description "Robin cannot book Pottery basics because Sam took the only seat"
23
+ given caller as Attendee
24
+ when RobinBooks
25
+ then error
26
+ ```
27
+
28
+ No workshop exists in its history, so the command is refused because the view is missing, and a bare `then error` accepts any refusal other than an authorization denial. Move every fact of the description into a step:
29
+
30
+ ```play
31
+ example PotteryScheduled : WorkshopScheduled
32
+ for "11111111-1111-4111-8111-111111111111"
33
+ title = "Pottery basics"
34
+ seats = 12
35
+
36
+ specification RefusingAFullWorkshop
37
+ description "A workshop with no seats left takes no more bookings"
38
+ given PotteryScheduled seats = 1
39
+ given SeatBooked
40
+ for "11111111-1111-4111-8111-111111111111"
41
+ attendee = "Sam"
42
+ given caller as Attendee
43
+ when RobinBooks
44
+ then error "The workshop is full"
45
+ ```
46
+
47
+ - **State the rule reads** goes in a `given`: the facts that established it, or a seeded read model as the skill's "The decision reads state" entry describes. Leave the givens empty only for a first-ever action or an input refused whatever the history.
48
+ - **The values the rule decides on** go on the `when` step.
49
+ - **The outcome** goes in `then`: the expected fact or state with its values, or `then error "<message>"`. A refusal that witnesses a rule always names the message, because a bare `then error` cannot tell one refusal from another.
50
+ - **`description`** keeps only the rule as a general statement, which the values cannot show. Do not repeat values there.
51
+
52
+ Done when someone who reads only the steps, never the description, can say why the outcome follows.
53
+
54
+ ## Show only the deciding values
55
+
56
+ A value is deciding when changing it changes the outcome or breaks the link between the steps:
57
+
58
+ - the values the rule decides on (the one seat, the date on the wrong side of a deadline);
59
+ - the identifier that links the steps, written as the same literal in the givens, the action and the outcome;
60
+ - the asserted outcome.
61
+
62
+ Every other value hides the rule. Screenplay still requires some of them, so keep them out of sight instead of leaving them out:
63
+
64
+ | Step | What the language requires | How to show only the deciding values |
65
+ | --- | --- | --- |
66
+ | `given <Event>`, `when <Command>`, `when append <Event>`, `then <Event>` | Every required property, or the model does not bind (`PLAY0524`) | Carry the other values in a typed `example` and override the deciding value on the step: `given PotteryScheduled seats = 1` |
67
+ | `then readmodel`, `then query` `result` | Only the properties you state are compared | State the key and the properties the rule changes. Add `exactly` only when the absence of other properties is the promise |
68
+ | A record under `then returns` | Only the fields you state are compared, and at least one must be stated. There is no `exactly` form | State the fields the rule decides |
69
+ | `then invokes` | Only the values you state are compared | State the values the hand-over depends on |
70
+
71
+ Keep a deciding value on the step even when an example already holds the same value. In the specification above, `seats = 1` is the rule, so it is written on the `given` line.
72
+
73
+ ## Business rules, not technical guarantees
74
+
75
+ A case earns a specification when the owner of the behavior would recognize the rule and could argue about it. Each of these is a case:
76
+
77
+ - every rule the model declares with a message (`validate`, `require`, a constraint): one accepted and one refused example;
78
+ - a state that makes the action invalid: booking a seat in a cancelled workshop;
79
+ - a repeated business action: cancelling a workshop that is already cancelled, booking a guest who already has a seat;
80
+ - an authorization denial the model declares;
81
+ - a different valid outcome on either side of a limit;
82
+ - an answer or failure of another system that the model records as a fact;
83
+ - a reversal and what it releases.
84
+
85
+ Do not write a specification for a technical guarantee. It says nothing about the domain, and most of these cannot be proven here:
86
+
87
+ | Not a case | Why |
88
+ | --- | --- |
89
+ | A missing required value, or a value of the wrong type | Values are typed and a step without a required property does not bind. No rule decides anything |
90
+ | Two generated identifiers that collide | The scenario pins every generated value, so a collision is something you would construct, not a rule |
91
+ | The same request delivered twice, or retried after a timeout | A specification performs one action. Prove once-only handling with `cratis-specifications-exercise-backend` when the owner needs that promise |
92
+ | Two callers racing | The same: one action, in memory |
93
+ | A store, network or process failure | The reference runner starts none of them |
94
+
95
+ The test for a repeat: if the person did the business action again (pressed Cancel on a cancelled workshop), it is a case. If the transport delivered one action twice, it is not.
96
+
97
+ If a rule the owner states has no declaration in the model, do not write a specification that cannot fail. Record it as an open domain question in the [coverage worksheet](coverage-worksheet.md) and return to the model.
98
+
99
+ ## Refusal messages in domain language
100
+
101
+ `then error "<message>"` must equal the message the rule declares, so the wording is decided on the rule, not in the specification.
102
+
103
+ - The message is the reason as the person who is refused would read it: "The workshop is full".
104
+ - It names no identifier, type or internal name, and repeats no value from one example, because the same rule refuses every other input too.
105
+ - A rule with no message gets a default one. Add a `message` to the rule (`cratis-screenplay-declare-slice`) before you specify its refusal.
106
+ - A refusal the platform words itself, such as a protected read that finds no instance, is asserted with that wording as it stands.
107
+
108
+ ## Example values
109
+
110
+ 1. **Read first.** Before choosing a value, read the `example` declarations and specifications the slice already has, and those of the slice that owns each event you replay. In a model workspace, the `screenplay` server's `find-fixtures` tool lists the values in effect and where each comes from.
111
+ 2. **Reuse.** Use the same value for the same thing in every step and every neighboring slice: one workshop identifier, one attendee name. The scenarios then read as one story.
112
+ 3. **Never change an existing example to fit a new scenario.** Every specification that uses it inherits the change and may pass or fail for a new reason. Override the value on the step, or declare another example.
113
+ 4. **Keep values short and from the domain:** "Pottery basics", 12 seats, "Robin". No placeholders such as "test" or "foo". One value per property.
114
+ 5. **Take the type from the declaration,** never from the property's name. A `Uuid` value is a complete UUID literal.
115
+ 6. **Name an example for what it is** in the domain (`PotteryScheduled`, `RobinBooks`), never by number.
116
+
117
+ When you hand off, list the examples you added, the ones you reused and any existing value that contradicts another.
118
+
119
+ ## Check before reporting
120
+
121
+ - No specification has a rule that appears only in its `description`.
122
+ - No rule that depends on earlier facts has empty givens.
123
+ - Every refusal that witnesses a rule names its message.
124
+ - The deciding values are visible on the steps; the rest sit in examples.
125
+ - No specification covers a technical guarantee from the table above.
126
+ - No existing example was changed.
@@ -0,0 +1,61 @@
1
+ # Tell a slice's specifications to a business reader
2
+
3
+ Use this when someone who owns the behavior, and does not read `.play`, needs to confirm what a slice does: a review, a read-out or onboarding. The narrative retells what the specifications prove. It adds nothing they do not state.
4
+
5
+ Names are illustrative: a studio schedules workshops and guests book seats.
6
+
7
+ ## Before you write
8
+
9
+ 1. Run the slice's specifications. Tell only those that passed.
10
+ 2. Group them; do not retell them one by one:
11
+ - **Purpose:** what the slice is for, in one sentence.
12
+ - **Normal flow:** the specifications that end in a new fact or the expected view state.
13
+ - **Rules:** what each scenario's givens or input change about the outcome. Several scenarios that show one rule become one statement.
14
+ - **Refusals:** each refused or denied scenario, with its message.
15
+ - **Lifecycle:** how one thing moves through its states, taken from the view, state machine or workflow specifications in the order the facts happen.
16
+ 3. Keep only the deciding values (see [scenario discipline](scenario-discipline.md)): the one seat, the date past the deadline. Leave the rest out.
17
+
18
+ ## Write it
19
+
20
+ Use this order and omit a part the slice has nothing for:
21
+
22
+ ```markdown
23
+ ## Booking a seat
24
+
25
+ A guest books one seat in a scheduled workshop.
26
+
27
+ ### Normal flow
28
+ Robin books a seat in "Pottery basics", which has 12 seats. The booking is recorded and 11 seats are left.
29
+
30
+ ### Rules
31
+ - A seat may only be booked while the workshop has seats left. With one seat and Sam already booked, Robin's booking is refused.
32
+ - A guest must be signed in as an attendee to book.
33
+
34
+ ### What is refused
35
+ - Booking a full workshop: "The workshop is full".
36
+ - Booking without the attendee role: access is denied.
37
+
38
+ ### Lifecycle
39
+ A scheduled workshop shows its seats. Each booking takes one away. A cancelled workshop is no longer listed.
40
+ ```
41
+
42
+ - State each rule as a sentence the reader could repeat: "X must …" or "X may only … when Y". Put its example straight after it.
43
+ - Use the reader's words. Say "booking a seat", not `BookSeat`; "the list of workshops", not the read model's name. Leave out identifiers unless the reader uses them. Quote a refusal message exactly, because the reader will see it.
44
+ - Write in the language the reader uses. Keep a declared message in the language it is declared in.
45
+ - Write no "Scenario 1, Scenario 2", no Given/When/Then keywords and no specification names.
46
+
47
+ ## Account for every specification
48
+
49
+ List the slice's specification addresses and check each one off against a sentence of the narrative. A case table counts once per rule, not once per case.
50
+
51
+ A specification that did not pass, or that covers a technical guarantee, is not told. Report it beside the narrative with its address and the reason.
52
+
53
+ ## Keep open points out
54
+
55
+ The narrative states proven behavior only. A missing case, an unanswered question or a rule the owner doubts goes in the [coverage worksheet](coverage-worksheet.md) with an owner. A reader must be able to take every sentence of the narrative as true today.
56
+
57
+ ## Where it goes
58
+
59
+ Give the narrative to the reader in your reply or hand-off. It is derived text, so write it again whenever the specifications change.
60
+
61
+ Exception: when the owner asks to keep it with the model, store it as the slice's `documentation` block (a `markdown` fence, see `cratis-screenplay-declare-slice`). A slice takes one such block, so add the narrative to what the block already holds and, on a later run, replace only the narrative part. Run the specifications again afterwards; the block is report-only and changes no result.
@@ -151,3 +151,5 @@ Names here are illustrative. Model authoring uses the Screenplay DSL, not an app
151
151
  - Reconcile every rule found only in code or only in a description with the invariant table; mark a description-only promise as stated intent with an owner.
152
152
 
153
153
  For target admission use `cratis-stage-render-slice`; for a model acceptance review use `cratis-screenplay-accept-model`.
154
+
155
+ Read [provenance](references/provenance.md) when checking attribution.
@@ -0,0 +1,18 @@
1
+ # Provenance
2
+
3
+ This skill uses material from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://nebulit.de), with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them.
4
+
5
+ Source repository: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`. Skill paths are relative to `eventmodelers-cli/`.
6
+
7
+ Skill paths below are under `stacks/modeling-kit/templates/.claude/skills/`. The notice is in `LICENSE`, which also carries the TrogonStack/agentskills notice for the ownership interview, the interface inventory, the cross-boundary walkthrough and the event-by-event identity check.
8
+
9
+ | Source | Idea used | Where | Form |
10
+ |---|---|---|---|
11
+ | `eventmodeling-optimizing-stream-design` | Decide the identity first, then check every event against it; classify the result; a long history is not in itself a defect. | `references/stream-patterns.md`, Identity and event-membership review, Interpret the evidence | close adaptation |
12
+ | `eventmodeling-optimizing-stream-design`, `references/patterns.md` and `references/domain-patterns.md` | The boundary decision tree, the signs that the boundary rather than the volume is wrong, and identity patterns per domain. | `references/stream-patterns.md`, Boundary decision tree, Red flags, Boundary patterns by domain | close adaptation |
13
+ | `eventmodeling-core-rules` | Facts are immutable, no calculated events, every command has an explained origin, an open question is not a decided failure, fan-out is a signal, and thinking the work through offline first. | `references/stream-patterns.md`, Core rules that bear on stream design | close adaptation |
14
+ | `eventmodeling-applying-conways-law` and its `references/examples.md` | The ownership interview with follow-up triggers, the ownership and interface inventory, the responsibility matrix and ownership timeline, the boundary checklist, and treating a team and its system boundary as one lens. | `references/boundaries.md`, Ownership by design, Ownership interview, Ownership and interface inventory, Responsibility matrix and ownership timeline, Boundary checklist | close adaptation |
15
+
16
+ An earlier version of this corpus adapted the same material from the authors' agentic-engineer repository (https://github.com/Nebulit-GmbH/agentic-engineer, commit `07b0f30648d663cb588d7e2c7aa031af9dfc21f2`), under the same consent.
17
+
18
+ Not adopted: stream length thresholds and mandatory archival splits; the "no natural end" red flag, which contradicts long-lived identities; the claim that a team always equals a system, kept here as a hypothesis to test; board lanes, linked copies and the role catalog.
@@ -210,3 +210,5 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
210
210
  - `references/csharp-colocated.md`: read when a C# application project compiles its specs beside its slices instead of in a separate spec project (project setup, Release exclusion, how to run them).
211
211
 
212
212
  Python has no Cratis application SDK or testing kit: write the spec in the service that owns the command, query or event, and reach that behavior from Python only through the service's HTTP API.
213
+
214
+ Read [provenance](references/provenance.md) when checking attribution.
@@ -41,10 +41,18 @@ result.ShouldHaveConstraintViolation("UniqueCarrierName");
41
41
  | `Given.ForEventSource(id).Events(...)` | Seed history; awaited. A seeded event the log refuses throws `GivenEventAppendFailed` naming the violations, so a spec never runs against history it did not receive |
42
42
  | `When.ForEventSource(id).Events(first, ...)` | The act; returns `AppendResult` |
43
43
  | `EventLog` / `EventSequence` | The real client API over the in-memory store, for `Append`, `AppendMany`, `HasEventsFor` and the assertions below |
44
- | `ReadModels` | Read models materialized from the scenario's events |
44
+ | `ReadModels` | Read models folded from this scenario's own log: `GetInstanceById`, `GetInstances` and `Observe<T>()`. See the note below the table |
45
45
  | `Time` | The scenario clock, a `ScenarioTime` |
46
46
  | `Dispose()` | Release the scenario; use `using` or `Destroy` |
47
47
 
48
+ `scenario.ReadModels` is the surface to hand to code that depends on `IReadModels` and enumerates or observes. It reads only what was seeded or appended through this scenario (`Given`, `When`, `EventLog`).
49
+
50
+ - `await scenario.ReadModels.GetInstances<T>()` returns the collection folded from the log, and `GetInstanceById<T>(key)` one instance.
51
+ - `scenario.ReadModels.Observe<T>()` (import `System.Reactive.Linq` to subscribe) emits the collection on subscription and again after each successful append that changes it; an unchanged collection does not emit. Await a signal completed by the subscription, for example a `TaskCompletionSource` per expected emission, with a timeout. Never sleep before asserting. Dispose the subscription. Passive read models and event-target projections cannot be observed.
52
+ - To give an existing testing read-model surface this behaviour over a log you already hold, wrap it: `new ReadModelsForTesting(inner, eventLog)` (namespace `Cratis.Chronicle.Testing.ReadModels`). Take `inner` from the testing event store that owns that log, so its artifacts, explicit projections and services are kept.
53
+
54
+ This proves the fold and what the subscriber is handed. It does not prove kernel delivery or a sink's change notifications.
55
+
48
56
  ## Append-result assertions
49
57
 
50
58
  | Assertion | Passes when |
@@ -43,6 +43,37 @@ Both `Perform` and `Observe` take optional `paging` (`Paging`) and `sorting` (`S
43
43
 
44
44
  Events seeded through `Given.ForEventSource(id).Events(...)` run the application's own projection or reducer, including children and joins, so the query is proven against the model production would hold. After `Observe`, seed further events and await `observation.Next()` to prove the query pushes the changed model.
45
45
 
46
+ ## Observe what a command appends
47
+
48
+ A query scenario and a command scenario created independently have separate logs, so the observation never sees the command's appends and `Next()` times out. Share the command scenario's services and context with the query scenario before seeding or first using either one:
49
+
50
+ ```csharp
51
+ using Cratis.Arc.Chronicle.Testing.Commands;
52
+ using Cratis.Arc.Chronicle.Testing.Queries;
53
+ using Cratis.Arc.Testing.Commands;
54
+ using Cratis.Arc.Testing.Queries;
55
+
56
+ await using var commands = new CommandScenario<ChangeBalance>();
57
+ await using var queries = new QueryScenario<AccountBalance>();
58
+
59
+ foreach (var resource in queries.Context.Values.Distinct().OfType<IDisposable>()) resource.Dispose();
60
+ queries.Context.Clear();
61
+ queries.Services.Clear();
62
+ foreach (var service in commands.Services) queries.Services.Add(service);
63
+ foreach (var (key, value) in commands.Context) queries.Context[key] = value;
64
+ ```
65
+
66
+ Then seed with `queries.Given.ForEventSource(id).Events(...)`, open `await queries.Observe(...)`, run `await commands.Execute(...)` and assert the result of `await observation.Next()`.
67
+
68
+ State each prior event exactly once. After sharing, `queries.Given` and `commands.Given` write to the same seed store, and the observation also receives every successful append to the command's log, including events placed there with `commands.EventScenario.Given`. An event stated through two of those is folded twice, so counts and sums double.
69
+
70
+ | Mode | What the observation folds | Where a seed lands |
71
+ | --- | --- | --- |
72
+ | Default | The `Given` seeds plus the command log's successful appends | `Given` seeds feed injected read models and the observation, and never enter the command log |
73
+ | Decision | One log shared by seeds, commands and observation | `Given` seeds enter that log; `commands.EventScenario` throws |
74
+
75
+ `QueryScenario` has no decision-mode switch: the command scenario selects the mode and the shared query follows it.
76
+
46
77
  An observed query merges a row pinned with `.ReadModel(instance)` by its identifier: `[Key]`, then `[Subject]`, then a property named `Id`. A pinned instance without a readable identifier, or with a null one, cannot be merged. `scenario.Observe` does not throw for it: the failure arrives as a failed query result carrying the `PinnedReadModelCannotBeObserved` message. Where it arrives depends on when the instance was pinned:
47
78
 
48
79
  | Pinned | Failed result |
@@ -4,6 +4,7 @@
4
4
 
5
5
  - Setup
6
6
  - What to prove per slice type
7
+ - What a scenario does not prove
7
8
  - Default path: refuse an invalid command
8
9
  - Common mistakes
9
10
  - Command scenario
@@ -68,6 +69,20 @@ Each row lists the proofs a slice of that type needs; follow the link for how to
68
69
 
69
70
  A reactor that calls the command pipeline is not failed by an unsuccessful result unless its own code throws on it, so which results it throws on and which it tolerates is behaviour to prove.
70
71
 
72
+ ## What a scenario does not prove
73
+
74
+ Every scenario here runs in process. None of them proves observer delivery, storage in a real sink, transport or HTTP: those need a running kernel or the HTTP host ([csharp-integration.md](csharp-integration.md)). Beyond that, each scenario has its own limit and one combination to avoid.
75
+
76
+ | Scenario | It does not prove | Do not combine |
77
+ | --- | --- | --- |
78
+ | `CommandScenario` | That a query or subscription sees what the command appended. That needs a query scenario sharing its services and context: [csharp-query-scenario.md](csharp-query-scenario.md). | Seeds in two places for one fact. In default mode `Given` supplies injected read-model state and `EventScenario.Given` supplies log history. |
79
+ | `QueryScenario` | Anything about a command scenario created independently: the two have separate state, so waiting for the next emission times out. | The same event seeded through both `commands.Given` and `queries.Given` once the scenarios are shared: they write to one seed store and the observation folds both copies. Seed each event once. |
80
+ | `EventScenario` | That a projection, reducer or reactor was delivered the event by an observer. `ReadModels` folds the scenario's own log on each read. | Appends through `Defaults.Instance.EventStore` or another store: that is a different log, which this scenario's `ReadModels` never reads. |
81
+ | `ReadModelScenario` | Collection reads and subscriptions. It collects its input instead of appending it to a log, so its `ReadModels` serves only `GetInstanceById` for seeded instances. | `ReadModels.GetInstances` or `ReadModels.Observe` expecting the scenario's output: `Observe` throws `ReadModelCannotBeObserved` and `GetInstances` needs a running Chronicle. Assert through `Instance`, `Instances` or `InstanceForEventSourceId`. Hand code that enumerates or observes through `IReadModels` the `ReadModels` of an `EventScenario` instead ([csharp-events.md](csharp-events.md)). |
82
+ | `ReactorScenario` | That anything was sent, appended or executed. The default recorder records what the reactor returned; it does not append events, execute commands or call a registered `IReactorSideEffectHandler`. | An assertion on a gateway or a substitute behind a side-effect handler after a default-recorder run: it was never called. Assert `Produced` or `ShouldHaveProduced<T>`, and prove the effect in a spec of the handler or against a running kernel. |
83
+
84
+ A reactor that returns a custom type still needs an `IReactorSideEffectHandler` claiming that type registered in `scenario.Services`; without one, the scenario throws `InvalidReactorHandlerReturnType`. The registration only makes the return type legal: the recorder keeps the value and the handler does not handle it.
85
+
71
86
  ## Default path: refuse an invalid command
72
87
 
73
88
  Seed another registration so earlier history is distinguishable from this command’s work.
@@ -0,0 +1,15 @@
1
+ # Provenance
2
+
3
+ This skill uses ideas from the Eventmodelers Build-Kits skills by Martin Dilger and Nebulit GmbH (https://nebulit.de), with the explicit consent of Martin Dilger and Nebulit GmbH. The adapted material remains credited to them.
4
+
5
+ Source repository: https://github.com/Nebulit-GmbH/Eventmodelers-Build-Kits at commit `bfab031`. Skill paths are relative to `eventmodelers-cli/`.
6
+
7
+ | Source | Idea used | Where | Form |
8
+ |---|---|---|---|
9
+ | `stacks/classic` `build-state-change` and `build-automation` | Tests follow the contract: one per specification, so each rule has its own case. | `SKILL.md`, the rule to commit one spec per uncovered consequential rule | idea |
10
+ | `stacks/classic` and `stacks/kurrent` `build-automation` | Handling the same trigger again must not repeat the effect, and a test delivers it again to show that. | `SKILL.md`, Reactor scenario, Redeliver | idea |
11
+ | `stacks/classic` `build-state-view` | A view test asserts every contracted field against the expected values, and covers the empty result. | `references/csharp-read-models.md`, the case table | idea |
12
+
13
+ An earlier version of this corpus took these ideas, and the check that a view's item is removed by its ending event, from the same authors' agentic-engineer repository (https://github.com/Nebulit-GmbH/agentic-engineer, commit `07b0f30648d663cb588d7e2c7aa031af9dfc21f2`), under the same consent.
14
+
15
+ Not adopted: the stack-specific test fixtures, storyline-derived tests, and tests that set up state by inserting rows.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cratis-specifications-test-typescript-behavior
3
- description: Use when writing or repairing an isolated TypeScript spec for a calculation, parser, serializer, view model, or command decision invoked directly in the package's runner. Not for the Arc Node command or query pipeline (use cratis-arc-testing-typescript), mounted UI (use cratis-specifications-test-application-ui), or C# specs (use cratis-specifications-isolate-behavior).
3
+ description: Use when writing or repairing an isolated TypeScript spec for a calculation, parser, serializer, view model, or command decision invoked directly in the package's runner, or the client-side validation of a generated command proxy without a backend. Not for the Arc Node command or query pipeline (use cratis-arc-testing-typescript), mounted UI (use cratis-specifications-test-application-ui), or C# specs (use cratis-specifications-isolate-behavior).
4
4
  ---
5
5
 
6
6
  # Specify isolated behavior in the package's runner
@@ -27,6 +27,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
27
27
  | A calculation, parser, serializer, mapping or value rule | This skill: call the function directly |
28
28
  | A view model's decisions without mounting the UI | This skill |
29
29
  | The calculation or branch inside a command handler, given explicit inputs | This skill: call the handler on a command instance |
30
+ | What a generated command proxy rejects locally, with no backend | This skill: `validateClientSide()`; see the SDK reference |
30
31
  | Validation, authorization, preparation, service binding, or result envelope in the Arc server pipeline | `cratis-arc-testing-typescript` |
31
32
  | Which events a command appends, or which read model a projection produces | `cratis-specifications-exercise-backend` |
32
33
  | A mounted screen that responds to input, navigates or survives a refusal | `cratis-specifications-test-application-ui` |