@cratis/pi 7.6.5 → 7.7.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.
- package/package/corpus/agents/backend-developer.md +14 -0
- package/package/corpus/agents/code-reviewer.md +16 -0
- package/package/corpus/agents/coordinator.md +17 -0
- package/package/corpus/agents/frontend-developer.md +17 -0
- package/package/corpus/agents/orchestrator.md +18 -0
- package/package/corpus/agents/planner.md +24 -0
- package/package/corpus/agents/screenplay-modeler.md +57 -0
- package/package/corpus/agents/screenplay-renderer.md +42 -0
- package/package/corpus/agents/screenplay-reviewer.md +45 -0
- package/package/corpus/agents/slice-implementer.md +32 -5
- package/package/corpus/agents/spec-writer.md +16 -3
- package/package/corpus/prompts/add-reactor.prompt.md +5 -3
- package/package/corpus/prompts/new-vertical-slice.prompt.md +16 -5
- package/package/corpus/prompts/write-specs.prompt.md +12 -6
- package/package/corpus/rules/application-profile.md +7 -3
- package/package/corpus/rules/general.md +8 -3
- package/package/corpus/rules/glossary.md +1 -1
- package/package/corpus/rules/profiles.md +42 -4
- package/package/corpus/rules/reactors.md +30 -22
- package/package/corpus/rules/vertical-slices.md +3 -1
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +13 -0
- package/package/corpus/skills/cratis-application-slice-conformance/LICENSE +2 -0
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +173 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +66 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/contract-and-precedence.md +49 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/provenance.md +23 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/worked-example.md +91 -0
- package/package/corpus/skills/cratis-application-slice-conformance/verification.json +14 -0
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +57 -1
- package/package/corpus/skills/cratis-application-slice-specifications/references/provenance.md +16 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +68 -8
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +199 -0
- package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +10 -0
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +38 -10
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +58 -6
- package/package/corpus/skills/cratis-chronicle-reactor/references/provenance.md +9 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +13 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +47 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/references/provenance.md +11 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +13 -0
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +13 -0
- package/package/corpus/skills/cratis-event-model-diagram/SKILL.md +35 -16
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/LICENSE +28 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +166 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +31 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +139 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/cases-to-specify.md +69 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +88 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/integration-contracts.md +64 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +37 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +34 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +208 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translate-example.md +126 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +93 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/worked-integration.md +98 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +267 -50
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +185 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/verification.json +60 -12
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +42 -12
- package/package/corpus/skills/cratis-screenplay-discovery/LICENSE +30 -0
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +229 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/divergent-sweep.md +37 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/event-naming.md +64 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +62 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +222 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/interview-questions.md +66 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +152 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +111 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/provenance.md +37 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +119 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/worked-session.md +87 -0
- package/package/corpus/skills/cratis-screenplay-discovery/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +140 -77
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/invoicing-example.md +51 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +114 -28
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +50 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +28 -3
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/LICENSE +31 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +239 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/chronicle-observations.md +25 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/evidence-table-template.md +79 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/expert-verification.md +48 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +75 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/intent-example.md +164 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/interview-findings.md +88 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/loss-report-template.md +47 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +147 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/rule-modeling.md +36 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +126 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/signal-to-intent.md +57 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +52 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/verification.json +17 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +77 -57
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +50 -20
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +211 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +44 -6
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +64 -10
- package/package/corpus/skills/cratis-screenplay-model-review/LICENSE +34 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +209 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +89 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +128 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +176 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/provenance.md +36 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +149 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/review-questions.md +59 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +255 -0
- package/package/corpus/skills/cratis-screenplay-model-review/verification.json +13 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/LICENSE +32 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +239 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/code-reading-and-tokens.md +55 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +124 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +84 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/opt-in.md +48 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phase-report-inventories.md +25 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +162 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/principles.md +53 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/provenance.md +63 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/reasoning-notes.md +31 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +31 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/stop-or-assume.md +46 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +204 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +55 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/worked-example.md +86 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/verification.json +16 -0
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +14 -3
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +15 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/LICENSE +2 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +179 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +99 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +67 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +72 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/provenance.md +27 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +56 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +124 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +14 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/LICENSE +31 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +200 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/berth-reservations.md +579 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/chronicle-verification.md +24 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +102 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/provenance.md +41 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +196 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +102 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +71 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +91 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/verification.json +13 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/LICENSE +30 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +236 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +107 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +130 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/provenance.md +20 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +201 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/review-questions.md +23 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +41 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +122 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +305 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/verification.json +43 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +217 -36
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +28 -4
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/LICENSE +33 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +191 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +154 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +54 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +191 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution-example.md +70 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +65 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +128 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +378 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +14 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/LICENSE +2 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +177 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/automation-translate-example.md +121 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +319 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet.md +96 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +107 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +48 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-example.md +113 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +148 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/pdl-example.md +267 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +51 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +88 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +51 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +134 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +134 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +15 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +53 -5
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +56 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/provenance.md +13 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +65 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +4 -1
- package/package/corpus/skills/cratis-specification-by-example/SKILL.md +44 -1
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +10 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +186 -219
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +177 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +150 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +87 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +98 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +19 -0
- package/package/profile-catalog.json +11 -0
- package/package.json +1 -1
package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Boundaries: modules, teams and contracts
|
|
2
|
+
|
|
3
|
+
Read when you split, merge or connect modules, or when a fact crosses between owners. Grammar
|
|
4
|
+
for reactions and translations lives in `cratis-screenplay-automations-and-translations`.
|
|
5
|
+
|
|
6
|
+
## Establish the boundary, not an organizational formula
|
|
7
|
+
A `module` groups business behaviour; it does not automatically define a team, deployment, event
|
|
8
|
+
source or transaction. Evidence: differences in language, decision authority, lifecycle, change
|
|
9
|
+
cadence and consistency needs (tariffs change weekly, member records yearly). One team may own
|
|
10
|
+
several modules; a module may be shared during a transition; record which of team and system the
|
|
11
|
+
model follows. Organise by business responsibility, not layer: a name like "Notifications" proves
|
|
12
|
+
nothing either way, so investigate the responsibility behind it.
|
|
13
|
+
|
|
14
|
+
Do not reorganise teams by fiat. When answers are unavailable, label assumptions and leave the
|
|
15
|
+
decision visible in the session `STATE.md`; never report independence as established. Before
|
|
16
|
+
splitting a boundary revisit every invariant that needs information from both sides: an event
|
|
17
|
+
exchange does not make that decision atomic.
|
|
18
|
+
|
|
19
|
+
## Ownership interview
|
|
20
|
+
Run it when ownership, autonomy or integration decisions are missing; skip it when the user or
|
|
21
|
+
the model already states all three. Ask one question at a time, offer the options, and follow
|
|
22
|
+
the trigger. Unattended: assume the most conservative option, mark it `ASSUMED` in the slice or
|
|
23
|
+
module `description` and in `STATE.md`.
|
|
24
|
+
|
|
25
|
+
| # | Question (options) | Decides | Follow-up trigger |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| 1 | Who decides these rules, and who operates them when they fail? (A one team owns everything; B teams by business domain; C teams by technical function) | how many modules and who owns each | B: what does each team own and decide? C: which business responsibility does each function really serve? Offer organising by business capability; do not prescribe a reorganisation |
|
|
28
|
+
| 2 | How much can each side move alone? (A very high: separate releases and outages tolerated; B moderate: coordinate through published facts; C low: coupling accepted) | contract strictness; sync versus async | A: name the contract and the tolerated delay. C: ask why the coupling is needed; it may mean one module |
|
|
29
|
+
| 3 | Which external systems take part? (payment, access control, accounting, none) | translation edges and adapter owners | for each: who owns the adapter, its failures and its contract changes? |
|
|
30
|
+
| 4 | What delay, outage or temporary disagreement can the business tolerate? | `eventual by choice` rows in the invariant table | what is the compensating fact and who sees the disagreement? |
|
|
31
|
+
|
|
32
|
+
Record the answers as: team or owner, what they decide, autonomy (high, moderate, low), external
|
|
33
|
+
dependencies with owners, and the facts that cross between owners (`A -> B via <Event>`).
|
|
34
|
+
|
|
35
|
+
## Ownership and interface inventory
|
|
36
|
+
For each affected boundary, identify:
|
|
37
|
+
- responsibility, lifecycle and decision owner;
|
|
38
|
+
- stream identities and the rules decided on them;
|
|
39
|
+
- commands handled and their permitted human or system origins (the owner of a command differs
|
|
40
|
+
from the actors allowed to invoke it; preserve authorization);
|
|
41
|
+
- facts produced, contracts consumed, views provided or read;
|
|
42
|
+
- processors: trigger, local decision or effect, resulting command or fact, operational owner;
|
|
43
|
+
- external dependencies, adapter owners and known coupling.
|
|
44
|
+
|
|
45
|
+
Use declaration addresses, not copies of payloads. Per slice, also record the events it consumes
|
|
46
|
+
and which slice produces them, for orientation, not as a build order. A command or reaction may
|
|
47
|
+
consult another slice's view (`reads`; unprotected in `.play`, see `consistency-and-concurrency.md`
|
|
48
|
+
section 3); a slice calls another slice's command only through `invokes`.
|
|
49
|
+
|
|
50
|
+
### Boundary record (compact output, one per boundary)
|
|
51
|
+
```text
|
|
52
|
+
Boundary: <module or context> Owner: <team/person or ASSUMED>
|
|
53
|
+
Decides: <rules and the streams they hold on>
|
|
54
|
+
Commands handled: <names> Allowed origins: <personas / systems>
|
|
55
|
+
Facts produced: <events, public or internal> Facts consumed: <event -> producing slice>
|
|
56
|
+
Views provided: <read models> Views read from others: <read models>
|
|
57
|
+
Processors: <trigger -> decision/effect -> result; operational owner>
|
|
58
|
+
External: <system -> adapter owner -> contract>
|
|
59
|
+
Open: <unresolved decisions, each also in STATE.md>
|
|
60
|
+
```
|
|
61
|
+
Keep durable rationale in module, feature and slice descriptions and the record's `Open` lines in
|
|
62
|
+
`STATE.md`. Do not build a second catalogue that duplicates the model.
|
|
63
|
+
|
|
64
|
+
## Cross-boundary walkthrough
|
|
65
|
+
Walk one real interaction across each affected boundary:
|
|
66
|
+
1. the producer and the published fact or interface;
|
|
67
|
+
2. the receiving boundary and any translation into its language;
|
|
68
|
+
3. the receiver's decision, command or effect, and the destination identity;
|
|
69
|
+
4. success, rejection or failure, correlation and retry behaviour;
|
|
70
|
+
5. what happens when the receiver is late, unavailable or sees the input again.
|
|
71
|
+
|
|
72
|
+
A reaction may produce events directly without an invented command; an email or payment stays an
|
|
73
|
+
effect even before any domain command exists.
|
|
74
|
+
|
|
75
|
+
### Worked walkthrough: marina berth booking
|
|
76
|
+
Harbour Office owns a berth booking. Billing owns invoices. Ownership interview answers: two
|
|
77
|
+
teams by domain (Q1 B), moderate autonomy (Q2 B), the card payment provider is external with
|
|
78
|
+
Billing as adapter owner (Q3), Billing may lag the Harbour Office by minutes but must never
|
|
79
|
+
invoice twice (Q4).
|
|
80
|
+
1. **Producer.** Harbour Office decides `BerthBooked` on the booking stream (`BookingId`: one
|
|
81
|
+
stream per booking of one berth by one vessel; it answers "is this stay confirmed?"). Its
|
|
82
|
+
description marks `BerthBooked` **public** and lists consumers: Billing.
|
|
83
|
+
2. **Translation.** Billing consumes `BerthBooked` through a Translate-style reaction and speaks
|
|
84
|
+
its own language: a `StayInvoiceDue` fact on `InvoiceId`, with the booking id kept as a
|
|
85
|
+
correlation property, not as its stream identity.
|
|
86
|
+
3. **Decision.** Billing decides whether an invoice is due (a tariff, a free night). Harbour
|
|
87
|
+
Office never writes Billing's facts, and Billing never pretends to have produced `BerthBooked`.
|
|
88
|
+
4. **Failure and correlation.** The card provider rejects the charge: Billing records
|
|
89
|
+
`StayPaymentRefused` and shows it in its own view. Correlation is the booking id. Whether
|
|
90
|
+
Harbour Office must release the berth is a business decision (a new public fact,
|
|
91
|
+
`StayPaymentLapsed`), not a hidden call.
|
|
92
|
+
5. **Late or repeated input.** `BerthBooked` delivered twice must not create two invoices: a
|
|
93
|
+
`unique event StayInvoiceDue` on the invoice stream whose id is derived from the booking (the
|
|
94
|
+
retry identity) makes the second append a rejection, which the processor treats as done.
|
|
95
|
+
Billing unavailable: Harbour Office still confirms; its view shows "invoice pending".
|
|
96
|
+
Open: the invoice-id derivation rule and who owns the dead-letter handling are written in
|
|
97
|
+
`STATE.md` with Billing named as owner. This is a reasoning example, not evidence of executable
|
|
98
|
+
integration support.
|
|
99
|
+
|
|
100
|
+
## Internal and public events
|
|
101
|
+
- **Internal events** record decisions inside the module. They can be fine-grained and change
|
|
102
|
+
with the module.
|
|
103
|
+
- **Public events** are a contract other modules or contexts build on. Keep them coarse,
|
|
104
|
+
stable and complete enough that consumers do not need to call back. A summary fact
|
|
105
|
+
(`EnrolmentConfirmed` carrying what downstream needs) is often better than exposing every
|
|
106
|
+
internal step.
|
|
107
|
+
- Treat a public event like a published API: evolution follows `evolution.md` with the
|
|
108
|
+
consumers named, and breaking changes become new events.
|
|
109
|
+
- Screenplay has no public/internal marker. Record the classification in the event's
|
|
110
|
+
`description`, and keep the list in `STATE.md`.
|
|
111
|
+
|
|
112
|
+
## Crossing a boundary in Screenplay
|
|
113
|
+
| Situation | Construct |
|
|
114
|
+
|---|---|
|
|
115
|
+
| another module in the same application | reference the event by name (cross-module resolution works within one application) |
|
|
116
|
+
| another bounded context's contract | unquoted `import Context.Event` (foreign contract; does not bind on either compiler, PLAY0268; see `versions.md` in `cratis-screenplay-toolchain`) |
|
|
117
|
+
| my own files | quoted `import "glob"` |
|
|
118
|
+
| outside data entering | `Translate` slice: `capture`, or a translator `reaction` over an imported event (`cratis-screenplay-automations-and-translations`) |
|
|
119
|
+
| our fact another context needs | a public summary event; the other side translates it into its own language |
|
|
120
|
+
|
|
121
|
+
Never let an external system's ids, codes or shapes become our domain vocabulary: translate at
|
|
122
|
+
the edge, keep the external reference as a property when it is needed for correlation or dedup.
|
|
123
|
+
Stage renders no Automation or Translate slice today, so the whole translation is gap-fill code
|
|
124
|
+
with the model as its contract (`cratis-screenplay-render-and-gap-fill`).
|
|
125
|
+
|
|
126
|
+
## Change data capture is not a domain event
|
|
127
|
+
A row change captured from a database (CDC) says which columns changed, not why. Treat it as an
|
|
128
|
+
external record: translate it into business facts with a named reason, or keep it as evidence.
|
|
129
|
+
Do not publish raw row changes as public events.
|
|
130
|
+
|
|
131
|
+
## Check coupling rather than banning every cycle
|
|
132
|
+
An acknowledgement returning to its initiator is not automatically a bad dependency. Investigate:
|
|
133
|
+
- synchronous mutual dependence that stops either side progressing;
|
|
134
|
+
- feedback that can repeatedly produce the same work;
|
|
135
|
+
- private event or shared-view changes that force coordinated consumer changes;
|
|
136
|
+
- invariants split across owners without an agreed enforcement or compensation strategy.
|
|
137
|
+
|
|
138
|
+
Record the concrete consequence and proposed repair. Independent development, deployment and
|
|
139
|
+
scaling are separate claims; establish each only when the dependencies support it. A shared view
|
|
140
|
+
is a versioned interface and an availability dependency, not free decoupling.
|
|
141
|
+
|
|
142
|
+
## Boundary checklist
|
|
143
|
+
- [ ] every boundary has a named owner or an `ASSUMED` mark in `STATE.md`
|
|
144
|
+
- [ ] every command has allowed origins; ownership of a command is not permission to invoke it
|
|
145
|
+
- [ ] every consumed fact names its producing slice; every public event names its consumers
|
|
146
|
+
- [ ] every processor has a trigger, an outcome and an operational owner
|
|
147
|
+
- [ ] every external system has an adapter owner and a translation edge
|
|
148
|
+
- [ ] cycles were classified (legitimate feedback, mutual dependence, repeated work), not just counted
|
|
149
|
+
- [ ] one interaction was walked across each boundary including late, repeated and failed input
|
|
150
|
+
|
|
151
|
+
## Review questions
|
|
152
|
+
- Which facts cross this boundary, and who depends on each?
|
|
153
|
+
- Would a change inside this module force a change in another? Then the contract is too fine.
|
|
154
|
+
- Is the boundary following people who talk to each other, or the business capability?
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Chronicle boundaries
|
|
2
|
+
|
|
3
|
+
Read when consistency, tenancy or personal data decides where a boundary falls. These are
|
|
4
|
+
target facts; the `.play` model declares only part of them (`versions.md` in
|
|
5
|
+
`cratis-screenplay-toolchain`).
|
|
6
|
+
|
|
7
|
+
## Pins
|
|
8
|
+
Chronicle **v19.32.0** (`f17a2ff`): CHR0012 (nullable event properties) and CHR0034 (PII on an
|
|
9
|
+
event-source id) are present. Three runtime defects are **open at v19.32.0**: #3744 (SQL and
|
|
10
|
+
InMemory providers do not settle unique claims), #4123 (constraint index updates run after commit
|
|
11
|
+
and fail silently) and #4131 (composite unique constraints collide when a component contains the
|
|
12
|
+
separator). Arc **v22.50.5** has `[ProtectedDecision]` (since v22.39.0, needs Chronicle 19.23 or
|
|
13
|
+
later); Stage-rendered apps pin Arc 22.25.0 and Chronicle client 19.8.1, so it is not available
|
|
14
|
+
there (see `consistency-and-concurrency.md` section 3). Re-check the issues before relying on a
|
|
15
|
+
constraint in a new release.
|
|
16
|
+
A concurrency scope's first append is unchecked by default at v19.32.0; see
|
|
17
|
+
`consistency-and-concurrency.md` section 4.
|
|
18
|
+
|
|
19
|
+
## Identity, routing and claims
|
|
20
|
+
Name four things separately: the event store/namespace, the business event-source identity, any
|
|
21
|
+
process streams that route work, and the scope of each invariant. Use source/stream
|
|
22
|
+
classification to separate genuinely independent work inside one identity; do not split a
|
|
23
|
+
business identity just to reduce contention. Tags classify occurrences; they do not isolate
|
|
24
|
+
tenants.
|
|
25
|
+
|
|
26
|
+
A value constraint protects a claim across sources within its configured scope; an event-type
|
|
27
|
+
constraint protects one occurrence per source. List every event that claims, changes or
|
|
28
|
+
releases the value, including correction and import paths. Post-commit index maintenance is not
|
|
29
|
+
atomic durability (Chronicle#4123); composite separator collisions are tracked in #4131; the
|
|
30
|
+
SQL and InMemory providers do not settle unique claims (Chronicle#3744).
|
|
31
|
+
|
|
32
|
+
## State used for decisions
|
|
33
|
+
Materialized views may lag. A passive read folds events on demand but does not protect the
|
|
34
|
+
interval between reading and appending. A guarded decision read adds that protection for an
|
|
35
|
+
admitted projection and key shape (including absence) when the dependency is enrolled in the
|
|
36
|
+
same protected commit. Name the actual target mechanism and deployment assumptions; do not
|
|
37
|
+
invent guards from sequence numbers, and do not assume joins, reducers, other namespaces or
|
|
38
|
+
external services qualify. Current `reads`/`concurrency` declarations supply no such runtime
|
|
39
|
+
protection: keep the invariant and its race outcome as explicit target requirements.
|
|
40
|
+
|
|
41
|
+
## Tenancy and personal data
|
|
42
|
+
A namespace scopes event positions, claims, observer progress and encryption keys. State
|
|
43
|
+
whether uniqueness and completion are per tenant or genuinely cross-tenant.
|
|
44
|
+
|
|
45
|
+
Decide the data subject before the event and view shape. One data subject per event and per
|
|
46
|
+
stream; one per read-model instance. Never put PII on the event-source id and never mark the
|
|
47
|
+
identifier's concept `@pii`: Chronicle cannot encrypt a source id (analyzer CHR0034). Use a surrogate `Uuid`
|
|
48
|
+
identity and carry the sensitive value as a `@pii` property. Bearer tokens, magic links and
|
|
49
|
+
signed URLs are never facts; record a keyed hash or a reference.
|
|
50
|
+
|
|
51
|
+
Redaction (payload replacement keeping the sequence slot) and crypto-erasure serve compliance
|
|
52
|
+
only; they are asynchronous, namespace-local and do not erase external copies. Model erasure as
|
|
53
|
+
an owned workflow, not as a flag or a claim that history is undeletable. Domain correction is a
|
|
54
|
+
new fact.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Consistency and concurrency
|
|
2
|
+
|
|
3
|
+
Pins: Screenplay v4.64.0, Chronicle v19.32.0, Arc v22.50.5, Stage v4.24.0 (table in `versions.md` of
|
|
4
|
+
`cratis-screenplay-toolchain`).
|
|
5
|
+
|
|
6
|
+
## 1. Invariant table (fill before writing constraints)
|
|
7
|
+
| # | Rule (business words) | Data it needs | Decided atomically where | Screenplay construct | Status | Race / retry outcome |
|
|
8
|
+
|---|---|---|---|---|---|---|
|
|
9
|
+
| 1 | an email belongs to one member | email on `MemberRegistered` | append-time constraint, whole sequence | `constraint UniqueMemberEmail` | enforced | second registrant rejected with the fixed message |
|
|
10
|
+
| 2 | one active enrolment per member and course | courseId + memberId | append-time constraint | composite `unique … released by` | enforced | racing enrolments: one rejected |
|
|
11
|
+
| 3 | an enrolment is recorded once | enrolment stream history | append-time constraint | `unique event MemberEnrolled` | enforced | append rejected either way; the target tells a true retry (same operation key, same payload: return the original outcome) from a conflicting request on the same stream (different payload: reject) |
|
|
12
|
+
| 4 | enrolments never exceed capacity | count over enrolment streams + course capacity | **not in the model** | `reads CourseAvailability` + `require … message "The course is full"` as stated intent; slice `description` + `STATE.md` | recorded (NOT enforced) | concurrent enrolments can overbook; the enrolment-to-course fan-in cannot be guarded, so the target decides a redesign (§3 options a/b) |
|
|
13
|
+
|
|
14
|
+
Status describes how the model treats the requirement:
|
|
15
|
+
- `enforced`: a supported construct the model declares covers the rule and every write path
|
|
16
|
+
that can break it;
|
|
17
|
+
- `recorded`: a true requirement the model cannot enforce (NOT enforced in the model today);
|
|
18
|
+
the target must, and the row names the target construct;
|
|
19
|
+
- `eventual by choice`: the business accepts temporary disagreement; name detection, the
|
|
20
|
+
compensating fact and the consequence that remains possible.
|
|
21
|
+
|
|
22
|
+
`enforced` is a declaration, not a runtime test result. In Chronicle the kernel checks a
|
|
23
|
+
constraint at append, but the SQL and InMemory providers do not settle unique claims today
|
|
24
|
+
(Chronicle#3744) and index updates run after commit (#4123); composite values can collide when a component contains the separator (#4131); all three are open at v19.32.0: name the target's storage
|
|
25
|
+
provider when you rely on a constraint, record runtime evidence separately, and never claim
|
|
26
|
+
atomic index-and-append durability. Per row, cite the exact construct or description address
|
|
27
|
+
and the scenario names; on extracted models keep the legacy evidence locator and separate an
|
|
28
|
+
observed legacy check from verified atomic protection.
|
|
29
|
+
|
|
30
|
+
## 2. Where a rule can be enforced
|
|
31
|
+
| Rule depends on | Place | Notes |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| one command property | concept `validate` (format) or command `validate` | every failed rule rejects, whatever its severity |
|
|
34
|
+
| several command properties / constants | `require` | runs after property rules, before production |
|
|
35
|
+
| a value across all sources | `unique <prop> on <Event>` | value owned by one source; same source may re-claim |
|
|
36
|
+
| a fact at most once per source; mutually exclusive facts | `unique event` (+ `released by`) | covers simple lifecycle transitions |
|
|
37
|
+
| state-dependent rule not reducible to the supported uniqueness/release semantics (a balance, capacity, "only if approved") | no protected decision read in `.play` today | state it as `reads` + `require … message`, mark NOT enforced, name the target enforcement (below) |
|
|
38
|
+
| a view (read model) | an unguarded materialized read is not protection | views lag; `reads` is PLAY0271, `require` over views PLAY0268 at binding (expected in design mode) |
|
|
39
|
+
|
|
40
|
+
## 3. Record each state-dependent rule that the model cannot enforce
|
|
41
|
+
Never accept the caller's copy of the state: `currentStatus Status` on the command with
|
|
42
|
+
`require currentStatus == "approved"` protects nothing, and neither does a boolean attestation
|
|
43
|
+
input (`confirmsX == true`) standing in for the rule. Never move the rule into `handler` or
|
|
44
|
+
`implementation hint` prose; a description is not rendered (Stage#178), so prose alone leaves
|
|
45
|
+
the rule unenforced in rendered scope.
|
|
46
|
+
|
|
47
|
+
Right: write the rule as stated intent and mark it unenforced.
|
|
48
|
+
- `reads <View> as x by …` plus `require <expr over x> message "…"` on the command (the
|
|
49
|
+
`StateChange` slice in `streams-example.md`). Binding reports PLAY0271 / PLAY0268; that is
|
|
50
|
+
expected in design mode, so keep the lines. Do not remove them to pass a tool.
|
|
51
|
+
- Slice `description`, one block per rule:
|
|
52
|
+
- Requirement: the business rule in business words.
|
|
53
|
+
- Status: NOT enforced in the model today (Screenplay#129, #209).
|
|
54
|
+
- Decision inputs: the authoritative facts or state.
|
|
55
|
+
- Missing guarantee: why the construct does not protect the decision.
|
|
56
|
+
- Race consequence: what two individually plausible commands could jointly violate.
|
|
57
|
+
- Intended enforcement: the target mechanism (below), or the options awaiting agreement.
|
|
58
|
+
- Business outcome: what a rejected, delayed or compensated request means.
|
|
59
|
+
- A `STATE.md` row with owner and revisit condition. A general note "some state rules are
|
|
60
|
+
unsupported" does not replace these per-rule blocks.
|
|
61
|
+
- A specification written as a business question when the model cannot run it; do not count
|
|
62
|
+
it as passing.
|
|
63
|
+
|
|
64
|
+
Options to discuss with the domain expert (decide, do not assume):
|
|
65
|
+
a. **one stream is the boundary**: put the decision on the stream that owns the state (often a
|
|
66
|
+
different identity choice) and enforce it in the target with a concurrency scope, plus the
|
|
67
|
+
first-append check described under "First append into a scope" below (a scope on an empty
|
|
68
|
+
source or partition is not checked by default);
|
|
69
|
+
b. **reservation by identity**: if the scarce things can be named (seat 1..N, slot at 09:00),
|
|
70
|
+
give each its own identity and use uniqueness, after checking it expresses the invariant;
|
|
71
|
+
c. **accept and compensate**: allow the over-commit, detect it in a view or automation and
|
|
72
|
+
record a compensating fact (`EnrolmentWaitlisted`); only when the business agrees.
|
|
73
|
+
|
|
74
|
+
Target realization (for the handoff, not the model): in an Arc/Chronicle target (Arc v22.39.0 or
|
|
75
|
+
later, Chronicle 19.23 or later) the rule is a `[ProtectedDecision]` command reading `DecisionRead<T>` (or `IDecisionReads.Get<T>(key)` for
|
|
76
|
+
another event source) in `Provide()`/`Handle()` and returning a validation result; a conflict
|
|
77
|
+
at commit is reported as a concurrency violation. Equivalently a Chronicle decision-consistency
|
|
78
|
+
read with a `concurrency` scope on the event source or stream. A passive read is fresh
|
|
79
|
+
computation, not an atomic read-and-append; a plain materialized view and a validator are
|
|
80
|
+
advisory. Protection covers only a single projection keyed directly by the event source id (routing key
|
|
81
|
+
empty or `$eventSourceId`). Reducers, joins, children, nested sources and **event-property
|
|
82
|
+
routing** (fan-in from many streams by a payload reference) are refused, and a concurrency scope
|
|
83
|
+
on the referenced source does not see appends made on other sources. A rule over such a view, for
|
|
84
|
+
example a course capacity computed from enrolment streams, needs option a or b: write the
|
|
85
|
+
deciding fact on the source that owns the state, or give each scarce item its own identity. Sources: Arc `v22.50.5:Documentation/backend/csharp/chronicle/read-models/injecting-into-commands.md`;
|
|
86
|
+
`chronicle-boundaries.md`.
|
|
87
|
+
|
|
88
|
+
**Availability caveat for Stage-rendered applications.** `cratis render` scaffolds Arc 22.25.0 and
|
|
89
|
+
Chronicle client 19.8.1 (Stage v4.24.0), which predate `[ProtectedDecision]` and `DecisionRead<T>`.
|
|
90
|
+
In a rendered app that attribute is not available, so a gap-fill handler cannot use it unless the
|
|
91
|
+
application's Arc and Chronicle packages are upgraded as a separately approved change. When they
|
|
92
|
+
are not, choose option a or b (put the deciding fact on the stream that owns the state, or give
|
|
93
|
+
each scarce item its own identity and claim it with a constraint), or option c, and keep the rule
|
|
94
|
+
**NOT enforced in the model today** in the slice description with the race consequence. Never
|
|
95
|
+
claim protection for a rendered app because the rule is written as `reads` + `require`, and never
|
|
96
|
+
weaken the rule to make it render.
|
|
97
|
+
|
|
98
|
+
## 4. Concurrency scenarios
|
|
99
|
+
For each enforced or recorded rule write three short scenarios:
|
|
100
|
+
- **race**: two commands for the same claim at the same moment -> which one wins, what the
|
|
101
|
+
loser sees. With constraints: one append commits, the other is rejected. Note: Chronicle
|
|
102
|
+
checks uniqueness before the commit and updates the index after it; index update failures
|
|
103
|
+
are logged, not rolled back (Screenplay `constraints.md`, Chronicle#4123, open at v19.32.0). Do not call it an
|
|
104
|
+
atomic index-and-append guarantee.
|
|
105
|
+
- **retry** (same request and operation identity, after a lost reply) -> must not record a
|
|
106
|
+
second occurrence, without blocking a different legitimate operation. A once-only fact uses
|
|
107
|
+
`unique event`; a repeatable operation needs an operation identity and target-side
|
|
108
|
+
idempotency. Say which guarantee the model actually supplies.
|
|
109
|
+
- **duplicate intent** (same business intent, new identifier) -> caught only by a
|
|
110
|
+
property constraint over the business key, or not at all; decide which.
|
|
111
|
+
Chronicle applies optimistic concurrency to appends by default; the `concurrency` block
|
|
112
|
+
narrows the scope (eventSource, sourceType, streamType, streamId, events). It does not bind
|
|
113
|
+
in the executable model; it documents intent for the target.
|
|
114
|
+
|
|
115
|
+
**First append into a scope (Chronicle v19.32.0, version-qualified).** The default optimistic
|
|
116
|
+
strategy compares the scope's tail sequence number. When nothing matches the scope yet (the
|
|
117
|
+
first event on a new event source, or the first event of a new source type, stream type or
|
|
118
|
+
stream id), there is no tail and the append is **not checked**: two writers opening the same
|
|
119
|
+
source or narrowed partition can both succeed. This is the append most exposed to a race, so a
|
|
120
|
+
concurrency scope alone does not protect "only one writer may open this". For a target that
|
|
121
|
+
needs it:
|
|
122
|
+
- enable the check, application-wide with `ConcurrencyOptions.CheckFirstAppendIntoAScope`
|
|
123
|
+
(default `false`) or per append with `ConcurrencyScopeBuilder.ExpectingNoMatchingEvent()`,
|
|
124
|
+
and handle the `ConcurrencyViolation` it can now raise; or
|
|
125
|
+
- use a unique event constraint, which the kernel enforces for every writer whether or not the
|
|
126
|
+
append declared a scope (the model's `unique event`).
|
|
127
|
+
Require target evidence that the check ran: a concurrent first-append scenario against a real
|
|
128
|
+
Chronicle, asserting one append wins, one is rejected, and `IAppendResult.ConcurrencyCheckPerformed`
|
|
129
|
+
is `true` (a skipped check and a passing one look identical otherwise; a current client against
|
|
130
|
+
an older kernel always reads `false`). This was source- and documentation-inspected, not
|
|
131
|
+
concurrency-tested here. Stage-rendered apps pin Chronicle client 19.8.1: do not assume these
|
|
132
|
+
APIs exist there; confirm the package version before recommending them.
|
|
133
|
+
|
|
134
|
+
## 5. Three different guarantees (do not conflate)
|
|
135
|
+
| Guarantee | Meaning | Screenplay evidence |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| once-only event occurrence | the fact exists at most once per source (or value) | `unique event` / `unique … on` + violation spec |
|
|
138
|
+
| idempotent command handling | repeating a request yields the same outcome to the caller | target behaviour; the model shows a rejection, the target maps "already has the event" to success where intended |
|
|
139
|
+
| exactly-once external effect | the outside world sees the effect once (email, payment) | cannot be shown by the model; see `cratis-screenplay-automations-and-translations` |
|
|
140
|
+
|
|
141
|
+
## 6. Lost acknowledgements
|
|
142
|
+
The append may commit while the reply is lost. The caller retries. Decide per command:
|
|
143
|
+
- **same request**: same stable operation key (or stream identifier) and same payload ->
|
|
144
|
+
`unique event` rejects the append; the target compares the payload and returns the
|
|
145
|
+
original outcome to the caller (idempotent handling);
|
|
146
|
+
- **conflicting request on the same stream**: same key, different payload -> a real
|
|
147
|
+
rejection the caller must see; never report it as success;
|
|
148
|
+
- **new identifier** -> duplicate unless a business-key constraint exists.
|
|
149
|
+
The model shows only the rejection; payload comparison and outcome replay are target
|
|
150
|
+
behaviour. Write the answer in the slice `description`.
|
|
151
|
+
|
|
152
|
+
## 7. Ordering
|
|
153
|
+
- Within one source, facts are in append order. Across sources, do not assume an order
|
|
154
|
+
unless a single sequence guarantees it in the target; views combining sources must tolerate
|
|
155
|
+
any arrival order (a child before its parent).
|
|
156
|
+
- Constraints are evaluated in append order, including earlier appends of the same command.
|
|
157
|
+
|
|
158
|
+
## 8. Projection lag and rebuild
|
|
159
|
+
- Views are built after the append; a screen may show the previous state briefly. An
|
|
160
|
+
unguarded materialized view is never a protected decision input. A passive read is fresh
|
|
161
|
+
computation, and only a guarded decision read on an admitted projection shape (section 3)
|
|
162
|
+
protects the interval between reading and appending.
|
|
163
|
+
- A rebuild replays every fact, old generations included: projections must handle every
|
|
164
|
+
shape still stored, use only event data and `$eventContext` values (never "now"), and keep
|
|
165
|
+
side effects out of projections.
|
|
166
|
+
- A todo list rebuilt from history must not re-trigger work that already finished (its
|
|
167
|
+
closing facts are history too).
|
|
168
|
+
|
|
169
|
+
## 9. Corrections and backdated facts
|
|
170
|
+
- Facts are immutable in the model. A wrong business fact is corrected by a new fact the
|
|
171
|
+
business names (`ResultCorrected`, `PaymentReversed`), and views apply it. Chronicle
|
|
172
|
+
redaction and crypto-erasure exist for compliance only (prohibited content, erasure
|
|
173
|
+
obligations): separately authorized operational work, not domain undo and not a scenario step.
|
|
174
|
+
- `$context.occurred` is when it was recorded. If the business has an effective date that can
|
|
175
|
+
differ (backdated sickness, late-reported delivery), model it as a property and decide which
|
|
176
|
+
date views and rules use. Constraints and reactions still see record order.
|
|
177
|
+
|
|
178
|
+
## 10. Specification limits (no local spec engine)
|
|
179
|
+
- A spec can show a source re-claiming its own value and a `unique event` violation. Whether
|
|
180
|
+
it can show a collision between two different sources is contested in the docs:
|
|
181
|
+
`constraints.md` says not yet, `specifications.md` says `for` on `given` events allows it. Treat
|
|
182
|
+
such a spec as parsed (V1), not proven; spec outcomes come only from a reference run (V4) or
|
|
183
|
+
rendered tests. See `cratis-screenplay-scenario-coverage`.
|
|
184
|
+
- Constraint violation messages are fixed strings: copy them exactly into `then error`.
|
|
185
|
+
- For every value constraint write a competing-claim spec (one source owns the value, a
|
|
186
|
+
different source attempts it) using `when <Command>` with the earlier fact as `given`.
|
|
187
|
+
Repeating the same source tests another rule (re-claim). When release is declared, also
|
|
188
|
+
cover release followed by a claim from another source.
|
|
189
|
+
- These are sequential histories. They do not run simultaneous commands or prove race safety;
|
|
190
|
+
concurrent execution and failure-recovery tests belong to the target implementer, reported
|
|
191
|
+
separately.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Example: evolving persisted events
|
|
2
|
+
|
|
3
|
+
A complete design-mode model showing the three evolution routes from `evolution.md`: a new
|
|
4
|
+
generation (compatible change), an identity-aware rename that keeps the stored name as an `id`
|
|
5
|
+
pin, and a changed meaning that becomes a new event. Several generations select ESM v4.
|
|
6
|
+
|
|
7
|
+
```screenplay
|
|
8
|
+
// cratis-screenplay-streams-and-consistency: event evolution, complete design-mode example (V1, warnings as errors).
|
|
9
|
+
// - MembershipRenewed: a compatible change (new property with a defined default for old facts),
|
|
10
|
+
// declared as generation 2 in full beside generation 1, in the same slice.
|
|
11
|
+
// - MembershipPaused: the persisted event formerly stored as "MembershipSuspended"; renamed
|
|
12
|
+
// through the identity-aware path, which keeps the old stored name as an `id` pin.
|
|
13
|
+
// - MembershipEnded vs MembershipTerminatedForBreach: a change of meaning is a NEW event, not
|
|
14
|
+
// a generation.
|
|
15
|
+
// Screenplay does not express migrations/upcasters (Documentation/screenplay/events.md); the
|
|
16
|
+
// target must convert generation 1 facts. Multiple generations select ESM v4.
|
|
17
|
+
|
|
18
|
+
concept MembershipId : Uuid
|
|
19
|
+
|
|
20
|
+
module Membership
|
|
21
|
+
feature Renewals
|
|
22
|
+
slice StateChange RenewMembership
|
|
23
|
+
description "Renewal records the period length; generation 1 facts were always 12 months"
|
|
24
|
+
command RenewMembership
|
|
25
|
+
membershipId MembershipId identifier
|
|
26
|
+
months Int
|
|
27
|
+
validate
|
|
28
|
+
months > 0 message "A renewal covers at least one month"
|
|
29
|
+
produces MembershipRenewed
|
|
30
|
+
for membershipId
|
|
31
|
+
months = months
|
|
32
|
+
event MembershipRenewed generation 1
|
|
33
|
+
event MembershipRenewed generation 2
|
|
34
|
+
months Int
|
|
35
|
+
specification RenewingForSixMonths
|
|
36
|
+
when RenewMembership
|
|
37
|
+
membershipId = "5b0f4c3e-2d1a-4e6b-8f7c-9a1b2c3d4e05"
|
|
38
|
+
months = 6
|
|
39
|
+
then MembershipRenewed
|
|
40
|
+
for "5b0f4c3e-2d1a-4e6b-8f7c-9a1b2c3d4e05"
|
|
41
|
+
months = 6
|
|
42
|
+
|
|
43
|
+
slice StateChange PauseMembership
|
|
44
|
+
command PauseMembership
|
|
45
|
+
membershipId MembershipId identifier
|
|
46
|
+
produces MembershipPaused
|
|
47
|
+
for membershipId
|
|
48
|
+
event MembershipPaused
|
|
49
|
+
id "MembershipSuspended"
|
|
50
|
+
|
|
51
|
+
slice StateChange EndMembership
|
|
52
|
+
description "Ending by the member and termination for breach are different facts"
|
|
53
|
+
command EndMembership
|
|
54
|
+
membershipId MembershipId identifier
|
|
55
|
+
forBreach Bool
|
|
56
|
+
produces when forBreach == false
|
|
57
|
+
MembershipEnded
|
|
58
|
+
for membershipId
|
|
59
|
+
produces when forBreach == true
|
|
60
|
+
MembershipTerminatedForBreach
|
|
61
|
+
for membershipId
|
|
62
|
+
event MembershipEnded
|
|
63
|
+
event MembershipTerminatedForBreach
|
|
64
|
+
specification EndingByChoice
|
|
65
|
+
when EndMembership
|
|
66
|
+
membershipId = "5b0f4c3e-2d1a-4e6b-8f7c-9a1b2c3d4e05"
|
|
67
|
+
forBreach = false
|
|
68
|
+
then MembershipEnded
|
|
69
|
+
for "5b0f4c3e-2d1a-4e6b-8f7c-9a1b2c3d4e05"
|
|
70
|
+
```
|
package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Event evolution
|
|
2
|
+
|
|
3
|
+
Stored facts outlive the code and the model that wrote them. Plan a change by asking what
|
|
4
|
+
happens to facts already stored, to every reader of the event, and to the deployment window
|
|
5
|
+
when old and new code run side by side. The best evolution is the one you avoid: short
|
|
6
|
+
lifecycles and events that record what the business decided (not table rows) change less.
|
|
7
|
+
|
|
8
|
+
## Classify the change
|
|
9
|
+
Edit class depends on whether the event is **persisted** (facts may be stored: the model was
|
|
10
|
+
accepted, deployed or rendered into a running system; ask when unsure). Changing an
|
|
11
|
+
unpersisted event's members is an ordinary text edit when no `.screenplay/identities.json` exists; with it, adding or removing event properties changes catalog addresses and goes through MCP. Any change to a
|
|
12
|
+
persisted event's contract (new generation, property added, removed or retyped, meaning) is
|
|
13
|
+
**contract evolution**: identity-affecting (identity procedure in `cratis-screenplay-modeling-lifecycle`). Write the
|
|
14
|
+
compatibility scenarios below first; the identity owner then applies the change (see
|
|
15
|
+
*Identity owner*). The table assumes a persisted event.
|
|
16
|
+
|
|
17
|
+
| Change | Old facts still mean the same? | Screenplay action | Edit class |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| add a property with a business-defined value for old facts | yes | new `generation N+1`, every generation declared in full in the same slice; record the default for old facts in the slice `description` | contract evolution |
|
|
20
|
+
| add a property with no sensible old value | the old fact lacks information | usually a **new event** for the new situation, or a separate fact recording the extra information | review with the expert |
|
|
21
|
+
| remove a property | yes, if no reader needs it | new generation without it; every reference fails with PLAY0273 until removed | contract evolution, check readers |
|
|
22
|
+
| change meaning (same name, different business fact) | **no** | **new event** with its own name; old event stays for history | identity: add, not rename |
|
|
23
|
+
| rename (same meaning) | yes | identity-aware rename by the identity owner; the stored name is kept with `id "OldName"` | identity-affecting |
|
|
24
|
+
| split one event into two / merge two | depends | new events from now on; never rewrite history; projections read both old and new | identity-affecting |
|
|
25
|
+
| rename a constraint | n/a | starts an empty index: values claimed before are unprotected. Ask first | identity-affecting |
|
|
26
|
+
|
|
27
|
+
A test for "generation or new event": a new version must be convertible from the old one
|
|
28
|
+
without inventing facts. If it is not, it is a different event.
|
|
29
|
+
|
|
30
|
+
## Compatibility scenarios (write before editing)
|
|
31
|
+
For each changed event, answer in the slice `description` or `STATE.md`:
|
|
32
|
+
1. **Replay**: does every projection still build from generation 1 facts? Which value do old
|
|
33
|
+
facts give the new property (default, absent, derived)?
|
|
34
|
+
2. **Readers**: which projections, reactions, constraints, specifications and other modules
|
|
35
|
+
(imports) reference this event? Each needs a decision.
|
|
36
|
+
3. **Mixed deployment**: can old code read new facts during rollout? If not, order the rollout
|
|
37
|
+
(readers first) or use a new event.
|
|
38
|
+
4. **Constraints**: does a constrained property change type, casing or meaning? A changed
|
|
39
|
+
meaning under the same constraint name corrupts uniqueness.
|
|
40
|
+
5. **Migration**: Screenplay does not express migrations or upcasters. Chronicle's route is
|
|
41
|
+
event-type migrations between consecutive generations (defaults, renames, split/combine of
|
|
42
|
+
properties, value maps); a migration maps one event to one event and never splits a fact into
|
|
43
|
+
several. A target without migration support must reject an evolved contract. Record who
|
|
44
|
+
writes the migration and test replay of old-generation facts; disposable greenfield data
|
|
45
|
+
needs none.
|
|
46
|
+
6. **Specifications**: `given` facts use the current shape only (a historical shape is
|
|
47
|
+
PLAY0449). Old-shape behaviour is checked in the target, not in `.play` specs.
|
|
48
|
+
|
|
49
|
+
## Identity rules
|
|
50
|
+
- Generations of one event live in one slice; a same-named event in another slice is a
|
|
51
|
+
different contract, not a generation (and ambiguous to the binder).
|
|
52
|
+
- Leave `id` absent on new events; a pin equal to the event's current name is information
|
|
53
|
+
PLAY0471 (Screenplay `events.md`). MCP and workspace renames add the pin by default because
|
|
54
|
+
the tool cannot know whether events were stored; set "never persisted" only when you know.
|
|
55
|
+
- Every rename, move or removal of an event, constraint, command, read model, slice, feature
|
|
56
|
+
or module is identity-affecting and is done by the identity owner.
|
|
57
|
+
|
|
58
|
+
## Identity owner
|
|
59
|
+
Procedure and ownership: the identity procedure in `cratis-screenplay-modeling-lifecycle` (the
|
|
60
|
+
owning session, or a brief that asks for the rename, applies it; a subagent without MCP returns
|
|
61
|
+
the catalog-changing request to the owner; never leave a requested change silently unapplied).
|
|
62
|
+
- Several generations select ESM v4; that binds executably on both tools (compiled
|
|
63
|
+
with `evolution-example.md`).
|
|
64
|
+
|
|
65
|
+
Complete compiled example: `evolution-example.md` (generation, rename pin, meaning change).
|
package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/provenance.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
| Item | Source | Licence | Kind | Where in this skill |
|
|
4
|
+
|---|---|---|---|---|
|
|
5
|
+
| Conditional ownership interview (team structure, autonomy, external integrations, skip rule, follow-up triggers) | TrogonStack/agentskills@7b249d3:plugins/trogonstack-eventmodeling/skills/eventmodeling-applying-conways-law/SKILL.md | MIT, Copyright (c) 2025 Straw Hat, LLC | ADAPT (reworded for Screenplay; the "team = system" absolutes dropped) | SKILL.md "Interview phase", `boundaries.md` |
|
|
6
|
+
| Interface and processor inventory per boundary, communication trace, system-organization output shape, quality checklist | same file | MIT | ADAPT | `boundaries.md` "Ownership and interface inventory", "Boundary record" |
|
|
7
|
+
| Event-by-event stream identity check, decision per identity, "design first, snapshot second" | TrogonStack/agentskills@7b249d3:plugins/trogonstack-eventmodeling/skills/eventmodeling-optimizing-stream-design/SKILL.md and its patterns reference | MIT | ADAPT (arbitrary length thresholds and mandatory archival splits dropped) | `stream-patterns.md` |
|
|
8
|
+
| Growth-estimate interview and the order "redesign, then read model, then measure, then snapshot" | same skill | MIT | ADAPT | SKILL.md "Interview phase", `stream-patterns.md` "Growth and snapshots" |
|
|
9
|
+
| Interview and capture ideas for ownership and stream decisions | idea from Nebulit-GmbH/agentic-engineer@07b0f30:.claude/skills/eventmodeling-applying-conways-law and eventmodeling-optimizing-stream-design, written independently, no text reused | none | IDEA | `boundaries.md`, `stream-patterns.md` |
|
|
10
|
+
| Invariant table, state-dependent rule recording, race/retry/duplicate scenarios, evolution classes, Chronicle boundaries | Cratis corpus drafts for #493 | MIT | ORIGINAL | `consistency-and-concurrency.md`, `evolution.md`, `chronicle-boundaries.md` |
|
|
11
|
+
| Worked examples (courses and enrolment, memberships, marina berths) | written for this skill, compiled with Screenplay 4.64.0 | MIT | ORIGINAL | `streams-example.md`, `evolution-example.md`, `boundaries.md` |
|
|
12
|
+
|
|
13
|
+
Event Modeling practice is by Adam Dymitruk and Martin Dilger, cited as practice; no text taken.
|