PD-105 — Manifest de décomposition¶
Ce document est produit par l'orchestrateur Claude à l'étape 6a. Il découpe le plan d'implémentation en tâches assignées à des agents spécialisés.
Résumé¶
- Story : PD-105 — Implémenter push notifications
- Nombre de tâches : 10
- Agents mobilisés : agent-developer (×6), agent-adversarial (×1), agent-qa-unit-integration (×2), agent-qa-ihm (×1)
Tâche 1 : agent-developer — backend/device-tokens¶
- Agent : agent-developer
- LLM : claude
- Code contract : backend.device_tokens
- Périmètre fichiers :
ProbatioVault-backend/src/modules/notifications/device-tokens/** - Livrable attendu :
- Entity DeviceToken avec schéma complet
- Controller avec endpoints POST /api/v1/notifications/device-tokens et DELETE /:deviceId
- Service avec logique d'enregistrement/révocation/upsert
- DTO RegisterTokenDto avec validation
- Tests unitaires (coverage >= 80%)
- Dépendances : aucune
Tâche 2 : agent-developer — backend/event-classifier¶
- Agent : agent-developer
- LLM : claude
- Code contract : backend.event_classifier
- Périmètre fichiers :
ProbatioVault-backend/src/modules/notifications/classifier/** - Livrable attendu :
- EventClassifierService avec méthodes classify() et shouldNotify()
- Enum Criticality (CRITIQUE, HAUTE_CRITIQUE, HAUTE, NORMALE, BASSE)
- Catalogue phase 1 hardcodé (5 événements probatoires)
- Tests unitaires sur matrice de classification complète
- Dépendances : aucune
Tâche 3 : agent-developer — backend/apns-client¶
- Agent : agent-developer
- LLM : claude
- Code contract : backend.apns_client
- Périmètre fichiers :
ProbatioVault-backend/src/modules/notifications/apns/** - Livrable attendu :
- ApnsClient avec méthode send()
- ApnsConfig chargeant credentials depuis Vault (auth key p8)
- Gestion retry avec backoff exponentiel (3 tentatives)
- Callback APNs feedback pour marquer tokens invalides
- Tests unitaires avec mock @parse/node-apn
- Dépendances : aucune
Tâche 4 : agent-developer — backend/dispatch-service¶
- Agent : agent-developer
- LLM : claude
- Code contract : backend.dispatch_service
- Périmètre fichiers :
ProbatioVault-backend/src/modules/notifications/dispatch/** - Livrable attendu :
- DispatchService avec méthodes dispatch(), sendAlert(), sendSilent()
- PayloadBuilder avec build() et sanitize() (validation PII)
- Instrumentation latence (timestamp_event, timestamp_dispatch, delta_ms)
- Tests unitaires sur chemins alert/silent, validation payload
- Dépendances : Tâche 2 (event-classifier), Tâche 3 (apns-client)
Tâche 5 : agent-developer — frontend/notification-service¶
- Agent : agent-developer
- LLM : claude
- Code contract : frontend.notification_service
- Périmètre fichiers :
ProbatioVault-app/src/services/notifications/notificationService.ts,ProbatioVault-app/src/services/notifications/index.ts - Livrable attendu :
- NotificationService singleton avec initialize(), getDeviceToken(), registerTokenListener()
- Configuration expo-notifications (iOS uniquement)
- Listeners foreground/background/response
- Tests unitaires avec mock expo-notifications
- Dépendances : aucune
Tâche 6 : agent-developer — frontend/notification-handlers¶
- Agent : agent-developer
- LLM : claude
- Code contract : frontend.notification_handlers
- Périmètre fichiers :
ProbatioVault-app/src/services/notifications/handlers.ts - Livrable attendu :
- NotificationHandlers avec handleForeground(), handleBackground(), handleNotificationResponse()
- Déduplication par notificationId (UUID v4)
- Sérialisation via queue pour éviter race conditions badge
- Tests unitaires sur 3 chemins (foreground/background/killed)
- Dépendances : Tâche 7 (notification-store), Tâche 8 (notification-storage), Tâche 9 (resolver)
Tâche 7 : agent-developer — frontend/notification-store¶
- Agent : agent-developer
- LLM : claude
- Code contract : frontend.notification_store
- Périmètre fichiers :
ProbatioVault-app/src/store/notificationStore.ts - Livrable attendu :
- useNotificationStore (Zustand) avec state (notifications, unreadCount, isLoading)
- Méthodes addNotification() avec déduplication, markAsRead(), computeBadge()
- computeBadge() sérialisé via queue (éviter race conditions)
- Tests unitaires Zustand sur mutations state
- Dépendances : aucune
Tâche 8 : agent-developer — frontend/notification-storage¶
- Agent : agent-developer
- LLM : claude
- Code contract : frontend.notification_storage
- Périmètre fichiers :
ProbatioVault-app/src/services/notifications/storage.ts - Livrable attendu :
- NotificationStorage avec save(), getAll(), purgeOlderThan()
- Persistance SQLite chiffré (expo-sqlite)
- Validation UUID v4 pour notificationId (test unitaire avec regex)
- Rétention 90 jours (cron au lancement)
- Tests unitaires sur CRUD + purge
- Dépendances : aucune
Tâche 9 : agent-developer — frontend/resolver + UI¶
- Agent : agent-developer
- LLM : claude
- Code contract : frontend.resolver, frontend.notification_center, frontend.permission_prompt
- Périmètre fichiers :
ProbatioVault-app/src/services/notifications/resolver.tsProbatioVault-app/src/screens/notifications/NotificationCenterScreen.tsxProbatioVault-app/src/screens/notifications/NotificationDetailScreen.tsxProbatioVault-app/src/components/notifications/PermissionPrompt.tsx- Livrable attendu :
- NotificationResolver avec resolve() → NavigationTarget | null
- NotificationCenterScreen (liste, tri DESC receivedAt)
- NotificationDetailScreen (métadonnées + fallback si contexte indisponible)
- PermissionPrompt (message valeur probatoire AVANT requestPermissions)
- Tests unitaires resolver + composants (React Testing Library)
- Dépendances : Tâche 7 (notification-store)
Tâche 10 : agent-adversarial — security-review¶
- Agent : agent-adversarial
- LLM : claude
- Code contract : N/A (review transverse)
- Périmètre fichiers : Tous les fichiers produits par tâches 1-9
- Livrable attendu :
- Rapport de sécurité markdown identifiant vulnérabilités potentielles
- Focus sur : validation PII (INV-105-07), stockage credentials APNs, déduplication notificationId, race conditions badge
- Vérification absence de données sensibles dans payloads
- Recommandations de corrections si nécessaire
- Dépendances : Tâches 1-9 (code produit)
Tâche 11 : agent-qa-unit-integration — backend-integration-tests¶
- Agent : agent-qa-unit-integration
- LLM : claude
- Code contract : N/A (tests intégration backend)
- Périmètre fichiers :
ProbatioVault-backend/src/modules/notifications/__tests__/integration/ - Livrable attendu :
- Tests d'intégration E2E backend : enregistrement token → classification événement → dispatch APNs → logs latence
- Tests sur chemins alert/silent selon criticité
- Tests révocation token
- Validation p95 latence < 5s (TC-NOM-09)
- Coverage >= 80%
- Dépendances : Tâches 1-4 (backend complet)
Tâche 12 : agent-qa-unit-integration — frontend-integration-tests¶
- Agent : agent-qa-unit-integration
- LLM : claude
- Code contract : N/A (tests intégration frontend)
- Périmètre fichiers :
ProbatioVault-app/src/__tests__/notifications/integration/ - Livrable attendu :
- Tests d'intégration E2E frontend : réception notification → historisation → badge → navigation
- Tests sur foreground/background/killed
- Tests déduplication notificationId
- Tests reconciliation badge après désalignement
- Coverage >= 80%
- Dépendances : Tâches 5-9 (frontend complet)
Tâche 13 : agent-qa-ihm — ui-e2e-tests¶
- Agent : agent-qa-ihm
- LLM : claude
- Code contract : N/A (tests E2E UI)
- Périmètre fichiers :
ProbatioVault-app/e2e/notifications.test.ts - Livrable attendu :
- Tests E2E Detox sur device physique ou simulateur iOS
- Scénarios : permission prompt → enregistrement token → réception notification → tap → navigation
- Tests centre notifications (liste, détail, mark as read, badge)
- Tests fallback contexte indisponible
- CRITIQUE : Exécution sur build EAS iOS uniquement (INV-105-13)
- Rapport d'exécution avec métadonnées build type
- Dépendances : Tâches 5-9 (frontend complet), build EAS configuré
Ordre d'exécution¶
Phase 1 (parallèle) — Modules isolés¶
- Tâche 1 (backend/device-tokens)
- Tâche 2 (backend/event-classifier)
- Tâche 3 (backend/apns-client)
- Tâche 5 (frontend/notification-service)
- Tâche 7 (frontend/notification-store)
- Tâche 8 (frontend/notification-storage)
Phase 2 (séquentiel) — Modules dépendants¶
- Tâche 4 (backend/dispatch-service) après Tâches 2, 3
- Tâche 9 (frontend/resolver + UI) après Tâche 7
- Tâche 6 (frontend/notification-handlers) après Tâches 7, 8, 9
Phase 3 (parallèle) — Tests et review¶
- Tâche 11 (backend-integration-tests) après Tâches 1-4
- Tâche 12 (frontend-integration-tests) après Tâches 5-9
- Tâche 10 (security-review) après Tâches 1-9
Phase 4 (séquentiel) — Tests E2E¶
- Tâche 13 (ui-e2e-tests) après Tâches 5-9 + build EAS configuré
Notes de l'orchestrateur¶
Learnings critiques appliqués¶
- PD-96 : EAS build obligatoire pour tests acceptabilité (Expo Go ne supporte pas vraies push notifications)
- Tâche 13 doit ABSOLUMENT s'exécuter sur build EAS iOS
-
Vérifier métadonnées build dans rapport d'exécution
-
PD-99 : Observables contractuels explicites
- Tâche 4 (dispatch-service) : logs timestamp_event, timestamp_dispatch, delta_ms
-
Tâche 8 (notification-storage) : validation UUID v4 avec regex (test unitaire)
-
PD-106 : Coverage >= 80% requis
- Toutes les tâches agent-developer doivent inclure tests unitaires
- Tâches 11-12 (intégration) + Tâche 13 (E2E) pour atteindre 80%+
Points de vigilance¶
- Race conditions badge (INV-105-09)
- Tâche 6 (handlers) et Tâche 7 (store) : sérialisation via queue pour computeBadge()
-
Tests unitaires dédiés sur concurrence
-
Déduplication notificationId (INV-105-08)
- Tâche 6 (handlers) : vérifier notificationId existe avant historisation
-
Test unitaire sur réception duplicate
-
Validation PII (INV-105-07)
- Tâche 4 (dispatch-service) : PayloadBuilder.sanitize() avec regex PII
-
Tâche 10 (security-review) : audit approfondi payloads
-
Latence p95 < 5s (INV-105-11)
- Tâche 4 (dispatch-service) : instrumentation timestamp
-
Tâche 11 (backend-integration) : validation métrique p95
-
Credentials APNs (sécurité)
- Tâche 3 (apns-client) : chargement depuis Vault (kv/app/apns/auth-key-p8)
-
Jamais en clair dans code ou config
-
Rétention 90 jours (INV-105-14)
- Tâche 8 (notification-storage) : purgeOlderThan(90) en cron au lancement
Mapping Invariants → Tâches¶
| Invariant | Tâche(s) responsable(s) | Commentaire |
|---|---|---|
| INV-105-01 | Tâche 5 | iOS uniquement (expo-notifications config) |
| INV-105-02 | Tâche 2 | EventClassifier.shouldNotify() + catalogue phase 1 |
| INV-105-03 | Tâche 1, Tâche 5 | Token enregistré au contexte authentifié |
| INV-105-04 | Tâche 1 | Révocation token au logout (DELETE endpoint) |
| INV-105-05 | Tâche 4, Tâche 6 | Silent sans alerte (content-available:1) |
| INV-105-06 | Tâche 2, Tâche 4 | Alert pour CRITIQUE/HAUTE-CRITIQUE |
| INV-105-07 | Tâche 4, Tâche 10 | Payload sans PII (sanitize + security review) |
| INV-105-08 | Tâche 6, Tâche 7, Tâche 8 | Historisation champs obligatoires (UUID v4, type, receivedAt, read) |
| INV-105-09 | Tâche 6, Tâche 7 | Badge = non lus (computeBadge sérialisé) |
| INV-105-10 | Tâche 6, Tâche 9 | Navigation contextuelle + fallback |
| INV-105-11 | Tâche 4, Tâche 11 | Latence p95 < 5s (instrumentation + tests) |
| INV-105-12 | Tâche 3, Tâche 4 | Taux livraison >= 99% (feedback APNs) |
| INV-105-13 | Tâche 13 | Build EAS uniquement (E2E tests) |
| INV-105-14 | Tâche 8 | Rétention 90 jours (purge automatique) |
Risques identifiés¶
- Build EAS configuration : Tâche 13 bloquée si EAS non configuré
-
Mitigation : Vérifier entitlements iOS Push Notifications avant Phase 4
-
Credentials APNs : Tâche 3 bloquée si Auth Key p8 non disponible dans Vault
-
Mitigation : Provisionner credentials en environnement dev/test avant Phase 1
-
Compatibilité expo-notifications SDK 52 : Hypothèse technique (HT-01)
-
Mitigation : Vérifier version expo-notifications compatible avant Phase 1
-
Quota APNs silent : iOS limite ~2-3 silent push/heure en arrière-plan
- Mitigation : Privilégier alert pour événements critiques, documenter limitation
Synthèse¶
Le workflow d'implémentation est structuré en 4 phases :
- Phase 1 (6 tâches parallèles) : Modules backend et frontend isolés sans dépendances
- Phase 2 (3 tâches séquentielles) : Modules dépendants (dispatch, resolver, handlers)
- Phase 3 (3 tâches parallèles) : Tests intégration + security review
- Phase 4 (1 tâche séquentielle) : Tests E2E UI sur build EAS
Estimation effort total : 9-11 jours (selon plan initial)
Points critiques pour acceptabilité : - Coverage >= 80% (learnings PD-106) - Build EAS obligatoire pour tests (INV-105-13, learnings PD-96) - Observables contractuels explicites (learnings PD-99) - Validation PII (INV-105-07) - Latence p95 < 5s (INV-105-11)