codex-genesis-harness 0.1.4 → 0.1.6
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/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -216
- package/.codebase/CURRENT_STATE.md +9 -7
- package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -161
- package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -613
- package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -429
- package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -351
- package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -419
- package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -292
- package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -486
- package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -456
- package/.codebase/README.md +139 -139
- package/.codebase/RECOVERY_POINTS.md +438 -438
- package/.codebase/state.json +37 -0
- package/.codex/skills/genesis-api-sync/SKILL.md +354 -354
- package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -101
- package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -257
- package/.codex/skills/genesis-debug-guide/SKILL.md +479 -479
- package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -339
- package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -210
- package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -158
- package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -365
- package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -289
- package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -288
- package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -1003
- package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -359
- package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -312
- package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -382
- package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -851
- package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -491
- package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -187
- package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -297
- package/.codex/skills/genesis-harness/SKILL.md +1427 -1418
- package/.codex/skills/genesis-harness/agents/openai.yaml +7 -7
- package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -169
- package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -157
- package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -216
- package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -211
- package/.codex/skills/genesis-harness/references/planning-schema.md +35 -35
- package/.codex/skills/genesis-harness/references/quality-rubric.md +21 -21
- package/.codex/skills/genesis-harness/references/research-rubric.md +41 -41
- package/.codex/skills/genesis-harness/references/workflows.md +33 -33
- package/.codex/skills/genesis-harness/resources/agents-template.md +27 -27
- package/.codex/skills/genesis-harness/resources/api-docs-template.md +32 -32
- package/.codex/skills/genesis-harness/resources/architecture-template.md +30 -30
- package/.codex/skills/genesis-harness/resources/audit-template.md +26 -26
- package/.codex/skills/genesis-harness/resources/bug-template.md +34 -34
- package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -204
- package/.codex/skills/genesis-harness/resources/check-template.md +21 -21
- package/.codex/skills/genesis-harness/resources/conventions-template.md +42 -42
- package/.codex/skills/genesis-harness/resources/decision-template.md +33 -33
- package/.codex/skills/genesis-harness/resources/design-template.md +26 -26
- package/.codex/skills/genesis-harness/resources/escalation-template.md +21 -21
- package/.codex/skills/genesis-harness/resources/feature-template.md +49 -49
- package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -131
- package/.codex/skills/genesis-harness/resources/integrations-template.md +32 -32
- package/.codex/skills/genesis-harness/resources/journeys-template.md +13 -13
- package/.codex/skills/genesis-harness/resources/lessons-learned-template.md +12 -12
- package/.codex/skills/genesis-harness/resources/observability-template.md +34 -34
- package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -76
- package/.codex/skills/genesis-harness/resources/phase-template.md +34 -34
- package/.codex/skills/genesis-harness/resources/pitfalls-template.md +22 -22
- package/.codex/skills/genesis-harness/resources/planning-tree-template.md +39 -39
- package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -347
- package/.codex/skills/genesis-harness/resources/project-template.md +38 -38
- package/.codex/skills/genesis-harness/resources/quality-score-template.md +11 -11
- package/.codex/skills/genesis-harness/resources/requirements-template.md +26 -26
- package/.codex/skills/genesis-harness/resources/research-template.md +26 -26
- package/.codex/skills/genesis-harness/resources/review-template.md +22 -22
- package/.codex/skills/genesis-harness/resources/spec-changelog-template.md +6 -6
- package/.codex/skills/genesis-harness/resources/stack-template.md +33 -33
- package/.codex/skills/genesis-harness/resources/verification-template.md +26 -26
- package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/compact-context.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/create-adr.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/create-bug.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/create-feature.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/detect-stack.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/init-planning.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/offload-log.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/run-verification.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +0 -0
- package/.codex/skills/genesis-harness/scripts/update-state.sh +0 -0
- package/.codex/skills/genesis-mvp-planning/SKILL.md +114 -0
- package/.codex/skills/genesis-mvp-planning/agents/openai.yaml +6 -0
- package/.codex/skills/genesis-mvp-planning/checklists/mvp-readiness.md +18 -0
- package/.codex/skills/genesis-mvp-planning/examples/5-phase-roadmap-example.md +43 -0
- package/.codex/skills/genesis-mvp-planning/templates/phase-1-core.md +17 -0
- package/.codex/skills/genesis-mvp-planning/templates/phase-2-auth.md +17 -0
- package/.codex/skills/genesis-mvp-planning/templates/phase-3-features.md +17 -0
- package/.codex/skills/genesis-mvp-planning/templates/phase-4-integrations.md +17 -0
- package/.codex/skills/genesis-mvp-planning/templates/phase-5-readiness.md +17 -0
- package/.codex/skills/genesis-new-design/agents/openai.yaml +3 -3
- package/.codex/skills/genesis-observability-automation/checklists/.gitkeep +0 -0
- package/.codex/skills/genesis-observability-automation/observability/.gitkeep +0 -0
- package/.codex/skills/genesis-observability-automation/playbooks/.gitkeep +0 -0
- package/.codex/skills/genesis-observability-automation/templates/.gitkeep +0 -0
- package/.codex/skills/genesis-release-orchestration/SKILL.md +653 -653
- package/.codex/skills/genesis-release-orchestration/checklists/post-deployment-verification.md +274 -274
- package/.codex/skills/genesis-release-orchestration/checklists/pre-release-validation.md +220 -220
- package/.codex/skills/genesis-release-orchestration/observability/release-tracking.md +253 -253
- package/.codex/skills/genesis-release-orchestration/playbooks/canary-deployment-orchestration.md +472 -472
- package/.codex/skills/genesis-release-orchestration/playbooks/semantic-versioning-automation.md +494 -494
- package/.codex/skills/genesis-release-orchestration/templates/deployment-strategy-template.md +303 -303
- package/.codex/skills/genesis-release-orchestration/templates/release-runbook-template.md +420 -420
- package/.codex/skills/genesis-research-first/SKILL.md +237 -237
- package/.codex/skills/genesis-research-first/templates/.gitkeep +0 -0
- package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -534
- package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -384
- package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -257
- package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -373
- package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -692
- package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -434
- package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -407
- package/.codex/skills/genesis-state-machine/SKILL.md +34 -0
- package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +3 -3
- package/.codex/skills/spec-impact-engine/SKILL.md +504 -504
- package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +0 -0
- package/.codex-plugin/plugin.json +24 -24
- package/CHANGELOG.md +42 -0
- package/LICENSE +22 -22
- package/README.EN.md +784 -719
- package/README.VI.md +776 -712
- package/README.md +113 -253
- package/VERSION +2 -2
- package/bin/genesis-harness.js +90 -87
- package/package.json +68 -43
- package/scripts/README.md +342 -342
- package/scripts/compact-context.sh +0 -0
- package/scripts/contract_integrity_gate.js +83 -0
- package/scripts/detect-changes.sh +0 -0
- package/scripts/healing_telemetry.js +118 -0
- package/scripts/install.sh +4 -1
- package/scripts/offload-log.sh +0 -0
- package/scripts/prompt_sentinel.js +84 -0
- package/scripts/run-evals.sh +1 -0
- package/scripts/run-verify-loop.sh +11 -0
- package/scripts/spec_visual_sync.js +157 -0
- package/scripts/test_generator.js +142 -0
- package/scripts/transition_state.sh +67 -0
- package/scripts/uninstall.sh +1 -0
- package/scripts/validation_gates.sh +85 -0
- package/scripts/verify.sh +5 -0
- package/tests/unit/contract_integrity_gate.test.js +74 -0
- package/tests/unit/healing_telemetry.test.js +58 -0
- package/tests/unit/prompt_sentinel.test.js +50 -0
- package/tests/unit/spec_visual_sync.test.js +77 -0
- package/tests/unit/test_generator.test.js +62 -0
|
@@ -1,312 +1,312 @@
|
|
|
1
|
-
# Spec-Alignment Checklist
|
|
2
|
-
|
|
3
|
-
**Purpose**: Verify that all phases are aligned on specs, types, and data contracts
|
|
4
|
-
|
|
5
|
-
**When to Use**: During doc validation phase, before marking docs ready for commit
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 🔗 Cross-Layer Type Alignment
|
|
10
|
-
|
|
11
|
-
### Phase 1 → Phase 3 Alignment (Contract → Backend)
|
|
12
|
-
|
|
13
|
-
**For each endpoint in Phase 1 API contract**:
|
|
14
|
-
|
|
15
|
-
**GET /api/users/{id}**
|
|
16
|
-
- [ ] Phase 1 spec defines response: `{ id: string, email: string, name?: string }`
|
|
17
|
-
- [ ] Phase 3 handler returns exactly this structure (no extra fields)
|
|
18
|
-
- [ ] Phase 3 type definition: `interface User { id: string; email: string; name?: string; }`
|
|
19
|
-
- [ ] No optional fields in Phase 1 become required in Phase 3
|
|
20
|
-
- [ ] No required fields in Phase 1 are optional in Phase 3
|
|
21
|
-
|
|
22
|
-
**POST /api/users**
|
|
23
|
-
- [ ] Phase 1 request schema matches Phase 3 handler parameters
|
|
24
|
-
- [ ] Phase 1 request validation rules enforced in Phase 3
|
|
25
|
-
- [ ] Phase 1 response schema matches Phase 3 handler response
|
|
26
|
-
- [ ] No type coercion surprises (string "123" vs number 123)
|
|
27
|
-
|
|
28
|
-
### Phase 3 → Phase 4 Alignment (Backend → SDK)
|
|
29
|
-
|
|
30
|
-
**For each type in Phase 3 backend**:
|
|
31
|
-
|
|
32
|
-
- [ ] Phase 3 response `{ id, email, name }` → Phase 4 type `User`
|
|
33
|
-
- [ ] Phase 4 type includes all fields from Phase 3 (nothing lost)
|
|
34
|
-
- [ ] Phase 4 optional fields match Phase 3 optional fields
|
|
35
|
-
- [ ] Phase 4 methods signature matches Phase 3 API behavior
|
|
36
|
-
- [ ] Phase 4 error handling matches Phase 3 error codes
|
|
37
|
-
|
|
38
|
-
### Phase 4 → Phase 5 Alignment (SDK → E2E Tests)
|
|
39
|
-
|
|
40
|
-
**For each SDK method used in Phase 5**:
|
|
41
|
-
|
|
42
|
-
- [ ] Phase 5 test calls `userService.getUser(id)` → Phase 4 method exists
|
|
43
|
-
- [ ] Phase 5 test expects type `{ id, email, name }` → Phase 4 type matches
|
|
44
|
-
- [ ] Phase 5 test error handling matches Phase 4 SDK errors
|
|
45
|
-
- [ ] Phase 5 test data setup uses Phase 4 types/methods
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 🔄 Data Flow Alignment
|
|
50
|
-
|
|
51
|
-
### End-to-End User Data Flow
|
|
52
|
-
|
|
53
|
-
**Scenario**: User registers, profile updated, retrieved
|
|
54
|
-
|
|
55
|
-
**Phase 1 Contract**:
|
|
56
|
-
```json
|
|
57
|
-
POST /api/users/register {
|
|
58
|
-
"email": "user@example.com",
|
|
59
|
-
"password": "secure",
|
|
60
|
-
"name": "John"
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
Response 200 {
|
|
64
|
-
"id": "uuid-1",
|
|
65
|
-
"email": "user@example.com",
|
|
66
|
-
"name": "John"
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Phase 2 Tests**:
|
|
71
|
-
- [ ] Test mock: `{ email: "user@example.com", password: "secure", name: "John" }`
|
|
72
|
-
- [ ] Test assertion: Response has `id`, `email`, `name`
|
|
73
|
-
- [ ] Test assertion: Password NOT in response
|
|
74
|
-
|
|
75
|
-
**Phase 3 Backend**:
|
|
76
|
-
- [ ] Handler receives: `{ email, password, name }`
|
|
77
|
-
- [ ] Handler validates: Email format, password strength
|
|
78
|
-
- [ ] Handler hashes: Password stored securely (not plaintext)
|
|
79
|
-
- [ ] Handler returns: `{ id, email, name }` (NO password)
|
|
80
|
-
- [ ] Handler stores: User record in database
|
|
81
|
-
|
|
82
|
-
**Phase 4 SDK**:
|
|
83
|
-
- [ ] Register method signature: `register(email, password, name)`
|
|
84
|
-
- [ ] Type definition: `interface User { id, email, name }`
|
|
85
|
-
- [ ] SDK returns: `User` type with id, email, name
|
|
86
|
-
- [ ] SDK error handling: Maps backend errors to SDK exceptions
|
|
87
|
-
|
|
88
|
-
**Phase 5 E2E Tests**:
|
|
89
|
-
- [ ] Test data setup: `await userService.register("user@ex.com", "pwd", "John")`
|
|
90
|
-
- [ ] Test assertion: `response.id` exists
|
|
91
|
-
- [ ] Test assertion: `response.email === "user@ex.com"`
|
|
92
|
-
- [ ] Test assertion: `response.password` NOT in response (undefined)
|
|
93
|
-
|
|
94
|
-
✅ **Full alignment verified**: Data consistent through all phases
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 🔒 Error Code Alignment
|
|
99
|
-
|
|
100
|
-
### Phase 1: Error Codes Defined
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"409": "Email already registered",
|
|
105
|
-
"400": "Invalid email format",
|
|
106
|
-
"422": "Password too weak"
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Phase 3: Error Codes Implemented
|
|
111
|
-
|
|
112
|
-
- [ ] Handler throws error 409 when: Email collision detected
|
|
113
|
-
- [ ] Handler throws error 400 when: Email fails validation
|
|
114
|
-
- [ ] Handler throws error 422 when: Password fails strength check
|
|
115
|
-
- [ ] Handler includes error message in response
|
|
116
|
-
- [ ] Handler doesn't leak sensitive info in error (no stack traces)
|
|
117
|
-
|
|
118
|
-
### Phase 4: Error Codes Documented
|
|
119
|
-
|
|
120
|
-
- [ ] SDK has enum: `UserErrors = { EMAIL_EXISTS: 409, INVALID_EMAIL: 400, WEAK_PASSWORD: 422 }`
|
|
121
|
-
- [ ] SDK throws TypeScript Error with proper type
|
|
122
|
-
- [ ] SDK error message matches Phase 3 message
|
|
123
|
-
- [ ] SDK error handling clear in documentation
|
|
124
|
-
|
|
125
|
-
### Phase 5: Error Codes Tested
|
|
126
|
-
|
|
127
|
-
- [ ] E2E test: Registers with duplicate email → 409 handled correctly
|
|
128
|
-
- [ ] E2E test: Registers with invalid email → 400 handled correctly
|
|
129
|
-
- [ ] E2E test: Registers with weak password → 422 handled correctly
|
|
130
|
-
- [ ] E2E test: Error UI shows correct message to user
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## 📋 Database Schema Alignment
|
|
135
|
-
|
|
136
|
-
**If database schema changed**:
|
|
137
|
-
|
|
138
|
-
### Phase 1: Schema Changes Documented
|
|
139
|
-
|
|
140
|
-
```json
|
|
141
|
-
"User table:
|
|
142
|
-
- id: UUID (primary key)
|
|
143
|
-
- email: VARCHAR(255) UNIQUE
|
|
144
|
-
- passwordHash: VARCHAR(255)
|
|
145
|
-
- name: VARCHAR(255) NULL
|
|
146
|
-
- createdAt: TIMESTAMP DEFAULT NOW()
|
|
147
|
-
"
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Phase 3: Schema Changes Implemented
|
|
151
|
-
|
|
152
|
-
- [ ] Migration script created: `migrations/20260531_add_users_table.sql`
|
|
153
|
-
- [ ] Migration creates `users` table with specified columns
|
|
154
|
-
- [ ] Unique constraint on `email` field (prevents duplicates)
|
|
155
|
-
- [ ] Index on `email` (for fast lookups)
|
|
156
|
-
- [ ] Default timestamp on `createdAt`
|
|
157
|
-
- [ ] Tests verify migration runs successfully
|
|
158
|
-
|
|
159
|
-
### Phase 4: Schema Changes Known
|
|
160
|
-
|
|
161
|
-
- [ ] SDK documentation notes: "User.email is unique"
|
|
162
|
-
- [ ] SDK documentation notes: "User.passwordHash never exposed"
|
|
163
|
-
- [ ] SDK documentation notes: "User.createdAt is timestamp"
|
|
164
|
-
|
|
165
|
-
### Phase 5: Schema Changes Verified
|
|
166
|
-
|
|
167
|
-
- [ ] E2E test: Two users can't have same email (409 on duplicate)
|
|
168
|
-
- [ ] E2E test: User.email is returned (public field)
|
|
169
|
-
- [ ] E2E test: User.passwordHash is NOT returned (private field)
|
|
170
|
-
- [ ] E2E test: User.createdAt is returned (timestamp)
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## 📊 Type Definition Alignment
|
|
175
|
-
|
|
176
|
-
### Before (Misaligned)
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
Phase 1: { id: string, email: string, name?: string, avatar?: string }
|
|
180
|
-
Phase 3: { id, email, name } // Missing avatar
|
|
181
|
-
Phase 4: { id: string; email: string; name: string; } // Wrong: name required
|
|
182
|
-
Phase 5: Test expects { id, email, name, avatar } // Expects avatar
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
❌ **MISALIGNED**: Phases disagree on `avatar` field and `name` optionality
|
|
186
|
-
|
|
187
|
-
### After (Aligned)
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
Phase 1: { id: string, email: string, name?: string }
|
|
191
|
-
Phase 3: { id, email, name? } // Matches contract
|
|
192
|
-
Phase 4: { id: string; email: string; name?: string; } // Matches contract
|
|
193
|
-
Phase 5: Test expects { id, email, name? } // Matches all phases
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
✅ **ALIGNED**: All phases agree on structure
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## 🔍 Method Signature Alignment
|
|
201
|
-
|
|
202
|
-
### SDK Method Signature
|
|
203
|
-
|
|
204
|
-
**Phase 1 (Contract)**:
|
|
205
|
-
```
|
|
206
|
-
POST /api/users/register
|
|
207
|
-
Request: { email, password, name }
|
|
208
|
-
Response: { id, email, name }
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
**Phase 4 (SDK)**:
|
|
212
|
-
- [ ] Method name: `register()` or `createUser()`? Pick ONE consistently
|
|
213
|
-
- [ ] Method signature: `register(email: string, password: string, name?: string): Promise<User>`
|
|
214
|
-
- [ ] Parameter types: string (matches contract)
|
|
215
|
-
- [ ] Parameter optionality: name optional (matches contract)
|
|
216
|
-
- [ ] Return type: User object (matches contract response)
|
|
217
|
-
- [ ] Throws errors: Matches Phase 3 errors (409, 400, 422)
|
|
218
|
-
|
|
219
|
-
**Phase 5 (E2E)**:
|
|
220
|
-
- [ ] Test calls: `await userService.register("email@ex.com", "pwd", "John")`
|
|
221
|
-
- [ ] Test expects: Promise returns User object
|
|
222
|
-
- [ ] Test expects: User has { id, email, name }
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## ⚡ Validation Order
|
|
227
|
-
|
|
228
|
-
Check these in order (stop if misaligned):
|
|
229
|
-
|
|
230
|
-
```
|
|
231
|
-
1. Phase 1 API Contract Valid?
|
|
232
|
-
- JSON schema valid, types defined
|
|
233
|
-
|
|
234
|
-
2. Phase 1 → Phase 3 Match?
|
|
235
|
-
- Backend implements contract
|
|
236
|
-
|
|
237
|
-
3. Phase 3 → Phase 4 Match?
|
|
238
|
-
- SDK types match backend response
|
|
239
|
-
|
|
240
|
-
4. Phase 4 → Phase 5 Match?
|
|
241
|
-
- E2E tests use SDK correctly
|
|
242
|
-
|
|
243
|
-
5. Round-trip Test
|
|
244
|
-
- Phase 5 test calls all the way through to Phase 1 contract
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
If any mismatch: 🔴 STOP, document conflict, request manual review
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
## 🎓 Example: Breaking Change Detection
|
|
252
|
-
|
|
253
|
-
### Scenario: Removing `legacyId` field
|
|
254
|
-
|
|
255
|
-
**Phase 1 Contract Change**:
|
|
256
|
-
```diff
|
|
257
|
-
{
|
|
258
|
-
"id": "uuid",
|
|
259
|
-
"email": "user@example.com",
|
|
260
|
-
- "legacyId": "legacy-format-id"
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**Alignment Check**:
|
|
265
|
-
|
|
266
|
-
Phase 1 → Phase 3:
|
|
267
|
-
- [ ] Phase 3 handler: Remove `legacyId` from response ✓
|
|
268
|
-
- [ ] Phase 3 tests: Don't expect `legacyId` ✓
|
|
269
|
-
|
|
270
|
-
Phase 3 → Phase 4:
|
|
271
|
-
- [ ] Phase 4 type: Remove `legacyId` property
|
|
272
|
-
- [ ] But wait: existing code uses `user.legacyId`?
|
|
273
|
-
- [ ] Decision: Add deprecation warning or break?
|
|
274
|
-
- [ ] Need: Migration guide for Phase 4 users
|
|
275
|
-
|
|
276
|
-
Phase 4 → Phase 5:
|
|
277
|
-
- [ ] Phase 5 E2E: Remove test assertions on `legacyId` ✓
|
|
278
|
-
|
|
279
|
-
**Alignment Result**: ⚠️ BREAKING - Requires migration guide
|
|
280
|
-
|
|
281
|
-
**Migration Guide Needed**:
|
|
282
|
-
```
|
|
283
|
-
## Migration: Removing legacyId
|
|
284
|
-
|
|
285
|
-
Before: const legacyId = user.legacyId;
|
|
286
|
-
After: Use user.id instead (single ID field)
|
|
287
|
-
|
|
288
|
-
Deprecation: legacyId removed in v2.1
|
|
289
|
-
Timeline: 6 months from v2.0
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## ✅ Sign-Off
|
|
295
|
-
|
|
296
|
-
When all alignments verified:
|
|
297
|
-
|
|
298
|
-
- [ ] All phase-to-phase connections consistent
|
|
299
|
-
- [ ] No type mismatches found
|
|
300
|
-
- [ ] No missing fields in downstream phases
|
|
301
|
-
- [ ] Error codes aligned across all phases
|
|
302
|
-
- [ ] Database schema known to all phases
|
|
303
|
-
- [ ] Method signatures compatible
|
|
304
|
-
- [ ] Migration guides provided for breaking changes
|
|
305
|
-
|
|
306
|
-
**ALIGNMENT VALIDATION**: ✅ PASSED
|
|
307
|
-
|
|
308
|
-
Document in: `DOCS_UPDATE_LOG.md`
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
**Last Updated**: May 31, 2026 | **Status**: ACTIVE
|
|
1
|
+
# Spec-Alignment Checklist
|
|
2
|
+
|
|
3
|
+
**Purpose**: Verify that all phases are aligned on specs, types, and data contracts
|
|
4
|
+
|
|
5
|
+
**When to Use**: During doc validation phase, before marking docs ready for commit
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🔗 Cross-Layer Type Alignment
|
|
10
|
+
|
|
11
|
+
### Phase 1 → Phase 3 Alignment (Contract → Backend)
|
|
12
|
+
|
|
13
|
+
**For each endpoint in Phase 1 API contract**:
|
|
14
|
+
|
|
15
|
+
**GET /api/users/{id}**
|
|
16
|
+
- [ ] Phase 1 spec defines response: `{ id: string, email: string, name?: string }`
|
|
17
|
+
- [ ] Phase 3 handler returns exactly this structure (no extra fields)
|
|
18
|
+
- [ ] Phase 3 type definition: `interface User { id: string; email: string; name?: string; }`
|
|
19
|
+
- [ ] No optional fields in Phase 1 become required in Phase 3
|
|
20
|
+
- [ ] No required fields in Phase 1 are optional in Phase 3
|
|
21
|
+
|
|
22
|
+
**POST /api/users**
|
|
23
|
+
- [ ] Phase 1 request schema matches Phase 3 handler parameters
|
|
24
|
+
- [ ] Phase 1 request validation rules enforced in Phase 3
|
|
25
|
+
- [ ] Phase 1 response schema matches Phase 3 handler response
|
|
26
|
+
- [ ] No type coercion surprises (string "123" vs number 123)
|
|
27
|
+
|
|
28
|
+
### Phase 3 → Phase 4 Alignment (Backend → SDK)
|
|
29
|
+
|
|
30
|
+
**For each type in Phase 3 backend**:
|
|
31
|
+
|
|
32
|
+
- [ ] Phase 3 response `{ id, email, name }` → Phase 4 type `User`
|
|
33
|
+
- [ ] Phase 4 type includes all fields from Phase 3 (nothing lost)
|
|
34
|
+
- [ ] Phase 4 optional fields match Phase 3 optional fields
|
|
35
|
+
- [ ] Phase 4 methods signature matches Phase 3 API behavior
|
|
36
|
+
- [ ] Phase 4 error handling matches Phase 3 error codes
|
|
37
|
+
|
|
38
|
+
### Phase 4 → Phase 5 Alignment (SDK → E2E Tests)
|
|
39
|
+
|
|
40
|
+
**For each SDK method used in Phase 5**:
|
|
41
|
+
|
|
42
|
+
- [ ] Phase 5 test calls `userService.getUser(id)` → Phase 4 method exists
|
|
43
|
+
- [ ] Phase 5 test expects type `{ id, email, name }` → Phase 4 type matches
|
|
44
|
+
- [ ] Phase 5 test error handling matches Phase 4 SDK errors
|
|
45
|
+
- [ ] Phase 5 test data setup uses Phase 4 types/methods
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🔄 Data Flow Alignment
|
|
50
|
+
|
|
51
|
+
### End-to-End User Data Flow
|
|
52
|
+
|
|
53
|
+
**Scenario**: User registers, profile updated, retrieved
|
|
54
|
+
|
|
55
|
+
**Phase 1 Contract**:
|
|
56
|
+
```json
|
|
57
|
+
POST /api/users/register {
|
|
58
|
+
"email": "user@example.com",
|
|
59
|
+
"password": "secure",
|
|
60
|
+
"name": "John"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Response 200 {
|
|
64
|
+
"id": "uuid-1",
|
|
65
|
+
"email": "user@example.com",
|
|
66
|
+
"name": "John"
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Phase 2 Tests**:
|
|
71
|
+
- [ ] Test mock: `{ email: "user@example.com", password: "secure", name: "John" }`
|
|
72
|
+
- [ ] Test assertion: Response has `id`, `email`, `name`
|
|
73
|
+
- [ ] Test assertion: Password NOT in response
|
|
74
|
+
|
|
75
|
+
**Phase 3 Backend**:
|
|
76
|
+
- [ ] Handler receives: `{ email, password, name }`
|
|
77
|
+
- [ ] Handler validates: Email format, password strength
|
|
78
|
+
- [ ] Handler hashes: Password stored securely (not plaintext)
|
|
79
|
+
- [ ] Handler returns: `{ id, email, name }` (NO password)
|
|
80
|
+
- [ ] Handler stores: User record in database
|
|
81
|
+
|
|
82
|
+
**Phase 4 SDK**:
|
|
83
|
+
- [ ] Register method signature: `register(email, password, name)`
|
|
84
|
+
- [ ] Type definition: `interface User { id, email, name }`
|
|
85
|
+
- [ ] SDK returns: `User` type with id, email, name
|
|
86
|
+
- [ ] SDK error handling: Maps backend errors to SDK exceptions
|
|
87
|
+
|
|
88
|
+
**Phase 5 E2E Tests**:
|
|
89
|
+
- [ ] Test data setup: `await userService.register("user@ex.com", "pwd", "John")`
|
|
90
|
+
- [ ] Test assertion: `response.id` exists
|
|
91
|
+
- [ ] Test assertion: `response.email === "user@ex.com"`
|
|
92
|
+
- [ ] Test assertion: `response.password` NOT in response (undefined)
|
|
93
|
+
|
|
94
|
+
✅ **Full alignment verified**: Data consistent through all phases
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🔒 Error Code Alignment
|
|
99
|
+
|
|
100
|
+
### Phase 1: Error Codes Defined
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"409": "Email already registered",
|
|
105
|
+
"400": "Invalid email format",
|
|
106
|
+
"422": "Password too weak"
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Phase 3: Error Codes Implemented
|
|
111
|
+
|
|
112
|
+
- [ ] Handler throws error 409 when: Email collision detected
|
|
113
|
+
- [ ] Handler throws error 400 when: Email fails validation
|
|
114
|
+
- [ ] Handler throws error 422 when: Password fails strength check
|
|
115
|
+
- [ ] Handler includes error message in response
|
|
116
|
+
- [ ] Handler doesn't leak sensitive info in error (no stack traces)
|
|
117
|
+
|
|
118
|
+
### Phase 4: Error Codes Documented
|
|
119
|
+
|
|
120
|
+
- [ ] SDK has enum: `UserErrors = { EMAIL_EXISTS: 409, INVALID_EMAIL: 400, WEAK_PASSWORD: 422 }`
|
|
121
|
+
- [ ] SDK throws TypeScript Error with proper type
|
|
122
|
+
- [ ] SDK error message matches Phase 3 message
|
|
123
|
+
- [ ] SDK error handling clear in documentation
|
|
124
|
+
|
|
125
|
+
### Phase 5: Error Codes Tested
|
|
126
|
+
|
|
127
|
+
- [ ] E2E test: Registers with duplicate email → 409 handled correctly
|
|
128
|
+
- [ ] E2E test: Registers with invalid email → 400 handled correctly
|
|
129
|
+
- [ ] E2E test: Registers with weak password → 422 handled correctly
|
|
130
|
+
- [ ] E2E test: Error UI shows correct message to user
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 📋 Database Schema Alignment
|
|
135
|
+
|
|
136
|
+
**If database schema changed**:
|
|
137
|
+
|
|
138
|
+
### Phase 1: Schema Changes Documented
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
"User table:
|
|
142
|
+
- id: UUID (primary key)
|
|
143
|
+
- email: VARCHAR(255) UNIQUE
|
|
144
|
+
- passwordHash: VARCHAR(255)
|
|
145
|
+
- name: VARCHAR(255) NULL
|
|
146
|
+
- createdAt: TIMESTAMP DEFAULT NOW()
|
|
147
|
+
"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Phase 3: Schema Changes Implemented
|
|
151
|
+
|
|
152
|
+
- [ ] Migration script created: `migrations/20260531_add_users_table.sql`
|
|
153
|
+
- [ ] Migration creates `users` table with specified columns
|
|
154
|
+
- [ ] Unique constraint on `email` field (prevents duplicates)
|
|
155
|
+
- [ ] Index on `email` (for fast lookups)
|
|
156
|
+
- [ ] Default timestamp on `createdAt`
|
|
157
|
+
- [ ] Tests verify migration runs successfully
|
|
158
|
+
|
|
159
|
+
### Phase 4: Schema Changes Known
|
|
160
|
+
|
|
161
|
+
- [ ] SDK documentation notes: "User.email is unique"
|
|
162
|
+
- [ ] SDK documentation notes: "User.passwordHash never exposed"
|
|
163
|
+
- [ ] SDK documentation notes: "User.createdAt is timestamp"
|
|
164
|
+
|
|
165
|
+
### Phase 5: Schema Changes Verified
|
|
166
|
+
|
|
167
|
+
- [ ] E2E test: Two users can't have same email (409 on duplicate)
|
|
168
|
+
- [ ] E2E test: User.email is returned (public field)
|
|
169
|
+
- [ ] E2E test: User.passwordHash is NOT returned (private field)
|
|
170
|
+
- [ ] E2E test: User.createdAt is returned (timestamp)
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 📊 Type Definition Alignment
|
|
175
|
+
|
|
176
|
+
### Before (Misaligned)
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Phase 1: { id: string, email: string, name?: string, avatar?: string }
|
|
180
|
+
Phase 3: { id, email, name } // Missing avatar
|
|
181
|
+
Phase 4: { id: string; email: string; name: string; } // Wrong: name required
|
|
182
|
+
Phase 5: Test expects { id, email, name, avatar } // Expects avatar
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
❌ **MISALIGNED**: Phases disagree on `avatar` field and `name` optionality
|
|
186
|
+
|
|
187
|
+
### After (Aligned)
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Phase 1: { id: string, email: string, name?: string }
|
|
191
|
+
Phase 3: { id, email, name? } // Matches contract
|
|
192
|
+
Phase 4: { id: string; email: string; name?: string; } // Matches contract
|
|
193
|
+
Phase 5: Test expects { id, email, name? } // Matches all phases
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
✅ **ALIGNED**: All phases agree on structure
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 🔍 Method Signature Alignment
|
|
201
|
+
|
|
202
|
+
### SDK Method Signature
|
|
203
|
+
|
|
204
|
+
**Phase 1 (Contract)**:
|
|
205
|
+
```
|
|
206
|
+
POST /api/users/register
|
|
207
|
+
Request: { email, password, name }
|
|
208
|
+
Response: { id, email, name }
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Phase 4 (SDK)**:
|
|
212
|
+
- [ ] Method name: `register()` or `createUser()`? Pick ONE consistently
|
|
213
|
+
- [ ] Method signature: `register(email: string, password: string, name?: string): Promise<User>`
|
|
214
|
+
- [ ] Parameter types: string (matches contract)
|
|
215
|
+
- [ ] Parameter optionality: name optional (matches contract)
|
|
216
|
+
- [ ] Return type: User object (matches contract response)
|
|
217
|
+
- [ ] Throws errors: Matches Phase 3 errors (409, 400, 422)
|
|
218
|
+
|
|
219
|
+
**Phase 5 (E2E)**:
|
|
220
|
+
- [ ] Test calls: `await userService.register("email@ex.com", "pwd", "John")`
|
|
221
|
+
- [ ] Test expects: Promise returns User object
|
|
222
|
+
- [ ] Test expects: User has { id, email, name }
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## ⚡ Validation Order
|
|
227
|
+
|
|
228
|
+
Check these in order (stop if misaligned):
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
1. Phase 1 API Contract Valid?
|
|
232
|
+
- JSON schema valid, types defined
|
|
233
|
+
|
|
234
|
+
2. Phase 1 → Phase 3 Match?
|
|
235
|
+
- Backend implements contract
|
|
236
|
+
|
|
237
|
+
3. Phase 3 → Phase 4 Match?
|
|
238
|
+
- SDK types match backend response
|
|
239
|
+
|
|
240
|
+
4. Phase 4 → Phase 5 Match?
|
|
241
|
+
- E2E tests use SDK correctly
|
|
242
|
+
|
|
243
|
+
5. Round-trip Test
|
|
244
|
+
- Phase 5 test calls all the way through to Phase 1 contract
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
If any mismatch: 🔴 STOP, document conflict, request manual review
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🎓 Example: Breaking Change Detection
|
|
252
|
+
|
|
253
|
+
### Scenario: Removing `legacyId` field
|
|
254
|
+
|
|
255
|
+
**Phase 1 Contract Change**:
|
|
256
|
+
```diff
|
|
257
|
+
{
|
|
258
|
+
"id": "uuid",
|
|
259
|
+
"email": "user@example.com",
|
|
260
|
+
- "legacyId": "legacy-format-id"
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Alignment Check**:
|
|
265
|
+
|
|
266
|
+
Phase 1 → Phase 3:
|
|
267
|
+
- [ ] Phase 3 handler: Remove `legacyId` from response ✓
|
|
268
|
+
- [ ] Phase 3 tests: Don't expect `legacyId` ✓
|
|
269
|
+
|
|
270
|
+
Phase 3 → Phase 4:
|
|
271
|
+
- [ ] Phase 4 type: Remove `legacyId` property
|
|
272
|
+
- [ ] But wait: existing code uses `user.legacyId`?
|
|
273
|
+
- [ ] Decision: Add deprecation warning or break?
|
|
274
|
+
- [ ] Need: Migration guide for Phase 4 users
|
|
275
|
+
|
|
276
|
+
Phase 4 → Phase 5:
|
|
277
|
+
- [ ] Phase 5 E2E: Remove test assertions on `legacyId` ✓
|
|
278
|
+
|
|
279
|
+
**Alignment Result**: ⚠️ BREAKING - Requires migration guide
|
|
280
|
+
|
|
281
|
+
**Migration Guide Needed**:
|
|
282
|
+
```
|
|
283
|
+
## Migration: Removing legacyId
|
|
284
|
+
|
|
285
|
+
Before: const legacyId = user.legacyId;
|
|
286
|
+
After: Use user.id instead (single ID field)
|
|
287
|
+
|
|
288
|
+
Deprecation: legacyId removed in v2.1
|
|
289
|
+
Timeline: 6 months from v2.0
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## ✅ Sign-Off
|
|
295
|
+
|
|
296
|
+
When all alignments verified:
|
|
297
|
+
|
|
298
|
+
- [ ] All phase-to-phase connections consistent
|
|
299
|
+
- [ ] No type mismatches found
|
|
300
|
+
- [ ] No missing fields in downstream phases
|
|
301
|
+
- [ ] Error codes aligned across all phases
|
|
302
|
+
- [ ] Database schema known to all phases
|
|
303
|
+
- [ ] Method signatures compatible
|
|
304
|
+
- [ ] Migration guides provided for breaking changes
|
|
305
|
+
|
|
306
|
+
**ALIGNMENT VALIDATION**: ✅ PASSED
|
|
307
|
+
|
|
308
|
+
Document in: `DOCS_UPDATE_LOG.md`
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
**Last Updated**: May 31, 2026 | **Status**: ACTIVE
|