@eventmodelers/cli 0.0.1
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/README.md +175 -0
- package/cli.js +676 -0
- package/package.json +35 -0
- package/shared/build-kit/code-export.mjs +560 -0
- package/shared/build-kit/lib/ollama-agent.js +147 -0
- package/shared/build-kit/package.json +11 -0
- package/shared/build-kit/ralph-ollama.js +39 -0
- package/shared/build-kit/realtime-agent.js +18 -0
- package/stacks/axon/templates/.claude/skills/build-automation/SKILL.md +407 -0
- package/stacks/axon/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/SKILL.md +496 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/axon-workflow-api.md +279 -0
- package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/feature-flag-patterns.md +114 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +396 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/axon-test-fixture-patterns.md +162 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +56 -0
- package/stacks/axon/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +115 -0
- package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +282 -0
- package/stacks/axon/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/axon/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +611 -0
- package/stacks/axon/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/axon/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/axon/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/axon/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/axon/templates/build-kit/lib/backend-prompt.md +158 -0
- package/stacks/axon/templates/build-kit/lib/prompt.md +126 -0
- package/stacks/axon/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/axon/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/axon/templates/build-kit/ralph.sh +98 -0
- package/stacks/axon/templates/root/.env.example +5 -0
- package/stacks/axon/templates/root/CLAUDE.md +60 -0
- package/stacks/axon/templates/root/README.md +44 -0
- package/stacks/axon/templates/root/docker-compose.yml +64 -0
- package/stacks/axon/templates/root/mvnw +259 -0
- package/stacks/axon/templates/root/mvnw.cmd +149 -0
- package/stacks/axon/templates/root/pom.xml +125 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java +128 -0
- package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/config/WebConfig.java +155 -0
- package/stacks/axon/templates/root/src/main/resources/application.properties +2 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-body.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/bg-header.png +0 -0
- package/stacks/axon/templates/root/src/main/resources/static/index.html +596 -0
- package/stacks/cratis-csharp/templates/.claude/skills/_shared/cratis-conventions.md +251 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/SKILL.md +99 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-automation/references/patterns.md +115 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/SKILL.md +163 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/references/patterns.md +234 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/SKILL.md +120 -0
- package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/references/patterns.md +166 -0
- package/stacks/cratis-csharp/templates/.claude/skills/connect/SKILL.md +169 -0
- package/stacks/cratis-csharp/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +609 -0
- package/stacks/cratis-csharp/templates/.claude/skills/load-slice/SKILL.md +141 -0
- package/stacks/cratis-csharp/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/AGENT.md +58 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/backend-prompt.md +129 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/prompt.md +124 -0
- package/stacks/cratis-csharp/templates/build-kit/lib/ralph.js +302 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph-claude.js +37 -0
- package/stacks/cratis-csharp/templates/build-kit/ralph.sh +98 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.css +29 -0
- package/stacks/cratis-csharp/templates/root/.frontend/index.html +17 -0
- package/stacks/cratis-csharp/templates/root/.frontend/main.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.json +42 -0
- package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.node.json +11 -0
- package/stacks/cratis-csharp/templates/root/.frontend/vite.config.ts +56 -0
- package/stacks/cratis-csharp/templates/root/App.tsx +23 -0
- package/stacks/cratis-csharp/templates/root/CLAUDE.md +62 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.csproj +25 -0
- package/stacks/cratis-csharp/templates/root/CratisApp.sln +18 -0
- package/stacks/cratis-csharp/templates/root/GlobalUsings.cs +3 -0
- package/stacks/cratis-csharp/templates/root/Home.tsx +102 -0
- package/stacks/cratis-csharp/templates/root/Program.cs +26 -0
- package/stacks/cratis-csharp/templates/root/README.md +192 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/AllListings.ts +47 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.cs +11 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.ts +12 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/ListingDataTable.tsx +17 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Register.ts +51 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/RegisterDialog.tsx +18 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Registration.cs +27 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeFeature.tsx +22 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeName.cs +3 -0
- package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/index.ts +1 -0
- package/stacks/cratis-csharp/templates/root/appsettings.Development.json +9 -0
- package/stacks/cratis-csharp/templates/root/appsettings.json +26 -0
- package/stacks/cratis-csharp/templates/root/docker-compose.yml +23 -0
- package/stacks/cratis-csharp/templates/root/package.json +33 -0
- package/stacks/cratis-csharp/templates/root/tsconfig.json +3 -0
- package/stacks/modeling-kit/templates/.claude/settings.local.json +13 -0
- package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +215 -0
- package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +176 -0
- package/stacks/modeling-kit/templates/.claude/skills/connect/SKILL.md +182 -0
- package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +383 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +465 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +587 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/facilitating-event-modeling-workshops.md +626 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +542 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +497 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +783 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +604 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +699 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +674 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +231 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +150 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +329 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +204 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +352 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/project-planning-with-event-modeling.md +341 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +153 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +136 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +78 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +85 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +655 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +479 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +234 -0
- package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +200 -0
- package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +94 -0
- package/stacks/modeling-kit/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +441 -0
- package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +290 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +212 -0
- package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +123 -0
- package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +353 -0
- package/stacks/modeling-kit/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +134 -0
- package/stacks/modeling-kit/templates/kit/lib/agent.sh +20 -0
- package/stacks/modeling-kit/templates/kit/lib/ollama-agent.js +147 -0
- package/stacks/modeling-kit/templates/kit/lib/ralph.js +286 -0
- package/stacks/modeling-kit/templates/kit/package.json +12 -0
- package/stacks/modeling-kit/templates/kit/ralph-claude.js +50 -0
- package/stacks/modeling-kit/templates/kit/ralph-ollama.js +38 -0
- package/stacks/modeling-kit/templates/kit/ralph.sh +61 -0
- package/stacks/modeling-kit/templates/kit/realtime-agent.js +18 -0
- package/stacks/modeling-kit/templates/root/CLAUDE.md +56 -0
- package/stacks/node/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +412 -0
- package/stacks/node/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/node/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/node/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/node/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/node/templates/build-kit/README.md +86 -0
- package/stacks/node/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/node/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/node/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/node/templates/build-kit/lib/prompt.md +122 -0
- package/stacks/node/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/node/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/node/templates/build-kit/ralph.sh +98 -0
- package/stacks/node/templates/root/.env.example +15 -0
- package/stacks/node/templates/root/CLAUDE.md +60 -0
- package/stacks/node/templates/root/docker-compose.yml +15 -0
- package/stacks/node/templates/root/flyway.conf +17 -0
- package/stacks/node/templates/root/migrations/V1__schema.sql.example +12 -0
- package/stacks/node/templates/root/package.json +50 -0
- package/stacks/node/templates/root/server.ts +130 -0
- package/stacks/node/templates/root/setup-env.sh +53 -0
- package/stacks/node/templates/root/src/common/assertions.ts +6 -0
- package/stacks/node/templates/root/src/common/db.ts +32 -0
- package/stacks/node/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/node/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/node/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/node/templates/root/src/common/realtimeBroadcast.ts +12 -0
- package/stacks/node/templates/root/src/common/replay.ts +16 -0
- package/stacks/node/templates/root/src/common/routes.ts +19 -0
- package/stacks/node/templates/root/src/common/testHelpers.ts +44 -0
- package/stacks/node/templates/root/src/swagger.ts +34 -0
- package/stacks/node/templates/root/src/util/assertions.ts +6 -0
- package/stacks/node/templates/root/src/util/hash.ts +9 -0
- package/stacks/node/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/node/templates/root/tsconfig.json +32 -0
- package/stacks/node/templates/root/vercel.json +8 -0
- package/stacks/supabase/templates/.claude/skills/build-automation/SKILL.md +266 -0
- package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +344 -0
- package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +390 -0
- package/stacks/supabase/templates/.claude/skills/build-webhook/SKILL.md +303 -0
- package/stacks/supabase/templates/.claude/skills/connect/SKILL.md +178 -0
- package/stacks/supabase/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
- package/stacks/supabase/templates/.claude/skills/load-slice/SKILL.md +143 -0
- package/stacks/supabase/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
- package/stacks/supabase/templates/build-kit/README.md +86 -0
- package/stacks/supabase/templates/build-kit/lib/AGENT.md +47 -0
- package/stacks/supabase/templates/build-kit/lib/agent.sh +20 -0
- package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +152 -0
- package/stacks/supabase/templates/build-kit/lib/prompt.md +123 -0
- package/stacks/supabase/templates/build-kit/lib/ralph.js +369 -0
- package/stacks/supabase/templates/build-kit/ralph-claude.js +44 -0
- package/stacks/supabase/templates/build-kit/ralph.sh +98 -0
- package/stacks/supabase/templates/root/.env.example +22 -0
- package/stacks/supabase/templates/root/CLAUDE.md +61 -0
- package/stacks/supabase/templates/root/flyway.conf +17 -0
- package/stacks/supabase/templates/root/package.json +52 -0
- package/stacks/supabase/templates/root/server.ts +177 -0
- package/stacks/supabase/templates/root/setup-env.sh +53 -0
- package/stacks/supabase/templates/root/src/common/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/common/db.ts +32 -0
- package/stacks/supabase/templates/root/src/common/loadPostgresEventstore.ts +23 -0
- package/stacks/supabase/templates/root/src/common/parseEndpoint.ts +51 -0
- package/stacks/supabase/templates/root/src/common/processorDlq.ts +28 -0
- package/stacks/supabase/templates/root/src/common/realtimeBroadcast.ts +19 -0
- package/stacks/supabase/templates/root/src/common/replay.ts +16 -0
- package/stacks/supabase/templates/root/src/common/routes.ts +23 -0
- package/stacks/supabase/templates/root/src/common/testHelpers.ts +54 -0
- package/stacks/supabase/templates/root/src/supabase/README.md +141 -0
- package/stacks/supabase/templates/root/src/supabase/api.ts +56 -0
- package/stacks/supabase/templates/root/src/supabase/requireOrgaAdmin.ts +32 -0
- package/stacks/supabase/templates/root/src/supabase/requireSysUser.ts +40 -0
- package/stacks/supabase/templates/root/src/supabase/requireUser.ts +72 -0
- package/stacks/supabase/templates/root/src/swagger.ts +34 -0
- package/stacks/supabase/templates/root/src/util/assertions.ts +6 -0
- package/stacks/supabase/templates/root/src/util/hash.ts +9 -0
- package/stacks/supabase/templates/root/src/util/sanitize.ts +23 -0
- package/stacks/supabase/templates/root/supabase/config.toml +295 -0
- package/stacks/supabase/templates/root/supabase/migrations/V1__schema.sql.example +12 -0
- package/stacks/supabase/templates/root/supabase/seed.sql +1 -0
- package/stacks/supabase/templates/root/tsconfig.json +32 -0
- package/stacks/supabase/templates/root/vercel.json +8 -0
package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md
ADDED
|
@@ -0,0 +1,783 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eventmodeling-elaborating-scenarios
|
|
3
|
+
description: "Step 7 of Event Modeling - Elaborate scenarios using Given-When-Then format. Specify behavior of commands and views. Each spec tied to exactly one command or view. Use after defining systems and boundaries. Do not use for: architectural validation (use eventmodeling-validating-event-models) or verifying field completeness across the model (use eventmodeling-checking-completeness)."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- AskUserQuestion
|
|
6
|
+
- Write
|
|
7
|
+
- Bash
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Elaborating Scenarios
|
|
11
|
+
|
|
12
|
+
> **Before doing anything else**, invoke the `connect` skill to resolve `TOKEN`, `BOARD_ID`, `ORG_ID`, and `BASE_URL`. Then invoke the `learn-eventmodelers-api` skill to load the full API reference. Do not proceed until both skills have been loaded.
|
|
13
|
+
|
|
14
|
+
## Interview Phase (Optional)
|
|
15
|
+
|
|
16
|
+
**When to Interview**: Skip if the user has already specified: scenario coverage depth (happy path + validation + state violations), known edge cases to include, and stakeholders available for review. Interview when coverage goals are unclear or edge cases haven't been identified.
|
|
17
|
+
|
|
18
|
+
**Interview Strategy**: Align on scenario depth and coverage strategy to avoid under-specification or excessive documentation. Identify stakeholders who can validate business rules.
|
|
19
|
+
|
|
20
|
+
### Critical Questions
|
|
21
|
+
|
|
22
|
+
When scenario coverage is uncertain:
|
|
23
|
+
|
|
24
|
+
1. **Scenario Depth & Coverage Goals** (Impact: Determines scope—happy path only vs. comprehensive coverage)
|
|
25
|
+
- Question: "How comprehensive should scenario coverage be? (A) Happy path + basic validation, (B) All command variations, (C) Comprehensive including edge cases and error paths"
|
|
26
|
+
- Why it matters: Affects time investment and implementation complexity; production code needs (C), design validation might use (A) or (B)
|
|
27
|
+
- Follow-up triggers: If (C) → ask "How many scenarios per command is reasonable?"; if (A) → clarify MVP vs. production distinction
|
|
28
|
+
|
|
29
|
+
2. **Known Edge Cases & Business Rules** (Impact: Ensures critical scenarios aren't missed)
|
|
30
|
+
- Question: "What specific edge cases or business rules are critical to test? (e.g., 'order cancellation within 24 hours', 'payment decline recovery')"
|
|
31
|
+
- Why it matters: Business rules often generate overlooked scenarios; edge cases reveal missing events
|
|
32
|
+
- Follow-up triggers: For each rule → ask "What scenarios demonstrate this rule? What happens when it's violated?"
|
|
33
|
+
|
|
34
|
+
3. **Testing & Automation Strategy** (Impact: Shapes scenario detail and executable format)
|
|
35
|
+
- Question: "Will these scenarios be: (A) Automated tests, (B) Manual QA reference, (C) Documentation only?"
|
|
36
|
+
- Why it matters: Automated tests need precise Given/When/Then; documentation can be more narrative
|
|
37
|
+
- Follow-up triggers: If (A) → ask about test framework; if (B) → ask about QA process
|
|
38
|
+
|
|
39
|
+
4. **Stakeholder Review & Validation** (Impact: Determines who validates business logic correctness)
|
|
40
|
+
- Question: "Who will review and validate scenarios? (A) Product Owner, (B) QA/Tester, (C) Multiple roles, (D) Engineering only?"
|
|
41
|
+
- Why it matters: Multi-role review catches business logic errors; single role may miss perspective
|
|
42
|
+
- Follow-up triggers: If (A) only → ask "Will PO have time for detailed review?"; if (C) → plan review workshop
|
|
43
|
+
|
|
44
|
+
### Interview Flow
|
|
45
|
+
|
|
46
|
+
**Conditional Entry**:
|
|
47
|
+
```
|
|
48
|
+
If user has provided:
|
|
49
|
+
- Clear scenario coverage goals (happy path + validation + state violations)
|
|
50
|
+
- AND identified edge cases or known business rules to test
|
|
51
|
+
- AND specified who will review/validate scenarios
|
|
52
|
+
|
|
53
|
+
Then: Skip interview, proceed directly to scenario elaboration
|
|
54
|
+
|
|
55
|
+
Else: Conduct interview
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Phase 1: Coverage Planning** (Questions 1-2)
|
|
59
|
+
- Determine depth (happy path vs. comprehensive)
|
|
60
|
+
- Identify critical edge cases to cover
|
|
61
|
+
- Establish coverage priorities
|
|
62
|
+
|
|
63
|
+
**Phase 2: Implementation & Review** (Questions 3-4)
|
|
64
|
+
- Decide on automation vs. documentation
|
|
65
|
+
- Confirm stakeholder availability
|
|
66
|
+
- Plan review workflow
|
|
67
|
+
|
|
68
|
+
### Capturing Interview Findings
|
|
69
|
+
|
|
70
|
+
Append findings to the project's event modeling file:
|
|
71
|
+
|
|
72
|
+
**File**: `.trogonai/interviews/[project-name]/EVENTMODELING.md`
|
|
73
|
+
|
|
74
|
+
Use Write tool to add/update this section:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
## 9. Scenarios (eventmodeling-elaborating-scenarios)
|
|
78
|
+
|
|
79
|
+
### Coverage Goals
|
|
80
|
+
[From Q1: Happy path / Comprehensive / Deep]
|
|
81
|
+
|
|
82
|
+
### Critical Edge Cases
|
|
83
|
+
[From Q2]
|
|
84
|
+
- Edge case 1: [Case] → [Why important]
|
|
85
|
+
- Edge case 2: [Case] → [Why important]
|
|
86
|
+
|
|
87
|
+
### Business Rules Requiring Scenarios
|
|
88
|
+
[From Q2]
|
|
89
|
+
- Rule 1: [Statement] → Success + Failure scenarios
|
|
90
|
+
- Rule 2: [Statement] → Success + Failure scenarios
|
|
91
|
+
|
|
92
|
+
### Testing Strategy
|
|
93
|
+
[From Q3: Automated / Manual / Documentation]
|
|
94
|
+
|
|
95
|
+
### Review & Validation
|
|
96
|
+
[From Q4: Who reviews, when, workflow]
|
|
97
|
+
|
|
98
|
+
### Key Scenario Specifications
|
|
99
|
+
[GWT format scenarios for critical commands and views]
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Validation & Completeness
|
|
104
|
+
|
|
105
|
+
### Validated
|
|
106
|
+
- [ ] All fields traced (completeness check)
|
|
107
|
+
- [ ] Events are immutable
|
|
108
|
+
- [ ] State projections deterministic
|
|
109
|
+
- [ ] Model ready for code generation
|
|
110
|
+
|
|
111
|
+
**Validation Date**: [Date]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Update Interview Trail:
|
|
115
|
+
```markdown
|
|
116
|
+
| 9 | eventmodeling-elaborating-scenarios | [today] | Scenario coverage, testing strategy, edge cases |
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
At this point, EVENTMODELING.md is complete and ready for implementation!
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Workshop Facilitation Guide
|
|
124
|
+
|
|
125
|
+
**Context**: Scenarios are created in a collaborative workshop with multiple stakeholders. Use this approach for rapid, real-time scenario creation:
|
|
126
|
+
|
|
127
|
+
### Before the Workshop
|
|
128
|
+
|
|
129
|
+
**Participants** (required roles):
|
|
130
|
+
- **Product Owner/Domain Expert**: Knows business rules, priorities, edge cases
|
|
131
|
+
- **Developer**: Technical feasibility, implementation concerns
|
|
132
|
+
- **QA/Tester**: Test coverage, edge cases, error scenarios
|
|
133
|
+
- **Facilitator**: Keeps pace, ensures shared understanding, captures scenarios
|
|
134
|
+
|
|
135
|
+
**Setup**:
|
|
136
|
+
- Whiteboard or collaborative tool (Miro, Figma, etc.)
|
|
137
|
+
- Sticky notes or digital cards for scenarios
|
|
138
|
+
- Previously completed steps: Events timeline and system boundaries
|
|
139
|
+
- Timer for time-boxing per command/view
|
|
140
|
+
|
|
141
|
+
### During Workshop (Per Command/View)
|
|
142
|
+
|
|
143
|
+
**Rapid Cycle** (15-20 min per command):
|
|
144
|
+
1. **Happy Path First**: "What's the normal success case?" (Product Owner leads)
|
|
145
|
+
- Facilitator writes scenario live
|
|
146
|
+
- All roles review in real-time
|
|
147
|
+
- Adjust based on feedback
|
|
148
|
+
|
|
149
|
+
2. **Validation Failures**: "What could go wrong with inputs?" (Developer/QA)
|
|
150
|
+
- Common: invalid format, missing fields, invalid references
|
|
151
|
+
- Quick scenarios, add to board
|
|
152
|
+
|
|
153
|
+
3. **State Violations**: "What if system is in wrong state?" (Domain Expert)
|
|
154
|
+
- Example: "Can't confirm if already confirmed"
|
|
155
|
+
- These are business rules, often overlooked
|
|
156
|
+
|
|
157
|
+
4. **Alternative Paths**: "Are there other ways this could work?" (Product Owner)
|
|
158
|
+
- Different paths through the same command
|
|
159
|
+
- Different outcomes based on business logic
|
|
160
|
+
|
|
161
|
+
5. **Error Handling**: "What if external systems fail?" (Developer)
|
|
162
|
+
- Payment decline, inventory unavailable
|
|
163
|
+
- Recovery/retry scenarios
|
|
164
|
+
|
|
165
|
+
6. **Compensation**: "Can this be undone?" (Domain Expert)
|
|
166
|
+
- Cancellation, reversal, refund flows
|
|
167
|
+
- Often reveal missing events
|
|
168
|
+
|
|
169
|
+
**Review Style**:
|
|
170
|
+
- Each scenario read aloud by facilitator
|
|
171
|
+
- Quick check: "Is this right?" (Everyone nods or speaks up)
|
|
172
|
+
- Move forward—don't perfect, iterate later
|
|
173
|
+
- Target: 3-5 scenarios per command, 10-20 minutes per command
|
|
174
|
+
|
|
175
|
+
### Multi-Role Review
|
|
176
|
+
|
|
177
|
+
As scenarios are written, ensure each role checks:
|
|
178
|
+
- **Product Owner**: "Is this the right business behavior?"
|
|
179
|
+
- **Developer**: "Can we implement this? Need system state? Edge cases?"
|
|
180
|
+
- **QA**: "Can we test this? Is it clear enough?"
|
|
181
|
+
- **Facilitator**: "Do we have enough detail for coding?"
|
|
182
|
+
|
|
183
|
+
### Common Workshop Mistakes to Avoid
|
|
184
|
+
|
|
185
|
+
**Perfectionism**: Don't spend 30 minutes on one scenario. Capture and move.
|
|
186
|
+
**Missing roles**: One person can't represent all perspectives.
|
|
187
|
+
**Too technical**: Use domain language, not code. Adjust in implementation.
|
|
188
|
+
**Incomplete givens**: "Given an order" is too vague. Specify state.
|
|
189
|
+
**Unclear events**: Every scenario must show what event is produced (or why not).
|
|
190
|
+
|
|
191
|
+
### Tips for Rapid Creation
|
|
192
|
+
|
|
193
|
+
**Use templates**: Have sticky note templates with Given/When/Then pre-printed
|
|
194
|
+
**Parallel work**: Different people write different scenarios simultaneously
|
|
195
|
+
**Capture edge cases**: When someone says "What if...?" → immediately capture as scenario
|
|
196
|
+
**Reference past decisions**: Point to event timeline and boundary diagrams
|
|
197
|
+
**Record decisions**: Why did we choose this behavior? (Helps implementers later)
|
|
198
|
+
|
|
199
|
+
## Scenario Types
|
|
200
|
+
|
|
201
|
+
**Do not reduce scenarios to a simple good-case / bad-case pair.** For each command, ask the questions below and write a scenario for every answer that the business case supports. Which types apply and how many scenarios each type generates is always determined by the domain — not by a fixed count or a static rule.
|
|
202
|
+
|
|
203
|
+
| # | Type | Question to ask |
|
|
204
|
+
|---|------|----------------|
|
|
205
|
+
| 1 | **Happy Path** | "What is the normal success case?" |
|
|
206
|
+
| 2 | **Validation Failure** | "What invalid or missing inputs should be rejected?" |
|
|
207
|
+
| 3 | **State Violation** | "What if the system is in a state that makes this command invalid?" |
|
|
208
|
+
| 4 | **Duplicate Action** | "What if this command is issued again after it already succeeded?" |
|
|
209
|
+
| 5 | **Alternative Path** | "Are there different valid outcomes depending on context?" |
|
|
210
|
+
| 6 | **External Failure** | "What if an external system or scheduler fails during this command?" |
|
|
211
|
+
| 7 | **Compensation** | "Can this be undone or reversed? What triggers the cleanup?" |
|
|
212
|
+
|
|
213
|
+
Work through each question with the domain in mind. If the answer is "that situation cannot occur in this business" then no scenario is needed for that type — but that judgment must come from the domain, not from a desire to write fewer scenarios.
|
|
214
|
+
|
|
215
|
+
## Workflow
|
|
216
|
+
|
|
217
|
+
For each command and view, write scenarios in Given-When-Then format:
|
|
218
|
+
|
|
219
|
+
### 1. Command Scenarios (Given-When-Then)
|
|
220
|
+
Specify command behavior:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Feature: Order Creation
|
|
224
|
+
|
|
225
|
+
Scenario: Create order successfully
|
|
226
|
+
Given a customer with ID "cust-123"
|
|
227
|
+
And products exist with IDs ["prod-1", "prod-2"]
|
|
228
|
+
And customer has valid shipping address
|
|
229
|
+
When the customer creates an order with items:
|
|
230
|
+
| productId | quantity | unitPrice |
|
|
231
|
+
| prod-1 | 2 | 50.00 |
|
|
232
|
+
| prod-2 | 1 | 30.00 |
|
|
233
|
+
Then the order should be created with status "Draft"
|
|
234
|
+
And the total should be calculated as 130.00
|
|
235
|
+
And an "OrderCreated" event is produced with:
|
|
236
|
+
| field | value |
|
|
237
|
+
| orderId | {uuid} |
|
|
238
|
+
| customerId | cust-123 |
|
|
239
|
+
| items | [...] |
|
|
240
|
+
| total | 130.00 |
|
|
241
|
+
| status | Draft |
|
|
242
|
+
|
|
243
|
+
Scenario: Reject order with invalid customer
|
|
244
|
+
Given a customer ID "invalid-cust"
|
|
245
|
+
And no customer exists with that ID
|
|
246
|
+
When the customer tries to create an order
|
|
247
|
+
Then the command should be rejected
|
|
248
|
+
And the rejection reason is "Customer not found"
|
|
249
|
+
And no event is produced
|
|
250
|
+
|
|
251
|
+
Scenario: Reject order with empty items
|
|
252
|
+
Given a customer with ID "cust-123"
|
|
253
|
+
And an empty items list []
|
|
254
|
+
When the customer tries to create an order
|
|
255
|
+
Then the command should be rejected
|
|
256
|
+
And the rejection reason is "Order must contain items"
|
|
257
|
+
And no event is produced
|
|
258
|
+
|
|
259
|
+
Scenario: Reject order with invalid address
|
|
260
|
+
Given a customer with ID "cust-123"
|
|
261
|
+
And an incomplete shipping address (missing city)
|
|
262
|
+
When the customer tries to create an order
|
|
263
|
+
Then the command should be rejected
|
|
264
|
+
And the rejection reason is "Invalid shipping address"
|
|
265
|
+
And no event is produced
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 2. Command Scenarios - State Validation
|
|
269
|
+
Specify how stream state affects command:
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
Feature: Order Confirmation
|
|
273
|
+
|
|
274
|
+
Scenario: Confirm order in Draft state
|
|
275
|
+
Given an order "order-456" in Draft state
|
|
276
|
+
And OrderCreated event exists
|
|
277
|
+
And no OrderConfirmed event exists
|
|
278
|
+
When the customer confirms the order with payment method "card"
|
|
279
|
+
Then the order should be confirmed
|
|
280
|
+
And an "OrderConfirmed" event is produced with:
|
|
281
|
+
| field | value |
|
|
282
|
+
| orderId | order-456 |
|
|
283
|
+
| paymentMethod | card |
|
|
284
|
+
| confirmedAt | {timestamp} |
|
|
285
|
+
|
|
286
|
+
Scenario: Reject confirming already-confirmed order
|
|
287
|
+
Given an order "order-456" in Confirmed state
|
|
288
|
+
And OrderConfirmed event already exists
|
|
289
|
+
When the customer tries to confirm the order again
|
|
290
|
+
Then the command should be rejected
|
|
291
|
+
And the rejection reason is "Order already confirmed"
|
|
292
|
+
And no OrderConfirmed event is produced
|
|
293
|
+
|
|
294
|
+
Scenario: Reject confirming cancelled order
|
|
295
|
+
Given an order "order-456" in Cancelled state
|
|
296
|
+
And OrderCancelled event exists
|
|
297
|
+
When the customer tries to confirm the order
|
|
298
|
+
Then the command should be rejected
|
|
299
|
+
And the rejection reason is "Cannot confirm cancelled order"
|
|
300
|
+
And no event is produced
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### 3. View Scenarios (Given-When-Then)
|
|
304
|
+
Specify how read models display data:
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
Feature: Order Status View
|
|
308
|
+
|
|
309
|
+
Scenario: Display order after creation
|
|
310
|
+
Given an OrderCreated event with:
|
|
311
|
+
| field | value |
|
|
312
|
+
| orderId | order-789 |
|
|
313
|
+
| customerId | cust-123 |
|
|
314
|
+
| items | [{...}] |
|
|
315
|
+
| total | 150.00 |
|
|
316
|
+
When the OrderStatusView processes this event
|
|
317
|
+
Then the view should display:
|
|
318
|
+
| field | value |
|
|
319
|
+
| Order ID | order-789 |
|
|
320
|
+
| Status | Draft |
|
|
321
|
+
| Total | $150.00 |
|
|
322
|
+
| Items | 3 products |
|
|
323
|
+
| Created | {date} |
|
|
324
|
+
|
|
325
|
+
Scenario: Update status after confirmation
|
|
326
|
+
Given an OrderCreated event already processed
|
|
327
|
+
And OrderStatusView showing status "Draft"
|
|
328
|
+
When an OrderConfirmed event is received with:
|
|
329
|
+
| field | value |
|
|
330
|
+
| orderId | order-789 |
|
|
331
|
+
| confirmedAt | 2024-12-31T10:00:00Z |
|
|
332
|
+
Then the view should update to display:
|
|
333
|
+
| field | value |
|
|
334
|
+
| Status | Confirmed |
|
|
335
|
+
| Confirmed Date | 12/31/2024 10:00 AM |
|
|
336
|
+
|
|
337
|
+
Scenario: Accumulate payment information
|
|
338
|
+
Given OrderConfirmed event processed (status=Confirmed)
|
|
339
|
+
When a PaymentAuthorized event arrives with:
|
|
340
|
+
| field | value |
|
|
341
|
+
| orderId | order-789 |
|
|
342
|
+
| paymentId | pay-123 |
|
|
343
|
+
| authCode | AUTH-456 |
|
|
344
|
+
Then the view should accumulate:
|
|
345
|
+
| field | value |
|
|
346
|
+
| Payment ID | pay-123 |
|
|
347
|
+
| Auth Code | AUTH-456 |
|
|
348
|
+
| Payment Status | Authorized |
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### 3b. List-type Read Model Scenarios
|
|
352
|
+
Specify expected rows and empty-list intent when the THEN readmodel is a list (`listElement: true`):
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
Feature: Product Catalog
|
|
356
|
+
|
|
357
|
+
Scenario: Products list shows all created products
|
|
358
|
+
Given a ProductCreated event with name "Shoes", index "0", family_id "22222..."
|
|
359
|
+
And a ProductCreated event with name "Clothing", index "1", family_id "33333..."
|
|
360
|
+
When the ProductList view processes these events
|
|
361
|
+
Then the list should contain:
|
|
362
|
+
| name | index | family_id |
|
|
363
|
+
| Shoes | 0 | 22222... |
|
|
364
|
+
| Clothing | 1 | 33333... |
|
|
365
|
+
|
|
366
|
+
Scenario: Products list is empty after last item is deleted
|
|
367
|
+
Given a ProductDeleted event for the last remaining item
|
|
368
|
+
When the ProductList view processes this event
|
|
369
|
+
Then the list should be empty
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### 4. Error Path Scenarios
|
|
373
|
+
Specify how system handles failures:
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
Feature: Payment Authorization Failure
|
|
377
|
+
|
|
378
|
+
Scenario: Handle declined payment
|
|
379
|
+
Given an order "order-001" in Confirmed state
|
|
380
|
+
And customer initiates payment
|
|
381
|
+
When the payment gateway declines the card
|
|
382
|
+
Then a PaymentFailed event is produced with:
|
|
383
|
+
| field | value |
|
|
384
|
+
| orderId | order-001 |
|
|
385
|
+
| reason | Card declined |
|
|
386
|
+
| timestamp | {now} |
|
|
387
|
+
|
|
388
|
+
Scenario: Update order view on payment failure
|
|
389
|
+
Given OrderStatusView shows status "Confirmed"
|
|
390
|
+
When PaymentFailed event arrives for order-001
|
|
391
|
+
Then the view should update:
|
|
392
|
+
| field | value |
|
|
393
|
+
| Payment Status | Failed |
|
|
394
|
+
| Failure Reason | Card declined |
|
|
395
|
+
| Retry Available | Yes |
|
|
396
|
+
|
|
397
|
+
Scenario: Allow retry after payment failure
|
|
398
|
+
Given a PaymentFailed event exists
|
|
399
|
+
And order status is still "Confirmed"
|
|
400
|
+
When customer retries payment
|
|
401
|
+
Then the new AuthorizePayment command is accepted
|
|
402
|
+
And can produce new PaymentAuthorized event
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### 5. Compensation Scenarios
|
|
406
|
+
Specify rollback/cancellation flows:
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
Feature: Order Cancellation
|
|
410
|
+
|
|
411
|
+
Scenario: Cancel order in Draft state
|
|
412
|
+
Given an order "order-555" in Draft state
|
|
413
|
+
And only OrderCreated event exists
|
|
414
|
+
When customer cancels the order with reason "Changed mind"
|
|
415
|
+
Then an OrderCancelled event is produced with:
|
|
416
|
+
| field | value |
|
|
417
|
+
| orderId | order-555 |
|
|
418
|
+
| reason | Changed mind |
|
|
419
|
+
| cancelledAt | {timestamp} |
|
|
420
|
+
|
|
421
|
+
Scenario: Cannot cancel completed order
|
|
422
|
+
Given an order "order-555" in Delivered state
|
|
423
|
+
And DeliveryConfirmed event exists
|
|
424
|
+
When customer tries to cancel
|
|
425
|
+
Then the command should be rejected
|
|
426
|
+
And the rejection reason is "Cannot cancel delivered order"
|
|
427
|
+
|
|
428
|
+
Scenario: Trigger compensation on cancellation
|
|
429
|
+
Given an order in Confirmed state
|
|
430
|
+
And PaymentAuthorized event exists
|
|
431
|
+
When OrderCancelled event is produced
|
|
432
|
+
Then a RefundPayment command should be automatically triggered
|
|
433
|
+
And RefundInitiated event should follow
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Output Format
|
|
437
|
+
|
|
438
|
+
Present as:
|
|
439
|
+
|
|
440
|
+
````markdown
|
|
441
|
+
# Scenarios: [Domain Name]
|
|
442
|
+
|
|
443
|
+
## Commands
|
|
444
|
+
|
|
445
|
+
### Command: CreateOrder
|
|
446
|
+
|
|
447
|
+
**Description**: Customer creates a new order with items and shipping address.
|
|
448
|
+
|
|
449
|
+
#### Scenario 1: Successful Order Creation
|
|
450
|
+
```gherkin
|
|
451
|
+
Given a customer with ID "cust-123"
|
|
452
|
+
And products ["prod-1", "prod-2"] exist in catalog
|
|
453
|
+
And the shipping address is valid
|
|
454
|
+
When the customer creates an order:
|
|
455
|
+
| customerId | cust-123 |
|
|
456
|
+
| items | [{productId: prod-1, qty: 2}, {productId: prod-2, qty: 1}] |
|
|
457
|
+
| shippingAddress | {street, city, state, zip} |
|
|
458
|
+
Then the command succeeds
|
|
459
|
+
And an "OrderCreated" event is produced with all input data
|
|
460
|
+
And the order status is "Draft"
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### Scenario 2: Reject with Invalid Customer
|
|
464
|
+
```gherkin
|
|
465
|
+
Given a customer ID "invalid" that doesn't exist
|
|
466
|
+
When the customer tries to create an order
|
|
467
|
+
Then the command is rejected
|
|
468
|
+
And the error is "Customer not found"
|
|
469
|
+
And no event is produced
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
[Continue for each scenario]
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
### Command: ConfirmOrder
|
|
477
|
+
|
|
478
|
+
**Description**: Customer confirms order and selects payment method.
|
|
479
|
+
|
|
480
|
+
#### Scenario 1: Confirm Draft Order
|
|
481
|
+
```gherkin
|
|
482
|
+
Given an order in "Draft" state
|
|
483
|
+
And OrderCreated event exists
|
|
484
|
+
When the customer confirms with paymentMethod="card"
|
|
485
|
+
Then an "OrderConfirmed" event is produced
|
|
486
|
+
And the order status becomes "Confirmed"
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
#### Scenario 2: Prevent Duplicate Confirmation
|
|
490
|
+
```gherkin
|
|
491
|
+
Given an order already in "Confirmed" state
|
|
492
|
+
And OrderConfirmed event already exists
|
|
493
|
+
When the customer tries to confirm again
|
|
494
|
+
Then the command is rejected
|
|
495
|
+
And the error is "Order already confirmed"
|
|
496
|
+
And no new event is produced
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Views
|
|
502
|
+
|
|
503
|
+
### View: OrderStatusView
|
|
504
|
+
|
|
505
|
+
**Description**: Real-time order status display showing accumulated event data.
|
|
506
|
+
|
|
507
|
+
#### Scenario 1: Initial Display After Creation
|
|
508
|
+
```gherkin
|
|
509
|
+
Given an OrderCreated event with id, customer, items, total, address
|
|
510
|
+
When the view processes this event
|
|
511
|
+
Then the view displays:
|
|
512
|
+
- Order ID: order-123
|
|
513
|
+
- Status: Draft
|
|
514
|
+
- Total: $150.00
|
|
515
|
+
- Items: 3 products
|
|
516
|
+
- Customer: cust-456
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
#### Scenario 2: Update on Confirmation
|
|
520
|
+
```gherkin
|
|
521
|
+
Given the view displaying status="Draft"
|
|
522
|
+
When an OrderConfirmed event arrives
|
|
523
|
+
Then the view updates to:
|
|
524
|
+
- Status: Confirmed
|
|
525
|
+
- Confirmed At: {timestamp}
|
|
526
|
+
- Payment Method: (from event)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
#### Scenario 3: Accumulate Payment Data
|
|
530
|
+
```gherkin
|
|
531
|
+
Given status="Confirmed"
|
|
532
|
+
When PaymentAuthorized event arrives
|
|
533
|
+
Then the view shows:
|
|
534
|
+
- Payment Status: Authorized
|
|
535
|
+
- Auth Code: (from event)
|
|
536
|
+
- Payment ID: (from event)
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## Error Paths
|
|
542
|
+
|
|
543
|
+
### Scenario: Payment Decline
|
|
544
|
+
```gherkin
|
|
545
|
+
Given an order in "Confirmed" state
|
|
546
|
+
When payment gateway declines
|
|
547
|
+
Then PaymentFailed event is produced
|
|
548
|
+
And OrderStatusView updates to show:
|
|
549
|
+
- Payment Status: Failed
|
|
550
|
+
- Retry Available: true
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## Compensation Flows
|
|
556
|
+
|
|
557
|
+
### Scenario: Order Cancellation with Refund
|
|
558
|
+
```gherkin
|
|
559
|
+
Given an order in "Confirmed" state
|
|
560
|
+
And PaymentAuthorized event exists
|
|
561
|
+
When OrderCancelled event is produced
|
|
562
|
+
Then a RefundPayment command is triggered
|
|
563
|
+
And RefundInitiated event follows
|
|
564
|
+
And inventory reservation is released
|
|
565
|
+
```
|
|
566
|
+
````
|
|
567
|
+
|
|
568
|
+
## Post Scenarios to Board
|
|
569
|
+
|
|
570
|
+
After designing all scenarios, post them to the board using the timeline/column API. Do this for every command and view that has scenarios.
|
|
571
|
+
|
|
572
|
+
### Step 1 — Identify the target timeline and column
|
|
573
|
+
|
|
574
|
+
Fetch all CHAPTER nodes to find the timeline:
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/nodes?type=CHAPTER" \
|
|
578
|
+
-H "x-token: $TOKEN"
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
If there is more than one chapter, ask the user which timeline to target.
|
|
582
|
+
|
|
583
|
+
For each command or view being specified, find its column: fetch the chapter node and read `meta.timelineData.columns`. Match the column to the COMMAND or READMODEL node that occupies the interaction row in that column. If the user named the slice, find the SLICE_BORDER node with that title to get its `colId`.
|
|
584
|
+
|
|
585
|
+
### Step 2 — Load valid step elements
|
|
586
|
+
|
|
587
|
+
For each target timeline, call spec-info to discover the node IDs that may appear in given/when/then:
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
curl -s "$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/spec-info" \
|
|
591
|
+
-H "x-token: $TOKEN"
|
|
592
|
+
# → { timelineId, elements: [{ id, title, type }] }
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
Build a lookup map: `title (lowercase) → { id, type }`. Use this to resolve scenario step names to node IDs.
|
|
596
|
+
|
|
597
|
+
### Step 3 — Resolve step IDs
|
|
598
|
+
|
|
599
|
+
For each scenario step (given/when/then items), match the step title against the spec-info lookup. If a title matches unambiguously, use that node's `id`. If a title is ambiguous or unmatched, log it and skip that step item rather than failing — the scenario can still be posted with fewer steps.
|
|
600
|
+
|
|
601
|
+
See `learn-eventmodelers-api` for the full step item format, scenario object shapes, and edge cases (SPEC_ERROR, multiple spec rows).
|
|
602
|
+
|
|
603
|
+
### Step 4 — Post all scenarios for a column in one call
|
|
604
|
+
|
|
605
|
+
Group all scenarios for the same column and POST them as an array. The SCENARIO spec node is created automatically — no pre-creation needed.
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
curl -s -X POST \
|
|
609
|
+
"$BASE_URL/api/org/$ORG_ID/boards/$BOARD_ID/timelines/$TL/columns/$COL/scenarios" \
|
|
610
|
+
-H "x-token: $TOKEN" \
|
|
611
|
+
-H "Content-Type: application/json" \
|
|
612
|
+
-d '[...scenario objects...]'
|
|
613
|
+
# → 201 { specNodeId, scenarios (all), added (count), isNewNode }
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
On `409` (duplicate title) or `400` (validation error), log the error and retry without the offending scenario. On `404`, check that the timeline and column IDs are correct.
|
|
617
|
+
|
|
618
|
+
**Rules enforced by the server (do not pre-validate — let the server reject):**
|
|
619
|
+
- `given`: EVENTs only
|
|
620
|
+
- `when`: at most one COMMAND; empty when `then` contains a READMODEL
|
|
621
|
+
- `then`: EVENTs only OR exactly one READMODEL — never mixed
|
|
622
|
+
- All step node IDs must belong to the same timeline
|
|
623
|
+
|
|
624
|
+
### Step 4b — List-type readmodel scenario fields
|
|
625
|
+
|
|
626
|
+
When `then` contains a READMODEL whose `listElement` property is `true`, add two fields **at the scenario level** (not inside `then`):
|
|
627
|
+
|
|
628
|
+
**`examples`** — one object per expected row, keyed by the readmodel's snake_case field names. Without this the spec node renders with no expected output and the scenario is unverifiable.
|
|
629
|
+
|
|
630
|
+
**`expectEmptyList: true`** — when the expected result is an empty list (e.g. after a delete). Do not leave `examples: []` without this flag — an empty array alone is ambiguous ("no data provided yet" vs. "intentionally empty").
|
|
631
|
+
|
|
632
|
+
Non-empty list scenario:
|
|
633
|
+
```json
|
|
634
|
+
{
|
|
635
|
+
"id": "<uuid>",
|
|
636
|
+
"title": "Products list shows created items",
|
|
637
|
+
"given": [{"id":"<eventNodeId>","title":"ProductCreated","type":"EVENT"}],
|
|
638
|
+
"when": [],
|
|
639
|
+
"then": [{"id":"<readmodelNodeId>","title":"ProductList","type":"READMODEL"}],
|
|
640
|
+
"examples": [
|
|
641
|
+
{ "name": "Shoes", "index": "0", "family_id": "22222..." },
|
|
642
|
+
{ "name": "Clothing", "index": "1", "family_id": "33333..." }
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
Empty list scenario:
|
|
648
|
+
```json
|
|
649
|
+
{
|
|
650
|
+
"id": "<uuid>",
|
|
651
|
+
"title": "No products remain after deletion",
|
|
652
|
+
"given": [{"id":"<eventNodeId>","title":"ProductDeleted","type":"EVENT"}],
|
|
653
|
+
"when": [],
|
|
654
|
+
"then": [{"id":"<readmodelNodeId>","title":"ProductList","type":"READMODEL"}],
|
|
655
|
+
"expectEmptyList": true,
|
|
656
|
+
"examples": []
|
|
657
|
+
}
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
### Step 4c — Error/rejection scenarios
|
|
661
|
+
|
|
662
|
+
When a scenario represents a command being **rejected** (validation failure, state violation, or business rule rejection), set two fields **at the scenario level**:
|
|
663
|
+
|
|
664
|
+
**`expectError: true`** — signals that the command should be rejected and no event is produced. Set this for every failure/rejection scenario.
|
|
665
|
+
|
|
666
|
+
**`errorDescription`** — a short human-readable description of the expected error or rejection reason (e.g. `"missing required field: date"`, `"reservation already confirmed"`). Do not leave this empty when `expectError` is `true`.
|
|
667
|
+
|
|
668
|
+
When `expectError` is `true`:
|
|
669
|
+
- `then` must be `[]` — no events are produced on rejection
|
|
670
|
+
- `when` contains the COMMAND being rejected
|
|
671
|
+
- `given` contains any prerequisite EVENTs needed to establish the wrong state (may be empty for pure input-validation rejections)
|
|
672
|
+
- Do **not** set `expectEmptyList` — that flag is only for list READMODELs
|
|
673
|
+
|
|
674
|
+
Rejection scenario example:
|
|
675
|
+
```json
|
|
676
|
+
{
|
|
677
|
+
"id": "<uuid>",
|
|
678
|
+
"title": "Reject reservation with missing required date field",
|
|
679
|
+
"expectError": true,
|
|
680
|
+
"errorDescription": "missing required field: date",
|
|
681
|
+
"given": [],
|
|
682
|
+
"when": [{"id": "<commandNodeId>", "title": "Reservation Command", "type": "COMMAND"}],
|
|
683
|
+
"then": [],
|
|
684
|
+
"examples": [],
|
|
685
|
+
"expectEmptyList": false
|
|
686
|
+
}
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
State-violation rejection (given events establish the wrong state):
|
|
690
|
+
```json
|
|
691
|
+
{
|
|
692
|
+
"id": "<uuid>",
|
|
693
|
+
"title": "Reject confirming an already-confirmed reservation",
|
|
694
|
+
"expectError": true,
|
|
695
|
+
"errorDescription": "reservation already confirmed",
|
|
696
|
+
"given": [{"id": "<eventNodeId>", "title": "ReservationConfirmed", "type": "EVENT"}],
|
|
697
|
+
"when": [{"id": "<commandNodeId>", "title": "Confirm Reservation", "type": "COMMAND"}],
|
|
698
|
+
"then": [],
|
|
699
|
+
"examples": [],
|
|
700
|
+
"expectEmptyList": false
|
|
701
|
+
}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### Step 5 — Report back
|
|
705
|
+
|
|
706
|
+
After posting, tell the user:
|
|
707
|
+
- How many scenarios were posted successfully (per command/view)
|
|
708
|
+
- Any scenarios skipped due to duplicate title or unresolvable step IDs
|
|
709
|
+
- The `specNodeId` of each spec node created or updated
|
|
710
|
+
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
## Quality Checklist
|
|
714
|
+
|
|
715
|
+
**Per command — all 7 scenario types considered (skip only with explicit reason):**
|
|
716
|
+
- [ ] **Happy Path** — normal success case written
|
|
717
|
+
- [ ] **Validation Failure** — invalid/missing input rejected (or marked N/A with reason)
|
|
718
|
+
- [ ] **State Violation** — command issued in wrong system state (or marked N/A with reason)
|
|
719
|
+
- [ ] **Duplicate Action** — second issuance after success handled (or marked N/A with reason)
|
|
720
|
+
- [ ] **Alternative Path** — different valid outcomes captured (or marked N/A with reason)
|
|
721
|
+
- [ ] **External Failure** — external system failure handled (or marked N/A with reason)
|
|
722
|
+
- [ ] **Compensation** — reversal/undo flow written (or marked N/A with reason)
|
|
723
|
+
|
|
724
|
+
**No command has only 2 scenarios unless all other types were reviewed and found inapplicable.**
|
|
725
|
+
|
|
726
|
+
**Format and posting:**
|
|
727
|
+
- [ ] State preconditions are explicit in Given (not just "Given an order")
|
|
728
|
+
- [ ] Actions are clear in When
|
|
729
|
+
- [ ] Outcomes are verifiable in Then (event produced or rejection with reason)
|
|
730
|
+
- [ ] Every view has at least one update scenario
|
|
731
|
+
- [ ] All scenarios posted to board spec cells via the `/scenarios` API
|
|
732
|
+
- [ ] **Workshop facilitation approach documented**
|
|
733
|
+
- [ ] **All stakeholder roles (PO, Dev, QA, Domain Expert) perspectives captured**
|
|
734
|
+
- [ ] **Edge cases suggested by participants captured**
|
|
735
|
+
- [ ] **Why behind business rules documented (not just the what)**
|
|
736
|
+
|
|
737
|
+
## Gherkin Best Practices
|
|
738
|
+
|
|
739
|
+
```
|
|
740
|
+
Good:
|
|
741
|
+
Given an order in "Draft" state
|
|
742
|
+
When the customer confirms the order
|
|
743
|
+
Then the status changes to "Confirmed"
|
|
744
|
+
|
|
745
|
+
Bad:
|
|
746
|
+
Given order
|
|
747
|
+
When stuff happens
|
|
748
|
+
Then it works
|
|
749
|
+
|
|
750
|
+
Good:
|
|
751
|
+
And an OrderConfirmed event is produced with:
|
|
752
|
+
| field | value |
|
|
753
|
+
| orderId | order-123 |
|
|
754
|
+
|
|
755
|
+
Bad:
|
|
756
|
+
And an event is produced
|
|
757
|
+
|
|
758
|
+
Good:
|
|
759
|
+
Then the command is rejected
|
|
760
|
+
And the error is "Customer not found"
|
|
761
|
+
|
|
762
|
+
Bad:
|
|
763
|
+
Then there's an error
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
## Scenario Organization
|
|
767
|
+
|
|
768
|
+
1. **Happy Path**: Successful execution
|
|
769
|
+
2. **Validation Failures**: Invalid inputs
|
|
770
|
+
3. **State Violations**: Wrong pre-conditions
|
|
771
|
+
4. **Duplicate Actions**: Already processed
|
|
772
|
+
5. **Alternative Paths**: Different branches
|
|
773
|
+
6. **Error Handling**: Failures and recovery
|
|
774
|
+
7. **Compensation**: Rollback and cleanup
|
|
775
|
+
|
|
776
|
+
## Key Principles
|
|
777
|
+
|
|
778
|
+
1. **One Scenario = One Test**: Each scenario is testable
|
|
779
|
+
2. **Explicit Preconditions**: State is clear in "Given"
|
|
780
|
+
3. **Clear Actions**: "When" describes user/processor action
|
|
781
|
+
4. **Verifiable Outcomes**: "Then" checks results
|
|
782
|
+
5. **Event-Centric**: Every scenario produces or updates events
|
|
783
|
+
6. **Business Language**: Use domain terms, not technical jargon
|