You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
직전 커밋 09fbb3b6의 한글판 개선을 영문판에 동기화한다.
- When Requirements Change — Order.Cancel() 정책 확장 시나리오로
사람/AI/프레임워크 역할 분담 구체화
- At 2 AM, What Actually Appears on Your Screen —
InvalidOrderStatusTransition 실패를 JSON 로그 + Mermaid 시퀀스
다이어그램으로 시각화, 3-Pillar trace_id 전파 증명
Copy file name to clipboardExpand all lines: README.md
+103Lines changed: 103 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,43 @@ This is how AI generates exception-free, safe code structures automatically.
125
125
>
126
126
> The framework's **automatic error classification + structured context logs + dashboards** — built into every Command/Query — translate code state into human language.
127
127
128
+
### When Requirements Change — Humans Update Text, AI Rebuilds the Plumbing
129
+
130
+
> The CS team urgently requests **"Allow change-of-mind cancellation within 24h after delivery"** to match a competitor's policy. The current rule permits cancellation only in `Pending/Confirmed` states ([`Order.Cancel()` in the ecommerce-ddd sample](./Docs.Site/src/content/docs/samples/ecommerce-ddd/index.md)).
131
+
132
+
| Aspect | Before | After |
133
+
|--------|--------|-------|
134
+
| Allowed state transitions |`Pending/Confirmed → Cancelled`| The above + `Delivered → Cancelled` (only when `DeliveredAt + 24h > now` & `reason = ChangeOfMind`) |
| Domain Event |`CancelledEvent(OrderId, OrderLines)`| The above + `CancellationReason Reason` field |
137
+
| New Union type | — |`CancellationReason = ChangeOfMind \| CustomerIssue \| Fraud`|
138
+
139
+
**The 3-step collaboration flow**:
140
+
141
+
1.**Human (architect)** — adds one line to PRD `§Order.Cancellation`:
142
+
> "Also allow `Delivered` orders to be cancelled for change-of-mind within 24h of delivery"
143
+
144
+
2.**AI (`domain-develop` skill)** — auto-generates/updates five artifacts:
145
+
- Add `("Delivered", Seq("Cancelled"))` to `OrderStatus.AllowedTransitions`
146
+
- Create a new `CancellationReason` Union (3-variant sealed records)
147
+
- Inject the time-window Specification into `Order.Cancel()`
148
+
- Extend `CancelledEvent` with a `CancellationReason` field
149
+
- Auto-add boundary-value unit tests (`23h59m` / `24h00m` / `24h01m`)
150
+
151
+
3.**Framework (triple verification gates)** — blocks regressions at build time:
152
+
- Architecture rule tests: verify `sealed`, record immutability, `Fin<T>` return types on the Union
153
+
- Contract regression tests: confirm the `Pending/Confirmed → Cancelled` path still holds
154
+
- Type system: enforce the new `Cancel()` signature at every call site at compile time
155
+
156
+
> **Developers never open the `Fin<Unit>` pipeline inside `Order.Cancel()`.**
157
+
> Just edit the text requirement. AI rebuilds state-transition rules, Unions, events, and tests; architectural integrity is guaranteed by [21+ rule tests](#gate-1-architecture-rule-tests--structural-integrity).
158
+
159
+
| Role | Responsibility | In this scenario |
160
+
|------|---------------|------------------|
161
+
|**Developer**| Architect — defines business rules and boundaries | Specify the "24h post-delivery cancellation" policy in text |
|**Framework**| Safety net — blocks structural regression | Validates architecture, types, and existing contracts automatically |
164
+
128
165
## How AI Breaks Through the Problems
129
166
130
167
### From Problem to Code — Structure Connected by AI
@@ -443,6 +480,72 @@ Functorium provides unified observability (Logging, Metrics, Tracing) based on O
443
480
444
481
The Application layer (EventId 1001–1004) and Adapter layer (EventId 2001–2004) use **identical `request.*` / `response.*` / `error.*` naming**, enabling end-to-end request flow tracking with a single dashboard query.
445
482
483
+
### At 2 AM, What Actually Appears on Your Screen
484
+
485
+
Here we visualize how the "24h post-delivery cancellation" policy from the [requirements-change scenario](#when-requirements-change--humans-update-text-ai-rebuilds-the-plumbing) fails at its boundary in production.
486
+
487
+
> `POST /orders/{id}/cancel` (reason=`ChangeOfMind`). The order was delivered **25 hours ago** — past the 24h window. No exception is thrown; instead, a structured failure response classified as `error.type = "expected"` is returned.
488
+
489
+
**What actually lands in the log** (this is literally what Seq or Grafana Loki displays):
| Business errors and system failures mixed |`error.type ∈ {expected, exceptional, aggregate}` — dashboard-filterable |
545
+
546
+
> **"No stack trace = undebuggable" is false.**
547
+
> Instead of a stack trace, the framework records **which domain rule was broken, in which state, and why** through the `error.codes` array and `ctx.*` business context. A single glance at `ctx.hours_since_delivery=25` reveals the root cause. The same `request_id` lets you cross-filter Logs, Metrics, and Traces for the same event.
548
+
446
549
For detailed specifications and guides, see the documentation site:
0 commit comments