Code, testing and CI
Syncthing API surface used
Section titled “Syncthing API surface used”All calls send X-API-Key. Base URL from config (hub) or the local
config.xml <gui><address> (device; HTTPS if tls="true", self-signed allowed
only for loopback addresses).
GET /rest/system/status→myIDGET /rest/config/devices,POST /rest/config/devicesGET /rest/config/folders,POST /rest/config/folders,PATCH /rest/config/folders/{id}GET /rest/db/ignores?folder=,POST /rest/db/ignores?folder=({"ignore": [...]})GET /rest/db/status?folder=,GET /rest/db/file?folder=&file=,GET /rest/db/browse?folder=&levels=0POST /rest/db/scan?folder=GET /rest/system/connections,GET /rest/db/completion?folder=&device=(the library UI’s progress, read on the hub; see Progress)
POST /rest/db/scan answers only when the scan is done, and a folder that is pulling runs a
scan only after the pull, which on a slow device can take longer than the client’s timeout
(30 s). A full scan that gets no answer in time is not an error: Syncthing keeps it queued and
runs it when the pull ends, so provision reports “rescan queued” and goes on, and prune
stops without deleting anything (its index would not be refreshed yet). A scan of a single
path (&sub=), whose result the caller reads right after, still fails on a timeout.
Only prune also reads GET /rest/db/ignores’s error field and
GET /rest/db/status’s state/stateChanged (see Pruning).
settings capture reads GET /rest/db/status’s state and needTotalItems and compares
the local and global records of GET /rest/db/file (see Capture).
settings apply and audit never call Syncthing.
Target: Syncthing v2.x (tested in CI against a pinned release, v2.1.7 at the
time of writing). Verified behaviour that the design relies on: POST /rest/db/ignores works on a paused folder and writes its .stignore; a missing
#include target makes the call return 200 with an error field instead of
failing; GET /rest/db/file answers 404 with a plain-text body for objects not
in the index; Syncthing creates a folder’s root directory on its own.
Code layout
Section titled “Code layout”warpzone/ __init__.py version __main__.py python3 -m warpzone cli.py argparse, exit codes, output errors.py `WarpzoneError` (every error carries its `exit_code`) and the `EXIT_*` codes paths.py `expand_home`: `~` against a given home (pure) report.py `Reporter`: the per-folder notes, warnings and deferred flag a command hands back runners.py the subprocess edge: flatpak, systemctl, the import check, the cut-off script check, `run_tool` (a tool killed with its children: inbox tools, Vita3K, the doctor's tool probes) config.py private config loading + validation (tomllib), dataclasses profiles.py profile loading + validation model.py folder specs: expands config + profiles into the desired state ignores.py ignore rendering (common, per-device, bootstrap) syncthing.py minimal REST client (urllib), redaction, dry-run recorder probes.py `DeviceProbes`: the process table, subprocess checks, commands and clock a device command reads, in one object a test can fake provision.py the name the commands import: re-exports what `cli` and `health` call provision_folders.py Syncthing folder steps both provisioning commands share (diff, patch, ignores, wait) provision_hub.py `provision hub` (and `--additive`) and `check`: devices, folders, the whitelist bootstrap provision_device.py `provision device`: the subscribed folders, then the steps below, in order provision_emulators.py device edits for ES-DE's system list, RetroArch, shadPS4, Cemu, the Switch emulators' update and DLC folders and title links provision_artwork.py frontend artwork on a device: the scope of the artwork folders, the gamelists provision_scripts.py the ES-DE startup scripts, turning ES-DE's event scripts on, the Options menu entries provision_timers.py the artwork, play state, unattended prune and ES-DE settings systemd user timers provision_updater.py the autonomous update: settings file, live updater script, its timer prune.py leftover detection (pure `classify`, with the files the hub deleted on purpose from the record), the unattended guard (pure `guard`) and the state file of its refusal, delete prune_leftovers.py emulator data of games the hub deleted on purpose: which items (pure `gone`, `ids_for`, `plan`), the emulator's index, listing, measuring and removing them notify.py the webhook POST `prune` and `inbox` share: JSON body, the URL never echoed, `NotifyError` bios.py BIOS manifest, local overrides, pure `judge_*`, disk checks whitelist.py managed whitelists: escape, parse, render, normalize, changes, matcher, effect, migration parsing and classification, unsupported systems (pure) whitelist_history.py the backups of a whitelist: names, comparison, diff, what a restore refuses (pure) whitelist_store.py whitelist files on the hub: read with a stamp, backups, guarded write, hub scan, `whitelist migrate` and its proof walk, `whitelist restore` dat.py Redump / No-Intro DAT parsing, cache, matching, disc grouping (pure) inbox_core.py what the inbox pipeline and its handlers share: errors, options, results, staging inbox_lock.py the `inbox/.warpzone.lock` file that keeps two `--apply` runs apart inbox_unattended.py the pure decisions of the unattended inbox: fingerprint, readiness, the state file and its changes, space, news and exit code; the run record, the records to purge and the webhook payload inbox_unattended_io.py the disk side of it: the walk of an item, the state file (read-modify-write), the work folder, the free space, and the run records under `catalog/inbox/runs/`; the record writer, the purge and the state's read-modify-write take the folder or a `StateFile`, so the nightly scrape reuses them inbox_unattended_run.py `inbox --apply --unattended`: one tick of the scheduled run, step by step (above `inbox.py`; only `cli.py` calls it) inbox_scrape.py the scrape at the end of `inbox`: which placed games, the report lines, failures as warnings inbox.py unpack, identify, convert, place, file the originals sfo.py the key/value table of a PARAM.SFO (pure; PS3 discs and PS4 packages) inbox_switch.py Switch games: identify with nsz, titledb names, decompress, place inbox_mame.py arcade sets: MAME / FBNeo / 2003-Plus fit, emulator choice, gamelist backup and write inbox_console_iso.py PS3, Xbox, Xbox 360 and Wii U images: identify by signature, place inbox_ps4.py PS4 packages: extract with orbis-pkg-util, place a game, update or DLC inbox_vita.py PS Vita game dumps: identify by param.sfo, place the folder and the .psvita file inbox_vita_pkg.py PS Vita .pkg: header and zRIF checks, install with Vita3K in a work folder, judge the result shadps4.py shadPS4's install directories and launch script edits (pure) cemu.py Cemu's MLC path and game paths in its settings.xml (pure) switchcontent.py Eden's and Ryujinx's lists of update and DLC folders (qt-config.ini, Config.json; pure) titlelinks.py symlinks from the library's game folders into an emulator's own (pure plan) inbox_n3ds.py 3DS images (`.3ds`, `.cci`, `.zcci`): NCSD / NCCH or Z3DS header check, placed as `.cci` or `.zcci` inbox_dolphin.py Wii and GameCube `.rvz` / `.wia`: header check (disc type, magic, game ID), placed in `wii/` or `gc/` inbox_chd.py a dropped `.chd` of a CHD system: `chdman info`, extraction to the work folder, unmatched reasons flatpak.py the SyncThingy flatpak: app id and the unit's commands selfupdate.py the updater's side in Python: paths, settings file, live copy rule, `self-update` wrapper versions.py order of package versions and release tags (`version_key`, `tag_key`; pure) updatetimer.py the systemd user units that start `updater.sh tick` (pure; quotes with `timers.exec_word`) timers.py the systemd user units of the artwork, play state, prune and settings timers, their names and the `ExecStart=` quoting (pure) settings.py `settings apply`, `capture`, `audit`: loading, prompts, output settings_formats.py format handlers ini, qt-ini, retroarch-cfg, yaml-flat (pure) settings_tree.py format handlers json, toml (pure) settings_xml.py format handler esde-xml: ES-DE's es_settings.xml (pure) settings_layers.py layer files: parse, validate, merge, render (pure) and atomic write settings_plan.py apply plan, capture candidates and pre-selection, audit rows (pure) settings_state.py device state: snapshots, backups, log, lock safefile.py safe writes: atomic write, stamps, `guarded_edit`, JSON cache; reads that follow no link procs.py process detection from `/proc` (`running`) esde.py ES-DE startup script, `es_settings.xml` check and edit (pure) options_menu.py the bash scripts of the ArkOS Options menu entries (pure) frontend.py frontend system list rewrite, RetroArch key gap (pure) gamelist.py ES-DE gamelist text edits: the per-game emulator and the helpers `playstate` shares (pure) artwork.py frontend artwork: ES-DE gamelist -> the frontend's gamelist, scope ignores, system names (pure; the reads are passed in) scrape.py scraping with Skyscraper: platform table, which games to scrape, command lines, what its output says, the merge plan, the not-found and incomplete memories, the account presence check, the report (pure) scrape_io.py `warpzone scrape`: stages the games, runs Skyscraper through `run_tool`, reads its output, writes media and gamelist entries to the hub (never over a file) scrape_unattended.py the nightly scrape's pure side: the plan (four tiers, the cap, what the memories skip), the outcome and trouble of a night, the state file and its changes, news and exit code, the run record and the webhook payload scrape_unattended_run.py `scrape --unattended`: one night of the scheduled scrape, step by step (above `scrape_io.py`; only `cli.py` calls it) playstate.py play state: ledgers, merge rules, times, its tags in a gamelist (pure) playstate_device.py play state on a device: files, ES-DE gamelists, generated gamelists diskstatus.py the disk a console reports to the hub: when to write, format, staleness (pure) diskstatus_io.py the disk report: written on a console beside the ledgers, read on the hub saveconvert.py save conversion: the `.dsv` footer, size rules, the three-way decision (pure) saveconvert_device.py save conversion on a device: files, state, backups, the running emulator tomlw.py TOML scalar and key writer (tomllib only reads) doctor.py the name the commands import: `CHECKS` (the list, in report order), `run_checks`, the renderer, exit code; re-exports the checks doctor_core.py what every check shares: statuses, groups, `Result`, `ConfigState`, `Context`, device lookup in the local Syncthing config doctor_probes.py `Probes`: what a check reads from the machine (tools, files, clock, HTTP), the platform family doctor_hints.py install hints per platform family and `hint_for` doctor_config.py Python and warpzone, the config file and `load_config_state`, the hub API line doctor_syncthing.py the local Syncthing: REST API, Game Mode, unit, flatpak access, leftover folders doctor_saves.py save-sync settings in an emulator's own files: Flycast VMUs, Vita3K user doctor_settings.py emulator settings layers, ES-DE scripts, last `settings apply`, play state doctor_frontend.py frontend: system list, RetroArch, shadPS4, Cemu, Switch update and DLC folders, title links, artwork, save conversion doctor_updates.py update timer, updater, the prune guard's refusal doctor_tools.py the external tools `inbox` runs: `ToolSpec`, `TOOLS`, `check_tool` doctor_scrape.py Skyscraper and the ScreenScraper account (the presence check of `userCreds`) doctor_inbox.py checks for the machine that runs `inbox`: DATs, Switch, hub folder, where inbox runs, RA key, the unattended inbox line health.py `warpzone health`: the dry runs and file checks that say a version works (decisions pure) ra.py RetroAchievements: RAHasher wrapper, game list lookup and parsing (ids, points) catalog.py catalog index: derivation of games and parts, system roots, title keys, search, RA badge state, JSON encoding and merge (pure) catalog_store.py `warpzone catalog`: the walk, hashing, RAHasher and RA list runs, guarded writes ra_data.py RA achievements, the user's progress and their JSON cache files; the merge and totals (pure) ra_store.py `catalog --ra-achievements`: achievements, progress and badge downloads, cache reads library_api.py the library UI's API as pure functions: validation, `plan_changes`, responses queue.py the play queue as pure decisions: schema, inferred states, views, release rule, `plan` for `POST /api/v1/queue`, the answers (see play-queue.md) queue_store.py the queue file on the hub: read with a stamp, backups, guarded write recommend.py the home page's recommendation shelves: unfinished games, games like a recent one (pure) progress.py per-device progress states from the hub's completion (pure) saves_index.py saves per game for the library API: exact matching of the hub's `saves/` to games (pure), the listing and its short cache trophies.py native trophies for the library API: RPCS3's TROPCONF.SFM and TROPUSR.DAT, shadPS4's trophy XML and npbind.dat, Vita3K's TROP.SFM and TROPUSR.DAT, the game link and the answers (pure) trophies_store.py the trophy folders below the hub's `saves/` read on request with their cache, the icons, the NPCommIDs of each PS3 disc, PS4 game and PS Vita app serve.py `warpzone serve`: http.server, sessions, the write lock, caches, background runs trash.py deleting a game from the library UI as pure decisions: the plan and its refusals, the manifest and cleanups encodings, what a restore moves, which cleanup is ready (see library-ui.md) trash_record.py the record of deleted games the hub delivers to the consoles: its JSON format, validation, what a write compacts and the index of what is recorded (pure; see library-ui.md) trash_store.py the disk side of it: what a plan reads, the moves into `trash/` and back with their rollback, the manifest, cleanups and record files, the gamelist edits, the listing and the purge trash_run.py the server's side of it: the dry run, the deletion, the restore, Delete now and the background task (record, whitelist cleanups, purge), under the hub lock and the write lock access_jwt.py Cloudflare Access tokens: strict JWT parsing, RS256 check with the standard library, claims (pure) access_keys.py Access's signing keys: the fetch, the cache and the gate `serve` asks about a token localst.py find and parse the local Syncthing config.xml data/ui/index.html the library UI page (static, no build step) data/ui/kit.js its DOM builder, pixel icons, system names, codes and colours, title parsing data/ui/api.js its API client: requests, error messages, title key port data/ui/store.js its state: catalog, coverage per console, progress poll, changes data/ui/components.js its shared pieces: art, tiles, console slots, the system lever data/ui/queue.js its play queue: the Up next section, the game's queue panel and their dialogs data/ui/views.js its pages: home, system, search, the game page, consoles data/ui/app.js its frame: router, search, confirmation dialog, keyboard and gamepad, login data/ui/style.css data/ui/placeholder.svg the cover of a game with no scrape data/ui/favicon.svg data/skyscraper/artwork-esde.xml Skyscraper's artwork for the main pass: cover, marquee, miximage data/skyscraper/artwork-3dbox.xml Skyscraper's artwork for the 3D box pass data/updater.sh the updater (POSIX sh): choose a release, verify it, roll it back data/bios.toml BIOS manifest (names, sizes, hashes, signatures only) data/allowed_signers the keys that sign releases, in the format of `ssh-keygen -Y` (see "Autonomous updates") data/profiles/steamos-emudeck.toml data/profiles/darkos.tomltemplates/ patterns-common.stignore patterns-device.example.stignoreexamples/config.example.tomlexamples/bios.example.tomlexamples/compose.example.yaml the hub's container, as Compose runs itdocker/Dockerfile the hub's container image: RAHasher, dolphin-tool and Skyscraper built in stages of their own, warpzone from the checkout.dockerignore keeps everything but the package out of the image's build contexttests/ unittest; unit tests + e2e (two real Syncthing instances)website/ documentation site (Starlight); the design pages are website/src/content/docs/development/design/model.py is pure: config + profiles in, list of desired folder specs out. All
I/O sits in syncthing.py, localst.py and the provision_* modules, so the diffing
logic is unit-tested without a network.
The library UI has no file left to add: its
modules and its data/ui/ files are all in the block above, and so are the hub’s container image
and its compose example. tests/test_container_files.py reads them: the base images pinned by
digest, RALibretro by commit, a health check, pip touching only the local wheel, no build tools
in the last stage, and no secret-looking value in the compose example. A pull request does not
build the image; the image job of the weekly and manual runs does (see “CI” below).
Testing
Section titled “Testing”-
Unit tests (stdlib
unittest): config validation errors, profile parsing, model expansion, ignore rendering, diffing (desired vs actual → calls), redaction,config.xmlparsing, dry-run output. -
A fake Syncthing (
http.serverin a thread) for provision flows, including the bootstrap wait loop and its timeout. -
The device commands (
provision device,frontend refresh,prune) reach the machine only through aDeviceProbes(probes.py): the/procto read, the import check, theflatpakandsystemctlrunners, the script check and the clock. A test passes one object with the pieces it fakes (tests/support.py:device_probes) instead of patching. -
End-to-end test, skipped unless
WARPZONE_E2E_SYNCTHINGpoints at a Syncthing binary: start a hub and a device instance in temp dirs, runprovision hubandprovision device, then assert that a whitelisted file reaches the device, a non-whitelisted one does not, and a save created on the device reaches the hub. It then removes a system from the whitelist and checks thatprunereports the leftovers, that--max-gib 0blocks the delete, and that--applyremoves only the leftovers (a device-only file and every whitelisted file stay). Another case turns a game off on the device, deletes it from the hub through the UI’s code path and checks thatprune --applyremoves the device’s copy through the record of deleted games, while a file removed from the hub by hand and a recorded path whose time or content differs stay. The same run covers the BIOS side: a plain BIOS file arrives through the library,bios/cemu/keys.txtreaches the Cemu folder only through its placement (a second file in the same hub folder does not, and the library does not createbios/cemu), and a symlink atbios/ryujinx/keysis left untouched. -
Profile and model unit tests cover the placement and library-exclusion tables (validation, overlaps, rendering order on the device and the hub); the provision tests cover skipped, created (
create_when) and dry-run targets. -
Play state tests (
test_playstate.py,test_playstate_device.py): the merge rules on a simulated fleet with explicit delivery of ledgers (a shared gamelist, a console, removal, offline devices, wrong clocks, random delivery orders), ledger files, byte-preserving edits, ES-DE open, closed and starting, the generated gamelists, and the unchanged shared folders. -
Artwork tests (
test_artwork.py,test_artwork_device.py): profile validation, the device and hub folder specs (the hub’s stay identical whatever the device order), the pure converter (escaping, paths that escape, user data, determinism, system names),ensure_gamelistsin a temporary home (idempotence, frontend running, no/proc, dry-run, a changed file), the timer units and their systemctl calls, scope sync against the fake Syncthing,frontend refreshand the doctor lines. -
Timer unit tests (
test_timers.py): theExecStart=quoting, with a config or Python path that holds$,%, a space, a quote or a backslash read back as the same words and with no%or$left for systemd to expand, the updater’s unit included; the priority settings of the four services; the unit names. -
Save conversion tests (
test_saveconvert.py,test_saveconvert_device.py): the footer (parse, strip, build, malformed input), every branch of the decision, the files in a temporary home (both directions, kept footer, conflicts and backups, invalid and temporary files, the emulator running or starting,--dry-run, the state), the profile table, the doctor line and the command; the system list wrapper is covered bytest_frontend.pyandtest_anbernic.py. -
darkostests: the shipped profile and its parsing,ignorePermsin the folder specs, the pure rewrite and key gap,provision devicein a temporary home (backups, second run, frontend or RetroArch running, no/proc, dry-run) and the doctor lines. -
pruneunit tests with the fake Syncthing: the pure decision (classify), every refusal (bootstrap ignores, wrong type, missing marker, size cap), protected names, nested folders, symlinks, re-check before delete, webhook. The files the hub deleted on purpose (test_prune_trashed.py): the pureclassifyandsha1_ok, the record read from disk (not in sync, unparsable, expired, a link), the re-checks and the hashing right before a delete, and the guards. -
Cloudflare Access sign-in (
test_access_jwt.py,test_access_keys.py,AccessSignInTestsintest_serve.py): tokens signed in the test with a fixed throwaway RSA key (access_support.py), no network. The pure checks (signature,alg,kid,exp,nbf,aud,iss, e-mail, malformed input), the key cache with a fake fetch and clock (refetch rules, one log per failure streak), and the requests through a real server. -
The webhook sender (
test_notify.py) with a stand-in HTTP server, and the run record ofinbox(test_inbox_record.py):build_recordfromItemResultvalues (no absolute path, a zRIF and secrets redacted, held, review, already), the id and the purge to 50, the record files, an attended--applyend to end, and the webhook that fires on review only. -
biostests: the pure judgements, manifest and override validation, and tmpdir libraries with tiny fake files and a test-only manifest (no real BIOS hashes): hashing only files of the expected size, content matches, local acceptance, skipped folders, zip members, exit codes. -
inboxtests: DAT parsing and the cache, matching (partial games, SHA1, ambiguous names, duplicate files), disc grouping, destination decisions and_donepurge selection as pure functions; archive extraction against traversal, absolute paths and links; whole runs on a temporary hub with tiny DATs and stand-inchdman,RAHasher,bsdtaranddolphin-toolscripts, including one cartridge flow with no external tool; the CLI, with the API key coming from the environment. -
Switch tests (
test_inbox_switch.py): kind, game-of-an-update, normalization, DLC name and bundle numbering, file names and length limits, thensz --infoparser and the PFS0 header as pure functions; titledb region order and cache; whole runs on a temporary hub with a stand-innsz(placement of games, updates, DLC and bundle parts,.nszdecompression and every way it can fail, name fallback, conflicts, review reasons, the keys content never shown). -
Arcade tests (
test_inbox_mame.py): set database parsing and its cache, fit, set identification and the emulator decision as pure functions over tiny synthetic XML databases (BIOS alternatives, merged and split clones, devices, optional and nodump ROMs); the gamelist update as a pure text function (add, change, remove, comments, other entries and unknown elements untouched, CRLF); whole runs on a temporary hub (placement, rename, the emulator order, Flycast for Atomiswave and Naomi, gamelist and its backup, conflict, already in the library, review reasons, folders of zips, configuration errors). -
Console image tests (
test_inbox_console_iso.py): claiming rules, PARAM.SFO, ISO9660 and XDVDFS parsing as pure functions of bytes; signature verdicts on tiny synthetic images built in the tests (a minimal ISO9660 with the PS3 files, XDVDFS volumes at offset 0 and at the XGD2, XGD3 and Redump offsets, the large offsets as sparse files); whole runs on a temporary hub (placement, the plain.isohook with a PS2 and a PSP image that a DAT matches, already present, conflicts, the full Xbox image, wrong content under a claimed name, the gamelist<altemulator>, zip and 7z input). -
Settings tests: for every handler, the contract on synthetic fixtures shaped like the real files (BOM, CRLF, no final newline, duplicated keys,
\defaultcompanions,@Variant(...)values, an unquoted RetroArch value, xemu’s multi-line array of inline tables, Vita3K’s sequences and document markers, nested JSON):write(text, {}) == text, only changed lines differ,NotWritable, typed round trips checked withjsonandtomllib. Pure tests for the pattern matcher, layer validation and merge,plan_apply(every branch of theC/L/Stable, first run, new keys),candidates, pre-selection, discard and audit rows. Process detection over a fake/proctree, including a process whose arguments name the emulator and warpzone’s own process. Wholeapply,captureandauditruns on a temporary home: backups and their rotation, atomic writes, idempotence (a second run writes nothing), held keys, a running emulator, a file changed between read and write, the lock, invalid layers changing nothing, scripted prompts,--yesand the pattern flags, a report without a terminal, conflict copies and the Syncthing in-sync check with the fake Syncthing. Fake login values (marked for gitleaks) must never appear in output, layers, snapshots or the log. The startup script rendering and thees_settings.xmlcheck and edit as pure functions (value changed, line added, every other byte kept, CRLF);provision devicewriting the script and enabling the setting with a backup, leaving it alone while a fake/procshows ES-DE running, and their dry run. The e2e test subscribes the device tosettingsand checks that a layer file travels both ways. It then takessettingsout of the device’sfolderswhile a second configured device still subscribes: a dry run says it would stop sharing, the real run takes the device off the hub’swz-settingswhile the device keeps the folder and its files, and putting the group back shares it again. -
A second e2e test starts from an empty hub: its folders exist and hold nothing.
provision hubruns while the whitelists and a game are copied in, so the bootstrap waits for them; the test then checks the createdwz-*folders, the final ignores,check, that a secondprovision hubreports every device and folder unchanged and leaves Syncthing’s devices, folders and ignores as they were (the fake Syncthing keeps what was sent, a real one fills in its defaults), and thatprovision devicemakes a device receive the whitelisted game and not the other one. -
The updater end to end (
test_e2e_updater.py, same two instances):updater.sh installsets a device up from a clone of a throwaway repository whose releases are this checkout’swarpzonepackage, andupdater.sh tickthen runs the real three-step verification, which is what the differential verdict reads. A release whose REST client sends the API key under the wrong header (refused by a real Syncthing, not by a fake one) is marked bad because the version known to work passes the same check; with the device’s Syncthing stopped, a good release and the version known to work both fail, so nothing is marked bad and the device backs off, and it installs that release once Syncthing is back and the day has passed. A release whose device whitelist starts with*passes its verification and hides the library; once it is retired the device goes down to the older release, whoseprovisionputs its own ignores back on the device’s Syncthing, and a new game arrives. The releases are built from the working tree, so the test needs neither the history nor the tags of the real repository. -
Updater script tests (
test_updater_sh.py):updater.shruns against real git repositories in temporary folders (an upstream with tagged releases, a clone, a fakepythonthat behaves like warpzone according to the checked-out version, a fake/procand a fake clock): a good update, the numeric order of tags, tags that are not ancestors oforigin/mainor whose version disagrees, a broken import, a wrong--version, a failingprovision, a failinghealthand a hang (all bad whengoodpasses and the release fails again), a failure that happens once (not bad), a step cut off with a grandchild alive (the grandchild dies and the pipe is free), the tick budget and the second look at a release that ran out of it, the budget on the uptime and not on the date, a user’s edit of a file the release changes (during a deferral and during probation), a python that imports another warpzone, a checkout cut in the middle by a filter that kills the process group or fails (the tree is repaired), too little free space, an ignored file in the way, a menu that closes and opens again, a lock from another boot, times from the future, a moved tag, a broken environment (no tag burned, back-off of 1, 2, 4, 7 and 7 days), a bad tag that never returns, a power cut (a fake that kills its own process group; no tag burned, a stale lock taken over, the second attempt, the give-up withretry_after), a menu that opens during the check, the 72 hour limit, probation at the next boot, the kinds of checkout (dev,dirty, a loose commit, an adopted branch that comes back to its branch), the staleindex.lock, the fetch interval of each channel and--fetch-now, state and settings that contain shell syntax,install(the best valid release of the channel that carries the script, the venv without pip with its.pthand shim,provision deviceand its arguments, every refusal before any change) and the venv repair (a venv that is gone, whose Python is gone, that cannot find the clone or whose.pthpoints elsewhere; one that works is left alone;--clearnever reaches a folder not calledvenv, one that is not a venv, the clone’s folder or the folder around the venv), andselftest. The syntax check,selftestand a full update run with every shell found amongsh,dashandbash(WZ_TEST_SHELLpicks the shell for all the others), and shellcheck runs when installed. CI runs this file in its ownupdaterjob (Ubuntu with dash assh, and macOS on the weekly and manual runs), apart from thetestjob, which skips it withWARPZONE_SKIP_UPDATER_SH=1. -
Self-update tests (
test_selfupdate.py,test_update_timer.py): tag and version comparison as pure functions (including the orderrc1<rc2< release); the settings file (render_conf, which refuses a line break, andparse_kv),updater_abi,install_decisionand the wrapper with a fake runner; the units’ rendering andensure_update_timerwith a fakesystemctl(first run, second run, an old unit rewritten, switched off, dry-run, no user manager, no live copy, failed enable);ensure_updaterin temporary folders (first install, atomic renewal with.prev, the same script, a lower ABI, a syntax error, a failing, wrong or hangingselftest, no ABI, dry-run);ensure_self_updateandprovision devicefor both shipped profiles, withself_update = falseand with a clone that is not a git checkout. -
doctortests of the updater: the judges as pure functions (state, settings, script) and the check over a temporary home (healthy, nothing installed, another channel, a Python that is gone, stuck, recent bad tags, silent when the config turns it off). -
doctortests: the renderer and exit code as pure functions; every check with fake probes (tool present, missing per platform, unrunnable, unrecognizable version; config missing, partial or invalid; Syncthing absent, answering, refusing, not on loopback; DATs old or absent; hub unmounted, incomplete or short of space); and that no key (RetroAchievements, Syncthing) appears anywhere in the output.
CI (GitHub Actions)
Section titled “CI (GitHub Actions)”ci.yml runs on every pull request, every Monday and by hand (workflow_dispatch), not on
pushes to main: main only takes a pull request that is up to date with it, squash-merged,
so its tree is the one the pull request already tested. The weekly run catches changes from
outside the code, such as new runner images or Python releases. docs.yml still runs on
main, because it publishes the website.
On a pull request a first job, changes, looks at the files it changes. test, typecheck
and e2e run only when something the tests read changes (code, tests, pyproject.toml,
examples/, CHANGELOG.md, the design pages); updater only when a file its tests use
changes (updater.sh, allowed_signers, procs.py, versions.py, the package __init__.py,
tests/test_updater_sh.py, tests/support.py or pyproject.toml). lint and secrets
always run, and a change to ci.yml runs everything. A skipped job counts as passed for
the required checks; the matrix jobs skip their steps rather than the whole job, so their
checks keep their names. The macOS entries of test and updater are left out of a pull
request’s matrix: macOS runners can wait long enough to time a job out, and macOS is where only
the inbox and the hub commands run, so the weekly run covers it and no required check is a
macOS one.
lint: ruff check + ruff format –check.typecheck: mypy in strict mode on thewarpzonepackage (strict = trueinpyproject.toml). The release workflow runs the same check before it builds. Itsverifyjob also refuses a tag whose SSH signature does not verify againstwarpzone/data/allowed_signers(scripts/verify_tag_signature.py, tested bytests/test_verify_tag_signature.pywith throwaway repositories and keys).test: unittest on Linux with Python 3.11 and 3.14 and, on the weekly and manual runs only, on macOS with Python 3.14, without the updater script’s tests (WARPZONE_SKIP_UPDATER_SH=1). The library UI’s scripts are also parsed with node (tests/test_ui_files.py), skipped where node is not installed.updater:tests/test_updater_sh.pyon Ubuntu with dash asshand, on the weekly and manual runs only, on macOS.e2e: ubuntu-latest, downloads a pinned Syncthing release, verifies its SHA-256 against a value committed in the workflow, runs the e2e test.secrets: gitleaks over the full history.
Two more jobs run only on the weekly and manual runs, never on a pull request, and no check depends on them:
image: buildsdocker/Dockerfilewithdocker buildfrom the root of the checkout (nothing is pushed and there is no registry login), then runs the image:warpzone --versionmust print the version of the checkout,chdman,bsdtar,RAHasherandSkyscrapermust be onPATH, and the default user must not be root.Skyscraper --versionruns as uid 65534 with--read-only --tmpfs /tmp --cap-drop ALLand a folder mounted at/skyscraper(and must fail without it), anddoctorin the container must show[ok]forSkyscraperand, with a fakeconfig.inion that folder, for the account. The job prints the size of the image. The RAHasher, Dolphin and Skyscraper stages compile C++, so the job has a timeout of 45 minutes. It finds a base image or apt change that breaks the build before someone rebuilds the image on the hub.coverage: the unit tests undercoverage(pinned to an exact version) with branch measurement, limited to thewarpzonepackage, on Ubuntu with Python 3.11 and without the updater script’s tests (they measure a shell script). The total and the ten least covered modules go to the job summary. There is no threshold: it publishes the number and never fails on it. Subprocesses the tests start are not measured.- Every third-party action pinned by commit SHA,
permissions: contents: readat workflow level, Dependabot for GitHub Actions.