Repository navigation
feat(rollback): add features rollback that holds updates until a newer revision - #461
Conversation
…sfers together, add the operation lock Phase 1 of plan 0001 (ADR-0016).
…activations Phase 3 of plan 0001 (ADR-0016).
…that updates honour Phase 4 of plan 0001 (ADR-0016).
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
frostyard-machines
left a comment
There was a problem hiding this comment.
Murbella (snosi owner): host and image review of the last commit (feat(rollback): …), comment only. I do not approve.
Verdict: no blocking finding. It matches Brian's decision "rollback skips and resumes": the record rejects the version rolled back from, features update and the timer link neither it nor an older one, the next newer revision links and deletes the record, and --clear resumes at once. The rollback takes the lock, refuses a target that is not staged, links all-or-none, and puts the old record back when a link fails. A held feature downloads nothing (only manifests). The rejected version stays protected from the vacuum while the record exists. Without --now, it applies at the next boot.
Non-blocking:
- Rollback across a base change. The minimum-image check does not run on rollback (#462), on the reasoning that an older revision needs at most the same base. That holds for base shrinks. It does not hold when a later base dropped something that the older delta expects from the base; the newer delta then carries it, and the older one does not. This is rare and the command is run by a person, so a sentence in the README is enough: "a rollback across an image update can need the older image too".
- The hold is feature-wide. A feature with 2 transfers stays held until every transferred component has a version newer than its rejected one. That is the safe choice; say it in the docs, because a publisher that bumps only one component of a feature keeps the hold.
--nowrefresh. It activates every other pending link too. The warning lists them (#460). Fine for a person at a shell.
Needs a real host (plan "Done when"): after rollback incus, a timer run keeps the old link, and the next published revision is linked automatically. That needs a publication, so I propose a local test catalog on a throwaway VM. Host test plan: see my comment on #462.
Review follow-up (Murbella): a sysext that is merged but not linked is unmerged by the refresh; list it, and tell SDK callers to show the list.
…ature-wide hold and rollback across an image update
|
Blocking: another enabled feature sharing a transfer can bypass its rollback hold. A transfer can legitimately belong to multiple features, for example I reproduced this against commit Please enforce all applicable rollback holds when updating a shared transfer, including enable --now, or refuse ambiguous rollbacks before making changes. Add regression coverage for a shared transfer across two enabled features. The rejected version must not become linked merely because another feature has no rollback record. |
…re failures Review follow-up (bsherman, blocking): a regular file at the link path is hard-linked to a backup before any link moves and renamed back when a later transfer fails; other non-symlink entries are refused up front; restore failures are joined into the returned error.
Review follow-up (bsherman): with ClientConfig.Definitions set, the refresh warning also reads the host's normal definitions.
… into feat/running-linked-status # Conflicts: # .coverage-baseline # updex/features.go
Review follow-up (bsherman, blocking): a transfer named by several features is held by the rollback record of any of them; an unreadable applicable record fails closed; a record is deleted only when every rejected version is behind a link.
|
Fixed in fc62e42 (Lucilla). #458's link-backup fix is merged in f919e10, so
|
|
Follow-up blocking concern on fc62e42: the original rejected-version bypass is fixed, but a sharing feature can still bypass the feature-wide hold and split the rolled-back feature. Reproduction with the existing rollback fixture:
The call succeeds. Its grp results say both components are held at 1.0.0, but processing other subsequently downloads and links alpha 3.0.0. The final links are alpha 3.0.0 and beta 1.0.0, despite the documented feature-wide hold. A focused regression test against fc62e42 fails on the alpha link preservation assertion. collectRollbackHolds retains the applicable record, but holdByRollback checks only the transfers of the feature currently being processed. When processing other, it never checks the beta rejection in grp record. Keeping the record until all components advance does not prevent this partial advancement. Please enforce the whole applicable rollback record before allowing a shared transfer to advance, or refuse this ambiguous sharing arrangement before rollback. Add coverage for a two-transfer rolled-back feature where another enabled feature shares only one transfer and only that transfer has a newer published revision. Cover enable --now through the sharing feature as well. |
Review follow-up (bsherman): when the transfer whose link failed cannot be restored, its result and the returned error carry the restore failure and say that the link may point at the new version.
… into feat/running-linked-status
…ble record can Review follow-up (bsherman, blocking): a feature that shares only some transfers of a rolled-back feature is held while any component of that record is still held, so it cannot split the rolled-back feature.
|
Fixed in 9c9c47e (Lucilla). #458's fix for a failed restore of the failing transfer itself is merged in 131f26c, through
|
|
Follow-up blocking concern on 131f26c: checking publication of every record component still permits a shared transfer to split the rolled-back feature after a download failure. The previous reproduction is fixed, and make verify plus the docs-integrity gate pass. However, I reproduced this additional failure path with the existing newSplitRollbackFixture:
Processing grp stages alpha 3.0.0, fails to download beta, and correctly links neither. But processing other then finds alpha already staged and relinks it to 3.0.0. Final links are alpha 3.0.0 and beta 1.0.0. grp alpha result says not linked while other alpha result reports it installed. The call returns the beta failure, but the rolled-back feature is nevertheless partially advanced. A focused regression test against 131f26c fails on alpha link preservation. rollbackHoldReason establishes only that newer versions are published. It does not establish that all components of the applicable rollback group have successfully staged and can be linked together. Please prevent a sharing feature from advancing a transfer independently after another component of that group fails, or explicitly refuse ambiguous sharing before rollback. Add coverage for this download-failure case, and the analogous partial link failure, so the all-or-none guarantee survives processing another sharing feature. |
…k record names Review follow-up (bsherman, blocking): a sharing feature is held while another feature's rollback record names one of its transfers, so a download or link failure in the owner cannot be bypassed by relinking a staged image through the sharing feature.
|
Fixed in c4f019c (Lucilla). New rule: only the owning feature advances a held group. While a rollback record of feature G exists, only G advances the transfers that the record names. G's transfers link all or none, and G deletes its record only after that link succeeds. Any other feature F that shares such a transfer is held as a whole: nothing is downloaded and no link moves. F reports
Documented limits:
Tests:
I updated the earlier shared-transfer tests to the owner message. |
…tatus # Conflicts: # .coverage-baseline # docs/specs/sdk-api.md # sysext/manager_test.go # updex/features.go
… feat/feature-rollback
# Conflicts: # .coverage-baseline
# Conflicts: # cmd/updex/features_run.go # cmd/updex/features_status_test.go # docs/specs/sdk-api.md # updex/features.go # updex/results.go # updex/status.go
Summary
Stacked on #460 (Phase 3), which is stacked on #458 (Phase 1). This branch contains their commits plus one commit,
feat(rollback): …. Review onlyfeat(rollback): …and the mergedbc4903, which brings in the #460 follow-up and adds 2 README sentences from review: the feature-wide hold, and a rollback across an image update. Merge #458 and then #460 first, then rebase this PR. It targetsmain, because the Tests workflow runs only for PRs intomain. I stacked it because it extends #458's stage-then-link pipeline and vacuum protection, and #460's status output.Phase 4 of plan 0001, which implements ADR-0016, "Rollback" (and the rejected-version item in "Retention").
updex features rollback <name> [--to VERSION] [--now] [--clear] [--dry-run], withClient.RollbackFeature(ctx, name, RollbackFeatureOptions):--to VERSION, every transfer goes to that version. It must be staged and older than the version the transfer rolls back from.linkAllOrNonecode shared with feat(update): keep linked and running images, link a feature's transfers together, add the operation lock #458. A failure also restores the previous record.<RollbackDir>/<feature>(default/var/lib/updex/rollback, the newRuntimePaths.RollbackDirfield).{"format":1,"feature":…,"created":…,"rejected":{"<component>":"<version>"}}, read with a 64 KiB cap and a format check.Lstatchecks. A crash between the two steps leaves only a harmless hold.catalog.ValidateSysextName.installTransfers, sofeatures update, the timer andenable --now):version.Compare), the whole feature is held: nothing is downloaded or linked, and the result isHeldplusRejectedVersion. A hold is not an error, and the run exits 0. The "already staged, relink" branch cannot move the link back to the rejected image, because the hold check runs before the stage step.VacuumPaths.ProtectVersions).--nowrefreshes, with the feat(status): report running and linked sysext versions and warn about pending activations #460 pending-activations warning. Without it, the change takes effect at the next boot.--cleardeletes only the record. A missing record is reported, not an error.rollback_rejectedappears on the per-transfer status and onCheckResult.UpdateAvailableis false while held. The text output showsheld (rejected X)incheckand aHELD BY ROLLBACK:footer inlist.LinkVersionAtandStagedVersionsAt, and an optionalVersionSysextRunnerinterface. A runner without it getsErrLegacySysextRunnerbefore any change.Checks
make fmtmake ci:==> CI gate passedlocally. Coverage is 88.1%, and.coverage-baselineis bumped./var/lib/updexwas not created.updex/rollback_test.go,cmd/updex/features_rollback_test.go,sysext/link_test.go):--to, the multi-transfer default and a second rollback;--clear,--now, a refresh failure, a dry run that writes nothing,ErrBusy, a legacy runner;--dry-run.Risk classification
Rationale:
sysext/**and adds a new root-written state file under/var/lib/updex./var/lib/updex/rollbackand/var/lib/extensions.Lstat, written with a temp file and rename, and the name is validated.features rollback --clearbefore you downgrade.Docs housekeeping
README.md,docs/design/overview.md,docs/specs/sdk-api.md,docs/specs/config-reference.mdandAGENTS.mdupdated (the rollback record, and the rule that every link path must honour it)Verification
node scripts/check-docs.mjsgreenNot verified on a real host. Plan 0001's "Done when" for this phase,
rollback incusfollowed by a timer run, needs one.Known limits:
disable --nowandcatalog removedo not delete a feature's record.rollback --clearworks for a removed feature.