From 44421bb76c7a916c43f96aace4b9a485dbd1fb8d Mon Sep 17 00:00:00 2001 From: Archipelago Date: Sun, 15 Nov 2026 23:19:20 +0300 Subject: [PATCH] Portal: continue a failed run from the same start action --- STATUS.md | 3 ++- control/app.js | 11 ++++++++++- control/index.html | 1 + tests/control_portal.py | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/STATUS.md b/STATUS.md index cd2b08b..3325dda 100644 --- a/STATUS.md +++ b/STATUS.md @@ -49,7 +49,8 @@ mode and snapshot it already had, so nothing is pinned twice. Until now a resume as the transient `archipelago-cycle-resume.service`, which the portal's stop button and status view did not know about; now one ordinary service unit covers starts, resumes and stops. `resolve_request` in the driver is covered by -`tests/cycle-recovery.py`. +`tests/cycle-recovery.py`. The portal shows `↻ Продолжить ` only while the +latest run is failed and nothing is running, and sends exactly that request. The first resume then failed in `building-core`, 38 s in, on `cp: cannot stat '.../software-adapter/libgs_plugin_archipelago.so'`: the failed diff --git a/control/app.js b/control/app.js index 0cab202..b8b008c 100644 --- a/control/app.js +++ b/control/app.js @@ -37,7 +37,9 @@ async function control(action, parameters) { const result=await api('/api/control',{method:'POST',headers:{'Content-Type':'application/json','X-Archipelago-Control':'1'},body:JSON.stringify(Object.assign({action},parameters||{}))}); if(action==='start'){ const req=result.request||{}; - $('action-result').textContent=`Принято: ${req.mode==='ostree'?'только OSTree':'ISO + OSTree'} · снимок ${req.snapshot}`; + $('action-result').textContent=req.resume + ? `Принято: продолжение прогона ${status?.runs?.[0]?.run||''} · снимок и режим прежние` + : `Принято: ${req.mode==='ostree'?'только OSTree':'ISO + OSTree'} · снимок ${req.snapshot}`; run='';runsKey=''; } else { $('action-result').textContent=({stop:'Остановка передана systemd','schedule-on':'Расписание включено','schedule-off':'Расписание отключено'})[action]||'Принято'; @@ -46,6 +48,9 @@ async function control(action, parameters) { catch(e){showError(e);}finally{refresh();} } $('start').onclick=()=>control('start',{mode:$('build-mode').value,snapshot:$('build-snapshot').value});$('stop').onclick=()=>control('stop'); +// A failed run continues under the same service unit: it keeps its own mode and +// immutable snapshot, so the stop button and the status always describe it. +$('resume').onclick=()=>control('start',{resume:true}); $('toggle-schedule').onclick=()=>control(status?.timer.ActiveState==='active'?'schedule-off':'schedule-on'); function drawStatus(s) { status=s;const active=['active','activating'].includes(s.service.ActiveState);const stopping=s.service.ActiveState==='deactivating'; @@ -54,6 +59,10 @@ function drawStatus(s) { $('schedule').textContent=s.timer.ActiveState==='active'?'ISO+OSTree · 1-е число':'Приостановлено'; $('next').textContent='Следующий: '+(s.timer.ActiveState==='active' && s.next_release ? `${s.next_release.date} · ${s.next_release.mode} · ${s.next_release.time}` : '—'); $('start').disabled=active||stopping;$('stop').disabled=!active;$('toggle-schedule').disabled=false; + // Continue only a failed run; a complete one is a finished publication. + const latest=s.runs?.[0]; + $('resume').disabled=active||stopping||!latest||latest.state!=='failed'; + $('resume').textContent=latest&&latest.state==='failed'?`↻ Продолжить ${latest.run}`:'↻ Продолжить'; $('build-mode').disabled=active||stopping;$('build-snapshot').disabled=active||stopping; const snapshots=s.snapshots||[]; $('snapshot').textContent=snapshots.length?snapshots[0].date:'Нет снимков'; diff --git a/control/index.html b/control/index.html index 1afa306..f59dd1a 100644 --- a/control/index.html +++ b/control/index.html @@ -49,6 +49,7 @@ + diff --git a/tests/control_portal.py b/tests/control_portal.py index 7f7b675..6f891eb 100644 --- a/tests/control_portal.py +++ b/tests/control_portal.py @@ -198,6 +198,10 @@ class Portal(unittest.TestCase): self.assertIn('function progressOf(', script) self.assertIn("track.setAttribute('aria-valuenow'", script) self.assertIn("control('start',{mode:$('build-mode').value,snapshot:$('build-snapshot').value})", script) + # Resume is the same start action: one unit, one stop button, one status. + self.assertIn('id="resume"', html) + self.assertIn("$('resume').onclick=()=>control('start',{resume:true})", script) + self.assertIn("latest.state!=='failed'", script) def test_failed_action_is_durable(self): with tempfile.TemporaryDirectory() as directory: