Itération 1 — Review du plan d'implémentation
Type de gate : AMBIGUITY
1. Documents de référence
| Document | Étape | Statut |
| PD-240-besoin.md | 0 | ✓ Présent |
| PD-240-specification.md | 1 | ✓ Présent (v3) |
| PD-240-tests.md | 2 | ✓ Présent (v3) |
| PD-240-plan.md | 4 | ✓ Présent |
| PD-240-code-contracts.yaml | 4 | ✓ Présent |
| PD-240-plan-review-v1.md | 5 | ✓ Présent |
| PD-240-confrontation-step5-v1.md | 5 | ✓ Présent |
2. Hypothèses déclarées
Extraites du plan d'implémentation :
| ID | Hypothèse | Validation |
| HT-01 | Keycloak Admin API accessible depuis le backend | Test de connexion au démarrage |
| HT-02 | Redis accessible avec sessions au format session:{userId}:* | Conforme à PD-30 |
| HT-03 | PostgreSQL a table users avec email, name | Conforme à PD-23 |
| HT-04 | ReauthMiddleware de PD-238 disponible et fonctionnel | PD-238 DONE |
3.1 Invariants ↔ Mécanismes Plan
| Invariant | Mécanisme Plan | Couvert ? |
| INV-240-01 | JwtAuthGuard sur route | ✓ |
| INV-240-02 | ReauthMiddleware (PD-238) | ✓ |
| INV-240-03 | Validation body confirm === "DELETE_MY_ACCOUNT" | ✓ |
| INV-240-04 | Keycloak Admin API DELETE | ✓ |
| INV-240-05 | PostgreSQL UPDATE/DELETE + audit entry + endpoint admin | ⚠️ Écart DIV-02 |
| INV-240-06 | Redis DEL avant suppression Keycloak | ✓ |
| INV-240-07 | Combinaison INV-240-04 + INV-240-06 | ✓ |
| INV-240-08 | ExceptionFilter avec format {error, message} | ✓ |
| INV-240-09 | Messages d'erreur explicites | ✓ |
| INV-240-10 | Hors périmètre | N/A |
3.2 Critères d'acceptation ↔ Tests
| CA | Test | Réalisable ? |
| CA-240-01 | T-240-ERR-01 | ✓ |
| CA-240-02 | T-240-ERR-02 | ✓ |
| CA-240-03 | T-240-ERR-03 | ✓ |
| CA-240-04 | T-240-POST-01 | ✓ |
| CA-240-05 | T-240-POST-02 | ⚠️ Dépend de DIV-02 (purgedAt) |
| CA-240-06 | T-240-NOM-01 | ✓ |
| CA-240-07 | T-240-ERR-* | ✓ |
| CA-240-08 | T-240-ERR-04/05/06 | ✓ |
| CA-240-09 | T-240-INV-01 | N/A (hors périmètre) |
3.3 Code Contracts ↔ Plan
| Module | Complétude | Cohérence | Écarts |
| delete-account-controller | ✓ | ✓ | — |
| delete-account-service | ✓ | ✓ | — |
| session-invalidation | ✓ | ✓ | — |
| user-data-purge | ✓ | ✓ | — |
| keycloak-user | ✓ | ✓ | — |
| audit-controller | ✓ | ⚠️ | DIV-02 (purgedAt optional) |
| delete-account-tests | ✓ | ✓ | — |
4. Points ouverts
Écarts identifiés
| ID | Type | Gravité | Description |
| DIV-01 | Incohérence spec | BLOQUANT | Spec §4 dit DELETE, INV-240-05 dit GET — incohérence interne |
| DIV-02 | Code Contract | MAJEUR | purgedAt optionnel dans code contract, obligatoire dans spec |
| DIV-03 | Non contractualisé | MAJEUR | État "limbo" post-invalidation sessions non spécifié |
Zones d'ombre
| ID | Description | Impact |
| ZO-01 | Comportement exact échec purge/Keycloak | À clarifier |
| ZO-02 | Format réponse succès | Mineur |
5. Rapport de confrontation
- Voir : PD-240-confrontation-step5-v1.md
- Synthèse : 3 divergences identifiées (1 BLOQUANT + 2 MAJEUR)
6. Recommandation pré-verdict
Justification
DIV-01 (BLOQUANT) : La spec contient une incohérence interne entre le périmètre (§4) et l'invariant INV-240-05. Le périmètre mentionne DELETE /admin/users/{userId}/audit alors que l'invariant définit GET /admin/audit/user/{userId}. Cette incohérence doit être corrigée avant de valider le plan.
DIV-02 (MAJEUR) : Le code contract autorise purgedAt optionnel, mais le test T-240-POST-02 exige sa présence.
DIV-03 (MAJEUR) : L'état "limbo" post-invalidation sessions n'est pas contractualisé.
Corrections requises
- Spec §4 Périmètre : Remplacer
DELETE /admin/users/{userId}/audit par GET /admin/audit/user/{userId} (aligner sur INV-240-05) - Code contract audit-controller : Rendre purgedAt obligatoire quand status="purged"
- Spec §8 ou Plan : Clarifier le comportement en cas d'échec purge/Keycloak après invalidation sessions
Attribution des corrections
| Écart | Document à corriger | Agent responsable |
| DIV-01 | PD-240-specification.md | ChatGPT |
| DIV-02 | PD-240-code-contracts.yaml | Claude |
| DIV-03 | PD-240-specification.md ou Plan | ChatGPT ou Claude |