diff --git a/VEZA_MVP_STABILITY_TODOLIST.json b/VEZA_MVP_STABILITY_TODOLIST.json index 703867c8a..36de3bf28 100644 --- a/VEZA_MVP_STABILITY_TODOLIST.json +++ b/VEZA_MVP_STABILITY_TODOLIST.json @@ -649,7 +649,7 @@ "description": "Backend sends error code as number, but Zod schema expects string", "owner": "frontend", "estimated_hours": 1, - "status": "todo", + "status": "completed", "priority": 10, "dependencies": [], "files_to_modify": [ @@ -900,12 +900,12 @@ ] }, "progress_tracking": { - "completed": 9, + "completed": 10, "in_progress": 0, - "todo": 6, + "todo": 5, "blocked": 0, - "last_updated": "2025-01-27T22:00:00Z", - "completion_percentage": 60 + "last_updated": "2025-01-27T23:00:00Z", + "completion_percentage": 67 }, "validation_checklist": { "description": "Run these checks after all tasks complete to verify MVP stability", diff --git a/VEZA_MVP_TODOLIST_TRACKING.md b/VEZA_MVP_TODOLIST_TRACKING.md index 1098595af..69fbce33a 100644 --- a/VEZA_MVP_TODOLIST_TRACKING.md +++ b/VEZA_MVP_TODOLIST_TRACKING.md @@ -10,17 +10,17 @@ | Métrique | Valeur | |----------|--------| -| **Tâches complétées** | 9 / 15 | +| **Tâches complétées** | 10 / 15 | | **Phase actuelle** | PHASE-2 (API Alignment) | -| **Progression globale** | █████████░ 60% | -| **Dernière mise à jour** | 2025-01-27 22:00 | +| **Progression globale** | ██████████░ 67% | +| **Dernière mise à jour** | 2025-01-27 23:00 | ### Progression par Phase | Phase | Statut | Progression | |-------|--------|-------------| | PHASE-1 — Bloquants Critiques | ✅ Terminé | 5/5 | -| PHASE-2 — Alignement API | 🔄 En cours | 4/5 | +| PHASE-2 — Alignement API | ✅ Terminé | 5/5 | | PHASE-3 — Fiabilité | ⚪ En attente | 0/5 | --- @@ -530,14 +530,14 @@ export const FEATURES = { | **Source** | INT-000009 | | **Owner** | Frontend | | **Effort** | ~1h | -| **Statut** | ⬜ À faire | +| **Statut** | ✅ Terminé | **Problème** : Backend envoie `code: number`, Zod attend `code: string`. -**Fichier** : -- [ ] `apps/web/src/schemas/validation.ts` (L338) +**Fichier modifié** : +- [x] `apps/web/src/schemas/validation.ts` → Corrigé `code: z.string()` en `code: z.number()` dans `apiResponseSchema` et `errorSchema` -**Changement** : +**Changements effectués** : ```typescript // Avant code: z.string() @@ -546,6 +546,15 @@ code: z.string() code: z.number() ``` +**Validation** : +- `npx tsc --noEmit` → ✅ Aucune erreur TypeScript +- Les comparaisons avec des nombres dans `auth.ts` (401, 1001, 1002) fonctionnent correctement + +**Critères d'acceptation** : +- [x] Code d'erreur parsé comme number dans les schémas Zod +- [x] TypeScript compile sans erreurs +- [x] Gestion d'erreur fonctionne correctement + --- ## 🔧 PHASE-3 : Fiabilité & Polish @@ -980,10 +989,34 @@ Frontend : **Temps passé** : 1h30 -**Prochaine tâche** : MVP-010 (Fix Error Code Type in Zod Schemas) +**Prochaine tâche** : MVP-011 (Simplify Token Refresh Response Handling) **Notes** : L'endpoint GetMe retourne maintenant l'objet User complet, permettant au frontend d'afficher toutes les informations utilisateur après login. Le format de réponse correspond exactement au type User du frontend. +---- + +## 2025-01-27 (suite 7) + +**Tâches travaillées** : MVP-010 +**Statut** : +- MVP-010 : ✅ Terminé + +**Changements effectués** : +- Modifié `apps/web/src/schemas/validation.ts` : + - `apiResponseSchema` : `code: z.string()` → `code: z.number()` (ligne 338) + - `errorSchema` : `code: z.string()` → `code: z.number()` (ligne 354) + +**Validation** : +- `npx tsc --noEmit` → ✅ Aucune erreur TypeScript +- Les comparaisons avec des nombres dans `auth.ts` (error.code === 401, 1001, 1002) fonctionnent correctement +- Les codes d'erreur réseau Axios ('ECONNABORTED', 'ETIMEDOUT') restent des strings, ce qui est correct + +**Temps passé** : 30 min + +**Prochaine tâche** : MVP-011 (Simplify Token Refresh Response Handling) + +**Notes** : Les schémas Zod correspondent maintenant au format du backend qui envoie les codes d'erreur comme nombres. Cela permet une validation correcte des réponses d'erreur de l'API. + --- ## 📚 Commandes Utiles diff --git a/apps/web/src/schemas/validation.ts b/apps/web/src/schemas/validation.ts index b5ad9fe71..100b32b00 100644 --- a/apps/web/src/schemas/validation.ts +++ b/apps/web/src/schemas/validation.ts @@ -335,7 +335,7 @@ export const apiResponseSchema = (dataSchema: T) => data: dataSchema.optional(), error: z .object({ - code: z.string(), + code: z.number(), message: z.string(), details: z.any().optional(), }) @@ -351,7 +351,7 @@ export const apiResponseSchema = (dataSchema: T) => // Schémas pour les erreurs export const errorSchema = z.object({ - code: z.string(), + code: z.number(), message: z.string(), details: z.any().optional(), field: z.string().optional(),