Skip to content

Fix: scope the systemd-analyze assertion to the unit under test (unblocks CI) - #608

Merged
cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/systemd-analyze-ubuntu26
Oct 26, 2026
Merged

cwiklik merged 1 commit into
rossoctl:mainfrom
cwiklik:fix/systemd-analyze-ubuntu26

Conversation

@cwiklik

@cwiklik cwiklik commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

deploy-scripts fails on every PR since the ubuntu-latest runner moved to Ubuntu 26 — the migration GitHub annotates on each run as beginning 2026-10-19. It is not a product defect; the test reads the runner image's own units as ours.

FAIL: systemd-analyze verify microvm-worker.service reports nothing about the unit itself
(want '', got '/usr/lib/systemd/system/walinuxagent.service:21:
 Support for option CPUAccounting= has been removed and it is ignored')

walinuxagent, xfs_scrub_all and system-xfs_scrub are Azure runner-image units. systemd-analyze verify reports on units it pulls in transitively, and systemd 258 removed CPUAccounting=, so a stock runner now emits three warnings about itself. The assertion excused exactly one known host-fact diagnostic (is not executable: No such file or directory) and required everything else to be empty — so the host's own warnings landed as our failure.

The fix

Filter to lines naming the unit being verified — which is what the check already claims to measure ("reports nothing about the unit itself") — through one helper used at both call sites (microvm-worker.service, moca-egress.service).

This narrows the filter to the stated intent rather than loosening it. The comment above the check already records that an unconditional version was red on every PR and got deleted once; leaving it sensitive to host upgrades invites that a second time.

Verification

Run on real systemd 259 (ubuntu:26.04), not inferred — macOS has no systemd-analyze, so this check self-skips locally and the local suite could not have caught it:

Case Result
Suite on Ubuntu 26, stock PASS
Seed a foreign CPUAccounting= unit + After= on it, pre-fix code FAILs with the CI message verbatim
Same seeded host, with this fix passes
Seeded defects in our own unit — unknown key, unparsable boolean, failed load all still caught, alone and buried in the noise
The known ExecStart host fact still excused (behaviour preserved)

shellcheck -S warning: clean.

Why separate

Found while addressing review on #607, which it blocks. Split out because it is CI infrastructure for deploy/microvm, unrelated to that PR's deploy/vm Redis change, and it unblocks #605 and everything after it too.

Assisted-By: Claude

`deploy-scripts` is red on every PR since the ubuntu-latest runner moved to
Ubuntu 26 (the migration GitHub annotates on each run as starting 2026-10-19):

  FAIL: systemd-analyze verify microvm-worker.service reports nothing about
  the unit itself (want '', got '/usr/lib/systemd/system/walinuxagent.service:21:
  Support for option CPUAccounting= has been removed and it is ignored')

walinuxagent, xfs_scrub_all and system-xfs_scrub are the runner image's OWN
units. `systemd-analyze verify` reports on units it pulls in transitively, and
systemd 258 dropped CPUAccounting=, so a stock runner now emits three warnings
that have nothing to do with us. The assertion excused exactly one known
host-fact diagnostic and demanded the rest be empty, so it read the runner's
units as our defect.

Filter on lines naming the unit being verified, which is what the check already
claims to measure ("reports nothing about the unit itself"), via one helper used
at both call sites. This keeps the check meaningful instead of loosening it --
and the comment above it already records that an unconditional version went red
on every PR and got deleted once; a host-upgrade-sensitive one invites that again.

Verified on real systemd 259 (ubuntu:26.04), not just by reading: seeding a
foreign CPUAccounting= unit and an After= on it reproduces the CI failure
verbatim against the pre-fix code and passes with this change, while seeded
defects in our own unit (unknown key, unparsable value, failed load) are still
caught, alone and buried in the noise.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
@cwiklik
cwiklik requested a review from pdettori as a code owner October 26, 2026 13:52
@cwiklik cwiklik added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 26, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This scopes the systemd-analyze verify diagnostics assertion to lines naming the unit under test, through one unit_diagnostics helper used at both call sites. That fixes the deploy-scripts failure caused by the Ubuntu 26 / systemd 258 runner image units (walinuxagent CPUAccounting=). The change matches the check's stated intent ("about the unit itself"), keeps the existing ExecStart host-fact exemption, and leaves the slice exit-status assertion unchanged. One non-blocking nit is inline.

Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell (test), CI
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (all 14 checks green, including deploy-scripts)

# unfiltered assertion reads those as our problem and goes red on every PR -- the exact
# failure mode the comment above says got this check deleted once already.
unit_diagnostics() { # <verify output> <unit path>
printf '%s\n' "$1" | grep -F "$(basename "$2")" |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The basename filter also drops verify output that names no unit at all, e.g. manager-level failures such as Failed to initialize manager or Failed to setup .... On CI the service exit status is not asserted (the ExecStart binary isn't installed), so that class of failure would now pass silently, where before it failed. This is narrow and not blocking. If you want to close it, you could also fail on lines that name no .service/.slice/.target unit, or assert sa_rc is 0 or 1 here. Either would keep the host-unit noise out without making the check unable to fail.

@cwiklik
cwiklik merged commit d8bc58b into rossoctl:main Oct 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants