qaa-agent 1.0.0
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/.claude/commands/create-test.md +40 -0
- package/.claude/commands/qa-analyze.md +60 -0
- package/.claude/commands/qa-audit.md +37 -0
- package/.claude/commands/qa-blueprint.md +54 -0
- package/.claude/commands/qa-fix.md +36 -0
- package/.claude/commands/qa-from-ticket.md +88 -0
- package/.claude/commands/qa-gap.md +54 -0
- package/.claude/commands/qa-pom.md +36 -0
- package/.claude/commands/qa-pyramid.md +37 -0
- package/.claude/commands/qa-report.md +38 -0
- package/.claude/commands/qa-start.md +33 -0
- package/.claude/commands/qa-testid.md +54 -0
- package/.claude/commands/qa-validate.md +54 -0
- package/.claude/commands/update-test.md +58 -0
- package/.claude/settings.json +19 -0
- package/.claude/skills/qa-bug-detective/SKILL.md +122 -0
- package/.claude/skills/qa-repo-analyzer/SKILL.md +88 -0
- package/.claude/skills/qa-self-validator/SKILL.md +109 -0
- package/.claude/skills/qa-template-engine/SKILL.md +113 -0
- package/.claude/skills/qa-testid-injector/SKILL.md +93 -0
- package/.claude/skills/qa-workflow-documenter/SKILL.md +87 -0
- package/CLAUDE.md +543 -0
- package/README.md +418 -0
- package/agents/qa-pipeline-orchestrator.md +1217 -0
- package/agents/qaa-analyzer.md +508 -0
- package/agents/qaa-bug-detective.md +444 -0
- package/agents/qaa-executor.md +618 -0
- package/agents/qaa-planner.md +374 -0
- package/agents/qaa-scanner.md +422 -0
- package/agents/qaa-testid-injector.md +583 -0
- package/agents/qaa-validator.md +450 -0
- package/bin/install.cjs +176 -0
- package/bin/lib/commands.cjs +709 -0
- package/bin/lib/config.cjs +307 -0
- package/bin/lib/core.cjs +497 -0
- package/bin/lib/frontmatter.cjs +299 -0
- package/bin/lib/init.cjs +989 -0
- package/bin/lib/milestone.cjs +241 -0
- package/bin/lib/model-profiles.cjs +60 -0
- package/bin/lib/phase.cjs +911 -0
- package/bin/lib/roadmap.cjs +306 -0
- package/bin/lib/state.cjs +748 -0
- package/bin/lib/template.cjs +222 -0
- package/bin/lib/verify.cjs +842 -0
- package/bin/qaa-tools.cjs +607 -0
- package/package.json +34 -0
- package/templates/failure-classification.md +391 -0
- package/templates/gap-analysis.md +409 -0
- package/templates/pr-template.md +48 -0
- package/templates/qa-analysis.md +381 -0
- package/templates/qa-audit-report.md +465 -0
- package/templates/qa-repo-blueprint.md +636 -0
- package/templates/scan-manifest.md +312 -0
- package/templates/test-inventory.md +582 -0
- package/templates/testid-audit-report.md +354 -0
- package/templates/validation-report.md +243 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
---
|
|
2
|
+
template_name: failure-classification
|
|
3
|
+
version: "1.0"
|
|
4
|
+
artifact_type: classification
|
|
5
|
+
produces: FAILURE_CLASSIFICATION_REPORT.md
|
|
6
|
+
producer_agent: qa-bug-detective
|
|
7
|
+
consumer_agents:
|
|
8
|
+
- human-reviewer
|
|
9
|
+
- qa-validator
|
|
10
|
+
required_sections:
|
|
11
|
+
- summary
|
|
12
|
+
- detailed-analysis
|
|
13
|
+
- auto-fix-log
|
|
14
|
+
- recommendations
|
|
15
|
+
example_domain: shopflow
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# FAILURE_CLASSIFICATION_REPORT.md Template
|
|
19
|
+
|
|
20
|
+
**Purpose:** Classifies every test failure into one of four actionable categories (APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, INCONCLUSIVE) with evidence, confidence levels, and auto-fix results. Enables reviewers to immediately focus on real application bugs rather than wasting time investigating test infrastructure issues.
|
|
21
|
+
|
|
22
|
+
**Producer:** qa-bug-detective (runs generated tests and classifies every failure)
|
|
23
|
+
**Consumers:** human-reviewer (reviews application bugs and unresolved issues), qa-validator (consumes auto-fix results to update validation status)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Classification Categories
|
|
28
|
+
|
|
29
|
+
| Category | Description | Auto-Fix Allowed | Action |
|
|
30
|
+
|----------|-------------|-----------------|--------|
|
|
31
|
+
| APPLICATION BUG | Error manifests in production code. Behavior contradicts requirements or API contracts. | NEVER | Report for human review. Include evidence from production code. |
|
|
32
|
+
| TEST CODE ERROR | Error in the test itself: wrong selector, missing await, incorrect assertion, bad import path. | YES (HIGH confidence only) | Auto-fix if HIGH confidence. Report if MEDIUM or lower. |
|
|
33
|
+
| ENVIRONMENT ISSUE | External dependency failure: database down, connection refused, missing env var, timeout. | NEVER | Report with suggested resolution steps. |
|
|
34
|
+
| INCONCLUSIVE | Cannot determine root cause. Ambiguous error, multiple possible causes, insufficient data. | NEVER | Report with what is known and what additional information would help classify. |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Classification Decision Tree
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Test fails
|
|
42
|
+
|
|
|
43
|
+
+-- Is the error a syntax/import error in the TEST file?
|
|
44
|
+
| YES --> TEST CODE ERROR
|
|
45
|
+
|
|
|
46
|
+
+-- Does the error occur in a PRODUCTION code path (src/, app/, lib/)?
|
|
47
|
+
| |
|
|
48
|
+
| +-- Is this a known bug or unexpected behavior per requirements?
|
|
49
|
+
| | YES --> APPLICATION BUG
|
|
50
|
+
| |
|
|
51
|
+
| +-- Does the code work as designed, but the test expectation is wrong?
|
|
52
|
+
| YES --> TEST CODE ERROR
|
|
53
|
+
|
|
|
54
|
+
+-- Is it a connection refused, timeout, or missing env var?
|
|
55
|
+
| YES --> ENVIRONMENT ISSUE
|
|
56
|
+
|
|
|
57
|
+
+-- Cannot determine?
|
|
58
|
+
--> INCONCLUSIVE
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Required Sections
|
|
64
|
+
|
|
65
|
+
### Section 1: Summary
|
|
66
|
+
|
|
67
|
+
**Description:** Aggregated counts by classification category showing the distribution of failures and what was auto-fixed.
|
|
68
|
+
|
|
69
|
+
**Fields:**
|
|
70
|
+
|
|
71
|
+
| Field | Type | Required | Description |
|
|
72
|
+
|-------|------|----------|-------------|
|
|
73
|
+
| Classification | enum | YES | APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, or INCONCLUSIVE |
|
|
74
|
+
| Count | integer | YES | Number of failures in this category |
|
|
75
|
+
| Auto-Fixed | integer | YES | Number auto-fixed (only TEST CODE ERROR can be > 0) |
|
|
76
|
+
| Needs Attention | integer | YES | Count - Auto-Fixed = items requiring human review |
|
|
77
|
+
|
|
78
|
+
Additional summary fields:
|
|
79
|
+
- Total failures analyzed
|
|
80
|
+
- Total auto-fixed
|
|
81
|
+
- Total requiring human attention
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Section 2: Detailed Analysis
|
|
86
|
+
|
|
87
|
+
**Description:** Per-failure analysis with ALL mandatory fields. Every single failure must have a complete entry -- no fields may be omitted.
|
|
88
|
+
|
|
89
|
+
**Mandatory fields per failure:**
|
|
90
|
+
|
|
91
|
+
| Field | Type | Required | Description |
|
|
92
|
+
|-------|------|----------|-------------|
|
|
93
|
+
| Test Name | string | YES | The failing test case name with its ID (e.g., `E2E-CHECKOUT-001: Complete purchase flow`) |
|
|
94
|
+
| Classification | enum | YES | One of the 4 categories |
|
|
95
|
+
| Confidence | enum | YES | HIGH, MEDIUM-HIGH, MEDIUM, or LOW |
|
|
96
|
+
| File | path:line | YES | Exact file path and line number where the error occurs |
|
|
97
|
+
| Error Message | text | YES | Complete error text -- not a summary, the actual error |
|
|
98
|
+
| Evidence | code + text | YES | Code snippet showing the issue PLUS reasoning for why this classification was chosen over others |
|
|
99
|
+
| Action Taken | enum | YES | "Auto-fixed" or "Reported for human review" |
|
|
100
|
+
| Resolution | text | YES | If auto-fixed: what was changed. If reported: what the human needs to investigate and suggested approach. |
|
|
101
|
+
|
|
102
|
+
**Classification reasoning requirement:** Each failure must include a brief explanation of why THIS category was chosen and not another. Example: "Classified as APPLICATION BUG (not TEST CODE ERROR) because the stack trace originates in orderService.ts:47, not in the test file, and the behavior contradicts the order state machine spec."
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### Section 3: Auto-Fix Log
|
|
107
|
+
|
|
108
|
+
**Description:** Record of every auto-fix applied, with the original error, fix details, and post-fix verification result. Only TEST CODE ERROR failures with HIGH confidence are eligible for auto-fix.
|
|
109
|
+
|
|
110
|
+
**Fields per fix:**
|
|
111
|
+
|
|
112
|
+
| Field | Type | Required | Description |
|
|
113
|
+
|-------|------|----------|-------------|
|
|
114
|
+
| Failure ID | string | YES | Reference to the failure in Detailed Analysis |
|
|
115
|
+
| Original Error | text | YES | The error before the fix |
|
|
116
|
+
| Fix Applied | text | YES | Exactly what was changed (before -> after) |
|
|
117
|
+
| Confidence at Fix | enum | YES | Must be HIGH |
|
|
118
|
+
| Verification Result | enum | YES | PASS (fix resolved the failure) or FAIL (fix did not resolve) |
|
|
119
|
+
|
|
120
|
+
If no auto-fixes were applied, state: **"No auto-fixes applied. No TEST CODE ERROR failures with HIGH confidence were found."**
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Section 4: Recommendations
|
|
125
|
+
|
|
126
|
+
**Description:** Actionable next steps grouped by classification category. Not generic advice -- specific to the failures found in this run.
|
|
127
|
+
|
|
128
|
+
**Structure:** One subsection per category that had failures:
|
|
129
|
+
|
|
130
|
+
- **APPLICATION BUG recommendations:** Which bugs to prioritize (by severity), suggested investigation steps, affected code paths
|
|
131
|
+
- **TEST CODE ERROR recommendations:** Patterns to improve across the test suite (e.g., "3 tests had missing await -- add ESLint rule for no-floating-promises"), preventive measures
|
|
132
|
+
- **ENVIRONMENT ISSUE recommendations:** Environment setup improvements, Docker/CI configuration changes
|
|
133
|
+
- **INCONCLUSIVE recommendations:** What additional information or debugging would help classify these failures
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Worked Example (ShopFlow E-Commerce API)
|
|
138
|
+
|
|
139
|
+
Below is a complete, filled FAILURE_CLASSIFICATION_REPORT.md for ShopFlow test execution results.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
# Failure Classification Report
|
|
144
|
+
|
|
145
|
+
**Generated:** 2026-03-18T15:45:00Z
|
|
146
|
+
**Agent:** qa-bug-detective v1.0
|
|
147
|
+
**Test Run:** shopflow-qa-tests (42 tests executed, 5 failures)
|
|
148
|
+
|
|
149
|
+
## Summary
|
|
150
|
+
|
|
151
|
+
| Classification | Count | Auto-Fixed | Needs Attention |
|
|
152
|
+
|---------------|-------|-----------|----------------|
|
|
153
|
+
| APPLICATION BUG | 2 | 0 | 2 |
|
|
154
|
+
| TEST CODE ERROR | 2 | 2 | 0 |
|
|
155
|
+
| ENVIRONMENT ISSUE | 1 | 0 | 1 |
|
|
156
|
+
| INCONCLUSIVE | 0 | 0 | 0 |
|
|
157
|
+
|
|
158
|
+
- **Total failures analyzed:** 5
|
|
159
|
+
- **Total auto-fixed:** 2
|
|
160
|
+
- **Total requiring human attention:** 3
|
|
161
|
+
|
|
162
|
+
## Detailed Analysis
|
|
163
|
+
|
|
164
|
+
### Failure 1: API-ORDER-003 -- Order status transition allows invalid CANCELLED to SHIPPED
|
|
165
|
+
|
|
166
|
+
- **Classification:** APPLICATION BUG
|
|
167
|
+
- **Confidence:** HIGH
|
|
168
|
+
- **File:** `src/services/orderService.ts:47`
|
|
169
|
+
- **Error Message:**
|
|
170
|
+
```
|
|
171
|
+
Error: expect(received).rejects.toThrow(InvalidTransitionError)
|
|
172
|
+
|
|
173
|
+
Expected: InvalidTransitionError
|
|
174
|
+
Received: undefined (no error thrown)
|
|
175
|
+
|
|
176
|
+
Test: PATCH /api/v1/orders/ord_123/status with body { status: "SHIPPED" }
|
|
177
|
+
Order current status: CANCELLED
|
|
178
|
+
```
|
|
179
|
+
- **Evidence:**
|
|
180
|
+
```typescript
|
|
181
|
+
// src/services/orderService.ts:42-55
|
|
182
|
+
async transitionStatus(orderId: string, newStatus: OrderStatus): Promise<Order> {
|
|
183
|
+
const order = await this.prisma.order.findUniqueOrThrow({ where: { id: orderId } });
|
|
184
|
+
// BUG: No guard clause checking valid transitions
|
|
185
|
+
// The state machine should reject CANCELLED -> SHIPPED
|
|
186
|
+
// Valid transitions from CANCELLED: none (terminal state)
|
|
187
|
+
const updated = await this.prisma.order.update({
|
|
188
|
+
where: { id: orderId },
|
|
189
|
+
data: { status: newStatus, updatedAt: new Date() },
|
|
190
|
+
});
|
|
191
|
+
return updated;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
**Reasoning:** Classified as APPLICATION BUG (not TEST CODE ERROR) because the stack trace originates in `orderService.ts`, not in the test file. The test correctly expects `InvalidTransitionError` per the order state machine specification (CANCELLED is a terminal state), but the production code lacks the guard clause to enforce it.
|
|
195
|
+
- **Action Taken:** Reported for human review
|
|
196
|
+
- **Resolution:** Add a state transition validation map to `orderService.transitionStatus()`. Suggested approach: create a `VALID_TRANSITIONS` const map defining allowed `fromStatus -> toStatus[]` pairs, and throw `InvalidTransitionError` if the requested transition is not in the map.
|
|
197
|
+
|
|
198
|
+
### Failure 2: API-PAY-002 -- Payment webhook handler missing Stripe signature verification
|
|
199
|
+
|
|
200
|
+
- **Classification:** APPLICATION BUG
|
|
201
|
+
- **Confidence:** MEDIUM-HIGH
|
|
202
|
+
- **File:** `src/controllers/paymentController.ts:89`
|
|
203
|
+
- **Error Message:**
|
|
204
|
+
```
|
|
205
|
+
Error: expect(received).toBe(expected)
|
|
206
|
+
|
|
207
|
+
Expected: 401
|
|
208
|
+
Received: 200
|
|
209
|
+
|
|
210
|
+
Test: POST /api/v1/payments/webhook with invalid Stripe signature header
|
|
211
|
+
```
|
|
212
|
+
- **Evidence:**
|
|
213
|
+
```typescript
|
|
214
|
+
// src/controllers/paymentController.ts:85-98
|
|
215
|
+
async handleWebhook(req: Request, res: Response): Promise<void> {
|
|
216
|
+
// BUG: No signature verification
|
|
217
|
+
// Should call stripe.webhooks.constructEvent(req.body, sig, webhookSecret)
|
|
218
|
+
// Without this, anyone can send fake webhook events
|
|
219
|
+
const event = req.body;
|
|
220
|
+
await this.processWebhookEvent(event);
|
|
221
|
+
res.status(200).json({ received: true });
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
**Reasoning:** Classified as APPLICATION BUG (not TEST CODE ERROR) because the test sends a request with an intentionally invalid Stripe signature header and correctly expects a 401 rejection. The production code at `paymentController.ts:89` processes the webhook without calling `stripe.webhooks.constructEvent()`, accepting any payload. Confidence is MEDIUM-HIGH rather than HIGH because the webhook endpoint might be in a development/test mode where signature verification is intentionally skipped -- this should be confirmed.
|
|
225
|
+
- **Action Taken:** Reported for human review
|
|
226
|
+
- **Resolution:** Add Stripe webhook signature verification using `stripe.webhooks.constructEvent(req.body, req.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET)`. Wrap in try/catch returning 401 on `StripeSignatureVerificationError`. This is a security-critical fix -- prioritize above the order state machine bug.
|
|
227
|
+
|
|
228
|
+
### Failure 3: E2E-LOGIN-001 -- Login form submit button selector mismatch
|
|
229
|
+
|
|
230
|
+
- **Classification:** TEST CODE ERROR
|
|
231
|
+
- **Confidence:** HIGH
|
|
232
|
+
- **File:** `tests/e2e/smoke/login.e2e.spec.ts:23`
|
|
233
|
+
- **Error Message:**
|
|
234
|
+
```
|
|
235
|
+
Error: locator.click: Error: strict mode violation: locator('.submit-btn') resolved to 0 elements
|
|
236
|
+
|
|
237
|
+
Waiting for locator('.submit-btn')
|
|
238
|
+
```
|
|
239
|
+
- **Evidence:**
|
|
240
|
+
```typescript
|
|
241
|
+
// tests/e2e/smoke/login.e2e.spec.ts:23 (BEFORE fix)
|
|
242
|
+
await page.locator('.submit-btn').click();
|
|
243
|
+
|
|
244
|
+
// Actual DOM shows the button has data-testid:
|
|
245
|
+
// <button type="submit" data-testid="login-submit-btn" class="btn-primary">Log in</button>
|
|
246
|
+
|
|
247
|
+
// Fix: use Tier 1 selector (data-testid) instead of Tier 4 (CSS class)
|
|
248
|
+
await page.getByTestId('login-submit-btn').click();
|
|
249
|
+
```
|
|
250
|
+
**Reasoning:** Classified as TEST CODE ERROR (not APPLICATION BUG) because the login button exists and functions correctly in the DOM. The test used a CSS class selector (`.submit-btn`) that does not match the actual class (`btn-primary`). The element has a `data-testid` attribute available.
|
|
251
|
+
- **Action Taken:** Auto-fixed
|
|
252
|
+
- **Resolution:** Updated selector from `.submit-btn` (Tier 4 CSS, wrong class) to `getByTestId('login-submit-btn')` (Tier 1 test ID). The button has `data-testid="login-submit-btn"` in the DOM.
|
|
253
|
+
|
|
254
|
+
### Failure 4: E2E-CHECKOUT-002 -- Missing await on page.click in checkout flow
|
|
255
|
+
|
|
256
|
+
- **Classification:** TEST CODE ERROR
|
|
257
|
+
- **Confidence:** HIGH
|
|
258
|
+
- **File:** `tests/e2e/smoke/checkout.e2e.spec.ts:45`
|
|
259
|
+
- **Error Message:**
|
|
260
|
+
```
|
|
261
|
+
Error: page.getByTestId('order-confirm-heading').toBeVisible: Timeout 5000ms exceeded.
|
|
262
|
+
|
|
263
|
+
Waiting for getByTestId('order-confirm-heading') to be visible
|
|
264
|
+
Note: Previous action page.click('[data-testid="checkout-submit-btn"]') may not have completed
|
|
265
|
+
```
|
|
266
|
+
- **Evidence:**
|
|
267
|
+
```typescript
|
|
268
|
+
// tests/e2e/smoke/checkout.e2e.spec.ts:44-47 (BEFORE fix)
|
|
269
|
+
page.click('[data-testid="checkout-submit-btn"]'); // Missing await
|
|
270
|
+
await expect(page.getByTestId('order-confirm-heading')).toBeVisible();
|
|
271
|
+
|
|
272
|
+
// Fix: Add await to the click action
|
|
273
|
+
await page.click('[data-testid="checkout-submit-btn"]');
|
|
274
|
+
await expect(page.getByTestId('order-confirm-heading')).toBeVisible();
|
|
275
|
+
```
|
|
276
|
+
**Reasoning:** Classified as TEST CODE ERROR (not APPLICATION BUG) because the checkout submit button works correctly. The test failed because `page.click()` was called without `await`, so the assertion ran before the click completed and the confirmation page loaded. The Playwright error message hints at this with "Previous action may not have completed."
|
|
277
|
+
- **Action Taken:** Auto-fixed
|
|
278
|
+
- **Resolution:** Added `await` keyword before `page.click('[data-testid="checkout-submit-btn"]')` at line 45. The click must complete before asserting the next page's heading visibility.
|
|
279
|
+
|
|
280
|
+
### Failure 5: API-ORDER-001 -- Database connection timeout
|
|
281
|
+
|
|
282
|
+
- **Classification:** ENVIRONMENT ISSUE
|
|
283
|
+
- **Confidence:** HIGH
|
|
284
|
+
- **File:** `tests/api/orders.api.spec.ts:12`
|
|
285
|
+
- **Error Message:**
|
|
286
|
+
```
|
|
287
|
+
Error: connect ECONNREFUSED 127.0.0.1:5432
|
|
288
|
+
|
|
289
|
+
PrismaClientInitializationError: Can't reach database server at `localhost:5432`
|
|
290
|
+
Please make sure your database server is running at `localhost:5432`.
|
|
291
|
+
```
|
|
292
|
+
- **Evidence:**
|
|
293
|
+
```
|
|
294
|
+
The error occurs before any test logic executes -- during the global setup phase when
|
|
295
|
+
Prisma attempts to connect to PostgreSQL. The error is ECONNREFUSED, indicating the
|
|
296
|
+
database server is not running, not that the credentials are wrong (which would show
|
|
297
|
+
EAUTH or similar).
|
|
298
|
+
|
|
299
|
+
Environment check:
|
|
300
|
+
- DATABASE_URL in .env: postgresql://test:test@localhost:5432/shopflow_test
|
|
301
|
+
- PostgreSQL process: NOT RUNNING
|
|
302
|
+
```
|
|
303
|
+
**Reasoning:** Classified as ENVIRONMENT ISSUE (not APPLICATION BUG) because the error is a TCP connection refusal to the database port, occurring before any application code executes. The database server is simply not running in the test environment.
|
|
304
|
+
- **Action Taken:** Reported for human review
|
|
305
|
+
- **Resolution:** Start PostgreSQL before running tests. Options: (1) Run `docker compose up -d postgres` if Docker Compose is configured, (2) Start the local PostgreSQL service: `sudo systemctl start postgresql`, (3) For CI: add a PostgreSQL service container to the GitHub Actions workflow.
|
|
306
|
+
|
|
307
|
+
## Auto-Fix Log
|
|
308
|
+
|
|
309
|
+
| Failure ID | Original Error | Fix Applied | Confidence | Verification |
|
|
310
|
+
|-----------|---------------|------------|------------|-------------|
|
|
311
|
+
| Failure 3 (E2E-LOGIN-001) | `locator('.submit-btn')` resolved to 0 elements | Changed `page.locator('.submit-btn').click()` to `page.getByTestId('login-submit-btn').click()` | HIGH | PASS -- login test completes successfully with updated selector |
|
|
312
|
+
| Failure 4 (E2E-CHECKOUT-002) | Timeout waiting for order-confirm-heading after unresolved click | Added `await` before `page.click('[data-testid="checkout-submit-btn"]')` | HIGH | PASS -- checkout test completes, confirmation heading visible after awaited click |
|
|
313
|
+
|
|
314
|
+
## Recommendations
|
|
315
|
+
|
|
316
|
+
### APPLICATION BUG (Priority Order)
|
|
317
|
+
|
|
318
|
+
1. **[CRITICAL] Add Stripe webhook signature verification** (`paymentController.ts:89`)
|
|
319
|
+
- Security vulnerability: any HTTP client can trigger fake webhook events
|
|
320
|
+
- Fix: Add `stripe.webhooks.constructEvent()` call with signature validation
|
|
321
|
+
- Priority: Fix before next deployment -- this is a security hole
|
|
322
|
+
|
|
323
|
+
2. **[HIGH] Add order state machine guard clause** (`orderService.ts:47`)
|
|
324
|
+
- Data integrity issue: orders can transition to invalid states (CANCELLED -> SHIPPED)
|
|
325
|
+
- Fix: Create `VALID_TRANSITIONS` map and validate before updating
|
|
326
|
+
- Priority: Fix in next sprint -- causes incorrect order states in production
|
|
327
|
+
|
|
328
|
+
### TEST CODE ERROR (Preventive Measures)
|
|
329
|
+
|
|
330
|
+
1. **Add ESLint rule `no-floating-promises`** to catch missing `await` keywords
|
|
331
|
+
- 1 of 2 test code errors was a missing `await` -- this is a common async/await mistake
|
|
332
|
+
- Add `@typescript-eslint/no-floating-promises: "error"` to `.eslintrc`
|
|
333
|
+
- This would have caught Failure 4 at lint time
|
|
334
|
+
|
|
335
|
+
2. **Enforce Tier 1 locator usage** in code review and linting
|
|
336
|
+
- 1 of 2 test code errors used a CSS class selector instead of `data-testid`
|
|
337
|
+
- Consider an ESLint plugin or custom rule to warn on `page.locator('.')` patterns
|
|
338
|
+
- Prefer `getByTestId()` and `getByRole()` per locator hierarchy standards
|
|
339
|
+
|
|
340
|
+
### ENVIRONMENT ISSUE (Infrastructure)
|
|
341
|
+
|
|
342
|
+
1. **Add Docker Compose for test database**
|
|
343
|
+
- Create `docker-compose.test.yml` with PostgreSQL service
|
|
344
|
+
- Add `pretest` script: `docker compose -f docker-compose.test.yml up -d`
|
|
345
|
+
- Ensures database is always available before test execution
|
|
346
|
+
|
|
347
|
+
2. **Add PostgreSQL service to GitHub Actions**
|
|
348
|
+
```yaml
|
|
349
|
+
services:
|
|
350
|
+
postgres:
|
|
351
|
+
image: postgres:15
|
|
352
|
+
env:
|
|
353
|
+
POSTGRES_USER: test
|
|
354
|
+
POSTGRES_PASSWORD: test
|
|
355
|
+
POSTGRES_DB: shopflow_test
|
|
356
|
+
ports:
|
|
357
|
+
- 5432:5432
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Guidelines
|
|
363
|
+
|
|
364
|
+
**DO:**
|
|
365
|
+
- Include the complete error message in every failure entry -- not a summary, the actual error output
|
|
366
|
+
- Show the code snippet that proves the classification -- reviewers need to see the evidence
|
|
367
|
+
- Include classification reasoning explaining why THIS category and not another
|
|
368
|
+
- Verify auto-fixes by re-running the test before marking the fix as PASS
|
|
369
|
+
- Group recommendations by category and prioritize within each group
|
|
370
|
+
|
|
371
|
+
**DON'T:**
|
|
372
|
+
- Auto-fix anything classified as APPLICATION BUG -- report only, never modify production code
|
|
373
|
+
- Auto-fix with confidence below HIGH -- report for human review instead
|
|
374
|
+
- Classify an error as INCONCLUSIVE without explaining what information is missing and what steps would help classify it
|
|
375
|
+
- Omit the file:line reference -- every failure must point to the exact location
|
|
376
|
+
- Combine multiple failures into a single entry -- each failure gets its own Detailed Analysis subsection
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Quality Gate
|
|
381
|
+
|
|
382
|
+
Before delivering a FAILURE_CLASSIFICATION_REPORT.md, verify:
|
|
383
|
+
|
|
384
|
+
- [ ] All 4 required sections are present (Summary, Detailed Analysis, Auto-Fix Log, Recommendations)
|
|
385
|
+
- [ ] Summary table includes all 4 categories (APPLICATION BUG, TEST CODE ERROR, ENVIRONMENT ISSUE, INCONCLUSIVE) even if count is 0
|
|
386
|
+
- [ ] Every failure has ALL mandatory fields: test name, classification, confidence, file:line, error message, evidence, action taken, resolution
|
|
387
|
+
- [ ] Every failure includes classification reasoning (why this category and not another)
|
|
388
|
+
- [ ] No APPLICATION BUG was auto-fixed (only TEST CODE ERROR with HIGH confidence)
|
|
389
|
+
- [ ] Auto-Fix Log entries include verification result (PASS/FAIL after fix)
|
|
390
|
+
- [ ] Recommendations are grouped by category and specific to the failures found (not generic advice)
|
|
391
|
+
- [ ] INCONCLUSIVE entries (if any) explain what information is missing
|