Repository navigation
feat(op): unless_exists — a capability gate for the download verb - #37
Conversation
A plan step has NO build-time distro filter. exclude_distro: is read by the CHECK
runner (sdk/kit/planrun.go), never by the build emitter, so a candy whose artifact
is supplied by the distro PACKAGE on some distros and by an upstream ARCHIVE on the
rest had no declarative way to express "fetch only where the package did not
already provide this".
The only recourse was to abandon the download: verb and hand-roll curl — which
silently forfeits everything the verb provides: the content-addressed
/tmp/downloads cache, the atomic .part -> mv rename, and stage-user-correct cache:
mounts. 48 candies in the consuming superproject already hand-roll curl, so the gap
is not a one-off; this closes the specific hole that forces it for a
package-or-archive install.
unless_exists?: string & !="" @go(UnlessExists)
Detection rather than a distro name, so any distro that later gains the package is
picked up with no edit. Optional and additive: absent means today's behaviour
exactly, so no existing candy changes. The consumer half is EmitDownload in the sdk.
Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
pr-validator — APPROVED ✅Change class: contract/schema (CUE source + generated Go) + CHANGELOG Re-derived independently in an isolated read-only worktree at the PR head. I trusted no claim in the body; every one below I re-ran. Checklist
SDD (item 12) — the gate was made to fail before it was believed
The gate discriminates on a single identifier. Since it passes on the committed tree, the generated files cannot have been hand-edited — that is the positive proof for the "no hand-edited generated file" sub-item, not an assumption. Wire type is CUE-sourced; no The classification that mattered most: modifier, not verb
checkVerbBijection(spec.VerbCatalog, spec.OpVerbs, spec.AuthoringVerbs)Reading the gate body: it demands a Constraint coherence — tested, not reasoned
Empty is unrepresentable in authored YAML, so Go's zero value No
|
| bed | steps | the gate |
|---|---|---|
check-ollama-pod (fedora, no package) |
13/13, 344s | PASS — fetches |
check-cachyos-ollama-pod (packaged) |
13/13, 373s | correctly SKIP |
Both directions, on disposable beds. sdk#142 (EmitDownload honors unless_exists) exists and consumes t.UnlessExists. That is what earns fully tested and validated; I confirmed the referenced PRs exist rather than taking the reference on faith.
Architecture gate (item 15)
placement: CORRECT. A wire shape belongs in the spec contract repo, CUE-first — exactly the boundary law's prescription. Per-item trace: no staged charly/*.go in this diff, therefore no alias file, no kit import, no boundary-law E/M/B/D/R item, and no *Legacy* relocation smell. Nothing to counterfactual outward: the field is already at the outermost correct layer.
unless_exists is placed inside the existing flat --- install/build modifiers --- block, adjacent to extract / extract_include / strip_components. Those download-family modifiers are likewise ungated per-verb, so the field is honored only by download: while being schema-legal on any step — that is the block's pre-existing design, which this PR follows rather than forking (R3). Not a defect introduced here.
Comments considered
none — the PR carried no comments at validation time.
Cross-PR interactions considered
- spec#34 (
feat/factory-unit5-box-load) — touchescontainer/,proc/, andCHANGELOG/2026.229.9999.md. Zero file overlap with this PR'sschema/_common.cue,spec/cue_types_gen.go,spec/vocab_gen.go.verified-non-blocking; it will simply needgh pr update-branchafter this merge, with no content conflict and no generated-file collision. No coordination comment warranted. - sdk#142 / charly#309 / plugins#205 — downstream consumers, not competitors. This PR is the head of that chain and correctly lands first.
Non-blocking finding
The body cites the consumer as opencharly/sdk#<sdk-pr> — an unfilled template placeholder; the real PR is sdk#142. It never reaches main (the CHANGELOG carries no such token, and the squash message is composed by me with the concrete reference), so it is recorded rather than blocking.
Decision
APPROVED. The contract is minimal, additive, and correctly placed; the generated Go is provably a faithful projection of the CUE source rather than a hand transcription; the schema-version omission is right on both landed precedent and mechanism; the constraint makes the absent/empty distinction unambiguous for the consumer; and the live end-to-end proof exists in the only repo where the field can execute. Finalizing the merge-time CalVer, squash-merging, and tagging.
Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
Merge-time CalVer stamp applied by the fresh pr-validator. Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
pr-validator — landed ✅All gated actions were ALLOWED; no denial at any step.
Tags — both schemes, deliberatelyMy dispatch brief said spec takes only the ordinary
Tagging only the ordinary form would therefore have merged the contract while leaving the consumer unable to resolve it. Tags are add-only and immutable, so minting both is safe and matches landed precedent. Verified on
|
What
One optional
#Opfield plus its generated Go and vocabulary entry:Why
A plan step has no build-time distro filter.
exclude_distro:is read by the CHECKrunner (
sdk/kit/planrun.go), never by the build emitter — so a candy whose artifact issupplied by the distro package on some distros and by an upstream archive on the
rest had no declarative way to say "fetch only where the package did not already provide
this".
The only recourse was to abandon the
download:verb and hand-rollcurl, which silentlyforfeits everything the verb provides: the content-addressed
/tmp/downloadscache, theatomic
.part→mvrename, and stage-user-correctcache:mounts. 48 candies in theconsuming superproject already hand-roll
curl, so the gap is not a one-off — this closesthe specific hole that forces it for a package-or-archive install.
R4a: the missing capability is the bug. This is that capability, deliberately scoped to one
field rather than a migration of the other 47.
Detection rather than a distro name, so any distro that later gains the package is picked up
with no edit.
Compatibility
Optional and additive — absent means today's behaviour exactly, so no existing candy or
emitted artifact changes.
Verification
task cue:genregenerates cleanly and is idempotent (re-running dirties nothing further).go build ./...andgo test ./...green across all 13 spec packages.The consumer half is
EmitDownloadin opencharly/sdk#, and the first user iscandy/ollamain opencharly/charly#309. Proven in both directions on real builds there:Fedora (no package) fetches; CachyOS (packaged
ollama) emits the skip line and performs nofetch.
Ordering: this lands FIRST (spec → sdk → superproject).
Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)