Skip to content

feat(init): let a candy ship socket/target/timer/path/slice units to systemd - #419

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/systemd-unit-types
Aug 28, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/systemd-unit-types

Conversation

@atrawog

@atrawog atrawog commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Batch B1's last item, and the half that had to wait for opencharly/sdk#176.

systemd's candy_file: listed only *.service, and its assembly_template hardcoded that same
extension twice:

cp /systemd/*.service /usr/lib/systemd/user/ && \
for svc in /systemd/*.service; do systemctl --global enable "$(basename "$svc")"; done

The pair agreed only because both were frozen. A candy could not ship a .socket, .target or
.slice at all — and widening either side alone would have been worse than leaving it: widening
candy_file: stages units the copy never installs; widening the copy installs units nothing
collected. So both move together here.

candy_file: now claims .service .socket .target .timer .path .slice, and the assembly
copies every staged unit, then enables only the types systemd can enable.

Two details that are asserted rather than merely commented:

  • .slice is claimed but never enabled. A slice is a resource container referenced by other
    units' Slice=; systemctl enable on one is an error, not a no-op.
  • The enable loop carries an existence guard. An unmatched glob stays literal in sh, so without
    [ -e "$unit" ] || continue a candy shipping only services would fail the build on
    systemctl enable '/systemd/*.socket'.

This is inert without sdk#176, which made candy_file: honoured at all (the candy scan is
init-agnostic, so the patterns are globbed at the point of use). The sdk pin moves to
v0.2026240.1542, which also carries #177's fix for the depends_candy false positive #176
introduced.

Why this matters beyond tidiness

cstream's session layer needs exactly the unit types that were unreachable — a .socket for the
socket-activated broker, a .target for the session, and a .slice drop-in. Before this, those had
to be hand-written with write: + command: systemctl daemon-reload && enable, which is the R4
violation batch B4 exists to remove.

How tested

Coverage that fails without the change

TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls guards the pair that has to stay
consistent — what candy_file: claims versus what the assembly copies and enables. Against the
pre-change vocabulary:

--- FAIL: TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls
    systemd candy_file: does not claim .socket — a candy shipping one is silently
      ignored, because the glob happens at the point of use
    systemd candy_file: does not claim .target — …
    the assembly still copies only *.service, so every other claimed unit type is
      staged and then never installed
    the assembly never enables .socket units, though candy_file: claims them
    the assembly never enables .target units, though candy_file: claims them

Verified by reverting charly.yml and re-running, not by inspection.

Module gates

$ go test ./charly/...
T=0
$ golangci-lint run          # in charly/
0 issues.

Fresh-rebuild R10 on a disposable bed, from the committed tree

The assembly template every systemd image renders through changed, and the sdk pin moved, so the bed
was re-run with the binary built from the final commit:

$ charly check run check-service-render-pod
check run check-service-render-pod: PASS (steps=13)
EXIT=0

Rulebook compliance

  • R0 — /charly-image:layer (init polymorphism, service:/candy_file:) and
    /charly-check:check loaded before editing.
  • R1 — no anomaly went unexplained; the depends_candy false positive observed while testing
    this change was root-caused and fixed in sdk#177 before this leg landed, not worked around here.
  • R2 — nothing deferred.
  • R3 — the claimed set and the installed set are now derived from one declaration, where there
    were two hardcoded copies of *.service.
  • R4 — the existence guard replaces what would otherwise be a "just don't ship only services"
    caveat; no sleeps, retries or environment-specific shims.
  • R5 — the hardcoded *.service copy is deleted, not left beside the new loop
    (git grep 'cp /systemd/\*.service' returns nothing).
  • R6 — git status checked; branch off fresh main; no force-push, no bypass.
  • R7/R10 — proven on a fresh-rebuild disposable bed from the committed tree.
  • R8 — the emitted artifact is the assembly RUN line, asserted directly by the guard test.
  • R9 — the bed ran the CalVer-stamped task build:binary output.
  • B13 — N/A — no CUE change here; #Box.init's enum widening was the spec leg
    (opencharly/spec#57, merged).
  • B16 — the sdk pin moves to an already-merged, already-tagged sibling leg.

Change classification

  • Class: runtime/config change — init vocabulary data (candy_file: + assembly_template) plus
    a pin bump.
  • Verification gate: module suite + lint + guard test with a revert control + fresh-rebuild bed.
  • Attribution tier: analysed on a live system. The supervisord path ran a full green R10
    and the vocabulary/assembly consistency is asserted directly, but no bed deploys a systemd
    image
    , so a candy actually shipping a .socket is not proven installed end to end. Claiming
    fully tested and validated would paper over that; closing it is what the cstream VM bed is for.

Not covered

  • B1 is complete with this leg, across five repos: sdk#175 (render context + #Box.init),
    plugin-init#2 (stdout mappers), charly#418 (quoting + stdout), sdk#176 (candy_file:),
    spec#57 (enum), and this.
  • No systemd bed exists. init: systemd on a container also requires the preserve_user
    capability and a candy that triggers the init, so a box declaring it still resolves supervisord
    today — correct behaviour (ResolveInitSystem ignores an untriggered explicit init), but it means
    the systemd file_copy path has no live coverage anywhere in the corpus. That gap is the cstream
    VM bed's job.

Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)

…systemd

B1's last item, and the half that had to wait for sdk#176.

systemd's candy_file: listed only *.service, and its assembly_template hardcoded
that same extension TWICE:

    cp /systemd/*.service /usr/lib/systemd/user/ && \
    for svc in /systemd/*.service; do systemctl --global enable ...; done

The pair agreed only because both were frozen. A candy could not ship a .socket,
.target or .slice at all - and widening either side alone would have been worse
than leaving it: widening candy_file: would stage units the copy never installs,
widening the copy would install units nothing collected.

Both move together now. candy_file: claims .service/.socket/.target/.timer/.path/
.slice, and the assembly copies EVERY staged unit, then enables only the types
systemd can enable.

.slice is claimed but deliberately NOT enabled: a slice is a resource container
referenced by other units' Slice=, and `systemctl enable` on one is an error, not
a no-op. That distinction is asserted, not just commented.

The enable loop carries an existence guard because an unmatched glob stays literal
in sh - without it, a candy shipping only services would fail the build on
`systemctl enable '/systemd/*.socket'`.

This is inert without sdk#176, which made candy_file: honoured at all (the scan is
init-agnostic, so the patterns are globbed at the point of use). The sdk pin moves
to v0.2026240.1542, which also carries #177's fix for the depends_candy
false positive that #176 introduced.

TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls guards the pair that has to
stay consistent - what candy_file: claims versus what the assembly copies and
enables - so neither side can drift again. Verified to fail on the pre-change
vocabulary rather than assumed.

Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)

Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq
@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 2b1340786b38 (branch: feat/init-systemd-unit-types)

Security screen: PASS — no scope mismatch (description accounts for all 4 files), no secrets/exfiltration, no weakened guardrails; the sdk pin bump (v0.2026240.1439→v0.2026240.1542) is a legitimate sibling-leg dependency update with matching go.sum entries.

Checklist: All applicable rules PASS or NA.

  • A1/A3 — Body is complete: summary accounts for every diff item, How-tested names the gate, disposable target (check-service-render-pod), fresh-rebuild confirmation, pasted output, and the attribution footer *Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)* is in the exact required form. The tier analysed on a live system is correctly justified — the body honestly states no systemd bed exists, so the changed systemd path never ran live, and it does not inflate to fully tested and validated.
  • A2/R10 — Runtime/config change with a fresh-rebuild disposable bed run (PASS (steps=13) EXIT=0). The bed exercises the supervisord path, not the systemd path; the body is transparent about this gap and compensates with a guard test (TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls) that directly asserts the changed assembly template and fails against the pre-change vocabulary (verified by revert control). The test coverage requirement is met.
  • R1 — No unexplained warnings; the depends_candy false positive was root-caused and fixed in sdk#177, not worked around.
  • R2 — Nothing deferred; the systemd-bed gap is a pre-existing corpus gap, named to the cstream VM bed (specific, not a vague follow-up).
  • R3/R5 — The duplicated *.service hardcoding is removed; git grep 'cp /systemd/\*.service' returns nothing.
  • R4 — The [ -e "$unit" ] || continue existence guard is a legitimate sh-glob fix, not a workaround.
  • R6/R8/R9 — git status checked; the assembly RUN line is asserted directly by the guard test; the bed ran the CalVer-stamped binary.
  • B13 — N/A (no CUE/candy change); B15 — single atomic commit; B16 — placement CORRECT (init vocabulary data + dependency pin, no capability code into core, no alias files, no new core imports); B17 — disposable target named; B18 — test code is clean and gofmt-consistent.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 28, 2026 16:08
@github-actions
github-actions Bot merged commit 84da038 into main Aug 28, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 28, 2026
@aitrawog
aitrawog deleted the feat/systemd-unit-types branch September 25, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant