system/SERVICE.md
2026-11-18 13:23:43 +00:00

20 KiB

archipelagod implementation checkpoint

2026-11-18 checkpoint: human CLI errors and complete help

Installed-host failures are rendered from the typed public error (code, phase, retryable, diagnostic_id) rather than from a JSON string. The CLI fetches the authorized operation log on a terminal failure and extracts one control-free cause line; the full journal remains behind archipelago transaction log ID. Internal engine phrases and the old fallback sentence are not shown to users. --json keeps one structured document and --debug keeps technical output on stderr.

archipelago --help, help COMMAND and COMMAND --help cover every implemented command family and option, including installed-host globals (--json, --debug, --interactive, --non-interactive, --offline, --request-id), command options (--plan, --file, --reason, --purpose, --erase, --full) and kernel-argument edits. Build/install-only --verbose and the lab-only overlay fixture are marked as such instead of being presented as global features.

The no-direct-write invariant is unchanged: mutating installed-host commands fail when archipelagod is unavailable; only the user-facing wording changed.

2026-11-16 checkpoint: native libostree kernel arguments

system/src/service/kargs.rs no longer runs python3 adapters/kernel-arguments.py. The same libostree calls (parse, append, append-if-missing, delete, delete-if-present, new-replace, to_strv, sysroot/deployment/bootconfig reads) are resolved with dlopen/dlsym and called through a typed FFI surface. Dynamic loading is deliberate: the release build image has no libostree, so linking would break the Cargo stage; the installed host has the library and gets a clear "libostree-1.so.1 is not available" error otherwise. The Python adapter and its fixture are deleted; validation and deployment-argument construction remain covered by Rust tests.

2026-11-16 checkpoint: guarded OSTree object collection

Installed hosts accumulated unreachable objects. ostree prune without --refs-only traverses every commit in the repository, so it only removes objects that were written but never committed; --refs-only collects objects no ref can reach. The first GC implementation was too aggressive: it ran admin cleanup before boot-readiness evidence existed, removed service refs without following overlay intent, and leaked its own old keep refs. Audit found this could retire recovery roots and, paradoxically, could keep old objects pinned forever.

  • archipelago cleanup plan [--json] is read-only and inventories deployment roots, overlay-selected/source layer commits, Host Extension bases and active-context plan targets. Absent optional commit metadata is tolerated (older images and local compositions do not carry every key). It lists the refs that apply would expire.
  • archipelago cleanup apply takes the shared host mutation lock, refuses live/no-booted/ pending states, establishes keep refs for the complete protected commit graph and invokes only ostree prune --refs-only. It does not run admin cleanup or delete deployments. It expires its own archipelago/keep/* refs and superseded service/bases|overlays|overlay-builds refs whose commits are no longer named by a deployment, active plan or retained intent — those deployments were already retired by OSTree finalize-staged retention, and the refs would otherwise pin their objects forever. stable/* refs, plans and generation history are untouched. The record stores protected commit identities and the before/after repo size. This safely removes objects already unreachable from every ref; it cannot yet reclaim commits kept alive by obsolete deployment/history refs.
  • The last step of a successful update/overlay Stage runs the same object collection inside the transaction, while it still owns the shared sysroot lock. That call may observe the pending deployment it has just written (D-120): the pending commit and all inputs it names stay protected, but superseded keep/service composition refs are expired and unreachable objects collected without waiting for a reboot or a separate cleanup command. The result is reported as cleanup on the Stage/apply outcome; a collection failure is reported as skipped and does not turn the successfully staged deployment into a failed update.
  • The archipelago-ostree-gc.timer unit (30 minutes after boot, then weekly) runs the guarded apply on installed hosts; the live ISO is excluded by condition. Manual and timer collection remain fail-closed and still refuse a pending deployment.

Unit tests cover deployment parsing, pending/unbooted guards, keep-root calculation, overlay source/layer roots and the non-retirement of stale refs. This is deliberately not full D-046 cleanup: D-047/D-048 boot checks and durable success records must exist before automatically retiring unpinned deployments or expiring service/history refs. Actual pruning on hardware remains user-verified; first inspect with cleanup plan.

2026-11-16 checkpoint: quoted release code name

defaults/os-release now writes VERSION="Tesseract", VERSION_ID="Tesseract" and VERSION_CODENAME="tesseract", and the Core package build asserts those exact lines so a Purpose cannot drift from an unquoted value. Container Runner keeps inheriting the Core file, with only the edition name substituted.

2026-11-16 checkpoint: native artifact verification on the overlay path

Managed Overlay planning no longer shells out to python3 artifact.py. Every load_layer (PrepareSet, catalog refresh, update reapplication) and every rebuilt overlay called python3, waited for a JSON document and then converted it in Rust. archipelago_composer::artifact::inspect now runs the equivalent verification in-process (composer/src/check.rs): strict metadata JSON without duplicate keys or fractional numbers, lock/manifest/index binding, original ALPM identity, payload identity with xattrs, authored sources, canonical package-contribution identity and a complete payload-tree accounting walk. The Python checker stays embedded only for the Python overlay-build adapters that still run inside the build sandbox.

Seven Rust tests mirror the Python acceptance and rejection cases (valid artifact, changed bytes, unindexed payload, substituted index, authored mismatch, metadata symlink, persistent path). Composer now depends on serde, sha2 and libc (xattrs) with regenerated lockfiles; cargo test --locked passes for composer (23 + 5), system (40 + 5) and the CLI (4). The Python fixtures remain for the sandbox checker and require root because they verify ownership against uid 0.

2026-11-16 checkpoint: local package import works on an installed host

archipelago extension add ./package.pkg.tar.zst (and --file PATH) now routes through the daemon: protected FD import, then one PrepareChange for every requested name and archive, then one Stage. extension import and extension add-local remain the explicit two-step form. A path is recognised by ./, ../, /, ~/ or an archive suffix, so a package name is never resolved from the filesystem and an unknown option is rejected.

The hardware import failure had one cause: the identity cross-check ran pacman --config /dev/null -Qp, which opens the default /var/lib/pacman that an installed OSTree host does not have. Every pacman call in the service now names /usr/lib/archipelago/package-db (inputs::PACKAGE_DB, shared argument builder), Native Rust tests assert that the import identity query uses the explicit image DBPath and that CLI parsing keeps local paths separate from package names. The Cockpit updater contract also has a native Rust test; the release build no longer executes Python test fixtures for these checks.

Sandbox::release now deletes the entire per-operation directory (request files, copied archives, adapter, checkout) instead of only the checkout, is not skipped by a cancel request, and a workspace untouched for a day is purged as orphaned. Every compose/plan/resolve path releases the workspace on success and failure. This prevents the private copies of processed packages that accumulated in /var/lib/archipelago/service/package-work.

Verification: cargo test for archipelago, archipelago-system, archipelago-builder, archipelago-composer (system suite 43 tests, including the database-path, argument-splitting and GC-root cases; builder checks the Cockpit assets and typed D-Bus operations). Hardware acceptance of the corrected import is a user manual check on an installed image that carries this source.

2026-11-14 checkpoint: observable progress and distributor identity

Progress.percent is now a monotonic completion estimate for the whole transaction. Phase checkpoints keep their fixed bands, and every fetching OSTree command additionally refines the value inside the current band from the tool's own console records. libostree prints transfer progress only to a terminal, so Worker::command_progress runs the command under script -qec (a PTY), strips ANSI/CR redrawing, and maps the newest Receiving objects:, Receiving delta parts:, Receiving metadata objects:, Writing objects: or completion record onto the band. Unrecognized output leaves the phase percentage untouched. OperationEvents::progress clamps to 99 and never decreases; repeated values do not fsync the journal. Call sites: layer pull, image pull in prepare/execute, both pull-local imports and retain_clean_base.

Clients: the Discover backend keeps one monotonic floor across PrepareUpdate→Stage, treats a failed GetStatus as "keep the last observation", and no longer renders reconciling as an update error. The GNOME Software plugin polls transaction snapshots on its worker thread, marshals percentage updates to the caller's GMainContext, mirrors them onto related package rows (the updates list averages watched apps and hides the bar if any is unknown), and ships the same policy for reconciling.

The archipelago package now installs archipelago.svg and archipelago-symbolic.svg into hicolor/scalable/apps; both adapters use the colored icon for the OS resource and the symbolic one for the source badge, and the GNOME/KDE finalizers refresh the hicolor cache.

Image size and licence (D-113): every image path (build-iso.sh, gnome-layer.sh, container-runner-layer.sh) measures the composed tree with builder/adapters/image-size.py and records archipelago.image-size (unique compressed objects, i.e. the transfer upper bound) and archipelago.image-installed-size (sum of checkout paths) in the published commit. refresh reads them after --commit-metadata-only, so GetStatus/GetUpdateDetails report download_size/installed_size before any image bytes move. Discover shows the transfer size as the resource size and the installed size in the description; GNOME Software sets the download size. Both adapters declare the licence MIT. A target commit without the metadata keeps an unknown size instead of a misleading zero.

Verification: the archipelago-system and archipelago-builder release test suites pass, including new unit tests for the console parser, terminal-control stripping and the size metadata parser, a real GNOME Software plugin contract test that now asserts the download size and licence, and a Discover adapter build against the 2026-11-12 snapshot. The daemon/adapter behaviour on installed hardware (progress animation, no reconciliation banner, icon rendering, displayed size) is still user-verified only.

2026-11-09 checkpoint (supersedes the historical status below)

The D-Bus images from run 20261109T113636Z were published with an explicit one-run VM-acceptance waiver. This was not a successful full VM acceptance.

D-096 adds Manager API minor 2 GetKernelArguments/ChangeKernelArguments, dedicated Polkit authorization, native libostree argument parsing, staged edits and durable argument verification. Update and extension staging inherit the selected pending/booted arguments. Installed CLI is human-first with explicit --json and --debug; private logs retain operation/request identities.

Implementation sources are pushed; a new normal pipeline has been started for compilation, native/Rust checks and Core/GNOME/KDE acceptance. No passing result or publication is claimed yet. The previous waiver does not apply. Current workspace checkpoint: IMPLEMENTATION-PLAN-KARGS-CLI.md. Consumer audit: infrastructure/pipeline/CLI-FORMATS.md.

Historical 2026-11-08 checkpoint

2026-11-08. D-092/D-093 are accepted; the full service migration is in progress.

D-095 supersedes the PackageKit work below: the backend, broker and store adaptations have been removed. Host Extension package installation is through the CLI/direct typed daemon API. Stock Arch Software/Discover retain native Archipelago OS D-Bus plugins and Flatpak/fwupd; no PackageKit dependency is shipped. The older PackageKit build notes below are historical evidence only.

Current integration work (not yet accepted or published)

Installed-host CLI now exposes overlay status, overlay list [QUERY [CURSOR]], overlay add ID EXACT_COMMIT, overlay remove ID, overlay order ALL_IDS... and overlay clear. Mutations submit a complete list with GetState's context, then Stage the returned plan. Reordering must name every selected overlay once. Installed-bus acceptance and declaration rebuild-on-update remain unfinished.

The read-only foundation below describes the last published source slice. The working tree now adds durable asynchronous mutations, worker supervision, FD imports, extension planning and native D-Bus clients. Installed-host CLI dispatch uses the service; unsupported workflows fail without falling back to direct mutation. General Managed Overlay execution and the corresponding capability/acceptance migration remain unfinished.

ManagedOverlays now registers GetState, ListAvailable, GetOverlay, RefreshCatalog and Revision with ObjectManager/signals. Refresh resolves the private configured overlay_catalog_ref through signed OSTree summary/commit verification and checks each indexed layer against its manifest before caching context-bound descriptors. The profile/catalog producer is not deployed. PrepareSet and the general overlay capability remain absent.

The private composition worker connects indexed artifacts to path planning, materialization and effective ALPM records, with retained original records and transformation provenance. Its offline finalizer reuses adapters/finalize-managed.sh, also used by Host Extensions. These composition functions are not yet called by an admitted PrepareSet/Stage workflow. Legacy Core/Purpose artifact producers, full base indexing/lifecycle adapters, whole-package replacement and complete overlay/extension update reapplication remain integration work. Existing test-marker acceptance does not cover this API.

Native GNOME and Discover OS clients observe retained transactions through D-Bus. Legacy software-helper and its broad Polkit policy are no longer packaged in the Desktop assets. Rust system/composer test binaries compile as of 2026-11-08; normal-pipeline runtime acceptance remains pending and no new release has started. See the workspace IMPLEMENTATION-PLAN-DBUS.md for current build handles and remaining work.

Previously published foundation

  • Thin cli/src/bin/archipelagod.rs entrypoint uses the existing system crate.
  • System-bus Manager, Properties, Introspectable and ObjectManager. Only GetCapabilities/GetStatus are advertised. Other Manager calls explicitly return org.archipelago.System1.Error.Unsupported, without spawning a CLI or admitting work. Extension/overlay/broker features are absent.
  • Local OSTree observation on a worker outside the D-Bus executor. It takes the existing /run/archipelago-compose.lock nonblocking, reads with a 10-second command deadline, retains cached state with reconciling=true on failure and emits StatusRevision after durable publication. Deployment IDs include serial; unknown base/Purpose/snapshot/support fields are omitted. No mirror request.
  • Private /var/lib/archipelago/service/observation.json contains versioned local observations, not update intent or a second operation authority. Revisions survive restart; unsupported schema stops startup without resetting it.
  • Admission journal foundation: private bounded records, lifetime ownership lock, UID/method/request-ID/canonical-input binding, reconnect deduplication, explicit transitions, file+directory fsync, immutable terminal records and fail-closed unknown schemas/durability errors. Surviving active work blocks new admission until engine reconciliation. No auto-replay, guessed success or automatic GC.
  • Async Polkit helper derives UID/unique sender from the bus, requires both interactive flags and uses a service-selected action. PackageKit's current owner is rejected from direct authorization: broker verification is still needed. Cancellation-own checks compare authenticated UID to the retained initiator in the service, not a caller option or an undocumented Polkit subject field.
  • Unit, activation, bus policy, separate Polkit actions/rules are provided under integrations/dbus/. They are not installed by the image builder yet.
  • updates::prepare returns its result instead of formatting it internally; current CLI wrappers preserve output. Exact-target callers cannot silently follow a moved track. This legacy engine adapter is not yet admitted by D-Bus.
  • Explicit development CLI: archipelago service capabilities|status. Ordinary installed-host commands retain their existing path until coordinated migration.

Dependency and compilation

Use pure-Rust zbus 5.12.0, async-io executor and blocking client wrapper; no new libdbus/GIO link dependency in the core Rust binary. Existing engine work is blocking and stays outside the bus executor. Pin zbus_macros=5.12.0 as well: the initial resolver selected macros 5.19 against zbus 5.12, producing a private DispatchResult2 API mismatch. Matching versions compile on the existing Rust 1.90 tools image. CLI/system lockfiles retain exact checksums for transitive crates.

Build preparation uses yabloko /opt/archipelago/dbus-next/, separate from frozen release sources and the regular target directory. Rust release compilation and compilation of the contract/system test executables have been checked there. Tests are wired into the regular release-cycle compile stage; no separate VM or standalone test run has been executed for this slice. Native proxy compilation, activation, real bus calls and Polkit session behavior still need pipeline evidence.

Next integration boundary

Do not install this read-only slice as a completed installed-host replacement. Still required: typed execution/progress/results; one migrated legacy plan/operation authority; durable terminal results and recovery against OSTree/boot state; bounded worker admission and cache; fast refresh; exact plan Download/Stage; safe Cancel; owned workers; full CLI routing and native GUI migration; measured limits; real Host Extension/overlay/broker implementation and acceptance. Local-package trust and future host method schemas remain governed by their RFC contracts.

The service observer's output does not claim that a legacy update job is a durable service transaction. The new journal is not connected to the mutation engine yet and must not be used as an independent second writer. Keep old records/inputs for migration. Feature policy and package plans must derive their required actions on the service side; an eventual Stage handler must never select stage-update solely because of its method name. Read-only compilation is not rollout or VM acceptance.

Future packaging destinations: binary /usr/bin/archipelagod, unit /usr/lib/systemd/system/archipelagod.service, bus activation /usr/share/dbus-1/system-services/, bus policy /usr/share/dbus-1/system.d/, Polkit action XML /usr/share/polkit-1/actions/, rules /usr/share/polkit-1/rules.d/. Keep KillMode=control-group; sandbox changes require real compose/mount acceptance. No service enablement or timer change is needed for bus activation. Both native clients must transition together before old helpers and their broad action are removed.