Skip to content

fix(sysext): clean up other-suite images in vacuum and disable - #515

Merged
bketelsen merged 6 commits into
mainfrom
fix/512-other-suite-cleanup
Nov 14, 2026
Merged

bketelsen merged 6 commits into
mainfrom
fix/512-other-suite-cleanup

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #512.

When the images of 2 suites sit in 1 transfer target (<name>_<ver>_13_<arch>.raw and <name>_<ver>_14_<arch>.raw, selected by %w; core Plan 0009 Phase 6), the vacuum and features disable saw only the current suite's files, so the other suite's files stayed on disk without limit.

  • Any-suite patterns (commit 88752b3): config keeps, for each target pattern with %w, a variant in which %w is version.SuiteWildcard (a NUL byte, which no file name and no config text can hold) and every other specifier expands as before (TargetSection.AnySuitePatterns, nil without %w). version.ParseAnySuitePattern turns each wildcard into a group [0-9a-z.~-]+ (no _), all wildcards of 1 name must match the same value, and @v loses _ there, so foo_@v_%w_%a.raw cannot match an image of a component foo_bar. ParsePattern and every existing pattern (a literal @w too) are unchanged.
  • Vacuum (sysext/manager.go planVacuum): the current suite keeps today's rule exactly (InstancesMax, linked, merged, ProtectVersion=, ProtectVersions). Other-suite files keep only the newest image of each other suite, so a switch back can relink without a download. The link target (by file name, also when it is an other-suite file, as right after a switch), the merged images and the legacy CurrentSymlink target are never removed. Everything is read before anything is deleted; a read error deletes nothing.
  • Disable (RemoveAllVersionsAt, called by features disable --now): removes the images of every suite; symlinks are still skipped.
  • Merged other-suite images: features disable refuses without --force when an image of another suite is active (sysext.ActiveOtherSuiteWith: CurrentSymlink, the origin path, a versioned name in extensions, /run/extensions; a read error means merge state unknown), before any write, unmerge or delete. The vacuum decides the merged image per extension: when the metadata names the component but its own origin entry gives no image path (metadata that names only the extension), it keeps every other-suite image (VacuumReport.OtherSuiteMergedUnknown). An Lstat/Readlink error on CurrentSymlink stops the vacuum before any delete.
  • A transfer without %w gets no new behavior; a host with only its own suite's files gets the same result as before (TestVacuumWithOwnSuiteOnlyUnchanged).

The retention rule is recorded in AGENTS.md ("Feature install and retention"), docs/design/overview.md, docs/specs/config-reference.md and docs/specs/cli-reference.md.

Checks

  • make fmt
  • make ci — green locally (coverage 90.8%; .coverage-baseline raised to 90.8)
  • CLI/e2e changes: covered by make ci
  • New or changed behavior has focused tests, including failure paths

Risk tier

  • Tier 1: Low
  • Tier 2: Moderate
  • Tier 3: High
  • Tier 4: Critical

Rationale: the PR touches L1 paths of .github/risk-paths.json:

  • sysext/** (sysext/manager.go, sysext/other_suite_test.go): the vacuum and the remove delete files as root. Safe: the current-suite rule is unchanged; other-suite deletion keeps the newest image per suite, the link target, the merged images and the CurrentSymlink target, and keeps every other-suite image when the merged image cannot be identified; the plan is read in full before any delete and fails without deleting on a read error.
  • config/transfer.go: adds the any-suite variant; MatchPatterns expansion is byte-identical.
  • updex/{install,features}.go (not risk paths): pass and report the new removals, and add the disable guard for merged other-suite images; no new link path.

Docs housekeeping

  • docs/design/overview.md, docs/specs/*, AGENTS.md updated
  • Conformance aliases untouched

Verification

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.
A transfer that selects its suite with %w (os-release VERSION_ID) saw only
the running suite's images. After a suite switch (bootc switch, trixie 13
to forky 14) the vacuum kept every image of the old suite for ever, and
`features disable --now` left them on disk (#512).

The vacuum keeps the running suite's rule unchanged (InstancesMax, linked,
merged, ProtectVersion=, ProtectVersions). An image that an any-suite
pattern (TargetSection.AnySuitePatterns) matches and no current pattern
matches is an other-suite image: for each other suite the vacuum keeps the
newest version, so a switch back can link it without a download, and
removes the older ones. It never removes the other-suite image the sysext
link points to (by base name; right after a switch the link still points
there), an image the merged state records, or a legacy CurrentSymlink
target. It reads them before it deletes anything and fails closed on a read
error. Only regular files count.

RemoveAllVersionsAt also removes every other-suite image that is a regular
file, so a disabled feature leaves no image of any suite.

VacuumWithReport and PlanVacuumWithReport return the other-suite lists;
VacuumWith and PlanVacuumWith keep their signatures. A real update prints
each other-suite removal; a dry run reports them in
UpdateResult.RemovedOtherSuiteImages and in its message. A transfer
without %w gets no new behavior and the same output.

Fixes #512
@github-actions github-actions Bot added documentation Improvements or additions to documentation go Pull requests that update go code labels Nov 13, 2026
@github-actions github-actions Bot added level:L1 Read every line risk:high Touches a path in .github/risk-paths.json labels Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.33180% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sysext/manager.go 85.71% 20 Missing and 8 partials ⚠️
updex/features.go 73.33% 3 Missing and 1 partial ⚠️
updex/install.go 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Review fixes for the other-suite cleanup (#512):

- The disable guard recognizes every suite that the removal matches.
  RemoveAllVersionsAt removes the images of every suite, but the guard
  (GetActiveVersionWith) saw only the running suite's patterns, so a
  merged image of another suite was removed without --force. The new
  sysext.ActiveOtherSuiteWith checks the same signals with the any-suite
  patterns: a legacy CurrentSymlink target, an origin path, a versioned
  name in the extensions list and /run/extensions. DisableFeature{Now}
  calls it after GetActiveVersionWith; an image it finds needs --force
  ("<component> (image <file> of another suite)"), and a read error is
  "merge state unknown". The refusal comes before any write, unmerge or
  delete.
- Older merged metadata (systemd < 258) has no origin and lists only the
  extension name (foo). The vacuum then protected foo.raw, which is no
  staged image, and could delete the other-suite image that is merged.
  When a hierarchy's metadata names the component but no image file of
  the transfer, the vacuum now keeps every other-suite image and reports
  VacuumReport.OtherSuiteMergedUnknown; updates print it. The running
  suite's rule does not change.
- The CurrentSymlink read of the other-suite vacuum skips only an absent
  path or a path that is not a symlink; any other Lstat or Readlink error
  fails the vacuum before it deletes anything.

Each finding has a record in .memory/corrections/ (core ADR-0081) that
names its guard test.

Refs #512
The other-suite vacuum decided per hierarchy whether the merged state
names the image of the transfer's extension. A bare `foo` entry (systemd
older than 258 writes only extension names) left foo's image unknown, but
any other entry that matched the pattern resolved it: with
`foo_bar_9.0_14_x86-64` in the list (it matches foo_@v_14_x86-64.raw as
version bar_9.0), the vacuum could delete a merged foo_1.0_13_x86-64.raw.

The decision is now per extension identity: the image of the extension
t.Component is unknown when an origin key or a bare extensions entry names
it and origin gives that same key no path whose base name is an image of
the transfer. Another entry never resolves it. While it is unknown, the
vacuum keeps every other-suite image (OtherSuiteMergedUnknown). The
running suite's rule and the protected names do not change.

The disable guard has no such mix: GetActiveVersionWith and
ActiveOtherSuiteWith only report an image as active, so any matching
entry refuses without --force; TestDisableFeatureNow_RefusesMixedMergedMetadata
pins that.

Refs #512
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record

  • Reviewer: openai/gpt-6.1-sol (coder: anthropic/claude-opus-5-5)
  • Base: 6d399badd5fc0267de8892dfccabbd1ec7dab54a
  • Initial review at cb746f6c10d4e58ac3e576f6ba40c86c8af7be57: Not ready, 3 blocking findings, all accepted:
    1. The disable guard did not see a merged image of another suite → sysext.ActiveOtherSuiteWith; disable refuses without --force before any write, unmerge or delete.
    2. Metadata that names only the component did not protect other-suite images → the vacuum keeps every other-suite image (OtherSuiteMergedUnknown).
    3. CurrentSymlink read errors were ignored → any error except absent / not a symlink stops the vacuum before any delete.
  • Re-review 1 at d157992160f0e02741d0f87d5b7bbc586a95ca0e: Not ready, 1 blocking finding, accepted: the merged image was decided for the whole hierarchy, so an unrelated matching entry could cancel the protection → decided per extension identity.
  • Re-review 2 at bb9c272150fddc58511469340d6fb92ba0b56ad9: Ready. Findings: none. Blocking: none.

Guards (each fails with its fix reverted; 1 .memory/corrections/2026-11-13-pr-515-*.json record each):

  • TestDisableFeatureNow_RefusesMergedOtherSuiteImage/{origin_path,versioned_name_in_the_extensions_list}
  • TestVacuumWithComponentOnlyMetadataKeepsOtherSuites
  • TestVacuumWithOtherSuiteFailsClosedOnCurrentSymlink/inspection_failure
  • TestVacuumWithMixedMetadataKeepsOtherSuites (4 cases)

Checks: make ci green locally at the head (coverage 90.8%, .coverage-baseline raised to match); all CI checks green at bb9c272.

Merge order: merge this PR before #516, which carries an identical copy of commit 88752b3 and is rebased after this merges.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@github-actions

Copy link
Copy Markdown

ready-for-human came off: CI at bb9c272150fd was not green when the label came. Add the label again when every check passes at this head.

@github-actions github-actions Bot removed the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
@github-actions github-actions Bot removed the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 13, 2026
bketelsen pushed a commit to frostyard/core that referenced this pull request Nov 14, 2026
…ess step (#246)

* fix(pr-triage): count only the newest run of each check in the readiness step

filter=latest gives the latest check run per check suite, and each
workflow run is its own check suite. A run that a newer workflow run of
the same check cancelled stayed in the list, so the readiness step saw
a cancelled check and removed ready-for-human although every check was
green (frostyard/updex#515 at bb9c272).

The step now keeps only the newest run (highest id) of each check name
and app. A cancelled, failed or unfinished newest run still counts as
not green.

* chore(memory): record the newest-check-run correction (ADR-0081)

* docs(specs): name the app fallback and the safe-integer id in pr-triage rule D

---------

Co-authored-by: frostyard-machines <[email protected]>
This was referenced Nov 14, 2026
…leanup

# Conflicts:
#	config/transfer.go
#	config/transfer_test.go
#	docs/specs/config-reference.md
#	updex/install.go
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review record: merge of main

Checks: make ci green locally at e2f3ae4 (coverage 90.7%, floor 90.3%); all CI checks green at e2f3ae4.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 14, 2026
@bketelsen
bketelsen added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit a8d3e2e Nov 14, 2026
25 checks passed
@bketelsen
bketelsen deleted the fix/512-other-suite-cleanup branch November 14, 2026 00:24
bketelsen pushed a commit to frostyard/frostyard-org that referenced this pull request Nov 15, 2026
* docs: follow Updex v2.3.1 in the Updex guide

The v2.3.1 README (frostyard/updex#510) no longer has the sections the
guide deep-linked. Point those links to docs/specs/cli-reference.md and
docs/specs/config-reference.md at v2.3.1, and add short lines for the
suite-switch unit, the other-suite cleanup, and the empty-specifier error
(frostyard/updex#515, #516, #518, #519). check-site.mjs now pins the
v2.3.1 sources and refuses a README deep link.

* docs: state what the other-suite cleanup keeps in the Updex guide

The vacuum keeps the newest image of each other suite, the linked image
and a merged image, and keeps every other-suite image on systemd older
than 258 while the feature is merged (updex v2.3.1 cli-reference, "What
the vacuum keeps"). check-site.mjs asserts both conditions; the record
is .memory/corrections/2026-11-14-pr-126-other-suite-vacuum-claim.json.

---------

Co-authored-by: frostyard-machines <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation go Pull requests that update go code level:L1 Read every line ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vacuum and disable leave the other suite's sysext files on disk Suite switch: a sysext is missing until the 2nd boot, and an empty %w fails silently

2 participants