Repository navigation
fix(updex): fail loud on an empty specifier and link the running suite at boot - #516
Merged
Merged
Conversation
A transfer that selects its suite with %w (os-release VERSION_ID) matches only the images of the running suite. Cleanup of the other suite's images (#512) and suite-switch detection (#511) need to match the images of every suite. config keeps, for each target pattern that contains %w, an any-suite variant in TargetSection.AnySuitePatterns: every other specifier expanded as before, %w replaced by version.SuiteWildcard. It is nil when no target pattern contains %w; "%%w" stays a literal "%w". version.SuiteWildcard is a NUL byte. A Linux file name cannot hold one, so no pattern that config text spells out can mean it; config builds no any-suite variant when the text or an expanded value already holds a NUL. Only the new version.ParseAnySuitePattern gives it a meaning; ParsePattern and every existing pattern (a literal "@w" included) parse as before. The wildcard matches 1 or more of [0-9a-z.~-], and @v in an any-suite pattern excludes '_', so "foo_@v_%w_%a.raw" never matches an image of a component "foo_bar". Pattern.Suite and version.ExtractSuiteParsed report the suite a file name matched.
…ble" A specifier that expands to an empty string leaves a MatchPattern that matches no published image. On a host whose os-release has no VERSION_ID (Debian testing or unstable before its release), %w is empty, so foo_@v_%w_%a.raw becomes foo_@v__x86-64.raw and every run ends with "no versions available", which hides the cause. The load now records the first empty specifier of a Source or Target MatchPattern on the transfer, as config.Transfer.SpecifierError, marked fault.Config: Target MatchPattern "foo_@v_%w_%a.raw": specifier %w is empty: os-release has no VERSION_ID The load does not fail, so listing, disable and the vacuum keep working. getAvailableVersions returns the error, so update, check and enable --now fail for that transfer with that message (the last-run record gets the class config), and the transfer status carries it, so features list shows it. An empty specifier in ProtectVersion= is recorded separately as ProtectVersionError and is only a warning: ProtectVersion protects nothing, as before. Refs #511
…itch A transfer whose target pattern has %w links the image of the running Debian suite (VERSION_ID 13 on trixie, 14 on forky). After a bootc switch from trixie to forky, the link still names the trixie image on the first forky boot, and systemd-sysext refuses it, so the feature is missing. The timer links the forky image only at its next run and never refreshes (ADR-0016), so the feature comes back only at the following boot. Design (ADR-0021): - UpdateFeaturesOptions.SuiteSwitchOnly, CLI `features update --suite-switch`, selects the enabled features with an active transfer whose link points to an image of another suite: the link target matches the any-suite pattern (%w as a wildcard) and not the current pattern (sysext.LinkedOtherSuiteAt). With none, the run does nothing: no lock, no download, no refresh, no last-run record. With some, it is a named update of exactly those features through every gate (lock, rollback holds, minimum image, refresh gate), then the normal refresh. It refuses names and NoRefresh; under systemd a busy lock is an error for it, because there is no later run on this boot. - A new packaged unit, updex-suite-switch.service, from updex.SuiteSwitchUnit and scripts/units.sh: a oneshot that runs the command once per boot, Wants/After network-online.target, Before updex-update.service, DefaultDependencies=no (so multi-user.target does not wait for a download), WantedBy multi-user.target, no AC-power condition. It refreshes, so it takes only systemd.RefreshSandboxDirectives: a private mount namespace (ProtectSystem, ProtectHome, PrivateTmp) would hide the merged images from the host, and the other dropped lines block loop devices, module loads, the namespace of systemd-sysext and the /etc writes of systemd-sysusers and systemd-tmpfiles. - daemon enable enables it (never starts it), daemon disable disables it and removes it only when updex wrote it, daemon status reports it. The .deb ships it disabled; CI verifies it with systemd-analyze and the nightly checks the .deb listing. Rejected: expanding %w from the staged bootc deployment's os-release before the reboot. It is specific to the bootc backend, and the running system would refuse the linked image of the new suite, so any refresh before the reboot would drop the feature on the old suite. A transfer without %w is never selected, and a host whose links all name its own suite behaves as before. Fixes #511
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Review fixes for the suite-switch run (ADR-0021, #511): - Its refresh activates only its own links. The systemd-sysext refresh merges every pending link of the host, so before it refreshes the run checks the other pending activations (pendingActivationLinks and activationLinks: a link whose merged version is not known to equal it, or whose state cannot be read). When one exists, for example a newer image that the timer linked with --no-refresh earlier on this boot and that ADR-0016 holds for the next boot, the run keeps its new links, skips the refresh and reports RefreshSkipped ("refresh skipped: <component> has an update that waits for the next boot; the suite switch takes effect at the next boot"); it is not an error. A pending deactivation does not count: updex cannot tell it from an image that another systemd-sysext directory provides. - The selection before the lock is only a fast path. Under the lock the run loads the domain and selects again before any download; an empty selection then ends the run with no download, no refresh and no last-run record. Client.afterSuiteSwitchScan is the test seam between both scans. - A domain that the unlocked scan cannot load goes on to the locked path, which records the failed run with class config (ADR-0020). Refused options and a confirmed empty selection still write nothing. A suite-switch run is always recorded as a selected run. - A ProtectVersion= value with an empty specifier keeps its literal part (1%w with %w empty is 1). The warning now names the expanded value and says that nothing is protected only when the value is empty. ADR-0021 no longer permits the collateral activation; the CLI, SDK, last-run, configuration and design docs and AGENTS.md follow. Each blocking finding has a record in .memory/corrections/ (core ADR-0081) that names its guard test. Refs #511
…itch refresh Review fixes for the suite-switch run (ADR-0021, #511): - A pending deactivation stops the refresh. A sysext that is merged but has no usable link is unmerged by a refresh unless another systemd-sysext directory provides the image, which updex cannot prove. A suite-switch run now keeps its links, skips the refresh and reports "refresh skipped: <component> is merged but not linked; the suite switch takes effect at the next boot" (RefreshSkipped, last-run refresh "skipped", not an error). - A failed host-wide enumeration stops the refresh. pendingActivationLinks warned and fell back to the scoped transfers when the host's definitions did not load, so a run scoped to 1 component could refresh over an unrelated pending update it never saw. The new pendingActivationLinksHost returns that failure (the other callers keep the warning only), and a suite-switch run skips the refresh when the host's pending state is unknown. - The ProtectVersionError field comment says that the expanded value stays in effect and that only an empty value protects nothing. ADR-0021, the CLI, SDK, last-run and design docs, AGENTS.md and the correction record of the first finding follow; a new record covers the host enumeration. Refs #511
8 of 11 tasks
Contributor
Author
Cross-review record
Guards (each fails with its fix reverted; 1
Checks: Merge order: merge #515 first. This branch is then rebased (commit |
bketelsen
approved these changes
Nov 14, 2026
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #511. Decision: ADR-0021.
Merge after #515. This branch carries an identical copy of #515's first commit (
3a1038a=88752b3, the any-suite target patterns). After #515 merges, this branch is rebased: that commit drops out and 4 files need a merge (config/transfer.go,config/transfer_test.go,docs/specs/config-reference.md,updex/install.go).Part A: an empty specifier fails loud (
8d8315f)expandSpecifiers(config/transfer.go) wrote""for a missing os-release key, so%won a host withoutVERSION_ID(Debian forky before its release) gave a pattern that matched nothing, and the run failed withno versions available(updex/install.go:80). Now an empty expansion in a Source/TargetMatchPatternis recorded on the transfer (Transfer.SpecifierError, classconfig), for exampleTarget MatchPattern "foo_@v_%w_%a.raw": specifier %w is empty: os-release has no VERSION_ID. The config load still succeeds, so native OS transfers in the default directory (partition, UKI) that use specifiers do not break updex.getAvailableVersions(update, check,enable --now) fails with the message,features listshows it, the last-run record gets classconfig.disableand the vacuum still work. An emptyProtectVersion=specifier is a warning only: the rest of the expanded value stays in effect, and only an empty expanded value protects nothing.Part B: close the suite-switch window (
3f46e43)Facts:
LinkedVersionAt(sysext/manager.go) reports""for a link to a file the current pattern does not match. Afterbootc switchto the other suite, the 1st boot finds/var/lib/extensions/<component>.rawpointing to the old suite's image; systemd-sysext refuses it (VERSION_IDdiffers), so the feature is missing. The timer service runsfeatures update --no-refresh(ADR-0016: updates apply at the next boot), so the right image was merged only at the 2nd boot.features update --suite-switch(UpdateFeaturesOptions.SuiteSwitchOnly) selects only enabled features whose link points to another suite's image (sysext.LinkedOtherSuiteAt: the link target matchesTarget.AnySuitePatternsbut no current pattern). It updates exactly those features throughinstallTransfers(all gates), then refreshes throughrefreshGateandrunner.Refresh(): that extension is not merged at all on this boot, so the refresh adds it. With no such link it does nothing: no lock, no download, no refresh, no last-run record. It refuses feature names and--no-refresh. Under systemd a busy lock is an error for it, not a skip.config).RefreshSkipped, last-runrefresh: skipped, a warning, not an error) when another sysext has a pending activation or a pending deactivation (merged but not linked), when a state cannot be read, or when the host's definitions do not load (pendingActivationLinksHostreturns that failure; the other callers keep the warning and fallback). The suite switch then takes effect at the next boot.updex-suite-switch.service(fromupdex.SuiteSwitchUnit(), written byscripts/units.sh, shipped by.goreleaser.yamlat/usr/lib/systemd/system/): oneshot,After=network-online.target,Before=updex-update.service shutdown.target,Conflicts=shutdown.target,DefaultDependencies=no(boot does not wait for a download),WantedBy=multi-user.target. Its sandbox keeps only the lines that need no mount namespace (RefreshSandboxDirectives): a private namespace would hide the merged images from the host, and the other lines would block the loop devices, module loads and/etcwrites that a refresh with sysusers and tmpfiles needs. The package enables nothing;updex daemon enable/disable/statushandle the unit with the timer.%wfrom the staged bootc deployment's os-release before the reboot. The path is backend-specific, and it links an image that the running system refuses, so any refresh before the reboot drops that feature.Trixie-only hosts: the unit runs once per boot and does nothing (no link to another suite). A transfer without
%wnever matches the any-suite check.Checks
make fmtmake ci— green locally (coverage 90.7%, floor 90.2%)go test -v ./cmd/updex ./tests/e2e/...(inmake ci)Risk tier
Rationale: matched paths of
.github/risk-paths.json:.github/workflows/**(ci.yml, L1): theunitsjob also runssystemd-analyze verifyon the new unit. No permission or secret change..goreleaser.yaml(L1): 1 newnfpms.contentsentry (mode 0644); no maintainer script, nothing enabled.scripts/{units,check-deb-units}.sh(L1): write and check the 3rd unit file.systemd/**(L1): unit generation and enable/disable of the new unit, through the same mockable runner.config/transfer.go,updex/list.go(L1): Part A;MatchPatternsexpansion is unchanged for non-empty values.sysext/**(L1): new read-only helperLinkedOtherSuiteAt.updex/{install,features,daemon}.go(L1): the selection runs read-only before the lock; the selected features go throughinstallTransfersandrefreshGatelike every update.Docs housekeeping
TEMPLATE.md, indexed indocs/README.mddocs/design/overview.md,docs/specs/{cli-reference,config-reference,sdk-api,last-run-record}.mdupdatedVerification
node scripts/check-docs.mjsgreen (inmake ci)TestSpecifierErrorEmptyValue,TestEmptySpecifierFailsLoudfail. Part B: with no feature selected,TestUpdateFeatures_SuiteSwitchLinksRunningSuite,TestUpdateFeatures_SuiteSwitchRelinksStagedImage,TestRunFeaturesUpdate_SuiteSwitchLockHeldUnderSystemdFailsfail; with the link check disabled,TestLinkedOtherSuiteAtfails; with the unit not written,TestUnitsHookMatchesGenerator,TestDaemonEnableDisableSuiteSwitchUnit,TestDaemonPackagedSuiteSwitchUnitfail..memory/corrections/2026-11-13-pr-516-*.jsonrecord:TestUpdateFeatures_SuiteSwitchKeepsOtherActivationsForNextBoot/{other_update_linked_by_the_timer,other_image_merged_but_not_linked},TestUpdateFeatures_SuiteSwitchSelectsAgainUnderLock,TestUpdateFeatures_SuiteSwitchRecordsDomainFailure,TestUpdateFeatures_SuiteSwitchHostDefinitionsUnreadable; andTestProtectVersionWarningNamesExpandedValue/literal_and_specifier(theProtectVersion=warning names the expanded value).enable updex-suite-switch.service); until then onlyupdex daemon enableturns it on.