Definition of Done (DoD)
Purpose: Tiêu chuẩn để đánh giá một task/module là "DONE". Scope: Áp dụng cho MỌI work package trong dự án.
Task-Level DoD
Một task được coi là DONE khi:
- [ ] Code đã merge vào
main(hoặc branch target) - [ ] Unit tests pass (coverage ≥ 80% cho business logic)
- [ ] Integration test pass cho state machines / cross-module flows
- [ ] API contract đã cập nhật vào Swagger/OpenAPI
- [ ] DTO validation + error codes chuẩn
- [ ] RBAC permissions gắn vào mọi endpoint (
@Permissions()decorator) - [ ] Negative tests: 403 (forbidden), 404 (not found), 400 (bad input)
- [ ] Tenant isolation verified (query luôn filter
tenantId) - [ ] Audit trail cho mutations quan trọng (latency < 1s after commit)
- [ ] Event catalog cập nhật — outbox/idempotency cho async flows
- [ ] No ambiguous FK fields — all relation FKs use
<name>Idpattern (ref:RELATIONSHIP_POPULATION_RULES.md) - [ ] Population rules enforced — API contract specifies allowed includes + projections
- [ ] Projection defined — each populated relation returns only Summary shape fields
- [ ] Depth limit tested — nested includes (depth > 1) rejected with 400
- [ ] Audit fields present —
createdById+updatedByIdset by service layer (ref:AUDIT_STAMPING_STANDARD.md) - [ ] Audit fields immutable from client — DTOs do NOT declare
createdById,createdAt, etc. (reserved fields stripped/ignored) - [ ] Datetime format consistent — all API responses use
YYYY-MM-DDTHH:mm:ss.sssZfor instants (ref:TIME_DATE_STANDARD.md) - [ ] Date suffix naming correct —
*Atfor server instants,*Datefor business instants,*Onfor date-only - [ ] Timezone tests pass — date parsing + UTC storage verified
- [ ] Code review approved (≥ 1 reviewer)
Module-Level DoD
Một module được coi là DONE khi các task-level DoD đều đạt, VÀ thêm:
- [ ] Migration scripts + seed data + rollback note
- [ ] Performance test pass (response time < 500ms for p95)
- [ ] Docs cập nhật:
- [ ]
DOC_REGISTRYupdated - [ ]
FEATURE_STATUS_MATRIXstatus = ✅ - [ ]
API_TRACEABILITYbackend match = YES - [ ]
TRACEABILITY_MATRIX.csvupdated
- [ ]
- [ ] E2E test pass cho critical flows
- [ ] Observability: logs + metrics + correlationId
- [ ] POPULATION_CONTRACT_GATE passed — all endpoints have include whitelist + depth tests
- [ ] AUDIT_STAMP_GATE passed — audit fields verified across all module entities
- [ ] TIME_STANDARD_GATE passed — datetime output format consistency verified
Phase-Level DoD
Một phase được coi là DONE khi tất cả modules trong phase đạt Module-Level DoD, VÀ:
- [ ] Cross-module integration tests pass
- [ ] Risk Register reviewed — no open HIGH risks
- [ ] Decision Log up-to-date
- [ ] Sprint retrospective completed
- [ ] Release notes drafted
Changelog
| Date | Change |
|---|---|
| 2026-02-23 | Initial creation from IMPLEMENTATION_ROADMAP_FULL DoD |
| 2026-02-23 | Added population rules compliance: FK naming, projection, depth limit, POPULATION_CONTRACT_GATE (D-008) |
| 2026-02-23 | Added audit stamping + datetime format DoD checks (GOV-AUDIT, GOV-TIME) |