feat(update): swap atomique + rollback (Lea.bat) + confirmation boot (main.py)
Implémente le SWAP réel de la MAJ silencieuse (DETTE-022), remplace les stubs : - updater.apply_update : ARME le swap (extrait le ZIP -> agent_v1_new/ + marqueur UPDATE_READY, garde-fou zip-slip). N'écrase JAMAIS le vivant. - updater.write_boot_ok_marker : désarme le rollback (retire PENDING_BOOT). - Lea.bat (template + embed généré par configure_embed.ps1) : swap ATOMIQUE par renames (agent_v1 -> agent_v1_prev backup ; agent_v1_new -> agent_v1) + rollback auto si PENDING_BOOT persiste (boot précédent non confirmé). - main.py : confirme le boot après 90 s de liveness locale OU quit propre (évite un faux rollback ; RPA_BOOT_CONFIRM_DELAY_S surchargeable pour les tests). Testable (Python) : 45 tests verts. Le swap OS (renames Lea.bat) + le câblage main.py seront validés par le test Win 11 (step 0 pré-canary, dont le rollback). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,29 @@ if exist "lea_agent.lock" (
|
||||
timeout /t 2 >nul
|
||||
)
|
||||
|
||||
:: MAJ SILENCIEUSE — swap atomique + rollback (renames uniquement)
|
||||
if exist "PENDING_BOOT" (
|
||||
echo [MAJ] Boot precedent non confirme : retour a la version precedente.
|
||||
if exist "agent_v1_prev" (
|
||||
if exist "agent_v1_echec" rmdir /s /q "agent_v1_echec" >nul 2>&1
|
||||
if exist "agent_v1" move "agent_v1" "agent_v1_echec" >nul 2>&1
|
||||
move "agent_v1_prev" "agent_v1" >nul 2>&1
|
||||
)
|
||||
del /f /q "PENDING_BOOT" >nul 2>&1
|
||||
) else if exist "UPDATE_READY" (
|
||||
if exist "agent_v1_new" (
|
||||
echo [MAJ] Application de la mise a jour...
|
||||
if exist "agent_v1" (
|
||||
if exist "agent_v1_prev" rmdir /s /q "agent_v1_prev" >nul 2>&1
|
||||
move "agent_v1" "agent_v1_prev" >nul 2>&1
|
||||
)
|
||||
move "agent_v1_new" "agent_v1" >nul 2>&1
|
||||
move "UPDATE_READY" "PENDING_BOOT" >nul 2>&1
|
||||
) else (
|
||||
del /f /q "UPDATE_READY" >nul 2>&1
|
||||
)
|
||||
)
|
||||
|
||||
if exist "config.txt" (
|
||||
for /f "usebackq eol=# tokens=1,* delims==" %%a in ("config.txt") do (
|
||||
if not "%%a"=="" if not "%%b"=="" set "%%a=%%b"
|
||||
|
||||
@@ -20,6 +20,35 @@ if exist "lea_agent.lock" (
|
||||
timeout /t 2 >nul
|
||||
)
|
||||
|
||||
:: ---------------------------------------------------------------
|
||||
:: MAJ SILENCIEUSE — swap atomique + rollback (hors-process)
|
||||
:: L'ancienne instance est fermee ci-dessus : agent_v1\ est libre.
|
||||
:: Renames uniquement (quasi-atomiques), jamais d'ecrasement fichier par fichier.
|
||||
:: ---------------------------------------------------------------
|
||||
if exist "PENDING_BOOT" (
|
||||
:: Le boot precedent n'a JAMAIS confirme (crash) -> ROLLBACK version precedente
|
||||
echo [MAJ] Boot precedent non confirme : retour a la version precedente.
|
||||
if exist "agent_v1_prev" (
|
||||
if exist "agent_v1_echec" rmdir /s /q "agent_v1_echec" >nul 2>&1
|
||||
if exist "agent_v1" move "agent_v1" "agent_v1_echec" >nul 2>&1
|
||||
move "agent_v1_prev" "agent_v1" >nul 2>&1
|
||||
)
|
||||
del /f /q "PENDING_BOOT" >nul 2>&1
|
||||
) else if exist "UPDATE_READY" (
|
||||
:: Une MAJ est armee (agent_v1_new pret) -> SWAP
|
||||
if exist "agent_v1_new" (
|
||||
echo [MAJ] Application de la mise a jour...
|
||||
if exist "agent_v1" (
|
||||
if exist "agent_v1_prev" rmdir /s /q "agent_v1_prev" >nul 2>&1
|
||||
move "agent_v1" "agent_v1_prev" >nul 2>&1
|
||||
)
|
||||
move "agent_v1_new" "agent_v1" >nul 2>&1
|
||||
move "UPDATE_READY" "PENDING_BOOT" >nul 2>&1
|
||||
) else (
|
||||
del /f /q "UPDATE_READY" >nul 2>&1
|
||||
)
|
||||
)
|
||||
|
||||
:: ---------------------------------------------------------------
|
||||
:: Verifier que l'installation a ete faite
|
||||
:: ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user