---
suivi: 1245
date: 2026-08-07
sujet: Batch web multi-programmes migration chantier SharePoint
chantier: sharepoint / suivi-chantier
type: feature
statut: poussé
hash: 16b85db6
fichiers:
  - app/Services/SharePointChantierArboMigrationBatchService.php
  - app/Http/Controllers/Admin/SharePointChantierArboMigrationController.php
  - routes/web.php
  - docs/suivi/SUIVI_1245_migration_chantier_batch.md
---

# SUIVI #1245 — batch migration chantier

## PROMPT ENVOYÉ

Orchestrateur web multi-programmes sur le service #1243 : `programmes` / `all`,
sim par défaut, enchaînement jusqu’à `done`, borne temps 80 %, reprise, sortie
lisible. Ne pas dupliquer la logique de migration ni relâcher les garde-fous.

## FICHES LUES

- `#1243` — drain `_old_` / `3_CONCESSIONNAIRES`, collisions, plan_version 1243
- `#1241` — migration unitaire web, sim/`apply`
- `#1229` — `.user.ini` non lu en CLI ; mesurer temps en contexte web
- `#1191` — sim par défaut
- `#1108` — échecs dans la sortie, pas seulement Log::warning

## OBJET

Route `GET /admin/sharepoint/migration-chantier/batch` (déclarée **avant**
`{programme}` numérique).

Paramètres :
- `programmes=3,12` ou `programmes=all` (VEFA non encore `done` plan_version≥1243)
- `apply` absent = simulation
- `limit` = max programmes par appel
- `batch` = taille d’ops passée au service unitaire (défaut 15)
- `reset=1` = rebuild plan (attention : à éviter sur une reprise)

## Temps

Mesure `ini_get(max_execution_time)` + `max_input_time` + `PHP_SAPI` dans la
réponse. Budget = min des plafonds positifs, sinon fallback 300 s (`.user.ini`).
Arrêt soft à **80 %**. Interruption = message explicite + URL CONTINUE (pas un
succès). Relance = mêmes IDs restants, état fichier déjà avancé → pas de refaire.

## Ordre `all`

`3, 12, 5, 7, 8, 9, 10, 11, 4, 1, 6`, puis **2 (TRITONS) en dernier**.
Programme 6 inclus (ENEDIS / `3_CONCESSIONNAIRES` — logique #1243 inchangée).

## Sortie

1. ERREURS (tête)
2. COLLISIONS (tête)
3. tableau `programme | statut | ops | erreurs | collisions`
4. TOTAL
5. RESTANTS + URL CONTINUE

## Garde-fous

- Délègue à `SharePointChantierArboMigrationService` uniquement
- Erreur d’un programme → marqué, suivants poursuivis
- Idempotence : conforme → 0 op / skip si `all`
- HECTARE exclu (filtre métier VEFA)
- Pas d’artisan Graph, pas de migration DB, pas de Vue

## LEÇON

Un batch qui timeout en silence = pire qu’un 500 : toujours `interrupted=OUI` +
URL de reprise. Mesurer le budget en **web**, jamais en CLI (#1229).

