Skip to content

Commit 1a6d1e4

Browse files
authored
fix(sdk,docs): adopt the OpenRC/busybox sdk fixes and sweep every claim they falsified (#287)
Bumps the sdk gitlink to 91cc241d (Alpine OpenRC sshd start, busybox addgroup/adduser fallback, probed $LOGIN_SHELL, curl-or-wget bootstrap) and sweeps every published claim those fixes falsified, at the candy source that generates both projections. The sweep's own defect is worth recording: the first rounds corrected the prose while the gitlink still pinned the pre-fix sdk, so four pages asserted that .build/*/Containerfile emits a block this tree's binary provably did not emit -- replacing true claims with false ones. The pin, not the prose, was wrong. The distro: rule went through five formulations before reaching "Always SET distro:, to a BARE id". Each earlier form was locally correct and globally incomplete: an exception list must be re-verified whenever the distro set changes, and every attempt to state the rule in OS-name terms had to smuggle an account name (cloud-user) into a distro list to stay complete. The final form names base_user as the discriminator and documents the second consumer -- buildVmSyntheticBox, which resolves distro against a five-id vocabulary and on a miss leaves img.Pkg unset, so candy installation compiles zero steps silently. Gate: three disposable beds, each with a fresh charly update rebuild leg -- check-pod-overlay, check-pod (box/fedora), check-charly-vm. The emitted .build/fedora.fedora/Containerfile carries the new create-mode block, which only the new emitter can produce. No bed in this superproject exercises the busybox or OpenRC arms; those were proven in sdk#138's own A/B on alpine:3.24, which is why the tier is analysed on a live system rather than fully tested and validated. Assisted-by: Claude Code deepseek-v4-flash:0731-cloud (analysed on a live system)
1 parent bb2f0b0 commit 1a6d1e4

161 files changed

Lines changed: 628 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG/2026.228.0649.md‎

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# 2026.228.0649 — the D18 sshd start is per-init, and three docs said otherwise
2+
3+
`sdk#138` branches the cloud-init sshd start on the guest's init system: the
4+
hardening drop-in still runs first and unbranched, but the START that follows is
5+
`systemctl unmask` + `enable --now` on systemd and `rc-update add` +
6+
`rc-service start` on OpenRC (Alpine, which has neither ssh.socket nor
7+
systemctl). That made three published claims false.
8+
9+
## The three claims
10+
11+
| surface | claim | why it was false |
12+
|---|---|---|
13+
| `vm-spec` — `RunCmd` | "prepended with three D18 hardening steps … `systemctl unmask ssh.socket`, then `systemctl enable --now sshd`" | three steps only on systemd; two on OpenRC, and neither is a systemctl call |
14+
| `cloud-init-renderer` — `composeRunCmd` | "prepends THREE steps, in order" | same |
15+
| `cloud-init-renderer` — `effectiveDistro` | "additionally infers `arch`" | it now also infers `alpine` from `base_user: "alpine"` |
16+
17+
Each is rewritten to separate the INVARIANT (the drop-in is always first and is
18+
distro-agnostic, because it writes into `sshd_config.d`, which OpenSSH Includes
19+
on every init) from the per-init VARIANT. The `composeBootCmd` mask is
20+
documented as deliberately unbranched: on Alpine the `|| true` swallows the
21+
missing binary and the mask is vacuous where nothing is socket-activated.
22+
23+
## Three surfaces, one source
24+
25+
The claims live in **one** place — `candy/charly-internals/charly.yml` — and are
26+
projected twice: to `plugins/**/SKILL.md` by `charly marketplace generate`, and
27+
to the published opencharly.ai pages under `docs/src/content/docs/recipes/` by
28+
`task docs:sync`. Both projections carry the DO-NOT-EDIT marker, so this change
29+
edits the source and regenerates; it never hand-edits a generated page.
30+
31+
**Worth recording, because the sweep that found these missed one:** a
32+
claim-keyed `git grep` from the superproject root does NOT cross a gitlink. The
33+
first sweep covered the superproject and `plugins` and reported "complete"; the
34+
`docs` submodule carried all three claims and was invisible to it. A sweep for a
35+
generated claim has to run **per-submodule**, once per projection — the
36+
published site is a surface like any other.
37+
38+
**Also worth recording:** regenerating from a stale tree is not additive. Run
39+
from a superproject six commits behind `main`, `charly marketplace generate`
40+
touched 24 files and would have REVERTED prose landed by the R4a doc sweep;
41+
`task docs:sync` deleted 93 reference pages because the `box/*` submodules were
42+
uninitialized and their sources appeared absent. Both were discarded and redone
43+
from a branch off fresh `main` with submodules initialized, where the same
44+
commands touch exactly the intended files. A regenerate is only safe from a
45+
current tree.
46+
47+
## Round 2 — the sweep was incomplete, and the reason is the transferable part
48+
49+
Two validators, working independently in different repos, found the same gap:
50+
**`sdk#138` shipped FOUR fixes and this sweep covered one.**
51+
52+
Fixes 2 and 3 changed the emitted create-mode Containerfile block — user
53+
creation now probes `command -v useradd` with a busybox `addgroup`/`adduser`
54+
fallback, and the login shell is probed rather than hardcoded to `/bin/bash`.
55+
**Six candy sites across four sources** printed the pre-fix block, projecting to
56+
four `plugins` skills and four published pages, each introduced as *what the
57+
generator emits*. A stale fenced excerpt is an integrity failure, not a wording
58+
nit: a reader copies a command the product no longer produces.
59+
60+
Three further instances of the fix-4 falsity also survived — two of them on
61+
lines this cutover's own first commit had edited, one directly contradicting a
62+
`+` line in the same file.
63+
64+
**Root cause: the sweep keyed on the STRING it had fixed rather than the CLAIM
65+
that became false.** Grepping `unmask`/`enable` finds every sshd site and is
66+
structurally blind to a stale `useradd` block, which expresses a different
67+
falsified claim from the same commit. Both defects came from one merge; only one
68+
had a memorable token. Proximity to the edit is not coverage — three of the
69+
misses were inside a line the fix itself had touched.
70+
71+
The corrected key is the claim, enumerated **per fix in the triggering commit**,
72+
then swept **per surface**. `git show <merge> --stat` is the cheap first step;
73+
it would have shown `deploykit/bootstrap.go` in the diff and named the two fixes
74+
the sweep never considered.
75+
76+
Fix 1 (the go-task `curl` → `(curl || wget)` fallback) is genuinely clean —
77+
every page elides that line.
78+
79+
### Controls, so no absence check rests on an empty result
80+
81+
| check | before | after |
82+
|---|---|---|
83+
| old shape `useradd -m -u … -s /bin/bash` (candy) | 6 | **0** |
84+
| new shape `LOGIN_SHELL` (candy) | 0 | **present in all 4 sources** |
85+
| old shape under `docs/src/content/docs` | 6 | **0** |
86+
| `task docs:sync` deletions, `box/*` initialized | — | **0** (a prior run without them deleted 93) |
87+
88+
## Round 3 — the pin, not the prose: this PR was making TRUE claims false
89+
90+
A validator found the inverse of this cutover's purpose, and it is the most
91+
serious finding of the sweep.
92+
93+
**The `sdk` gitlink was left at `c1c41b06` — the commit sdk#138 landed ON TOP
94+
OF, not sdk#138 itself.** `merge-base --is-ancestor 91cc241d c1c41b06` → rc=1;
95+
`91cc241d`'s parent IS `c1c41b06`. So this commit selected an sdk whose emitter
96+
still writes `useradd -m -u … -s /bin/bash` and has no OpenRC branch at all:
97+
98+
| | pinned `c1c41b06` | sdk#138 `91cc241d` |
99+
|---|---|---|
100+
| `LOGIN_SHELL` in `deploykit/bootstrap.go` | **0** | 3 |
101+
| `rc-update` in `vmshared/cloud_init_render.go` | **0** | 3 |
102+
103+
The base text was TRUE against that pin. The rewrite made four pages assert
104+
that `.build/debian/Containerfile` **emits** a block this tree's binary provably
105+
does not emit — replacing true claims with false ones, which is worse than the
106+
staleness the sweep exists to remove.
107+
108+
**Why it was missed, and it is the same shape as everything else here.** Every
109+
claim was verified against `91cc241d`, because that is where sdk#138 landed. The
110+
question never asked was *which sdk does this commit pin*. The claims were
111+
checked against the code in mind rather than the code the commit selects — an
112+
instrument answering a different question than the one the claim makes.
113+
114+
**Fixed by bumping the pin, not by reverting the prose.** `91cc241d` is the sdk
115+
`main` tip and the prose is what the product should say; reverting would
116+
re-land text that goes false the moment anyone bumps sdk. Checked so the bump
117+
drags nothing behind it: the `spec` pin `898d5fa0` already IS `v0.2026228.2`,
118+
which sdk#138 requires (`is-ancestor` rc=0).
119+
120+
The bump re-triggered the candy fan-out — `charly box validate` went 0 → 2
121+
warnings until all 91 candy modules were re-tidied against the newer sdk, the
122+
same cascade the earlier spec bump caused. Now 0 again, and the rebuilt binary
123+
carries the documented emitter (`rc-update` and `LOGIN_SHELL` both present in
124+
`bin/charly`), so the claim and the artifact finally agree.
125+
126+
**The generalizable rule: a documentation claim about emitted output is only as
127+
true as the gitlink the documenting commit pins.** Verify prose against the
128+
pinned dependency, never against the upstream tip you happen to be thinking of.
129+
130+
131+
## The projection list was itself incomplete — a fourth surface
132+
133+
This entry codifies *"`git grep` does not cross a gitlink — sweep per-submodule,
134+
once per projection"*, and enumerates three: candy source → `plugins` → `docs`.
135+
136+
**There is a fourth, and the sweep never enumerated it:** `spec/schema/*.cue`
137+
doc-comments. They are authored prose ABOUT emitter behaviour, they sit upstream
138+
of all three projections, and they live in a repo the sweep's own rule did not
139+
list. `schema/vm.cue` alone carries 80 comment lines; `schema/seam.cue` also
140+
describes emitter behaviour.
141+
142+
Measured: exactly **one** stale hit survives there —
143+
`spec@898d5fa0:schema/vm.cue:72`, still saying `pacman -S --needed` where this
144+
cutover corrected every other surface to `-Sy`. Presence control: `-Sy` already
145+
appears in 3 spec files outside `CHANGELOG/`, so the repo knows the new form and
146+
this comment is the lone holdout.
147+
148+
**Routed to the busybox-userland batch, not fixed here.** It needs a `spec` PR
149+
plus a gitlink bump — a fourth cross-repo leg on an already-escalated cutover —
150+
and pulling it in would repeat the overreach that produced the golden-fixture
151+
detour earlier in this same PR.
152+
153+
**The lesson is the one this entry already tried to state, and got half right.**
154+
A per-submodule sweep is necessary and not sufficient: the enumeration itself is
155+
a claim, and *"the surfaces someone thought to list"* is not the same as *"the
156+
surfaces that carry the claim."* Same defect shape as the `check-pod` grep that
157+
saw one `charly.yml` and missed 50 beds, and as the sdk pin that answered "where
158+
did the fix land" instead of "what does this commit select." Three instances,
159+
one mechanism: **an instrument scoped to a remembered inventory rather than a
160+
derived one.**
161+
162+
163+
## A line number is a coordinate with the same silent-baseline problem
164+
165+
`[email protected]` cites `debian.md` "line 39" and "line 55" without naming
166+
the commit those positions are in. They are pre-sweep coordinates: post-sweep
167+
the file carries the pattern once, at line 57. Measured:
168+
169+
```
170+
69f97926 (pre-sweep) 2 hits lines 39, 55
171+
origin/main (post) 1 hit line 57
172+
```
173+
174+
So *"carries the pattern twice"* is true only of `69f97926`. The fenced block two
175+
lines above the sentence establishes both baselines, so no reader is misled —
176+
which is why the validator raised it non-blocking and why it is recorded here
177+
rather than corrected there: that entry is now closed history under its own tag,
178+
and a third entry to add four words would cost more than the imprecision does.
179+
180+
**The point is that it is the same defect one axis over.** That entry's whole
181+
thesis is *state the pattern, the scope, and the unit* — and a line number is a
182+
fourth coordinate, equally meaningless without its baseline. A count without a
183+
unit and a line without a commit fail identically: both look precise, and both
184+
silently name a different population than the reader assumes.
185+
186+
**Rule, for the batch:** a line number in prose is a claim about a tree. Cite it
187+
as `<file>:<line>` at a named commit, or cite the content instead.

‎candy/charly-build/charly.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,14 @@ generate-skill:
14701470
14711471
```dockerfile
14721472
RUN if ! getent passwd 1000 >/dev/null 2>&1; then \
1473-
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) && \
1474-
useradd -m -u 1000 -g 1000 -s /bin/bash user; \
1473+
LOGIN_SHELL=/bin/sh; [ -x /bin/bash ] && LOGIN_SHELL=/bin/bash; \
1474+
if command -v useradd >/dev/null 2>&1; then \
1475+
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) && \
1476+
useradd -m -u 1000 -g 1000 -s "$LOGIN_SHELL" user; \
1477+
else \
1478+
(getent group 1000 >/dev/null 2>&1 || addgroup -g 1000 user) && \
1479+
adduser -D -h /home/user -u 1000 -G user -s "$LOGIN_SHELL" user; \
1480+
fi; \
14751481
fi
14761482
14771483
WORKDIR /home/user

‎candy/charly-coder/charly.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ arch-coder-skill:
9898
- grafana-tools
9999
```
100100
101-
No explicit `user:` / `uid:` / `gid:` — inherits the defaults. `user_policy:` defaults to `auto`; the `arch` base image declares no `base_user:` in its `distro:` vocabulary, so the policy falls through to create mode — the bootstrap emits an idempotent `useradd -m -u 1000 -g 1000 user`. See `/charly-image:image` "user_policy" and `/charly-build:build` "base_user".
101+
No explicit `user:` / `uid:` / `gid:` — inherits the defaults. `user_policy:` defaults to `auto`; the `arch` base image declares no `base_user:` in its `distro:` vocabulary, so the policy falls through to create mode — the bootstrap emits an idempotent user creation (`useradd` where shadow-utils is present, busybox `adduser` otherwise). See `/charly-image:image` "user_policy" and `/charly-build:build` "base_user".
102102
103103
## Resolved security posture
104104
@@ -519,8 +519,14 @@ debian-coder-skill:
519519
520520
```
521521
RUN if ! getent passwd 1000 >/dev/null 2>&1; then
522-
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) &&
523-
useradd -m -u 1000 -g 1000 -s /bin/bash user;
522+
LOGIN_SHELL=/bin/sh; [ -x /bin/bash ] && LOGIN_SHELL=/bin/bash;
523+
if command -v useradd >/dev/null 2>&1; then
524+
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) &&
525+
useradd -m -u 1000 -g 1000 -s "$LOGIN_SHELL" user;
526+
else
527+
(getent group 1000 >/dev/null 2>&1 || addgroup -g 1000 user) &&
528+
adduser -D -h /home/user -u 1000 -G user -s "$LOGIN_SHELL" user;
529+
fi;
524530
fi
525531
```
526532

‎candy/charly-distros/charly.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ debian-skill:
20072007
20082008
## User model — create, not adopt
20092009
2010-
The embedded `distro.debian` vocabulary **does not** declare a `base_user:` block, because the upstream `debian:13` base image ships no pre-existing uid-1000 account. `user_policy: auto` (the default for any downstream image) falls through to create mode — the generator emits an idempotent `useradd -m -u 1000 -g 1000 user` during bootstrap.
2010+
The embedded `distro.debian` vocabulary **does not** declare a `base_user:` block, because the upstream `debian:13` base image ships no pre-existing uid-1000 account. `user_policy: auto` (the default for any downstream image) falls through to create mode — the generator emits an idempotent user creation (`useradd` where shadow-utils is present, busybox `adduser` otherwise) during bootstrap.
20112011
20122012
This is the intentional asymmetry vs `/charly-distros:ubuntu`, which DOES ship `ubuntu:ubuntu` at uid 1000 and declares `base_user:` to adopt that identity. See `/charly-image:image` "user_policy" and `/charly-build:build` "base_user" for the full decision table.
20132013
@@ -2022,8 +2022,14 @@ debian-skill:
20222022
apt-get update && apt-get install -y --no-install-recommends curl ca-certificates gnupg && \
20232023
... install go-task binary ...
20242024
RUN if ! getent passwd 1000 >/dev/null 2>&1; then
2025-
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) &&
2026-
useradd -m -u 1000 -g 1000 -s /bin/bash user;
2025+
LOGIN_SHELL=/bin/sh; [ -x /bin/bash ] && LOGIN_SHELL=/bin/bash;
2026+
if command -v useradd >/dev/null 2>&1; then
2027+
(getent group 1000 >/dev/null 2>&1 || groupadd -g 1000 user) &&
2028+
useradd -m -u 1000 -g 1000 -s "$LOGIN_SHELL" user;
2029+
else
2030+
(getent group 1000 >/dev/null 2>&1 || addgroup -g 1000 user) &&
2031+
adduser -D -h /home/user -u 1000 -G user -s "$LOGIN_SHELL" user;
2032+
fi;
20272033
fi
20282034
WORKDIR /home/user
20292035
USER 1000

0 commit comments

Comments
 (0)