Show real progress for the selected run in the control portal
The bar follows the same phase plan as the stage grid: completed stages count only after the next one starts, uninstrumented runs are cut at the current or failed stage, running/failed runs stay below 100% and the track is exposed as a progressbar. Adopt the newer files that were already deployed on terra.
This commit is contained in:
parent
67e00f5bd9
commit
4661e1671c
6 changed files with 500 additions and 35 deletions
23
STATUS.md
23
STATUS.md
|
|
@ -13,6 +13,27 @@ caches reported `unchanged`. This run froze its source before D-113, so its
|
|||
image commits have no size metadata. Publication is not yet confirmed; do not
|
||||
treat the version change as delivered until the HTTPS/ref check below passes.
|
||||
|
||||
## Build control portal shows real progress (2026-11-14)
|
||||
|
||||
The private portal draws one progress bar for the selected run from the same
|
||||
phase plan as the stage grid. `phasePlan()` keeps hiding stages that a completed
|
||||
instrumented run never entered, and now also cuts an uninstrumented run's plan
|
||||
at the stage named by `state`/`failed_phase` instead of claiming that every
|
||||
stage ran. The bar counts a phase as completed only once a later phase starts;
|
||||
when there is no trace at all it takes the position of the current or failed
|
||||
stage. A running or failed run is capped at 99 %, only `complete` reports
|
||||
100 %, and the track exposes `aria-valuenow` for assistive technology.
|
||||
|
||||
The deployed portal at `/opt/archipelago/control-source/control/` was newer than
|
||||
this repository, so the live `app.js`, `index.html`, `style.css`, `server.py` and
|
||||
`README.md` were first copied back here and then extended. Verified with
|
||||
`node --check` and a stubbed DOM against the real `/api/status` and `/api/run`
|
||||
payloads of the in-flight `20261114T133314Z` run (9 of 17 stages, 53 %), a
|
||||
synthetic failed-at-Core run (7 of 8, 88 %) and a completed uninstrumented run
|
||||
(100 %, "no trace recorded"). `infrastructure/tests/control_portal.py` asserts
|
||||
the progress markup and the attribute update; `archipelago-control.service` was
|
||||
restarted and serves the new files.
|
||||
|
||||
## Image size and MIT licence in the software centers (D-113, 2026-11-14)
|
||||
|
||||
Every image path now records its size in the published commit. The builder
|
||||
|
|
@ -42,7 +63,7 @@ licence (`PLUGIN_DBUS_DIFF_DOWNLOAD_STAGE_ERROR_STATES_PASS`); the Discover
|
|||
adapter compiles against the `2026-11-12` snapshot with no missing libraries.
|
||||
Measured on the real Core commit `30717394…`: transfer 1 414 614 430 bytes,
|
||||
installed 2 092 868 303 bytes. Sources are pushed and deployed to the worker
|
||||
source tree: `builder 853a88d`, `system df3e312`, `rfc f678845`.
|
||||
source tree: `builder 853a88d`, `system bcc32b8`, `rfc f678845`.
|
||||
The size shown in the running software centers and the D-Bus values on an
|
||||
installed system remain user-verified only until the next cycle publishes.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,25 @@
|
|||
'use strict';
|
||||
const $ = id => document.getElementById(id);
|
||||
// Actual driver phases. The optional marker limits a phase to that build mode so
|
||||
// removed acceptance stages and disabled steps never appear in the UI.
|
||||
const phases = [
|
||||
['preflight','Подготовка'],['freezing-and-compiling-source','Исходники и тесты'],
|
||||
['updating-flatpak-cache','Flatpak / GNOME'],['updating-kde-flatpak-cache','Flatpak / KDE'],
|
||||
['building-software-adapter','GNOME Software'],['building-discover-adapter','Discover'],
|
||||
['building-core','Core / ISO'],['building-gnome-purpose-and-iso','GNOME / ISO'],['building-kde-purpose-and-iso','KDE / ISO'],
|
||||
['core-installed-acceptance','Приёмка Core'],['gnome-installed-acceptance','Приёмка GNOME'],['kde-installed-acceptance','Приёмка KDE'],
|
||||
['archiving-artifacts','Архив и целостность'],['preparing-publication','Подготовка публикации'],
|
||||
['signing-and-publishing','Подпись и публикация'],['verifying-public-endpoints','Проверка HTTPS'],['cleaning-worker','Очистка worker']
|
||||
['preflight','Подготовка окружения'],
|
||||
['selecting-repository','Выбор репозитория'],
|
||||
['freezing-and-compiling-source','Исходники, тесты, CLI'],
|
||||
['updating-flatpak-cache','Кэш Flatpak · GNOME','iso'],
|
||||
['updating-kde-flatpak-cache','Кэш Flatpak · KDE','iso'],
|
||||
['building-software-adapter','Адаптер GNOME Software'],
|
||||
['building-discover-adapter','Адаптер Discover'],
|
||||
['building-core','Core'],
|
||||
['building-gnome-purpose','GNOME'],
|
||||
['building-kde-purpose','KDE'],
|
||||
['building-container-runner','Container Runner'],
|
||||
['archiving-artifacts','Архив артефактов'],
|
||||
['preparing-publication','Проверка доказательств'],
|
||||
['signing-and-publishing','Подпись и публикация'],
|
||||
['verifying-public-endpoints','Проверка HTTPS'],
|
||||
['publishing-container-runner','Публикация Container Runner'],
|
||||
['cleaning-worker','Очистка worker']
|
||||
];
|
||||
let run = '', log = '', offset = 0, next = 0, size = 0, text = '', data = null, status = null, busy = false, logBusy = false;
|
||||
let logsKey = '', runsKey = '';
|
||||
|
|
@ -30,7 +42,7 @@ function drawStatus(s) {
|
|||
status=s;const active=['active','activating'].includes(s.service.ActiveState);const stopping=s.service.ActiveState==='deactivating';
|
||||
$('service').textContent=stopping?'Останавливается':active?'Выполняется':'Ожидает запуска';
|
||||
$('service-detail').textContent=`systemd: ${s.service.ActiveState} / ${s.service.SubState}`;
|
||||
$('schedule').textContent=s.timer.ActiveState==='active'?'OSTree: 3 дня · ISO: 30-го':'Приостановлено';
|
||||
$('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;
|
||||
$('toggle-schedule').textContent=s.timer.ActiveState==='active'?'Ⅱ Приостановить расписание':'↻ Включить расписание';
|
||||
|
|
@ -41,14 +53,52 @@ function drawStatus(s) {
|
|||
$('run-count').textContent=s.runs.length;
|
||||
$('sources').replaceChildren();for(const [name,sha] of Object.entries(s.sources)){const d=node('div','',name+' ');d.append(node('code','',sha.slice(0,12)));$('sources').append(d);}
|
||||
}
|
||||
function phasePlan(s, d, terminal) {
|
||||
const byMode = phases.filter(([id,, mode]) => !mode || s.output_mode === mode);
|
||||
if (d.instrumented && terminal) {
|
||||
// A finished instrumented run shows only the phases it actually executed.
|
||||
return byMode.filter(([id]) => d.events.some(e => e.phase === id));
|
||||
}
|
||||
if (d.instrumented) return byMode;
|
||||
// Without a phase trace the plan may not claim stages that never ran: cut it
|
||||
// after the stage the state names, or after the one that failed.
|
||||
const reached = byMode.findIndex(([id]) => id === (s.failed_phase || s.state));
|
||||
return reached < 0 ? byMode : byMode.slice(0, reached + 1);
|
||||
}
|
||||
function progressOf(s, d, plan) {
|
||||
const total = plan.length;
|
||||
if (!total) return {done: 0, total: 0, percent: 0};
|
||||
if (s.state === 'complete') return {done: total, total, percent: 100};
|
||||
let done = 0;
|
||||
if (d.instrumented) {
|
||||
// A phase counts once a later phase started; the current one is still running.
|
||||
done = plan.filter(([id]) => {
|
||||
const event = d.events.find(e => e.phase === id);
|
||||
return event && d.events.some(e => e.time > event.time);
|
||||
}).length;
|
||||
} else {
|
||||
done = Math.max(0, plan.findIndex(([id]) => id === (s.failed_phase || s.state)));
|
||||
}
|
||||
return {done, total, percent: Math.min(99, Math.round(done / total * 100))};
|
||||
}
|
||||
function drawRun(d) {
|
||||
data=d;const s=d.state;const terminal=['failed','complete'].includes(s.state);
|
||||
data=d;const s=d.state;const terminal=['failed','complete'].includes(s.state);const plan=phasePlan(s,d,terminal);
|
||||
$('run-name').textContent=s.run;$('run-state').textContent=label(s.state);
|
||||
$('run-meta').textContent=`${date(s.started)} · ${elapsed(s.started,terminal?(s.finished||s.updated):null)} · ${s.worker} · ${s.channel}`;
|
||||
$('run-state').className='badge'+(s.state==='failed'?' error':'');
|
||||
$('run-meta').textContent=`${date(s.started)} · ${elapsed(s.started,terminal?(s.finished||s.updated):null)} · ${s.worker} · ${s.channel} · ${s.output_mode||'—'}`;
|
||||
$('run-error').hidden=!s.error;$('run-error').textContent=s.error_details||s.error||'';
|
||||
const p=progressOf(s,d,plan);const track=$('run-progress-track');
|
||||
track.setAttribute('aria-valuenow',String(p.percent));
|
||||
track.className='progress-track'+(s.state==='failed'?' failed':s.state==='complete'?' complete':'');
|
||||
$('run-progress').style.width=p.percent+'%';
|
||||
$('run-progress-text').textContent=s.state==='complete'
|
||||
? (d.instrumented?`Готово · ${p.total} этапов · ${elapsed(s.started,s.finished||s.updated)}`:'Завершён · подробная трассировка не записывалась')
|
||||
: s.state==='failed'
|
||||
? `Остановлено после ${p.done} из ${p.total} этапов · ${p.percent}%`
|
||||
: `${p.done} из ${p.total} этапов · ${p.percent}% · идёт ${elapsed(s.started)}`;
|
||||
$('phase-summary').textContent=d.instrumented?'Фактические переходы и время':'Исторический прогон · подробная трассировка не записывалась';
|
||||
$('phases').replaceChildren();
|
||||
for(const [id,title] of phases){const event=d.events.find(e=>e.phase===id);const end=event?d.events[d.events.indexOf(event)+1]:null;let state='waiting';if(event)state=end?'succeeded':'active';if(s.state===id)state='active';if(s.failed_phase===id)state='failed';if(!d.instrumented&&s.state==='complete')state='succeeded';const p=node('div','phase '+state);p.append(node('strong','',({waiting:'○ ',active:'◉ ',succeeded:'✓ ',failed:'× '})[state]+title),node('small','',event?elapsed(event.time,end?.time):state==='waiting'?'Не выполнялся / нет данных':id));$('phases').append(p);}
|
||||
for(const [id,title] of plan){const event=d.events.find(e=>e.phase===id);const end=event?d.events[d.events.indexOf(event)+1]:null;let state='waiting';if(event)state=end?'succeeded':'active';if(s.state===id)state='active';if(s.failed_phase===id)state='failed';if(!d.instrumented&&s.state==='complete')state='succeeded';const p=node('div','phase '+state);p.append(node('strong','',({waiting:'○ ',active:'◉ ',succeeded:'✓ ',failed:'× '})[state]+title),node('small','',event?elapsed(event.time,end?.time):state==='waiting'?'Не выполнялся / нет данных':id));$('phases').append(p);}
|
||||
const opened = new Set([...$('actions').querySelectorAll('details[open]')].map(el=>el.dataset.id));
|
||||
$('action-count').textContent=`(${d.actions.length})`;$('actions').replaceChildren();
|
||||
for(const a of d.actions.filter(Boolean)){const el=node('details','action');el.append(node('summary','',`${a.id} · ${label(a.state)} · ${a.phase} · ${a.duration_seconds??'…'} с · exit ${a.returncode??'—'}`),node('pre','',a.command.join(' ')));if(a.error)el.append(node('p','',a.error));const link=node('a','', 'Открыть полный лог →');link.href='#log-content';link.onclick=()=>selectLog('monitor/'+a.log);el.append(link);$('actions').append(el);}
|
||||
|
|
|
|||
|
|
@ -2,35 +2,111 @@
|
|||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="theme-color" content="#080e12"><title>Archipelago // Build control</title>
|
||||
<link rel="icon" href="/mark.svg"><link rel="stylesheet" href="/style.css"><script src="/app.js" defer></script>
|
||||
<meta name="theme-color" content="#0E1414" media="(prefers-color-scheme: dark)">
|
||||
<meta name="theme-color" content="#F5FAFA" media="(prefers-color-scheme: light)">
|
||||
<title>Archipelago · Build control</title>
|
||||
<link rel="icon" href="/mark.svg">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script src="/app.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<header><a class="brand" href="/"><img src="/mark.svg" width="30" height="30" alt="">archipelago<span>_</span></a><div class="private">● PRIVATE / TERRA <span>LAN + TAILSCALE</span></div></header>
|
||||
<header>
|
||||
<a class="brand" href="/"><img src="/mark.svg" width="28" height="28" alt="">archipelago<span>_</span></a>
|
||||
<div class="private">● PRIVATE / TERRA <span>LAN + TAILSCALE</span></div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="heading"><div><p class="eyebrow">/ BUILD CONTROL ROOM</p><h1>Сборка под <span>контролем.</span></h1><p class="muted">От исходников до публикации. Каждый этап. Каждая строка.</p></div><div class="connection"><i id="connection-dot"></i><span id="connection">Подключение…</span><small id="updated">—</small></div></section>
|
||||
<div id="error" role="alert" hidden></div>
|
||||
<section class="overview">
|
||||
<article><span class="eyebrow">01 / PIPELINE</span><strong id="service">—</strong><small id="service-detail">Чтение systemd</small></article>
|
||||
<article><span class="eyebrow">02 / SCHEDULE</span><strong id="schedule">—</strong><small id="next">Каждые 3 дня; ISO 30-го · 00:00 UTC</small></article>
|
||||
<article><span class="eyebrow">03 / PUBLICATION</span><strong id="published">—</strong><small id="published-detail">Только по результату конвейера</small></article>
|
||||
<section class="heading">
|
||||
<div>
|
||||
<p class="eyebrow">Build control room</p>
|
||||
<h1>Сборка под <span>контролем</span></h1>
|
||||
<p class="muted">От исходников до публикации: этапы, действия и полные логи.</p>
|
||||
</div>
|
||||
<div class="connection"><span><i id="connection-dot"></i><span id="connection">Подключение…</span></span><small id="updated">—</small></div>
|
||||
</section>
|
||||
<section class="toolbar"><div class="controls"><button id="start" class="primary" disabled>▶ Запустить сборку</button><button id="stop" class="danger" disabled>■ Остановить</button><button id="toggle-schedule" disabled>Расписание</button></div><span id="action-result" role="status">Лимит каждого действия: 4 часа</span></section>
|
||||
|
||||
<div id="error" role="alert" hidden></div>
|
||||
|
||||
<section class="overview">
|
||||
<article><span class="eyebrow">Pipeline</span><strong id="service">—</strong><small id="service-detail">Чтение systemd</small></article>
|
||||
<article><span class="eyebrow">Schedule</span><strong id="schedule">—</strong><small id="next">—</small></article>
|
||||
<article><span class="eyebrow">Publication</span><strong id="published">—</strong><small id="published-detail">Только по результату конвейера</small></article>
|
||||
</section>
|
||||
|
||||
<section class="toolbar">
|
||||
<div class="controls">
|
||||
<button id="start" class="primary" disabled>▶ Запустить сборку</button>
|
||||
<button id="stop" class="danger" disabled>■ Остановить</button>
|
||||
<button id="toggle-schedule" class="tonal" disabled>Расписание</button>
|
||||
</div>
|
||||
<span id="action-result" role="status">Лимит каждого действия: 4 часа</span>
|
||||
</section>
|
||||
|
||||
<div class="workspace">
|
||||
<aside><div class="section-title"><h2>Прогоны</h2><span id="run-count">0</span></div><div id="runs" class="runs"></div><details class="sources"><summary>Закреплённые исходники</summary><div id="sources"></div></details></aside>
|
||||
<section class="run-panel"><div class="run-heading"><div><p class="eyebrow">/ SELECTED RUN</p><h2 id="run-name">Выберите прогон</h2></div><span id="run-state" class="badge">—</span></div><div id="run-meta" class="muted"></div><p id="run-error" hidden></p>
|
||||
<div class="section-title"><h3>Этапы конвейера</h3><small id="phase-summary">—</small></div><div id="phases" class="phases"></div>
|
||||
<details id="action-details"><summary>Все действия, команды и коды завершения <span id="action-count"></span></summary><div id="actions"></div></details>
|
||||
<aside>
|
||||
<div class="section-title"><h2>Прогоны</h2><span id="run-count">0</span></div>
|
||||
<div id="runs" class="runs"></div>
|
||||
<details class="sources"><summary>Закреплённые исходники</summary><div id="sources"></div></details>
|
||||
</aside>
|
||||
|
||||
<section class="run-panel">
|
||||
<div class="run-heading">
|
||||
<div><p class="eyebrow">Selected run</p><h2 id="run-name">Выберите прогон</h2></div>
|
||||
<span id="run-state" class="badge">—</span>
|
||||
</div>
|
||||
<div id="run-meta" class="muted"></div>
|
||||
<p id="run-error" hidden></p>
|
||||
|
||||
<div class="progress">
|
||||
<div id="run-progress-track" class="progress-track" role="progressbar" aria-label="Прогресс прогона" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
|
||||
<div id="run-progress"></div>
|
||||
</div>
|
||||
<p id="run-progress-text">—</p>
|
||||
</div>
|
||||
|
||||
<div class="section-title"><h3>Этапы конвейера</h3><small id="phase-summary">—</small></div>
|
||||
<div id="phases" class="phases"></div>
|
||||
|
||||
<details id="action-details">
|
||||
<summary>Все действия, команды и коды завершения <span id="action-count"></span></summary>
|
||||
<div id="actions"></div>
|
||||
</details>
|
||||
</section>
|
||||
</div>
|
||||
<section class="logs-panel"><div class="section-title"><div><p class="eyebrow">/ COMPLETE LOG EXPLORER</p><h2>Ничего за кадром.</h2></div><span id="log-count" class="muted">—</span></div>
|
||||
<div class="log-layout"><div class="log-sidebar"><label for="log-filter">Найти файл лога</label><input id="log-filter" type="search" placeholder="build, guest, serial, action…"><div id="log-files"></div></div>
|
||||
<div class="terminal"><div class="terminal-bar"><span id="log-name">Выберите лог</span><a id="download" hidden>↓ Полный файл</a></div>
|
||||
<div class="log-controls"><button id="log-first">В начало</button><button id="log-prev">← Раньше</button><button id="log-next">Дальше →</button><button id="log-tail">В конец</button><label><input id="follow" type="checkbox" checked> Следить</label><span id="log-range">—</span></div>
|
||||
<label class="search-label" for="log-search">Поиск в открытом фрагменте <input id="log-search" type="search" placeholder="ошибка, warning, пакет…"><span id="matches"></span></label>
|
||||
|
||||
<section class="logs-panel">
|
||||
<div class="section-title">
|
||||
<div><p class="eyebrow">Log explorer</p><h2>Ничего за кадром</h2></div>
|
||||
<span id="log-count" class="muted">—</span>
|
||||
</div>
|
||||
<div class="log-layout">
|
||||
<div class="log-sidebar">
|
||||
<label for="log-filter">Найти файл лога</label>
|
||||
<input id="log-filter" type="search" placeholder="build, guest, serial, action…">
|
||||
<div id="log-files"></div>
|
||||
</div>
|
||||
<div class="terminal">
|
||||
<div class="terminal-bar"><span id="log-name">Выберите лог</span><a id="download" hidden>↓ Полный файл</a></div>
|
||||
<div class="log-controls">
|
||||
<button id="log-first">В начало</button>
|
||||
<button id="log-prev">← Раньше</button>
|
||||
<button id="log-next">Дальше →</button>
|
||||
<button id="log-tail">В конец</button>
|
||||
<label><input id="follow" type="checkbox" checked> Следить</label>
|
||||
<span id="log-range">—</span>
|
||||
</div>
|
||||
<label class="search-label" for="log-search">Поиск в открытом фрагменте
|
||||
<input id="log-search" type="search" placeholder="ошибка, warning, пакет…"><span id="matches"></span>
|
||||
</label>
|
||||
<pre id="log-content" tabindex="0">Логи доступны целиком: навигация от первого байта до последнего и скачивание без ограничения размера.</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main><footer><span>ARCHIPELAGO / PRIVATE OPERATIONS</span><span>Обновление каждые 3 секунды · время в вашем часовом поясе</span></footer>
|
||||
</body></html>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<span>ARCHIPELAGO / PRIVATE OPERATIONS</span>
|
||||
<span>Обновление каждые 3 секунды · время в вашем часовом поясе</span>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,10 @@ class App:
|
|||
def runs(self):
|
||||
names = {p.name for root in (self.archive, self.history) if root.exists()
|
||||
for p in root.iterdir() if RUN.fullmatch(p.name)}
|
||||
return [s for name in sorted(names, reverse=True) if (s := self.state(name))]
|
||||
states = [s for name in names if (s := self.state(name))]
|
||||
# Show the run that changed most recently first: a resumed run keeps an
|
||||
# older identity but is the one actually progressing.
|
||||
return sorted(states, key=lambda s: (s.get("updated") or s.get("started") or "", s.get("run") or ""), reverse=True)
|
||||
|
||||
def logs(self, run):
|
||||
if not self.state(run):
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -69,6 +69,16 @@ class Portal(unittest.TestCase):
|
|||
server.shutdown()
|
||||
server.server_close()
|
||||
|
||||
def test_progress_markup_and_percentage_rules(self):
|
||||
root = Path(__file__).parents[1] / 'control'
|
||||
html = (root / 'index.html').read_text()
|
||||
script = (root / 'app.js').read_text()
|
||||
self.assertIn('id="run-progress-track"', html)
|
||||
self.assertIn('role="progressbar"', html)
|
||||
self.assertIn('aria-valuenow', html)
|
||||
self.assertIn('function progressOf(', script)
|
||||
self.assertIn("track.setAttribute('aria-valuenow'", script)
|
||||
|
||||
def test_failed_action_is_durable(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
observer = control.monitor.Monitor(Path(directory), '20261109T000000Z')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue