fix: harden phase summary open questions
This commit is contained in:
@@ -202,7 +202,7 @@ Expected: PASS.
|
||||
|
||||
**Files:**
|
||||
- Modify: `harness/.pi/extensions/gate/artifact-contracts.js`
|
||||
- Modify: `harness/.pi/extensions/gate/__tests__/artifact-contracts.test.js`
|
||||
- Modify: `harness/.pi/extensions/gate/__tests__/artifact_contracts.test.js`
|
||||
- Modify: `harness/.pi/skills/tht-sessione/SKILL.md`
|
||||
- Modify: `frontend/src/viewers/artifactV2.ts`
|
||||
- Modify: `frontend/src/viewers/PhaseSummaryViewer.tsx`
|
||||
@@ -214,7 +214,7 @@ Expected: PASS.
|
||||
- Frontend legacy normalization: string entries pass through; objects prefer `question`, then
|
||||
`label`; all other values become safe text or are omitted.
|
||||
|
||||
- [ ] **Step 1: Write failing gate validation test**
|
||||
- [x] **Step 1: Write failing gate validation test**
|
||||
|
||||
Pass the exact observed payload shape:
|
||||
|
||||
@@ -224,34 +224,34 @@ open_questions: [{ label: "pazienti_finale restituisce 0 righe", question: "Veri
|
||||
|
||||
Expect `ok:false` and an error naming `open_questions[0]`.
|
||||
|
||||
- [ ] **Step 2: Run gate test and verify RED**
|
||||
- [x] **Step 2: Run gate test and verify RED**
|
||||
|
||||
Run: `cd harness && node --test .pi/extensions/gate/__tests__/artifact-contracts.test.js`
|
||||
Run: `cd harness && node --test .pi/extensions/gate/__tests__/artifact_contracts.test.js`
|
||||
|
||||
Expected: payload is currently accepted.
|
||||
|
||||
- [ ] **Step 3: Implement strict gate validation**
|
||||
- [x] **Step 3: Implement strict gate validation**
|
||||
|
||||
Reject a non-array `open_questions` value and every non-string entry with an indexed error.
|
||||
Document the exact array-of-strings shape in the session skill.
|
||||
|
||||
- [ ] **Step 4: Write failing frontend resilience test**
|
||||
- [x] **Step 4: Write failing frontend resilience test**
|
||||
|
||||
Render a phase-summary artifact containing the observed object and assert the screen displays
|
||||
`Verificare i filtri` and does not show the ErrorBoundary fallback.
|
||||
|
||||
- [ ] **Step 5: Run frontend test and verify RED**
|
||||
- [x] **Step 5: Run frontend test and verify RED**
|
||||
|
||||
Run: `cd frontend && npx vitest run src/viewers/PhaseSummaryViewer.test.tsx src/viewers/ArtifactView.test.tsx`
|
||||
|
||||
Expected: React reports an object child/rendering failure.
|
||||
|
||||
- [ ] **Step 6: Implement safe legacy normalization**
|
||||
- [x] **Step 6: Implement safe legacy normalization**
|
||||
|
||||
Add a small `phaseOpenQuestionText(value: unknown): string | null` helper and map/filter entries
|
||||
before rendering. Preserve the strict public TypeScript contract for new v2 payloads.
|
||||
|
||||
- [ ] **Step 7: Run targeted tests and typechecks**
|
||||
- [x] **Step 7: Run targeted tests and typechecks**
|
||||
|
||||
Run: `cd harness && npm test`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user