Repository navigation
Description
What's the problem
Child of #4223 (split: this issue bundled the .env and quadlet renderers plus the Go module scaffold, which the sibling .env chunk owns — build this after it lands). render_quadlet_units() (lib/pithead/36-quadlet-units.sh, 402 lines) emits 13 Podman quadlet unit files (mining.network, proxy.network, tor/p2pool/xmrig-proxy/docker-proxy/docker-control/dashboard/caddy containers always; monerod under local_node, tari under local_tari, wallet-rpc under payout_confirm, tari-wallet under tari_payout_confirm) from the rendered .env by Bash heredoc. There is no quadlet renderer in Go anywhere — go-port/3811 hands render-quadlet back to Bash — so this is a fresh port, and any drift changes a running appliance on apply.
What it impacts
Every render-quadlet run and every appliance unit set the tier-4 KVM proofs boot (tests/os/monero-quadlet-proof.sh, tests/os/proxy-quadlet-proof.sh); profile gating mistakes start or omit daemons.
How I found it
Local-session split of #4223; verified on origin/go-port/3811 that render-quadlet is a hand-back (go/internal/cli/cli.go lists it with no implementation).
How important is it
Medium: same piece, second objective; appliance-only, default stays bash until the release flip.
Acceptance criteria
- A Go helper (
PITHEAD_GO_HELPER=quadlet-renderon the module and helper plumbing the .env chunk landed) renders the full unit set from the env file the same way render_quadlet_units derives it; Bash stays the file writer and lock holder — same umask 077, mkdir -p + chmod 0700 outdir, chmod 0600 of existing .container/.network, identicalrender-quadlet: env file not found: ...error, and the existing Bash renderer runs unchanged on any 125/failure/absent binary. - Byte semantics reproduced exactly:
env_get_fileread rules (first ^KEY= line; *_DIR CR/LF rejection);_qenvqescapes \->\\, "->", %>%% with NO $ doubling and always-quoted "KEY=value" (alias key support); quadlet_quote_exec_arg additionally doubles $; quadlet_wallet_deps two-line output only under local_node with the empty-line artifact in wallet-rpc [Unit] preserved; the PAYOUT_NODE_REMOTE tail in the env file feeds the wallet-rpc node args; exact per-profile emission, file order, section/key order, the two fixed comment lines inside tari-wallet.container, one trailing newline per file. - A NEW parity file (Go test, build tag
parity) plus a tests/go-parity oracle comparing Go against develop's live Bash renderer file-by-file, byte for byte, over the fixture set and every tier-covered config: os/quadlet/fixture.env with os/quadlet/{common,local,payout} goldens, profile variants (local_node, local_tari, payout_confirm, tari_payout_confirm, remote payout tail, tor profiles, DASHBOARD_ONION_* variants), and adversarial env values containing backslash, quote, %, $, spaces so every escape rule fires. - tests/stack/test-render-quadlet.sh (and the render/apply suites) pass unchanged in both modes on a Go leg that builds go/bin/pithead; the tier-4 KVM job running the tests/os quadlet proof legs is green on the head; wall-time medians for render-quadlet bash vs Go recorded in the PR.
- Table default for env-render stays bash; selection.md documents the render-quadlet Go path.
Possible solutions
A table-driven renderer in Go mirroring the heredocs field by field (single internal/config/quadlet.go plus a cli helper), fed the env-file bytes; keep Bash responsible for modes, dir creation and cleanup. Alternative shape (Go writes a temp dir Bash moves into place) rejected: the acceptance is bytes, and Bash staying the writer keeps the lock/umask story.
Parent: #4223
Worker brief: Test tier: tiers 1-3 green (go parity workflow + tests/stack) then tier4-kvm narrowed to the phase(s) that run the tests/os quadlet-proof legs (pick the phase from run.sh's phase list; pass --timeout-minutes sized to the leg).
Objective only: render Podman quadlet units in Go under _pithead_impl_selected env-render. Depends on the sibling .env chunk of #4223 for the go/ module, helper dispatch, Makefile targets, go CI workflow and the Bash-side selection plumbing — if that module is not on develop yet, stop and report blocked on it instead of duplicating the scaffold. Do not touch render_env/dotenv serialization (the sibling owns it).
Source of truth: lib/pithead/36-quadlet-units.sh (render_quadlet_units — 13 files, profile gating via the case ",$profiles," comma idiom, _qenv/_qenvq, QUADLET_HOST_CONFIG_DIR/QUADLET_CADDYFILE/QUADLET_ENGINE_SOCK inputs) and lib/pithead/35-quadlet-argument-helpers.sh (quadlet_quote_exec_arg doubles $, _qenvq does not; quadlet_wallet_deps/quadlet_wallet_node). go-port/3811 has NO quadlet Go code — hand-port it. Reproduce byte traps: the empty line left in wallet-rpc [Unit] when quadlet_wallet_deps prints nothing; always-quoted "K=V" _qenvq with \ " % escapes; the PAYOUT_NODE_REMOTE tail; env_get_file first-match and *_DIR CR/LF rejection; final newline per file.
Contract: Go helper receives the env-file content (and outdir derivation), emits every unit file with a deterministic framing on stdout; Bash writes them with the same modes (umask 077, dir 0700, existing files chmod 0600) and runs its own renderer unchanged on 125/failure. Keep render-quadlet: env file not found: $envf.
New parity file (build tag parity) + tests/go-parity oracle: Go vs live Bash over os/quadlet/fixture.env + os/quadlet/{common,local,payout} goldens and profile variants (local_node, local_tari, payout_confirm, tari_payout_confirm, remote payout, tor profiles) plus adversarial values (backslash, quote, %, $, spaces, #) — every file byte-equal. tests/stack/test-render-quadlet.sh and suites pass unchanged in both modes with the Go leg reaching the Go side. Default stays bash. Record render-quadlet median wall time bash vs Go (locally, no Docker needed) in the PR.
Rules: no comments/docstrings; parity tests must fail without the port; run ponytail pass, then verifier + security-reviewer in the foreground (unit files carry credentials/PublishPorts — check the helper never echoes secrets to stderr and modes are unchanged). Draft PR off origin/develop-v2.1.0, three sections, Part of #4223. bench via bin/bench-submit --base develop-v2.1.0.
Activity