Học cách viết Pull Request Description bằng tiếng Anh cho developer. Bao gồm title convention, body template (what/why/how), reviewer notes, mẫu câu thực tế và bài tập thực hành.
Pull Request (PR) là cầu nối giữa code bạn viết và codebase chung của team. Một PR description tốt giúp reviewer hiểu nhanh bạn đã làm gì, tại sao, và cần review những gì. Ngược lại, PR description kém khiến reviewer mất thời gian, dễ bỏ sót bug, và làm chậm cả team.
## What
Brief description of the changes.
## Why
The motivation or context. Link to ticket/issue.
## How
Technical approach and key decisions.
## Testing
How this was tested.
## Screenshots (if applicable)
Before/after screenshots for UI changes.
## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No breaking changes
## What
Add rate limiting to the public API endpoints using Redis-based token bucket algorithm.
## Why
We've been experiencing abuse on the `/api/search` endpoint (see incident #INC-234).
Current traffic from a single IP can reach 1000+ req/min, causing service degradation.
Ticket: PROJ-567
## How
- Implemented token bucket algorithm using Redis MULTI/EXEC for atomicity
- Default limit: 100 requests per minute per IP
- Configurable via environment variables (`RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW`)
- Returns `429 Too Many Requests` with `Retry-After` header
## Testing
- Added unit tests for the rate limiter middleware
- Load tested with k6 — verified limits are enforced correctly
- Tested Redis failover scenario — falls back to in-memory store
## Checklist
- [x] Tests added/updated
- [x] Documentation updated
- [x] No breaking changes
## What
Add email notification when an order status changes to "delivered".
## Why
Customers have been requesting delivery confirmation emails (see feedback #892).
Currently, they have to manually check the app for order status updates.
Ticket: PROJ-234
## How
- Integrated with SendGrid API for email delivery
- Created an email template using the existing design system
- Added an event listener on the `order.statusChanged` event
- Emails are sent asynchronously via a background job queue
## Testing
- Unit tests for the email service
- Integration test verifying email is triggered on status change
- Tested with SendGrid sandbox mode
## Checklist
- [x] Tests added
- [x] Documentation updated
- [x] No breaking changes
PR Description chất lượng giúp review nhanh hơn, ít bug hơn, và team hiểu nhau hơn. Hãy đầu tư 5 phút viết description tốt để tiết kiệm 30 phút giải thích sau.
Nhớ 3 nguyên tắc: Title chuẩn convention — Body có What/Why/How — Reviewer notes rõ ràng.