Aller au contenu

PD-55 — Decomposition en taches agents

Metadonnees

Champ Valeur
Story ID PD-55
Titre Worker ancrage blockchain periodique
Branche feature/PD-55-worker-ancrage
Total taches 17
Agents agent-developer (10), agent-qa-unit-integration (6), agent-sre (1)
Niveaux de parallelisation 9
Speedup factor 1.67x

Matrice des dependances

ID Agent Description Produit Consomme Depend de Niveau
1 agent-developer Entite AnchorBatch anchor-batch.entity.ts - [] 0
2 agent-developer Entite AnchorBatchEvent anchor-batch-event.entity.ts AnchorBatch [1] 1
3 agent-developer Migration tables anchor xxx-anchor-batch.ts AnchorBatch, AnchorBatchEvent [1, 2] 2
4 agent-qa-unit-integration Tests unitaires entites entities/*.spec.ts AnchorBatch, AnchorBatchEvent [1, 2] 2
5 agent-developer Service ProofEventService proof-event.service.ts Migration [3] 3
6 agent-developer Service AnchorBatchService anchor-batch.service.ts Migration, ProofEventService [3, 5] 4
7 agent-developer DTOs (ProofArtifactDto) proof-artifact.dto.ts - [] 0
8 agent-qa-unit-integration Tests unitaires services services/*.spec.ts ProofEventService, AnchorBatchService [5, 6] 5
9 agent-developer Processor BlockchainAnchorProcessor blockchain-anchor.processor.ts ProofEventService, AnchorBatchService [5, 6] 5
10 agent-developer Config job repetable (10 min) anchor.module.ts, constants/ BlockchainAnchorProcessor [9] 6
11 agent-qa-unit-integration Tests unitaires processor processors/*.spec.ts BlockchainAnchorProcessor [9] 6
12 agent-qa-unit-integration Tests integration (workflow complet) anchor.e2e.spec.ts BlockchainAnchorProcessor, Config [9, 10] 7
13 agent-developer Integrer module anchor dans app app.module.ts Config [10] 7
14 agent-sre Alertes PagerDuty + detectWindowGaps anchor-alert.service.ts AnchorBatchService [6] 5
15 agent-qa-unit-integration Tests robustesse (timeout, reorg) anchor-robustness.spec.ts Tests integration [12] 8
16 agent-developer Endpoint export proof artifact anchor.controller.ts AnchorBatchService, DTOs [6, 7] 5
17 agent-qa-unit-integration Tests endpoint anchor.controller.spec.ts Endpoint [16] 6

Analyse de parallelisation

Calcul des niveaux (DAG)

Niveau 0 : [T1, T7]           <- 2 taches paralleles (entite + DTOs)
Niveau 1 : [T2]               <- 1 tache (entite relation)
Niveau 2 : [T3, T4]           <- 2 taches paralleles (migration + tests entites)
Niveau 3 : [T5]               <- 1 tache (service)
Niveau 4 : [T6]               <- 1 tache (service avec dependances)
Niveau 5 : [T8, T9, T14, T16] <- 4 taches paralleles (tests + processor + alerting + endpoint)
Niveau 6 : [T10, T11, T17]    <- 3 taches paralleles (config + tests processor + tests endpoint)
Niveau 7 : [T12, T13]         <- 2 taches paralleles (tests e2e + integration module)
Niveau 8 : [T15]              <- 1 tache (tests robustesse)

Bloc parallelization

parallelization:
  strategy: by_level
  levels:
    - level: 0
      tasks: [1, 7]
      agents: [agent-developer, agent-developer]
      branches:
        - "feature/PD-55-l0-entity-anchor-batch"
        - "feature/PD-55-l0-dto-proof-artifact"
      estimated_time: "0.5h"
    - level: 1
      tasks: [2]
      agents: [agent-developer]
      branches:
        - "feature/PD-55-l1-entity-relation"
      estimated_time: "0.5h"
    - level: 2
      tasks: [3, 4]
      agents: [agent-developer, agent-qa-unit-integration]
      branches:
        - "feature/PD-55-l2-migration"
        - "feature/PD-55-l2-tests-entities"
      estimated_time: "1h"
    - level: 3
      tasks: [5]
      agents: [agent-developer]
      branches:
        - "feature/PD-55-l3-proof-event-service"
      estimated_time: "1h"
    - level: 4
      tasks: [6]
      agents: [agent-developer]
      branches:
        - "feature/PD-55-l4-anchor-batch-service"
      estimated_time: "1.5h"
    - level: 5
      tasks: [8, 9, 14, 16]
      agents: [agent-qa-unit-integration, agent-developer, agent-sre, agent-developer]
      branches:
        - "feature/PD-55-l5-tests-services"
        - "feature/PD-55-l5-processor"
        - "feature/PD-55-l5-alerting"
        - "feature/PD-55-l5-endpoint"
      estimated_time: "2h"
    - level: 6
      tasks: [10, 11, 17]
      agents: [agent-developer, agent-qa-unit-integration, agent-qa-unit-integration]
      branches:
        - "feature/PD-55-l6-config-job"
        - "feature/PD-55-l6-tests-processor"
        - "feature/PD-55-l6-tests-endpoint"
      estimated_time: "1h"
    - level: 7
      tasks: [12, 13]
      agents: [agent-qa-unit-integration, agent-developer]
      branches:
        - "feature/PD-55-l7-tests-e2e"
        - "feature/PD-55-l7-module-integration"
      estimated_time: "1h"
    - level: 8
      tasks: [15]
      agents: [agent-qa-unit-integration]
      branches:
        - "feature/PD-55-l8-tests-robustness"
      estimated_time: "0.5h"
  total_sequential_time: "15h"
  total_parallel_time: "9h"
  speedup_factor: 1.67
  git_strategy: branch_per_level

Detail des taches

Tache 1 - Entite AnchorBatch

  • Agent : agent-developer
  • Niveau : 0
  • Depend de : []
  • Contract : CC-55-01
  • Fichiers : src/modules/anchor/entities/anchor-batch.entity.ts
  • Description : Creer l'entite TypeORM pour les lots d'ancrage avec les champs : batchId, merkleRoot, treeId, txId, chainId, blockNumber, status, windowStart, windowEnd, createdAt, submittedAt, finalizedAt, eventCount, errorReason. Implementer le trigger d'immutabilite pour status FINALIZED.

Tache 2 - Entite AnchorBatchEvent

  • Agent : agent-developer
  • Niveau : 1
  • Depend de : [1]
  • Contract : CC-55-02
  • Fichiers : src/modules/anchor/entities/anchor-batch-event.entity.ts
  • Description : Creer l'entite de relation lot - evenement avec cle primaire composite (batchId, eventId), eventType, eventHash, leafIndex, eventCreatedAt. Contrainte unique sur (eventId, batchStatus='FINALIZED').

Tache 3 - Migration tables anchor

  • Agent : agent-developer
  • Niveau : 2
  • Depend de : [1, 2]
  • Contract : CC-55-01, CC-55-02
  • Fichiers : src/database/migrations/xxx-create-anchor-batch.ts
  • Description : Creer la migration pour les tables anchor_batches et anchor_batch_events avec les contraintes, indexes et trigger d'immutabilite.

Tache 4 - Tests unitaires entites

  • Agent : agent-qa-unit-integration
  • Niveau : 2
  • Depend de : [1, 2]
  • Contract : CC-55-01, CC-55-02
  • Fichiers : src/modules/anchor/entities/*.spec.ts
  • Description : Tests unitaires pour les entites : validation des etats, contraintes d'immutabilite, relations.

Tache 5 - Service ProofEventService

  • Agent : agent-developer
  • Niveau : 3
  • Depend de : [3]
  • Contract : CC-55-04
  • Fichiers : src/modules/anchor/services/proof-event.service.ts
  • Description : Implementation de collectEligibleEvents (tri canonique), isEventAnchored, markEventsAnchored avec journalisation AuditService.

Tache 6 - Service AnchorBatchService

  • Agent : agent-developer
  • Niveau : 4
  • Depend de : [3, 5]
  • Contract : CC-55-03
  • Fichiers : src/modules/anchor/services/anchor-batch.service.ts
  • Description : Implementation de createBatch, finalizeBatch, failBatch (atomique), getBatchEvents, exportProofArtifact avec journalisation complete.

Tache 7 - DTOs (ProofArtifactDto)

  • Agent : agent-developer
  • Niveau : 0
  • Depend de : []
  • Contract : CC-55-06
  • Fichiers : src/modules/anchor/dto/proof-artifact.dto.ts
  • Description : DTO pour l'artefact de preuve exportable (version 1.0) avec validation class-validator.

Tache 8 - Tests unitaires services

  • Agent : agent-qa-unit-integration
  • Niveau : 5
  • Depend de : [5, 6]
  • Contract : CC-55-03, CC-55-04
  • Fichiers : src/modules/anchor/services/*.spec.ts
  • Description : Tests unitaires pour ProofEventService et AnchorBatchService couvrant T55-02, T55-05, T55-08, T55-09.

Tache 9 - Processor BlockchainAnchorProcessor

  • Agent : agent-developer
  • Niveau : 5
  • Depend de : [5, 6]
  • Contract : CC-55-05
  • Fichiers : src/modules/anchor/processors/blockchain-anchor.processor.ts
  • Description : Worker BullMQ avec orchestration complete collect - build - anchor - finalize, idempotence par windowStart, trace no-op.

Tache 10 - Config job repetable (10 min)

  • Agent : agent-developer
  • Niveau : 6
  • Depend de : [9]
  • Contract : CC-55-05
  • Fichiers : src/modules/anchor/anchor.module.ts, src/modules/anchor/constants/
  • Description : Configuration BullMQ pour job repetable toutes les 10 minutes (±2 min tolerance) avec les constantes de configuration.

Tache 11 - Tests unitaires processor

  • Agent : agent-qa-unit-integration
  • Niveau : 6
  • Depend de : [9]
  • Contract : CC-55-05
  • Fichiers : src/modules/anchor/processors/*.spec.ts
  • Description : Tests unitaires pour BlockchainAnchorProcessor couvrant T55-03, T55-04, T55-15, T55-17.

Tache 12 - Tests integration (workflow complet)

  • Agent : agent-qa-unit-integration
  • Niveau : 7
  • Depend de : [9, 10]
  • Contract : CC-55-05
  • Fichiers : src/modules/anchor/__tests__/anchor.e2e.spec.ts
  • Description : Tests e2e du workflow complet avec mocks Redis, DB in-memory, couvrant T55-01, T55-06, T55-07.

Tache 13 - Integrer module anchor dans app

  • Agent : agent-developer
  • Niveau : 7
  • Depend de : [10]
  • Contract : -
  • Fichiers : src/app.module.ts, src/modules/anchor/anchor.module.ts
  • Description : Integration du module anchor dans l'application principale avec imports necessaires.

Tache 14 - Alertes PagerDuty + detectWindowGaps

  • Agent : agent-sre
  • Niveau : 5
  • Depend de : [6]
  • Contract : CC-55-03 (ERR-55-05, ERR-55-08)
  • Fichiers : src/modules/anchor/services/anchor-alert.service.ts
  • Description : Service d'alertes avec detectWindowGaps() (INV-55-07), escalade WARNING/CRITICAL, blocage lot si gap non resolu.

Tache 15 - Tests robustesse (timeout, reorg)

  • Agent : agent-qa-unit-integration
  • Niveau : 8
  • Depend de : [12]
  • Contract : CC-55-05
  • Fichiers : src/modules/anchor/__tests__/anchor-robustness.spec.ts
  • Description : Tests de robustesse couvrant T55-13, T55-18, T55-19 : timeout, reorg blockchain, backlog.

Tache 16 - Endpoint export proof artifact

  • Agent : agent-developer
  • Niveau : 5
  • Depend de : [6, 7]
  • Contract : CC-55-06
  • Fichiers : src/modules/anchor/anchor.controller.ts
  • Description : Endpoint GET /anchor/batches/:id/proof pour export de l'artefact de preuve externe (section 8 spec).

Tache 17 - Tests endpoint

  • Agent : agent-qa-unit-integration
  • Niveau : 6
  • Depend de : [16]
  • Contract : CC-55-06
  • Fichiers : src/modules/anchor/anchor.controller.spec.ts
  • Description : Tests du controller couvrant T55-10.

Resume

Metrique Valeur
Total taches 17
Niveaux de parallelisation 9
Temps sequentiel estime 15h
Temps parallele estime 9h
Speedup factor 1.67x
Strategie Git branch_per_level
Branches paralleles max 4 (niveau 5)

Repartition par agent

Agent Taches Niveaux
agent-developer 10 0, 1, 2, 3, 4, 5, 6, 7
agent-qa-unit-integration 6 2, 5, 6, 7, 8
agent-sre 1 5

Graphe de dependances

[1] AnchorBatch ----------------------+
                                       |
[2] AnchorBatchEvent -----------------+---> [3] Migration --+--> [5] ProofEventService --+
                                       |                     |                            |
                                       +---------------------+--> [6] AnchorBatchService -+--> [9] Processor
                                                             |                            |         |
[7] DTOs --------------------------------------------------------+----------------------------+         |
                                                             |                                      |
[4] Tests entites <------------------------------------------+                                      |
                                                                                                     |
[8] Tests services <---------------------------------------------------------------------------------+
                                                                                                     |
[10] Config job <------------------------------------------------------------------------------------+
                                                                                                     |
[11] Tests processor <-------------------------------------------------------------------------------+
                                                                                                     |
[12] Tests e2e <-------------------------------------------------------------------------------------+
                                                                                                     |
[13] Integration module <----------------------------------------------------------------------------+
                                                                                                     |
[14] Alerting <--------------------------------------------------------------------------------------+
                                                                                                     |
[15] Tests robustesse <------------------------------------------------------------------------------+
                                                                                                     |
[16] Controller <------------------------------------------------------------------------------------+
                                                                                                     |
[17] Tests controller <------------------------------------------------------------------------------+

References

  • Plan : PD-55-plan.md (v2)
  • Code contracts : CC-55-01 a CC-55-06
  • Specification : PD-55-specification.md (v3)
  • Tests : PD-55-tests.md