Repository navigation
Description
What
The "which add_candy: refs does a deploy contribute, and at what composition scope" traversal now exists three times:
| site | shape |
|---|---|
charly/charly/plugin_loader.go:1164 (deployNodePluginContext) |
addCandy = append(addCandy, spec.ScopedExtraCandyRefs(spec.BoxScope(name), n.AddCandy...)...) inside a visit that recurses n.InSubstrateMembers() |
charly/charly/build_overlay.go:360 (overlayCandies) |
the same collection for a pod-overlay build |
opencharly/plugin-check's scopedAddCandyRefs (added by plugin-check#147, PR open) |
the same loop, for the plugin-side ResolvedProjectRequest.ExtraCandyRefs |
The last one was added because the check plugin cannot import core (ARCH/boundary law) and had no other way to obtain the refs:
ResolvedProject carries no extra-refs field, spec.CheckLoadPluginsReply is empty by design, and ResolvedProjectRequest.ExtraCandyRefs is the only channel — a REQUEST field, so the caller must supply the input.
A maintainer-review finding on plugin-check#147 (R2) named the same thing: a second implementation of one behaviour.
Why it belongs on spec.DeployNode
The traversal is a pure function of the ONE ordered member tree (spec.DeployNode.Member + Member.InSubstrate()), and the scope vocabulary is already spec's (spec.BoxScope, spec.ScopedExtraCandyRefs in spec/spec/resolve_opts.go). Nothing about it is host-coupled — unlike the rest of deployNodePluginContext, which genuinely is (it also collects plugin WORDS and injects a canonical provider ref, and it reads the merged tree through the host loader).
A single home — e.g. func (d *Deploy) ScopedAddCandyRefs(scope string) []ExtraCandyRef — would let all three sites delete their loops. spec/spec/member_tree.go is precedent: the member-tree accessors (MemberByName, InSubstrateMembers, Alongside) already live there as hand-written behaviour beside the generated types.
Close condition
spec.DeployNode exposes the collection, and the three sites above call it with no local loop left — grep -rn 'ScopedExtraCandyRefs(spec.BoxScope' charly plugin-check returns only call sites of the shared function, no per-site traversal.
Scheduling note (for the campaign that found this)
opencharly/plugin-check#147 is the producer leg of opencharly/distro-omarchy#81 (which sits at 3 BLOCK comments of a 5 threshold), so the extraction is deliberately NOT chained in front of it: #147 states the duplication and points here. The migration of the two charly sites is that repo's own live write scope in the same campaign, so it lands with whoever is working there, not from the plugin lane.
Agent: fix-112
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Activity
feat(spec): one canonical deploy add_candy ref collection (#310)