Resume rebuilds missing adapter outputs before composing a Desktop image

This commit is contained in:
Archipelago 2026-11-15 23:13:46 +03:00
parent 995f94b999
commit aa37396f66
3 changed files with 39 additions and 1 deletions

View file

@ -51,6 +51,15 @@ 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`.
The first resume then failed in `building-core`, 38 s in, on
`cp: cannot stat '.../software-adapter/libgs_plugin_archipelago.so'`: the failed
attempt's workspace is removed after its evidence is archived, while the adapter
stages were skipped on resume because they are expensive and cached. The driver now
probes the plugin (and, for KDE, the Plasma setup package) and rebuilds the adapters
when the workspace no longer has them — a cache copy while the inputs are unchanged —
instead of composing a Desktop image that links a file nobody produced.
`tests/cycle-recovery.py` pins the probe shape.
## A stop takes effect immediately, not after two minutes (2026-11-15)
`archipelago-release-cycle.service` was `Type=oneshot`. systemd does not deliver

View file

@ -52,6 +52,21 @@ def resolve_request(candidate, age, resume):
return None
def adapter_probe(remote_root, desktops):
"""Shell test for the Desktop plugin inputs a resumed run must still have.
The adapter outputs live in the worker workspace, which a failed run removes
after archiving its evidence. They are deterministic and cached, so a resume
rebuilds them as a cache copy instead of composing a Desktop image that links
a plugin file nobody produced.
"""
probe = 'test -f ' + shlex.quote(remote_root + '/software-adapter/libgs_plugin_archipelago.so')
if 'kde' in desktops:
probe += (' && test -n "$(find ' + shlex.quote(remote_root + '/discover-adapter')
+ ' -name "plasma-setup-*.pkg.tar.zst" -print -quit 2>/dev/null)"')
return probe
def verify_snapshot(snapshot_url):
"""Refuse to build from a snapshot the public web server does not serve.
@ -370,7 +385,13 @@ find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote
' > ' + shlex.quote(remote_root + '/flatpak-kde.log') + ' 2>&1', 14400)
call(['rsync', '-a', f'{worker}:{kde_cache}/status.json', str(run / 'flatpak-kde-status.json')])
state['flatpak_kde'] = json.loads((run / 'flatpak-kde-status.json').read_text())
if not resume:
def adapters_ready():
if not resume:
return False
return subprocess.run(['ssh', '-o', 'BatchMode=yes', '-o', 'ConnectTimeout=20', worker,
adapter_probe(remote_root, desktops)],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0
if not adapters_ready():
phase('building-software-adapter')
if config.get('flatpak_cache'):
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/prepare-flatpak-tools.sh',

View file

@ -95,4 +95,12 @@ assert cycle.resolve_request({'mode': 'iso', 'snapshot': 'latest'}, 10, False) i
resume = {'resume': True, 'requested_at': 'stamp'}
assert cycle.resolve_request(resume, 10, False) is resume
assert cycle.resolve_request(resume, 901, False) is None
# A resume must not compose a Desktop image that links a plugin the workspace no
# longer has: the probe names the plugin and, for KDE, the Plasma setup package.
probe = cycle.adapter_probe('/work/20260101T000000Z', ['gnome'])
assert 'software-adapter/libgs_plugin_archipelago.so' in probe
assert 'discover-adapter' not in probe
kde_probe = cycle.adapter_probe('/work/20260101T000000Z', ['gnome', 'kde'])
assert 'discover-adapter' in kde_probe and 'plasma-setup-' in kde_probe
print('CYCLE_RECOVERY_ORDER_AND_OWNERSHIP_PASS')