Skip to content

feat(service): carry the portable lifecycle fields into the render context - #59

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/carry-portable-service-fields
Aug 28, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/carry-portable-service-fields

Conversation

@atrawog

@atrawog atrawog commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The consumer half of #58, and the second leg of batch B2.

#58 made type, requires, restart_sec, watchdog_sec and unit_options authorable on a
#CandyService. But BuildServiceRenderContext — the pure ServiceEntry → render-context
projection every init template renders against — dropped them, so nothing could reach a template.
The schema said yes and the renderer never saw it.

They are now carried verbatim, like the start hooks and for the same reason: each is an init-level
directive value, not a path to expand or an ordering list to merge.

How tested

Coverage that fails without the change

$ git stash && go test -count=1 ./spec/ -run TestBuildServiceRenderContextCarriesPortableFields
--- FAIL: TestBuildServiceRenderContextCarriesPortableFields (0.00s)
    Type = "", want notify — systemd Type= is unreachable
    Requires = [], want both entries — a hard dependency is unreachable
    RestartSec = "", want 5s

Two tests, and the second is the one that makes "purely additive" checkable rather than merely
claimed:

  • The fields survive the projection, including unit_options' list form. systemd needs that
    for repeatable directives such as RuntimeDirectory=; collapsing it to a scalar would emit one
    unusable value instead of two lines, so the element type is asserted, not just the key.
  • An entry setting none of them leaves the context zero, so an existing candy renders
    byte-identically. Without this, "additive" would rest on inspection.

Gates

$ go test ./...
18 packages ok, 0 failures
$ golangci-lint run
0 issues.

Rulebook compliance

  • R0 — /charly-image:layer (the service: schema and init polymorphism) loaded before editing.
  • R1 — no anomaly. The $TMPDIR tests that fail from a /tmp checkout were diagnosed in fix(box): make openrc selectable via #Box.init #57;
    this suite is run from outside /tmp.
  • R2 — nothing deferred.
  • R3 — one projection, extended; no second copy of the entry→context mapping (the dead
    duplicate that used to exist in deploykit was removed in sdk#175).
  • R4 — no workaround: the fields pass through rather than being special-cased per init.
  • R5 — N/A — nothing removed.
  • R6 — git status checked; branch off fresh main; no force-push, no bypass.
  • R7/R10 — N/A for a projection with no runtime path of its own; nothing renders these fields
    until the template legs land, which is why the tier is capped.
  • R8 — N/A — no emitted-artifact change yet; the context is an in-process value.
  • B12 — coverage fails without the change, verified by reverting rather than by inspection.
  • B13 — N/A — no CUE change in this leg; feat(service): portable lifecycle fields + the unit_options escape hatch #58 owns the schema and its regeneration.
  • B16 — no pin moved.

Change classification

  • Class: runtime/code change — the service render-context projection.
  • Verification gate: module suite + lint + revert-controlled coverage.
  • Attribution tier: analysed on a live system — the projection is exercised directly, but no
    template reads the fields yet, so there is no rendered output to prove.

Not covered — what still makes these fields inert

plugin-init + charly: the templates. systemd needs Type=, Requires=, RestartSec=,
WatchdogSec= and a range over unit_options.systemd; OpenRC needs need in its depend() block,
--respawn-delay and --healthcheck-timer. Until that lands, these fields are authorable, carried,
and rendered nowhere — which is exactly why this PR claims nothing about emitted units.

B2's third item, wait_for:, remains its own unit, as set out in #58: nine hand-rolled
while [ ! -e "$SOCKET" ] loops exist today, and the honest gate for replacing them is deleting that
duplication with the affected beds staying green.

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

…ntext

The consumer half of spec#58. Those fields were authorable on a #CandyService but
BuildServiceRenderContext - the pure entry -> context projection every init
template renders against - dropped them, so nothing could reach a template. The
schema said yes and the renderer never saw it.

Carried verbatim, like the start hooks and for the same reason: each is an
init-level directive value, not a path to expand or an ordering list to merge.

Two tests, both revert-controlled:

  - the fields survive the projection, including unit_options' LIST form, which
    systemd needs for repeatable directives like RuntimeDirectory= - collapsing it
    to a scalar would emit one unusable value instead of two lines.
  - an entry setting NONE of them leaves the context's fields zero, so an existing
    candy renders byte-identically. That is the assertion that makes "purely
    additive" checkable rather than asserted.

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

Review — PASS

Head SHA: f24abbcd970a7065cb09b53040898e8dbc5bfe4d (branch: feat/portable-lifecycle-fields)

Security screen: PASS — no scope mismatch (carries exactly the five fields claimed), no secrets/network/egress, no weakened guardrails, no new deps, no embedded directives.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body is complete: summary accounts for both files, How-tested names the gate (module suite + lint + revert-controlled coverage) with pasted output, every rulebook rule answered, tier analysed on a live system honestly capped (no template reads the fields yet) and matching the footer. R10 N/A is legitimate: this is a pure projection with no runtime path, so no bed could exercise it; the revert-controlled unit tests provide the coverage and the tier is not inflated.
  • B5/B6/B7/B8 — No warnings, nothing deferred (wait_for routed to named B2 item), no duplication (single projection extended), no workarounds.
  • B12 — Tests fail without the change (revert-verified) and the second test proves "additive" by asserting zero-context when fields are absent.
  • B16 — placement: CORRECT. The projection lives in spec/ where the render-context shape belongs; no alias files, no new sdk imports, no capability pulled into core.
  • B18 — gofmt-clean, no visible lint issues, clear test names.

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:22
@github-actions
github-actions Bot merged commit 6888658 into main Aug 28, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 28, 2026
charly-auto-merge Bot added a commit that referenced this pull request Aug 28, 2026
@aitrawog
aitrawog deleted the feat/carry-portable-service-fields branch September 25, 2026 19:09
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