Aller au contenu

PD-283 — Décomposition (Step 6a)

Stratégie de parallélisation

Mode : by_level — les composants sans dépendances inter-composants sont parallélisables.

Graphe de dépendances (DAG)

Level 0 : T1(C1), T2(C6), T3(C7), T4(C8), T5(C9)     ← indépendants
Level 1 : T6(C2), T7(C3→C8), T8(C4→C8)                 ← dépendent de L0
Level 2 : T9(C5→C6,C7,C8)                               ← dépend de L1
Level 3 : T10(C10→C1-C9), T11(C11→C1,C10)               ← orchestration + UI
Level 4 : T12(CC-12 Tests→all)                           ← tests unitaires + intégration

Manifest des tâches

Level 0 — Modules indépendants

T1 — ExportStateMachine (C1, CC-1)

  • Agent : agent-developer
  • Contract : CC-1
  • Fichiers : src/export/state-machine.ts, src/store/useExportStore.ts
  • Description : Machine à états contractuelle avec transitions gardées, store Zustand, journalisation horodatée
  • Dépendances : aucune
  • Branche : feature/PD-283-l0-state-machine

T2 — FilenameSanitizer (C6, CC-6)

  • Agent : agent-developer
  • Contract : CC-6
  • Fichiers : src/export/filename-sanitizer.ts
  • Description : Sanitization anti zip-slip (interdit .., /, \, contrôles ASCII), NFC, collision _N, limite 120 chars
  • Dépendances : aucune
  • Branche : feature/PD-283-l0-filename-sanitizer

T3 — StreamingHasher (C7, CC-7)

  • Agent : agent-developer
  • Contract : CC-7
  • Fichiers : src/export/streaming-hasher.ts
  • Description : Hash SHA3-256 streaming via @noble/hashes/sha3, chunks 64KB, sortie 64 hex lowercase
  • Dépendances : aucune
  • Branche : feature/PD-283-l0-streaming-hasher

T4 — TempFileManager (C8, CC-8)

  • Agent : agent-developer
  • Contract : CC-8
  • Fichiers : src/export/temp-file-manager.ts
  • Description : Registre fichiers temporaires, suppression immédiate, purge forcée, garde purge_ok, audit résiduel
  • Dépendances : aucune
  • Branche : feature/PD-283-l0-temp-file-manager

T5 — NotificationScheduler (C9, CC-9)

  • Agent : agent-developer
  • Contract : CC-9
  • Fichiers : src/export/notification-scheduler.ts
  • Description : Notification locale 24h via expo-notifications, fallback bandeau in-app si permission refusée
  • Dépendances : aucune
  • Branche : feature/PD-283-l0-notification-scheduler

Level 1 — Modules avec dépendances L0

T6 — ExportApiClient + Schemas (C2, CC-2)

  • Agent : agent-developer
  • Contract : CC-2
  • Fichiers : src/export/api-client.ts, src/export/schemas.ts
  • Description : POST /exports/complaint-file, validation Zod, gestion 403 FREE/422, validation regex exportId/HTTPS, refresh URLs
  • Dépendances : aucune directe (utilise service API existant)
  • Branche : feature/PD-283-l1-api-client

T7 — FileDownloader (C3, CC-3)

  • Agent : agent-developer
  • Contract : CC-3
  • Fichiers : src/export/file-downloader.ts
  • Description : Téléchargement séquentiel avec retry borné 3x (1s/2s/4s), détection expiration URL, streaming disque, check espace disque
  • Dépendances : T4 (TempFileManager pour registre fichiers)
  • Branche : feature/PD-283-l1-file-downloader

T8 — CryptoDecryptPipeline (C4, CC-4)

  • Agent : agent-developer
  • Contract : CC-4
  • Fichiers : src/export/crypto-pipeline.ts
  • Description : Dérivation K_doc via kmaster→K_share→K_doc, déchiffrement AES-256-GCM, zeroization immédiate
  • Dépendances : T4 (TempFileManager pour fichiers transitoires)
  • Branche : feature/PD-283-l1-crypto-pipeline

Level 2 — Assembleur ZIP

T9 — PvproofAssembler (C5, CC-5)

  • Agent : agent-developer
  • Contract : CC-5
  • Fichiers : src/export/pvproof-assembler.ts
  • Description : Construction conteneur .pvproof streaming, pvproof.json en 1ère entrée STORED, arborescence RFC PV-PACK-001, passthrough strict
  • Dépendances : T2 (FilenameSanitizer), T3 (StreamingHasher), T4 (TempFileManager)
  • Branche : feature/PD-283-l2-pvproof-assembler

Level 3 — Orchestration + UI

T10 — ExportOrchestrator (C10, CC-10)

  • Agent : agent-developer
  • Contract : CC-10
  • Fichiers : src/export/orchestrator.ts
  • Description : Coordination séquentielle C1-C9, émission progression, gestion annulation, refresh URL, contrôle taille, nommage exportId8
  • Dépendances : T1-T9 (tous les composants)
  • Branche : feature/PD-283-l3-orchestrator

T11 — ExportScreen + Composants UI (C11, CC-11)

  • Agent : agent-developer
  • Contract : CC-11
  • Fichiers : src/screens/ExportScreen.tsx, src/components/export/ExportProgress.tsx, src/components/export/ExportActions.tsx, src/components/export/RejectedProofsList.tsx
  • Description : Écran progression multi-étapes, écrans rejets/erreur/ready, bandeau in-app, bouton annulation, hash copiable
  • Dépendances : T1 (store), T10 (orchestrator)
  • Branche : feature/PD-283-l3-export-screen

Level 4 — Tests

T12 — Suite de tests (CC-12)

  • Agent : agent-qa-unit-integration
  • Contract : CC-12
  • Fichiers : src/export/__tests__/state-machine.test.ts, src/export/__tests__/filename-sanitizer.test.ts, src/export/__tests__/streaming-hasher.test.ts, src/export/__tests__/temp-file-manager.test.ts, src/export/__tests__/api-client.test.ts, src/export/__tests__/file-downloader.test.ts, src/export/__tests__/crypto-pipeline.test.ts, src/export/__tests__/pvproof-assembler.test.ts, src/export/__tests__/orchestrator.test.ts, src/export/__tests__/export-screen.test.tsx
  • Description : Tests unitaires + intégration couvrant 47 TC (nominaux, erreurs, invariants, négatifs, NR)
  • Dépendances : T1-T11 (toutes les tâches)
  • Branche : feature/PD-283-l4-tests

Parallelization

strategy: by_level
levels:
  - level: 0
    tasks: [1, 2, 3, 4, 5]
    agents: [agent-developer, agent-developer, agent-developer, agent-developer, agent-developer]
    branches:
      - "feature/PD-283-l0-state-machine"
      - "feature/PD-283-l0-filename-sanitizer"
      - "feature/PD-283-l0-streaming-hasher"
      - "feature/PD-283-l0-temp-file-manager"
      - "feature/PD-283-l0-notification-scheduler"
  - level: 1
    tasks: [6, 7, 8]
    agents: [agent-developer, agent-developer, agent-developer]
    branches:
      - "feature/PD-283-l1-api-client"
      - "feature/PD-283-l1-file-downloader"
      - "feature/PD-283-l1-crypto-pipeline"
  - level: 2
    tasks: [9]
    agents: [agent-developer]
    branches:
      - "feature/PD-283-l2-pvproof-assembler"
  - level: 3
    tasks: [10, 11]
    agents: [agent-developer, agent-developer]
    branches:
      - "feature/PD-283-l3-orchestrator"
      - "feature/PD-283-l3-export-screen"
  - level: 4
    tasks: [12]
    agents: [agent-qa-unit-integration]
    branches:
      - "feature/PD-283-l4-tests"
total_sequential_time: "12h"
total_parallel_time: "6h"
speedup_factor: 2.0
git_strategy: branch_per_level

Decision Trace

Décision Alternatives considérées Justification
by_level vs sequential sequential (plus simple) 5 modules L0 indépendants → parallélisation significative
1 branche par tâche 1 branche par niveau Tâches dans un même niveau touchent des fichiers distincts, merge propre
Tests en level 4 séparé Tests intégrés dans chaque tâche Agent QA dédié pour cohérence inter-composants et couverture TC contractuels
agent-developer pour tous sauf tests Agents mixtes (adversarial, sre) Composants sont du code pur TypeScript/React Native, pas d'infra ni review sécurité à ce stade