Change Impact Map
Overview
Documentation ที่แสดงว่า "แก้ A กระทบ B/C อะไรบ้าง" - dependency relationships ระหว่าง components ที่ช่วยให้ประเมิน impact ของ changes ได้ก่อน implement
Why This Matters
- Risk assessment: รู้ว่าแก้แล้วพังอะไรบ้าง
- Test coverage: รู้ว่าต้อง test อะไรเพิ่ม
- Review scope: รู้ว่าต้องให้ใคร review
- Rollback planning: รู้ว่าต้อง rollback อะไรบ้าง
Core Concepts
1. Dependency Types
- Code deps: imports, shared modules, shared contracts, shared libraries
- Runtime deps: services called, queues/topics, caches, feature flags, config
- Data deps: tables/collections, schemas, indexes, migrations, analytics pipelines
- Integration deps: third-party APIs, webhooks, auth providers, payment processors
2. Impact Categories
- Direct: component ที่แก้โดยตรง (ไฟล์/โมดูล/service)
- Indirect: สิ่งที่เรียกใช้/ถูกเรียกใช้ (upstream/downstream)
- Operational: deploy, migrations, observability, on-call/runbooks
- User-facing: UX, SLAs/SLOs, billing, security/compliance
3. Critical Paths
- ระบุ P0/P1 เส้นทางที่ถ้าพังจะกระทบทั้งระบบ (auth, payments, DB connection, routing)
- เชื่อมกับ SLOs และ alerts ที่มีอยู่ เพื่อกำหนด “must watch” metrics
- ห้ามเปลี่ยน behavior ใน critical path โดยไม่มี staged rollout หรือ kill switch
4. Change Scopes
- Small: single module, isolated behavior → unit tests + targeted smoke
- Medium: multiple files, one service → integration tests + staging validation
- Large: multi-service หรือ schema/contract change → migration plan + canary + rollback playbook
5. Blast Radius
- ถามว่า “ถ้าส่วนนี้ล้ม จะล้มเป็นโดมิโนไปถึงอะไรบ้าง” (availability / correctness / latency)
- ระบุ failure modes: timeout, retries storm, stale cache, partial writes, auth failures
- ระบุ data risk: corruption, duplication, backfill issues, missing events
6. Ripple Effects
- ผลกระทบลำดับสอง/สาม: background jobs, reporting, search indexing, notifications
- เปลี่ยน field/type อาจกระทบ: SDKs, mobile app, dashboards, data warehouse
- พิจารณา “migration window” ที่มี versions ผสมกัน (old/new running together)
7. Affected Stakeholders
- owners/reviewers ตาม component (ทีม + on-call)
- consumers ของ API/events (ทีมอื่น/partner)
- stakeholders: support, sales, finance, security/compliance (ตามประเภท change)
8. Mitigation Strategies
- Feature flags สำหรับ cutover/kill switch
- Canary/gradual rollout เพื่อลดความเสี่ยงและตรวจจับเร็ว
- Compatibility: backward-compatible contracts + deprecation plan
- Verification: dashboards, synthetic checks, sampling, shadow reads (ถ้าเหมาะ)
Quick Start
- ระบุ “change surface”: ไฟล์/โมดูล/service/table/event ที่แตะ
- ทำ dependency sweep: code imports + runtime calls + data + integrations
- เติม impact matrix (direct/indirect + must test)
- ใส่ mitigation: feature flag/canary/rollback + metrics to watch
- ระบุ owners/reviewers และสื่อสารกับ stakeholders ก่อน merge/deploy
Production Checklist
Change Impact Map Template
# IMPACT_MAP.md
> Last updated: 2024-01-15
## High-Level Dependencies
```
┌─────────────────────────────────────────────────────┐
│ Frontend │
│ (React App, Mobile App) │
└─────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ API Gateway │
│ (Auth, Rate Limiting, Routing) │
└──────┬─────────────┬─────────────┬──────────────────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ User │ │ Order │ │ Payment │
│ Service │ │ Service │ │ Service │
└────┬─────┘ └────┬─────┘ └────┬─────┘
│ │ │
└──────────────┼──────────────┘
▼
┌──────────────────┐
│ PostgreSQL │
│ Redis Cache │
└──────────────────┘
```
## Component Impact Matrix
| If you change... | Direct Impact | Indirect Impact | Must Test |
|------------------|---------------|-----------------|-----------|
| User Service | Auth flow | All services (auth tokens) | Login, Registration, All API calls |
| Order Service | Order creation | Payment processing, Notifications | Create order, Payment flow |
| Payment Service | Checkout | Order completion, Receipts | Full checkout flow |
| Database Schema | All services | N/A | All integration tests |
| API Gateway Config | All routes | Frontend apps | Smoke tests |
## Critical Path Analysis
### 🔴 Critical (P0 Impact)
Changes here can cause total outage:
- `src/infrastructure/db/connection.ts` - Database connection
- `src/middleware/auth.ts` - Authentication
- `src/api/gateway/routes.ts` - API routing
- `config/production.ts` - Production config
**Required**: Full test suite, staged rollout, immediate rollback plan
### 🟠 High Impact (P1)
Changes here affect major features:
- `src/domain/users/` - User management
- `src/domain/orders/` - Order processing
- `src/domain/payments/` - Payment handling
**Required**: Integration tests, canary deployment
### 🟡 Medium Impact (P2)
Changes here affect specific features:
- `src/domain/notifications/` - Email/SMS
- `src/domain/reports/` - Reporting
- `src/api/admin/` - Admin functions
**Required**: Unit tests, feature flag
### 🟢 Low Impact (P3)
Changes here are isolated:
- `src/shared/utils/` - Utility functions
- `src/shared/constants/` - Constants
- Documentation files
**Required**: Unit tests
## Dependency Chains
### User Authentication
```
Change: src/domain/users/auth/
Impact chain:
1. User Service (login/logout)
↓
2. API Gateway (token validation)
↓
3. All Services (auth middleware)
↓
4. Frontend (auth state)
↓
5. Mobile App (auth state)
```
### Database Schema
```
Change: prisma/schema.prisma
Impact chain:
1. Database migration required
↓
2. All repositories using changed tables
↓
3. All services using those repositories
↓
4. API responses may change
↓
5. Frontend/Mobile display
```
### Shared Types
```
Change: src/shared/types/user.ts
Impact chain:
1. All files importing User type
↓
2. API request/response shapes
↓
3. Frontend type definitions
↓
4. Test mocks and fixtures
```
## Team Ownership
| Component | Owner | Reviewer |
|-----------|-------|----------|
| User Service | @auth-team | @security-team |
| Order Service | @commerce-team | @backend-lead |
| Payment Service | @payments-team | @security-team, @finance |
| Infrastructure | @platform-team | @sre |
| Database | @data-team | @backend-lead |
| Frontend | @frontend-team | @ux-team |
## Change Checklist by Scope
### Small Change (Single file, isolated)
- [ ] Unit tests pass
- [ ] Code review by 1 person
- [ ] Deploy to staging
- [ ] Quick smoke test
### Medium Change (Multiple files, one service)
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Code review by 2 people
- [ ] Deploy to staging
- [ ] Full feature test
- [ ] Monitor for 30 min
### Large Change (Multiple services, schema change)
- [ ] All tests pass
- [ ] Security review (if auth/data)
- [ ] Code review by team lead
- [ ] Database migration reviewed
- [ ] Feature flag ready
- [ ] Rollback plan documented
- [ ] Canary deployment
- [ ] Monitor for 24 hours
```
## Impact Assessment Questions
```markdown
Before making a change, answer:
1. **What depends on this?**
- Which files import this?
- Which services call this?
- Which tests cover this?
2. **What does this depend on?**
- External APIs?
- Database tables?
- Configuration?
3. **Who needs to know?**
- Which teams?
- Which stakeholders?
- Which customers?
4. **What could go wrong?**
- Failure modes?
- Edge cases?
- Data corruption?
5. **How do we verify success?**
- Tests to run?
- Metrics to watch?
- Manual checks?
```
Anti-patterns
- No impact assessment: "It's just a small change"
- Missing dependencies: Hidden coupling
- Outdated map: Doesn't reflect current architecture
- No ownership: No one responsible for areas
Integration Points
- Change management process
- Code review templates
- CI/CD pipelines
- Incident post-mortems
Further Reading
1---2name: change-impact-map3description: A practical framework to map change dependencies and blast radius, including who/what is affected, what to test, rollout/rollback strategies, and stakeholder ownership4---5
6# Change Impact Map
7
8## Overview
9
10Documentation ที่แสดงว่า "แก้ A กระทบ B/C อะไรบ้าง" - dependency relationships ระหว่าง components ที่ช่วยให้ประเมิน impact ของ changes ได้ก่อน implement
11
12## Why This Matters
13
14- **Risk assessment**: รู้ว่าแก้แล้วพังอะไรบ้าง
15- **Test coverage**: รู้ว่าต้อง test อะไรเพิ่ม
16- **Review scope**: รู้ว่าต้องให้ใคร review
17- **Rollback planning**: รู้ว่าต้อง rollback อะไรบ้าง
18
19---
20
21## Core Concepts
22
23### 1. Dependency Types
24
25- **Code deps**: imports, shared modules, shared contracts, shared libraries
26- **Runtime deps**: services called, queues/topics, caches, feature flags, config
27- **Data deps**: tables/collections, schemas, indexes, migrations, analytics pipelines
28- **Integration deps**: third-party APIs, webhooks, auth providers, payment processors
29
30### 2. Impact Categories
31
32- **Direct**: component ที่แก้โดยตรง (ไฟล์/โมดูล/service)
33- **Indirect**: สิ่งที่เรียกใช้/ถูกเรียกใช้ (upstream/downstream)
34- **Operational**: deploy, migrations, observability, on-call/runbooks
35- **User-facing**: UX, SLAs/SLOs, billing, security/compliance
36
37### 3. Critical Paths
38
39- ระบุ P0/P1 เส้นทางที่ถ้าพังจะกระทบทั้งระบบ (auth, payments, DB connection, routing)
40- เชื่อมกับ SLOs และ alerts ที่มีอยู่ เพื่อกำหนด “must watch” metrics
41- ห้ามเปลี่ยน behavior ใน critical path โดยไม่มี staged rollout หรือ kill switch
42
43### 4. Change Scopes
44
45- **Small**: single module, isolated behavior → unit tests + targeted smoke
46- **Medium**: multiple files, one service → integration tests + staging validation
47- **Large**: multi-service หรือ schema/contract change → migration plan + canary + rollback playbook
48
49### 5. Blast Radius
50
51- ถามว่า “ถ้าส่วนนี้ล้ม จะล้มเป็นโดมิโนไปถึงอะไรบ้าง” (availability / correctness / latency)
52- ระบุ failure modes: timeout, retries storm, stale cache, partial writes, auth failures
53- ระบุ data risk: corruption, duplication, backfill issues, missing events
54
55### 6. Ripple Effects
56
57- ผลกระทบลำดับสอง/สาม: background jobs, reporting, search indexing, notifications
58- เปลี่ยน field/type อาจกระทบ: SDKs, mobile app, dashboards, data warehouse
59- พิจารณา “migration window” ที่มี versions ผสมกัน (old/new running together)
60
61### 7. Affected Stakeholders
62
63- owners/reviewers ตาม component (ทีม + on-call)
64- consumers ของ API/events (ทีมอื่น/partner)
65- stakeholders: support, sales, finance, security/compliance (ตามประเภท change)
66
67### 8. Mitigation Strategies
68
69- **Feature flags** สำหรับ cutover/kill switch
70- **Canary/gradual rollout** เพื่อลดความเสี่ยงและตรวจจับเร็ว
71- **Compatibility**: backward-compatible contracts + deprecation plan
72- **Verification**: dashboards, synthetic checks, sampling, shadow reads (ถ้าเหมาะ)
73
74## Quick Start
75
76- ระบุ “change surface”: ไฟล์/โมดูล/service/table/event ที่แตะ
77- ทำ dependency sweep: code imports + runtime calls + data + integrations
78- เติม impact matrix (direct/indirect + must test)
79- ใส่ mitigation: feature flag/canary/rollback + metrics to watch
80- ระบุ owners/reviewers และสื่อสารกับ stakeholders ก่อน merge/deploy
81
82## Production Checklist
83
84- [ ] Critical paths documented
85- [ ] Dependencies mapped
86- [ ] Impact matrix created
87- [ ] Stakeholders identified
88- [ ] Updated on architecture changes
89- [ ] Used in change management
90
91## Change Impact Map Template
92
93````markdown
94# IMPACT_MAP.md
95
96> Last updated: 2024-01-15
97
98## High-Level Dependencies
99
100```
101┌─────────────────────────────────────────────────────┐
102│ Frontend │
103│ (React App, Mobile App) │
104└─────────────────────┬───────────────────────────────┘
105 │
106 ▼
107┌─────────────────────────────────────────────────────┐
108│ API Gateway │
109│ (Auth, Rate Limiting, Routing) │
110└──────┬─────────────┬─────────────┬──────────────────┘
111 │ │ │
112 ▼ ▼ ▼
113┌──────────┐ ┌──────────┐ ┌──────────┐
114│ User │ │ Order │ │ Payment │
115│ Service │ │ Service │ │ Service │
116└────┬─────┘ └────┬─────┘ └────┬─────┘
117 │ │ │
118 └──────────────┼──────────────┘
119 ▼
120 ┌──────────────────┐
121 │ PostgreSQL │
122 │ Redis Cache │
123 └──────────────────┘
124```
125
126## Component Impact Matrix
127
128| If you change... | Direct Impact | Indirect Impact | Must Test |
129|------------------|---------------|-----------------|-----------|
130| User Service | Auth flow | All services (auth tokens) | Login, Registration, All API calls |
131| Order Service | Order creation | Payment processing, Notifications | Create order, Payment flow |
132| Payment Service | Checkout | Order completion, Receipts | Full checkout flow |
133| Database Schema | All services | N/A | All integration tests |
134| API Gateway Config | All routes | Frontend apps | Smoke tests |
135
136## Critical Path Analysis
137
138### 🔴 Critical (P0 Impact)
139Changes here can cause total outage:
140- `src/infrastructure/db/connection.ts` - Database connection
141- `src/middleware/auth.ts` - Authentication
142- `src/api/gateway/routes.ts` - API routing
143- `config/production.ts` - Production config
144
145**Required**: Full test suite, staged rollout, immediate rollback plan
146
147### 🟠 High Impact (P1)
148Changes here affect major features:
149- `src/domain/users/` - User management
150- `src/domain/orders/` - Order processing
151- `src/domain/payments/` - Payment handling
152
153**Required**: Integration tests, canary deployment
154
155### 🟡 Medium Impact (P2)
156Changes here affect specific features:
157- `src/domain/notifications/` - Email/SMS
158- `src/domain/reports/` - Reporting
159- `src/api/admin/` - Admin functions
160
161**Required**: Unit tests, feature flag
162
163### 🟢 Low Impact (P3)
164Changes here are isolated:
165- `src/shared/utils/` - Utility functions
166- `src/shared/constants/` - Constants
167- Documentation files
168
169**Required**: Unit tests
170
171## Dependency Chains
172
173### User Authentication
174```
175Change: src/domain/users/auth/
176Impact chain:
1771. User Service (login/logout)
178 ↓
1792. API Gateway (token validation)
180 ↓
1813. All Services (auth middleware)
182 ↓
1834. Frontend (auth state)
184 ↓
1855. Mobile App (auth state)
186```
187
188### Database Schema
189```
190Change: prisma/schema.prisma
191Impact chain:
1921. Database migration required
193 ↓
1942. All repositories using changed tables
195 ↓
1963. All services using those repositories
197 ↓
1984. API responses may change
199 ↓
2005. Frontend/Mobile display
201```
202
203### Shared Types
204```
205Change: src/shared/types/user.ts
206Impact chain:
2071. All files importing User type
208 ↓
2092. API request/response shapes
210 ↓
2113. Frontend type definitions
212 ↓
2134. Test mocks and fixtures
214```
215
216## Team Ownership
217
218| Component | Owner | Reviewer |
219|-----------|-------|----------|
220| User Service | @auth-team | @security-team |
221| Order Service | @commerce-team | @backend-lead |
222| Payment Service | @payments-team | @security-team, @finance |
223| Infrastructure | @platform-team | @sre |
224| Database | @data-team | @backend-lead |
225| Frontend | @frontend-team | @ux-team |
226
227## Change Checklist by Scope
228
229### Small Change (Single file, isolated)
230- [ ] Unit tests pass
231- [ ] Code review by 1 person
232- [ ] Deploy to staging
233- [ ] Quick smoke test
234
235### Medium Change (Multiple files, one service)
236- [ ] Unit tests pass
237- [ ] Integration tests pass
238- [ ] Code review by 2 people
239- [ ] Deploy to staging
240- [ ] Full feature test
241- [ ] Monitor for 30 min
242
243### Large Change (Multiple services, schema change)
244- [ ] All tests pass
245- [ ] Security review (if auth/data)
246- [ ] Code review by team lead
247- [ ] Database migration reviewed
248- [ ] Feature flag ready
249- [ ] Rollback plan documented
250- [ ] Canary deployment
251- [ ] Monitor for 24 hours
252```
253
254## Impact Assessment Questions
255
256```markdown
257Before making a change, answer:
258
2591. **What depends on this?**
260 - Which files import this?
261 - Which services call this?
262 - Which tests cover this?
263
2642. **What does this depend on?**
265 - External APIs?
266 - Database tables?
267 - Configuration?
268
2693. **Who needs to know?**
270 - Which teams?
271 - Which stakeholders?
272 - Which customers?
273
2744. **What could go wrong?**
275 - Failure modes?
276 - Edge cases?
277 - Data corruption?
278
2795. **How do we verify success?**
280 - Tests to run?
281 - Metrics to watch?
282 - Manual checks?
283```
284````
285
286## Anti-patterns
287
2881. **No impact assessment**: "It's just a small change"
2892. **Missing dependencies**: Hidden coupling
2903. **Outdated map**: Doesn't reflect current architecture
2914. **No ownership**: No one responsible for areas
292
293## Integration Points
294
295- Change management process
296- Code review templates
297- CI/CD pipelines
298- Incident post-mortems
299
300## Further Reading
301
302- [Dependency Mapping](https://martinfowler.com/bliki/Strangler.html)
303- [Change Management](https://www.atlassian.com/itsm/change-management)