Skip to content

feat(init): lower wait_for in all three init templates - #421

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/wait-for-lowering
Aug 28, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/wait-for-lowering

Conversation

@atrawog

@atrawog atrawog commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The charly (template-data) leg that makes wait_for actually hold a service back — and the last
piece of batch B2. spec#60 made it authorable and carried it; plugin-init#4 built the
lowering; until the templates call it, a declared wait_for did nothing at all.

Each init lowers it in its own idiom:

init lowering
systemd ExecStartPre=/bin/sh -c '<wait>', ahead of the authored exec_start_pre hooks
supervisord command=/bin/sh -c '<wait>; exec <original>'
OpenRC start_pre() { <wait>; }

Two of those placements are load-bearing rather than stylistic:

  • systemd, before the authored hooks — readiness is a precondition of those hooks, not a peer.
  • supervisord, exec in the same process — supervisord has no pre-exec, so the wait runs inline
    and exec hands the PID to the real daemon. Without exec, supervisord would track the shell,
    and its process supervision and signal delivery would both target the wrong process.

A service declaring no wait_for renders byte-identically: every branch sits inside {{if}},
and waitForScript returns "" for nil.

How tested

Live, on a bed built to fail without this

The bed is discriminating, not decorative:

  • waiter refuses to run when /tmp/late.sock is absent, and declares start_retry: 0, so a
    premature start is permanent — not retried into a false pass.
  • late-socket creates that socket only after 8 seconds.

So reaching RUNNING is possible only because the declared wait held the start back:

$ charly check run check-wait-for-pod
PASS  the waiter refuses to start without the socket, which is what makes the bed discriminating
PASS  the supervisord fragment lowers wait_for into a pre-exec ahead of the command
PASS  the service that waits for a late socket reached RUNNING
check run check-wait-for-pod: PASS (steps=13)
EXIT=0

Re-run from the committed tree with the binary rebuilt from the final commit — same result,
including the update destroy-and-rebuild leg.

The systemd rendering

ExecStartPre=/bin/sh -c 'n=0; until [ -e "${XDG_RUNTIME_DIR}/wayland-1" ]; do n=$((n+1)); if [ "$n" -ge 30 ]; then echo "wait_for: timed out after 30s waiting for: ${XDG_RUNTIME_DIR}/wayland-1" >&2; exit 1; fi; sleep 1; done'

That is pod-labwc/labwc-wrapper's loop as a declaration — with the timeout it declares actually
honoured. The wrapper says TIMEOUT=30 and waits 15.

Module gates

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

Pins

spec → v0.2026240.1719, plugin-init/candy/plugin-init → v0.2026240.1727. Both merged and
tagged.

A third stub, same reasoning

TestEmbeddedVocab_OpenRCIsAFirstClassInit parses the OpenRC template with an explicit func map;
waitForScript is the third custom function to appear there. Stubbed, not reimplemented — the
lowering is owned by candy/plugin-init and pinned by its TestWaitForScript; a second copy here
could drift from the one the renderer uses.

Rulebook compliance

  • R0 — /charly-image:layer and /charly-check:check loaded before editing.
  • R1 — no anomaly; the vocab-test failure pattern from the previous two legs was anticipated and
    handled the same way.
  • R2 — nothing deferred.
  • R3 — one lowering, three placements; the shell is written once in plugin-init, not thrice in
    templates.
  • R4 — this is the R4 payoff: a declared, bounded, supervised wait replaces hand-rolled sleeps
    and hardcoded timeouts.
  • R5 — N/A here; the nine wrappers are consumers, deleted when they migrate (below).
  • 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, output pasted, with
    coverage that fails without the change by construction.
  • R8 — the emitted artifacts are asserted: the supervisord fragment is grepped in-container,
    and the systemd unit text is pasted.
  • R9 — the bed ran the CalVer-stamped task build:binary output.
  • B13 — N/A — no CUE change in this leg.
  • B16 — both pins move to merged, tagged releases.

Change classification

  • Class: runtime/config change — init service-render templates (data) + two pin bumps.
  • Verification gate: module suite + lint + in-container artifact assertion + a fresh-rebuild
    disposable bed that fails without the change.
  • Attribution tier: fully tested and validated — for the supervisord path, which is what
    the bed deploys: the changed branch executes live and the bed cannot pass without it. See
    Not covered for the honest limit.

Not covered

  • systemd and OpenRC are proven to render, not to run. No bed in the corpus deploys either init,
    so ExecStartPre= and start_pre() are asserted at the artifact level only. That is the same gap
    the cstream VM bed exists to close, and it is why the tier above is scoped to supervisord rather
    than claimed across all three.
  • Migrating the nine existing wrappers (labwc, kde-selkies ×2, chrome-cdp, wayvnc ×3, swaync,
    waybar, waybar-labwc, sway) is its own unit. Their honest gate is check-selkies-labwc-pod and
    friends staying green while the loops are deleted — beds that build pixelflux from source and
    Chrome from the AUR. Bundling an unrunnable gate here would make this cutover unprovable;
    pod-labwc's 30-vs-15 timeout is that unit's first fix.

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

The charly (template-data) leg that makes wait_for actually hold a service back.
spec#60 made it authorable and carried it; plugin-init#4 built the lowering; until
the templates call it, a declared wait_for did nothing at all.

Each init lowers it in its own idiom, which is the point - the wait is SUPERVISED,
so a timeout fails the unit and surfaces in its status instead of a wrapper exiting
and looking like the daemon crashed:

  systemd      ExecStartPre=/bin/sh -c '<wait>'   ahead of the authored
               exec_start_pre hooks, because readiness is a precondition of those
               hooks too
  supervisord  command=/bin/sh -c '<wait>; exec <original>' - supervisord has no
               pre-exec, so the wait runs in the same process and `exec` hands the
               PID to the real daemon, keeping supervisord's process tracking and
               signal delivery intact
  openrc       start_pre() { <wait>; }

A service that declares no wait_for renders byte-identically: every branch is
inside {{if}}, and waitForScript returns "" for nil.

Proven live on a disposable bed, and the bed is DISCRIMINATING rather than
decorative: `waiter` refuses to run when its socket is absent and declares
start_retry: 0, so a premature start is permanent. `late-socket` creates the
socket only after 8 seconds. Reaching RUNNING is therefore possible only because
the declared wait held the start back:

    PASS  the waiter refuses to start without the socket, which is what makes the
          bed discriminating
    PASS  the supervisord fragment lowers wait_for into a pre-exec ahead of the
          command
    PASS  the service that waits for a late socket reached RUNNING
    check run check-wait-for-pod: PASS (steps=13)

Pins move to spec v0.2026240.1719 and plugin-init v0.2026240.1727.

TestEmbeddedVocab_OpenRCIsAFirstClassInit gains its third stub. Stubbed, not
reimplemented: the lowering is owned by candy/plugin-init and pinned by its
TestWaitForScript, and a second copy here could drift from the one the renderer
uses.

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

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

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: f2555b16cbfb5da5ec62bc28361196e17de307f6 (branch: feat/init-lower-wait-for)

Security screen: PASS — no scope mismatch (all 4 files accounted for in the body), no secrets/exfiltration, no weakened guardrails, no suspicious supply-chain changes (both pins bump to same-day merged/tagged releases, consistent across go.mod/go.sum).

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body is complete with Summary, How tested (pasted bed + module-gate output), Pins, Rulebook compliance, Change classification, and the required *Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)* footer. Change class (runtime/config) matches the gate: fresh-rebuild disposable bed check-wait-for-pod with pasted output, discriminating by construction (waiter refuses to start without socket, start_retry: 0, 8s late socket). Tier is honestly scoped to the supervisord path; systemd/OpenRC are asserted at artifact level with the limitation explicitly disclosed.
  • B4–B12 — R0 skills loaded; R1 zero warnings in pasted output; R2 wrapper migration named as its own unit with specific gate beds and first fix (not a vague follow-up); R3 one lowering in plugin-init, three placements; R4 payoff (declared wait replaces hand-rolled sleeps); R6/R8/R9 asserted; R10 coverage fails-without-the-change by construction.
  • B13 — No CUE change; test stub is a legitimate render-time stub (owned by plugin-init), not a generated-file hand-edit.
  • B14/B15 — No forbidden framing; single atomic commit.
  • B16 — placement: CORRECT. The lowering capability lives in the candy (plugin-init), the core templates are data that reference waitForScript; no alias files, no new sdk imports, no capability code pulled into core.
  • B17/B18 — Disposable bed named; test stub is gofmt-clean, no dead code/lint issues visible in the diff.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 28, 2026 17:46
@github-actions
github-actions Bot merged commit f089ddd 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/wait-for-lowering 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