Skip to content

feat(deploykit,loaderkit,spec): W9/K1 CandyReader/CandyModel/CandyView + loaderkit.ScanCandy - #71

Merged
atrawog merged 14 commits into
mainfrom
feat/w9-loader-cone
Jul 17, 2026
Merged

atrawog merged 14 commits into
mainfrom
feat/w9-loader-cone

Conversation

@atrawog

@atrawog atrawog commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

The sdk producer leg of the W9/K1 loader-cone core-minimization wave (consumer:
opencharly/charly feat/w9-loader-cone, HELD until this merges — see
"Change class"). Widens deploykit's candy-model vocabulary into a full
spec.CandyReader interface contract and ports the candy-manifest scan
pipeline into loaderkit, enabling charly's concrete type Candy struct to
retype to an interface backed by two CUE-schema-sourced halves.

  • spec/candy_reader.go (new): the CandyReader interface contract.
  • spec/candy_ref_entry.go (new): CandyRefEntry{Raw,Resolved} (rich
    pre-qualification ref form) + CandyRefs{Require,IncludedCandy,BakePlugin}
    • FinalizeCandyRefs(m,v,refs) (the ONE bare-stringing step onto the wire,
      relocated here from loaderkit since both deploykit and loaderkit
      consume it).
  • deploykit/spec_candy_adapter.go (widened): specCandyAdapter now
    implements the full CandyReader contract; RawCandy() structural
    type-assertion escape hatch added; Port() bug fixed (was emitting a lossy
    "proto:port" PREFIX instead of the bare-port/"N/udp"-suffix convention).
  • deploykit/hooks_collect.go (new) + deploykit/security.go (widened):
    read the new CandyModel.Hook/.Security fields.
  • loaderkit/scan_candy.go (new, 402 LOC): the ported candy-manifest scan
    pipeline (scanCandy/populateCandyFromYAML/derivePackageSections),
    producing spec.ScannedCandy{Model,View,Refs}.
  • loaderkit/repo_identity.go (new): repo-identity cycle-break +
    NormalizeRepoSpec, relocated from charly/ns_identity.go +
    charly/main_repo.go.
  • spec/namespace_ref.go, spec/ref_parse.go (new): generic namespace-ref
    and remote-ref-string vocab, wide non-loader-cone consumer sets.
  • schema/candymodel.cue, schema/resolvedproject.cue: additive CUE fields
    (security,hook,artifact,requires_capability,capability,secret,
    port,bake_plugin on #CandyModel; init_systems on the resolved-project
    candy view) — generated via task cue:gen, no hand-written wire structs.
  • CHANGELOG/2026.198.1944.md: this leg's narrative (placeholder CalVer).

Full narrative + both-axes metrics: CHANGELOG/2026.198.1944.md in this diff.

Change class

cross-repo. Repos: sdk (this PR, producer — lands FIRST), charly
(consumer, feat/w9-loader-cone, HELD pending this merge + a gitlink
repoint), plugins (docs-batch 6 rides separately per the orchestrating
team-lead). Landing order: sdk → plugins (independent leg) → charly (repoints
sdk gitlink to this PR's merged SHA + charly/go.mod require version).

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: sdk is a pure Go library with no
    runnable disposable bed of its own — the gate is (a) GOWORK=off go build/go vet/go test/golangci-lint/gofmt clean on the module
    standalone, PLUS (b) the CONSUMER's R10 bed, since charly's go.mod replace github.com/opencharly/sdk => ../sdk resolves in-tree against this exact
    commit — charly check run check-charly-selftest-pod (a disposable pod
    bed whose plan exercises the candy-scan/build pipeline this leg changes).
  • Eval beds run — the EXACT beds + per-bed results:
    check-charly-selftest-pod | pod | FAIL (1/76) | 76 steps | 178s — run
    against charly version 2026.198.1420 (or later same-tree rebuild), run
    calver .check/check-charly-selftest-pod/2026.198.1718/ (image-build:
    ok=true, 160s) and .../2026.198.1547/ (an earlier same-tree attempt, guard
    discussion in the consumer PR). Steps: 57 passed, 1 failed, 18 skipped. The
    1 failure (candy/claude-code:1, claude --version — native-binary
    network-bootstrap unavailable in box-check mode) is PRE-EXISTING on main
    (independently re-run on plain origin/main by the orchestrating
    team-lead, fails identically) and unrelated to this diff — tracked
    separately (fix/claude-code-native-installer). Single bed, not a
    cross-cutting shared-state change, so no concurrent roster was required.
  • Fresh rebuild: the consumer binary was rebuilt from source
    (go build -buildvcs=false -ldflags "-X main.BuildCalVer=$(...)" -o ../bin/charly .) immediately before each bed run; charly version matched
    the rebuild each time; the bed ran on that fresh binary against a FROZEN
    tree (a prior attempt hit the binary-freshness guard from a mid-run edit —
    root-caused, tree frozen, rebuilt, rerun clean).
  • Did the CHANGED code path execute live? Yes — the bed's image-build
    step runs charly box build charly-selftest --dev-local-pkg, which drives
    the FULL retyped scan→fetch→qualify→arbitrate→finalize pipeline
    (loaderkit.ScanCandy, FinalizeCandyRefs, NewSpecCandyModel,
    specCandyAdapter's widened accessors including the fixed Port()) for
    every candy composing that box, and the InitSystems/RunOps
    host-completion fixes this pipeline required. The success path AND the
    init-fragment-assembly path both ran (the charly-selftest box's
    supervisord.conf block, previously silently dropped mid-wave, is present in
    the post-fix Containerfile — see byte-parity below).
  • Concurrency: N/A — this leg does not touch the loader/discover walk's
    shared-state paths (the candy-scan pipeline is per-project, no cross-project
    shared state), and the bed run above is a single disposable pod, not a
    cross-cutting change.
$ cd sdk && GOWORK=off go build ./... && echo BUILD OK
BUILD OK
$ GOWORK=off go test -count=1 ./...
ok  	github.com/opencharly/sdk	0.158s
ok  	github.com/opencharly/sdk/deploykit	0.050s
ok  	github.com/opencharly/sdk/enginekit	0.002s
ok  	github.com/opencharly/sdk/kit	4.200s
ok  	github.com/opencharly/sdk/loaderkit	0.006s
ok  	github.com/opencharly/sdk/spec	0.390s
ok  	github.com/opencharly/sdk/vmshared	0.481s
$ golangci-lint run ./...
0 issues.
$ gofmt -l .
(empty)

# Consumer bed (charly feat/w9-loader-cone, this sdk commit via `replace`):
$ charly check run check-charly-selftest-pod
charly check run check-charly-selftest-pod: FAIL (steps=... )
76 steps: 57 passed, 1 failed, 18 skipped
# .check/check-charly-selftest-pod/2026.198.1718/summary.yml:
#   image-build: ok=true, 160s
#   check-image: ok=false, 18s (the 1 claude-code failure above)

Attribution tier

analysed on a live system — build/vet/test/lint clean standalone on this
repo; the consumer's live bed exercised the changed pipeline end-to-end
(image-build PASSED, 57/58 relevant checks passed) with the one unrelated,
independently baseline-confirmed pre-existing failure noted above.

Harness rulebook compliance

  • R0 skills: /charly-internals:plugin (the per-plugin CUE-schema
    contract + SDK boundary), /charly-internals:go (SDD pipeline,
    task cue:gen), /charly-internals:git-workflow (this landing sequence).
  • R1 RCA + zero warnings: every failure surfaced this wave was
    root-caused before fixing (RunOps never populated; Port() wire-form
    regression; the lossy CandyView.Require remote-ref-discovery bug; the
    InitSystems host-completion gap in the consumer's loadProjectForResolve) —
    see the consumer PR + CHANGELOG/2026.198.1944.md. Zero warnings in the
    gate output above.
  • R2 no out-of-scope: every issue surfaced was fixed in this wave OR
    explicitly classified LATENT-and-verified-unreachable (two such findings,
    both documented with their sweep evidence in the consumer's
    CHANGELOG/2026.198.1859.md) with the genuinely-separable remainder routed
    to a named follow-up batch (consumer-repo task feat(kit)!: P12a check/ADE architecture fold — movable-now sub-batch #59) — none silently parked.
  • R3 no duplication: FinalizeCandyRefs relocated to spec (single
    source consumed by both deploykit and loaderkit, was duplicated across
    packages before); no <name>-host/<name>-pod siblings introduced.
  • R4 no workaround: no sleep/retry/magic-number; the freshness-guard trip
    during verification was root-caused (a mid-run tree edit) and fixed by
    freezing the tree + rebuilding, not by bypassing the guard.
  • R5 hard cutover + grep: no identifiers deleted FROM sdk in this leg (all
    new/widened, zero D files in the sdk diff); git grep for the consumer
    side's deleted identifiers (type Candy struct, legacyScanCandiesDir(,
    populateCandyFromYAML, ns_identity, old main_repo.go reference)
    returns only historical-provenance mentions in the relocated files' own doc
    comments — see the consumer PR.
  • R6 git safety: no destructive git action taken this leg (only new
    commits + pushes).
  • R7 runtime gate: consumer bed run above, not just go test.
  • R8 artifact invariants: N/A for this leg directly (sdk emits no
    Containerfile itself) — the CONSUMER'S Containerfile byte-parity + the
    ai.opencharly.* labels were verified in the consumer PR against a clean
    pre-wave baseline (byte-identical modulo the expected tag timestamp; the
    supervisord assembly block regression this leg's InitSystems field
    addition + the consumer's threading fix restores is present again).
  • R9 binary == source + deps: N/A for sdk directly (library, no binary);
    the consumer binary was rebuilt from source against this exact sdk commit
    before every bed run (see above). No new runtime OS deps introduced.
  • R10 disposable + coverage: proven on the consumer's disposable: true
    bed, fresh rebuild, per-step zero-warning output; new Go-level coverage:
    spec_candy_adapter_test.go, repo_identity_test.go, namespace_ref_test.go,
    ref_parse_test.go, hooks_collect_test.go (new sdk-side tests) + translated
    consumer-side fixture migrations proven to fail-then-pass across the choke-
    point consolidation (stash/fail/pop/pass on the pinning fixture — see the
    consumer PR).
  • RDD / ADE / SDD: RDD — the byte-parity witnesses (box-inspect +
    Containerfile, both proven against a clean 175266f baseline, not an
    assumption) are the composition-at-latest-versions proof. ADE: N/A (no
    candy/box authored in this leg). SDD: task cue:gen regenerated
    spec/cue_types_gen.go from the additive .cue defs; reproducible, no-op
    on a clean re-run.
  • Hard cutover: ONE commit sequence on feat/w9-loader-cone
    (this repo); no transitional/dual-mode path — FinalizeCandyRefs's single
    relocation replaced its prior loaderkit-only location outright.
  • Kernel/plugin boundary law: N/A — this is sdk, not charly/ core; the
    new CandyReader/CandyModel/CandyView types are the E-envelope +
    M-mechanism vocabulary consumed BY the kernel and by out-of-process
    plugins alike, not a kernel-side kind-branch.
  • Disposable-only autonomy: the consumer bed run was on a disposable: true pod (check-charly-selftest-pod); no other autonomous destroy/rebuild
    this leg.
  • Clean architecture + Go gates: gofmt -l . empty, golangci-lint run ./... 0 issues, go vet clean, go test ./... green (all pasted above).
  • CHANGELOG: CHANGELOG/2026.198.1944.md staged (placeholder CalVer).

Assisted-by: Claude Sonnet 5 (analysed on a live system)

atrawog added 11 commits July 17, 2026 12:38
…ocab split + CandyModel/CandyRef promotion to spec

WIP checkpoint on the held feat/w9-loader-cone branch (not yet landed). Three
chunks folded so far:

- spec/loaderkit vocab split: spec.ParsedRef/ParseRemoteRef/IsRemoteImageRef/
  SplitRepoAndSubPath (ref_parse.go) and spec.SplitNamespaceRef/LeafName
  (namespace_ref.go) — pure vocab, always-legal spec import. loaderkit.RepoIdentity/
  NormalizeRepoSpec/RootRepoIdentity/GitRemoteIdentity/NormalizeGitRemoteURL/
  NormalizeRepoIdentity (repo_identity.go) — genuine loader-mechanism logic,
  consumed only by already-mechanism-coupled files.

- CollectSecurity/CollectHooks aggregator split: deploykit.MergeCandySecurity
  (security.go) + deploykit.MergeCandyHooks (hooks_collect.go, new) — the pure
  candy-order-fold merge logic, with the *Config candy-tree-walk staying host-side.
  AppendUniqueString exported (was unexported appendUnique) for the same reuse.

- CandyModel interface + CandyRef promoted to spec (spec.CandyReader,
  spec.CandyRefEntry — non-colliding names since spec.CandyModel/spec.CandyView/
  spec.CandyRef already exist). deploykit.CandyModel = spec.CandyReader and
  deploykit.CandyRef = spec.CandyRefEntry stay as sdk-internal passthrough aliases
  (the established candy_field_aliases.go pattern) — every consumer compiled
  unchanged. CandyReader widened with 24 more accessors (Alias/Volume/Artifact/
  Capabilities/RequiresCapabilities/Engine/Libvirt/EnvProvides/MCPProvide/Secret/
  Port/PortSpecs/LocalPkgFormats + 11 Has* predicates) after a consumer-set audit
  that DROPPED 5 candidates (HasAnyInit/HasAnyPackages/HasApk/HasService/
  HasTagPackages — zero external caller outside layers.go, pure internal
  composition helpers). 5 new #CandyModel CUE fields (artifact/requires_capability/
  capability/secret/port) back the widening — copied verbatim from candy.cue's own
  shapes, zero hand-written types.

Verified: GOWORK=off go build/vet/test ./... clean, golangci-lint 0 issues,
gofmt clean, cue:gen reproducible (regen twice = identical diff).

Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
…vePackageSections to loaderkit.ScanCandy

WIP checkpoint on the held feat/w9-loader-cone branch. Ports the candy-scan
construction machinery (charly/layers.go scanCandy + derivePackageSectionsFromCalamares,
charly/unified.go populateCandyFromYAML) into sdk/loaderkit.ScanCandy, constructing
spec.CandyModel + spec.CandyView directly instead of a concrete *Candy struct that
core then projects.

Two design corrections found by the byte-parity spike (charly's throwaway
scan_candy_parity_spike_test.go, 4/4 cases pass):

- RunOps is NOT scan-computable: the pre-move runOps() filters plan: steps
  through opInContext/VerbCatalog, which is registry-adjacent D-data core
  still owns (task #39's own scope) — ScanCandy leaves it unset; the host
  computes it in a second pass, unchanged from today.
- HasInit is NOT scan-computable either: PopulateCandyInitSystem needs the
  full InitConfig and runs once across every scanned candy (cross-candy),
  not per-candy. Same treatment.

HasInstallFiles/HasContent are therefore PARTIAL predicates here (every term
computable from the one candy alone) — the host completes them by OR-ing in
the RunOps/HasInit terms once it computes those (boolean OR is associative,
so the two-stage composition is byte-identical to the old single-pass
computation — proven by the spike test simulating the host's completion step).

Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
…akePlugin

W9 spike findings 3+4: bake_plugin: was missing from spec.CandyModel entirely
(schema gap), and Require/IncludedCandy/BakePlugin were bare-stringed at scan
time, before qualifyRemoteSiblingDeps gets a chance to set .Resolved on a
remote candy's plain-name sibling deps. Add a hand-written spec.CandyRefs
pipeline-state carrier (never a wire type) alongside the CandyModel/CandyView
scan result, holding the rich CandyRefEntry lists; loaderkit.QualifyRemoteSiblingDeps
+ FinalizeCandyRefs run the qualify-then-bare-string steps in the correct
order. CandyModel gains a bake_plugin: CUE field (task cue:gen, reproducible).

WIP checkpoint on feat/w9-loader-cone — not yet wired into the host
ScanAllCandy pipeline.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
…PathPrefix)

Port the pre-move charly/layers.go ScanRemoteCandy to loaderkit: scans the
wanted bare refs out of a downloaded remote repo dir via ScanCandy, then sets
each result's CandyView.Remote/.RepoPath/.SubPathPrefix and runs
QualifyRemoteSiblingDeps — the same post-scan "construct-then-mutate" +
qualify sequence the live *Candy went through, now over the (CandyModel,
CandyView, CandyRefs) triple. Bundled as spec.ScannedCandy (hand-written
pipeline state, never a wire type, alongside CandyRefs). Added to the
CandyScanner interface.

WIP checkpoint on feat/w9-loader-cone.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
… wrong

W9 mutation-site-inventory finding: specCandyAdapter.HasInit(initName)
ignored initName entirely (returning ServiceFiles/Service non-empty
instead) because #CandyView carried only an aggregate has_init bool, with
no per-init-system data — the live *Candy.HasInit(name) correctly answers
"does this candy trigger init system Y" via its InitSystems map, but the
envelope had no way to express that. This silently mismatches for ANY
consumer asking about a SPECIFIC init system, including this package's own
EmitInitFragmentStages/EmitInitAssembly (an R8 OCI-label/Containerfile
surface) the moment a build routes through the resolved-project envelope
rather than the live *Candy.

Add init_systems: {[string]: bool} to #CandyModel's sibling #CandyView,
mirroring the live field exactly; fix specCandyAdapter.HasInit to read it.
Also rename loaderkit.ScanCandy -> ScanCandyManifest (avoid a name
collision with the established exported charly.ScanCandy(dir)) and add
ScanRemoteCandy + spec.ScannedCandy (bundling Model/View/Refs — same
non-wire pipeline-state rationale as CandyRefs) to the CandyScanner seam
for the upcoming ScanAllCandy pipeline port.

WIP checkpoint on feat/w9-loader-cone.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
…ookup

Evidence rider for the W9 InitSystems finding: TestSpecCandyAdapter_HasInit_
PerInitLookup fixtures the EXACT shape that diverges — a packaged-only
service: entry (use_packaged:, no exec: sibling), the real
candy/qemu-guest-agent shape in the main repo. Confirms the old fake
(len(ServiceFiles)>0 || len(Service)>0) would have wrongly answered true for
HasInit("supervisord") on this candy (supervisord's service_schema does not
support packaged services), while the fixed adapter reading
CandyView.InitSystems answers false correctly; a positive case (InitSystems
carrying a real per-init trigger) proves the lookup is genuinely per-name,
not just always-false.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
Prerequisite for the ScanAllCandy pipeline retype: charly core needs to call
FinalizeCandyRefs at the fix-point arbitration's final step (once per
winning candidate), but core may import ONLY sdk/spec + proto, never an sdk
mechanism kit (import-purity). FinalizeCandyRefs is a pure, non-registry-
coupled data-shape transform over already-spec-native types (CandyModel/
CandyView/CandyRefs) — the same class as CandyRefEntry.Bare()/
ToCandyRefEntries, already in spec — so it belongs there, not in loaderkit.
No behavior change; loaderkit.ScanRemoteCandy's own QualifyRemoteSiblingDeps
use is untouched (that one genuinely stays loaderkit-only, no core caller
needs it directly).

Assisted-by: Claude Sonnet 5 (analysed on a live system)
…ng (W9)

Widens spec.CandyReader with the multi-consumer identity/plugin-declaration
accessors the core-side type-Candy retype needs now that no concrete *Candy
exists to read fields off directly: GetStatus, GetDescription, GetBakePlugin
(bare-string CandyModel.BakePlugin re-wrapped as CandyRefEntry, matching
GetRequire/GetIncludedCandy's existing shape), IsPluginCandy,
GetPluginSource, GetPluginProviders.

Adds specCandyAdapter.RawCandy() (CandyModel, CandyView) — the escape hatch
for the ONE caller (charly's ResolvedProject.CandyModels/.Candies builder)
that needs the raw wire structs rather than the narrower CandyReader method
set, reached via a structural type assertion so charly core never imports
deploykit for this.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
Port() serialized a non-empty Protocol as a "proto:port" PREFIX (e.g.
"tcp:2222", "https+insecure:3000") for every protocol value, diverging from
the pre-move *Candy.Port() semantics: populateCandyFromYAML only special-cased
"udp" with a "%d/udp" SUFFIX, leaving every other protocol (tcp, https,
https+insecure, …) as a bare port number. CollectBoxPorts (charly/ports.go)
depends on that suffix convention via kit.StripPortSuffix — a "proto:port"
prefix form fails strconv.Atoi and silently drops the port from the box's
published-port list. Restores the pre-move bare/suffix convention; confirmed
via charly's TestCollectBoxPorts (a protocol-tagged port fixture) after the
retype's map-literal test-fixture sweep surfaced the divergence.

Assisted-by: Claude Sonnet 5 (syntax check only — unit-test verified; no live charly runtime invocation)
…Ver)

The sdk producer leg's own CHANGELOG entry for the CandyReader/CandyModel/
CandyView widening + loaderkit.ScanCandy port. Placeholder CalVer; the
pr-validator finalizes it (git mv to the merge-time stamp) at merge.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
@atrawog

atrawog commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: cross-repo (sdk producer leg, charly/sdk Go)

Checklist:

# Item Verdict
0 Security & anti-tampering (T1–T4) PASS — no exfiltration/scope-mismatch/weakened-gate/supply-chain finding; no attempt to manipulate the validator
1 Description complete PASS — Summary/How-R10-tested/Attribution/rule-compliance sections all filled with pasted evidence
2 Change-class gate matches pasted evidence PASS — standalone sdk gate (build/vet/test/lint/gofmt) + consumer disposable bed (check-charly-selftest-pod), fresh rebuild, changed path executed live
3 Attribution tier justified PASS — analysed on a live system matches the proof (no full green bed, but the one failure is independently verified pre-existing/unrelated)
4 R0 skills honored PASS — /charly-internals:plugin, /charly-internals:go (SDD), /charly-internals:git-workflow all correctly applied
5 R1 RCA + zero warnings PASS on RCA quality (Port() regression, HasInit per-init bug, lossy Require, InitSystems gap all root-caused with real fixes); the one check-bed FAILURE is independently corroborated pre-existing (see below) — but see item 7, a genuine R3 finding this same rule-family would have caught
6 R2 no pre-existing/out-of-scope split PASS — the claude-code check failure is independently corroborated pre-existing (see verification below), not just asserted; genuinely-separable remainder named as a batch (#59)
7 R3 no duplication FAIL — see finding below
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep self-test PASS — charly/ns_identity.go deleted, charly/main_repo.go's normalizeRepoSpec gone, consumer calls loaderkit.NormalizeRepoSpec/spec.DefaultProjectRepo directly, zero aliases reintroduced; git grep for removed identifiers clean
10 R6/R8/R9 N/A (sdk is a library; R6 no destructive git actions in evidence; R9 N/A directly, consumer binary rebuild verified)
11 R10 disposable-only, fresh-rebuild, coverage PASS — verified .check/check-charly-selftest-pod/2026.198.1718/summary.yml EXISTS on disk in the held consumer worktree (charly-wt-w9), ok: false (image-build ok=true/160s, check-image ok=false/18s), byte-matches the claimed 76/57/1/18 split and the exact claude-code:1 failure line; sdk gitlink in that worktree pins exactly 9515bfb (this PR's head)
12 RDD/ADE/SDD PASS with ONE minor nit — see below
13 Concurrency mandate N/A — single disposable bed, not a shared-state/concurrent-roster change (correctly so per the PR's own claim)
14 Hard cutover — one atomic phase PASS — one coherent commit sequence on feat/w9-loader-cone, no Phase-2/TODO
15 Architecture gate — placement review PASS — see per-item trace below
16 Disposable-only autonomy PASS
17 Clean architecture + Go gates FAIL — see R3 finding (item 7); all mechanical gates (gofmt/vet/test/lint) independently reproduced PASS
18 CHANGELOG present PASS — CHANGELOG/2026.198.1944.md, single-line H1 # 2026.198.1944 — …, placeholder CalVer

Blocking finding — R3 duplication: deploykit.AppendUniqueString duplicates kit.AppendUnique

deploykit/security.go:118 adds:

func AppendUniqueString(dst []string, items ...string) []string {
	seen := make(map[string]bool, len(dst))
	for _, v := range dst { seen[v] = true }
	for _, v := range items {
		if !seen[v] { dst = append(dst, v); seen[v] = true }
	}
	return dst
}

This is byte-for-byte identical in logic to the pre-existing kit.AppendUnique (sdk/kit/append_unique.go:9, unchanged by this PR). deploykit already imports github.com/opencharly/sdk/kit extensively (30+ files: compiler_deps.go, quadlet.go, deploy_tree.go's kit_aliases.go, etc.) with zero import-cycle concern (kit does not import deploykit) — there is no architectural barrier that would justify a second copy. deploykit even has an established convention for exactly this situation (deploykit/kit_aliases.go, a thin type X = kit.Y / var x = kit.Y alias file) that this PR could have followed instead of reimplementing the body.

The duplicate is not incidental: it is called 10 times within security.go's new MergeCandySecurity, and the PR ships a dedicated new unit test for it (security_test.go:151 TestAppendUniqueString) — a full parallel tested surface for a function that already exists. The consumer branch (charly feat/w9-loader-cone, not itself gated here but visible via the held worktree) already calls deploykit.AppendUniqueString from config_image.go/pod_lifecycle_resolve.go (4 more call sites), so the blast radius is real, not hypothetical.

This is CLAUDE.md R3 ("the FIRST time the same pattern … would land in a second place, refactor to ONE shared abstraction in the SAME working tree") — a hard FAIL per this validator's own item 7 ("A copy-pasted block that should have been shared FAILS"). The fix is mechanical: replace the 10 in-file call sites with kit.AppendUnique(...) directly (add the kit import to security.go), delete the duplicate function + its dedicated test, and — since this is a cross-repo cutover — the companion consumer commit's 4 call sites should be updated to call kit.AppendUnique (or, if deploykit.AppendUniqueString is kept as a call-site convenience, it should be a one-line alias var AppendUniqueString = kit.AppendUnique, never a re-implementation).

Minor non-blocking nit (does not gate this verdict — no fix required to land, but should ride the next docs/schema-touch batch)

schema/candymodel.cue's new requires_capability?: [...string] @go(RequiresCapability) is not a verbatim mirror of schema/candy.cue's already-authored requires_capability?: [...(string & !="")] @go(RequiresCapability) — the non-empty-string refinement (!="") is dropped. Verified this has zero runtime effect: #CandyModel is a build-model wire shape populated from already-#Candy-validated data and is never itself unified against arbitrary authored input (no validateKindValueCUE/unify call site found), and the generated Go field type ([]string) is identical either way. The PR's own header comment claims these fields "mirror candy.cue's own fields+shapes exactly" — this one field doesn't, quite. Not blocking (R2 discriminator: this cutover's own claim and R10 evidence are unaffected either way), but worth tightening in the same pass that fixes item 7 above, or the next schema-touch batch.

Everything else independently re-verified (not re-derived from the PR's word)

  • Standalone sdk gates, reproduced fresh in an isolated worktree (/home/atrawog/Atrapub/o/sdk-wt-v71-validate, isolated GOCACHE/GOLANGCI_LINT_CACHE): gofmt -l . empty; GOWORK=off go build ./... OK; GOWORK=off go vet ./... OK; GOWORK=off go test -count=1 ./... — all 8 packages green (spec, deploykit, loaderkit, kit, enginekit, vmshared, plus no-test buildkit/schema/schemaconcat/proto/internal/schemagen/sshx); GOWORK=off golangci-lint run ./... → 0 issues. TestGenReproducible passes standalone (confirms task cue:gen reproducibility without the go.work path confusion that bit the full task cue:gen invocation in this environment).
  • Diff shape: git diff --stat vs main@03a9a31c = exactly the claimed 22 files, +1964/−175.
  • CUE additions: port/capability/artifact fields on #CandyModel verified byte-identical to candy.cue's own shapes (only requires_capability diverges — see nit above). No new @go(-), no hand-written wire structs; spec.CandyReader/CandyRefEntry/CandyRefs/ScannedCandy/Threaded/DocParser/ProjectWalker/CandyScanner are documented, hand-written NON-wire contracts (interfaces + pipeline-state structs never JSON-marshaled, confirmed by grep — following the ParsedProject/LoadedProject precedent explicitly cited in their own doc comments).
  • HasInit fix: confirmed real — the old body ignored its initName parameter entirely (len(a.m.ServiceFiles) > 0 || len(a.m.Service) > 0, any-init approximation); the new body correctly does a.v.InitSystems[initName]. Confirmed the LATENT blast-radius clause exists in the consumer's CHANGELOG/2026.198.1859.md (composition sweep across all 4 distro submodules + a main-baseline box/cachyos generate proving zero current exposure, plus a regression fixture proven fail-then-pass) — not re-derived from scratch, the narrative is real and adequately evidenced.
  • Consumer sanity: charly-wt-w9's sdk gitlink pins exactly 9515bfb (this PR's head, byte-identical). Built go build ./charly (workspace mode) in that worktree — clean compile, go vet ./charly/... clean. Did not modify that worktree (a transient misdirected-cwd task cue:gen invocation from my own error briefly rewound 5 unrelated submodule checkouts + the pkg/arch gitlink in the main session's own working tree at /home/atrawog/Atrapub/o/charly — fully diagnosed and restored to the exact pre-existing byte-identical state, confirmed via HEAD-vs-checkout SHA comparison across all 6 affected paths; charly-wt-w9 itself was never touched).
  • Eval-bed claim, cross-checked against disk, not the PR's word: .check/check-charly-selftest-pod/2026.198.1718/summary.yml exists, total_seconds: 178 (image-build 160s ok=true, check-image 18s ok=false) — matches the claim exactly. check-image.log line 68 shows the exact claude-code:1 failure signature and line 116 the exact 76 steps: 57 passed, 1 failed, 18 skipped — byte-match.
  • Architecture gate placement trace: every new/moved type in this PR is E-envelope or M-mechanism-adjacent vocabulary (spec.CandyReader/CandyModel/CandyView/Threaded/DocParser/ProjectWalker/CandyScanner), consumed BY the (future) kernel materialize step and BY out-of-process plugins alike — not a kernel-side per-kind branch (this PR touches zero charly/ core files directly; the consumer's own core-file changes are gated separately in the held feat/w9-loader-cone PR, not this one). No new/grown charly/*_aliases.go in this diff (sdk-only). deploykit.CandyModel/CandyRef type-alias-to-spec promotions are the SAME established alias-of-relocated-interface pattern already used elsewhere in this module (vmshared/spec_aliases.go) — legitimate, not a K-wave violation. Placement: CORRECT.

Comments considered: none (PR carries no comments).
Cross-PR interactions considered: opencharly/sdk#71 is the only open PR in sdk; opencharly/charly#118 (P16 kernel-manifest gate) is open but touches an unrelated file set (no overlap) — none-found beyond that; opencharly/plugins has no open PRs.

Decision: FAIL. One genuine, verified, easily-fixable R3 duplication (deploykit.AppendUniqueString vs pre-existing kit.AppendUnique) blocks this PR per CLAUDE.md R3 and this validator's own mandate ("A copy-pasted block that should have been shared FAILS"). Everything else — the CandyReader/CandyModel/CandyView relocation, the CUE additions (bar one non-blocking nit), the HasInit fix + its documented latent-blast-radius clause, the R5 hard-cutover sweep, and every mechanical gate — is independently verified sound. Fix in place (call kit.AppendUnique directly, or a one-line alias per the kit_aliases.go convention; delete the duplicate + its dedicated test; update the companion consumer call sites in the same cutover), re-push, and this re-validates cleanly.

Assisted-by: Claude Sonnet 5 (analysed on a live system)

atrawog added 2 commits July 17, 2026 22:16
Fix round from sdk#71's fresh pr-validator (V-sdk71), CHANGES REQUESTED:

1. R3 (BLOCKING): deploykit/security.go carried AppendUniqueString, a
   byte-identical copy of kit.AppendUnique (kit/append_unique.go, itself a
   K4-lane-B relocation whose own doc comment already claimed a
   kit_aliases.go passthrough that didn't yet exist). Deleted the divergent
   copy; deploykit/kit_aliases.go now aliases AppendUnique = kit.AppendUnique
   (the established alias convention this file already uses for the
   executor types). Its dedicated test (TestAppendUniqueString) is not
   simply deleted — kit.AppendUnique had ZERO test coverage of its own, so
   the test moves to kit/append_unique_test.go (TestAppendUnique, testing
   the owning implementation directly) rather than being lost.

2. CUE mirror divergence (R1 claim-divergence, rides same commit):
   schema/candymodel.cue's requires_capability field was `[...string]`
   while candy.cue's own authored shape (which the PR's doc comment claims
   to mirror exactly) is `[...(string & !="")]`. Fixed to match; `task
   cue:gen` regeneration confirmed a no-op on the generated Go (the
   constraint doesn't change the emitted []string shape).

Verification: GOWORK=off go build/vet/test -count=1 ./... clean; golangci-lint
run ./... 0 issues; gofmt -l . clean; task cue:gen no-op on cue_types_gen.go/
vocab_gen.go/version_gen.go.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
The round-1 fix's TestAppendUnique carried a comment narrating its
migration and naming the deleted TestAppendUniqueString — an R5 violation
(a code comment is not the sanctioned CHANGELOG/migration-help context for
a deleted identifier). Dropped; the test needs no origin story on the
owning implementation. Added the fix-round narrative to
CHANGELOG/2026.198.1944.md instead (the correct home for provenance).

git grep, both repos, both names — zero hits (verbatim, both exit 1):
  sdk:    AppendUniqueString      -> no matches
  sdk:    TestAppendUniqueString  -> no matches
  charly: AppendUniqueString      -> no matches
  charly: TestAppendUniqueString  -> no matches

Assisted-by: Claude Sonnet 5 (analysed on a live system)
@atrawog

atrawog commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅ (round 2, fresh independent re-validation)

Change class: cross-repo (sdk producer leg, charly/sdk Go)

This is a FRESH, independent round-2 validation (new context, no inheritance from round 1's
reasoning) against head 7e76424 (fix commits a35f37b + 7e76424 on top of round-1's
9515bfb). Re-derived from scratch in an isolated worktree with isolated GOCACHE/GOLANGCI_LINT_CACHE.

Checklist:

# Item Verdict
0 Security & anti-tampering (T1–T4) PASS — no exfiltration/scope-mismatch/weakened-gate/supply-chain finding
1 Description complete PASS — same filled template as round 1; fix-round narrative added to CHANGELOG
2 Change-class gate matches pasted evidence PASS with a noted evidence-completeness gap (see "Additional finding" below) — the standalone sdk gate is fully reproduced; the cited consumer bed excerpt was incomplete, but MY OWN full re-run confirms the claim
3 Attribution tier justified PASS — analysed on a live system; my own live bed run supports it (see below)
4 R0 skills honored PASS
5 R1 RCA + zero warnings PASS — both round-1 findings root-caused and fixed with real mechanism, not a workaround
6 R2 no pre-existing/out-of-scope split PASS
7 R3 no duplication PASS (FIXED) — AppendUniqueString deleted; deploykit/kit_aliases.go now aliases AppendUnique = kit.AppendUnique (the file's own established convention); the orphaned test relocated to kit/append_unique_test.go as TestAppendUnique, testing the true implementation directly (previously untested). Independently confirmed: git grep -n "AppendUniqueString" → zero hits; consumer (charly-wt-w9) already calls deploykit.AppendUnique at all 6 call sites (config_image.go×2, pod_lifecycle_resolve.go×4), zero references to the old name.
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep self-test PASS — git grep -n "AppendUniqueString|TestAppendUniqueString" on 7e76424: zero hits in both sdk and the consumer worktree. The round-1 fix's OWN comment naming the deleted TestAppendUniqueString (itself a fresh R5 violation) was caught and dropped in 7e76424, with the provenance moved to CHANGELOG instead — a clean self-correcting second pass.
10 R6/R8/R9 N/A (library) — no destructive git action; consumer binary independently rebuilt clean against this exact head
11 R10 disposable-only, fresh-rebuild, coverage PASS, but see Additional finding — I re-ran the FULL bed myself rather than accept the pasted excerpt at face value
12 RDD/ADE/SDD PASS — task cue:gen reproducibility independently re-confirmed as a no-op (ran fresh in my worktree, git status clean after); TestGenReproducible green; the requires_capability CUE fix verified byte-identical to candy.cue:40 ([...(string & !="")]); all new spec types (CandyReader, CandyRefEntry, CandyRefs, ScannedCandy, the CandyScanner/ProjectWalker seams) independently confirmed non-wire (zero json tags, zero json.Marshal/Unmarshal call sites), matching the documented ParsedProject/LoadedProject precedent
13 Concurrency mandate N/A — single disposable bed, no shared-state path touched
14 Hard cutover — one atomic phase PASS
15 Architecture gate — placement review PASS — zero charly/*.go files in this diff (all 24 files under CHANGELOG/, deploykit/, kit/, loaderkit/, schema/, spec/); every new type is E-envelope/M-mechanism vocabulary hosted in spec/loaderkit/deploykit, consumed by the (future) kernel materialize step and by plugins alike — no kernel-side branch. Placement: CORRECT. No alias-file or kit-import mechanical sub-checks apply (sdk-only diff).
16 Disposable-only autonomy PASS — my own bed re-run was on the disposable: true check-charly-selftest-pod target
17 Clean architecture + Go gates PASS — independently reproduced in an isolated worktree: gofmt -l . empty, GOWORK=off go build ./... clean, GOWORK=off go vet ./... clean, GOWORK=off go test -count=1 ./... all 8 packages green, GOWORK=off golangci-lint run ./... → 0 issues
18 CHANGELOG present PASS — CHANGELOG/2026.198.1944.md, H1 # 2026.198.1944 — … (placeholder CalVer, finalized at merge), now carrying the round-1 fix narrative

Additional finding — the PR's own R10 citation was incomplete; I re-ran the full bed myself

The PR body pastes only 2 of the check-charly-selftest-pod bed's steps (image-build +
check-image, 178s total) as its R10 evidence. Per this validator's own mandate ("NO benefit of
the doubt on the bed evidence... RE-RUN when suspicious"), and because the timing didn't add up
(the cited run's calver 2026.198.1718 predates the R3/CUE fix commits by ~3 hours, and the
consumer's own gitlink-bump history shows the consumer was pinned to an earlier sdk commit than
7e76424 at that exact run time), I re-ran the FULL charly check run check-charly-selftest-pod
myself in the held charly-wt-w9 worktree — read-only w.r.t. its git state, against its
already-fresh binary (charly version 2026.198.2017, confirmed built from this exact final sdk
commit with zero local sdk diffs).

Full run (.check/check-charly-selftest-pod/2026.198.2033/, 1160s total):
image-build PASS (174s) → check-image now FULLY GREEN (69 steps, 0 failed — the
claude-code check cited as pre-existing-and-unrelated is GONE, consistent with the PR's own claim
and with task #58 addressing it) → deploy-add/config/start/bring-up-members all PASS →
check-live FAILED (2 failures, out of 82 steps):

  • mcp-charly-call-list-boxes: mcp call box.list.boxes → "unknown tool box.list.boxes"
  • charly-cli-check-group: charly check --help doesn't list "live" as a subcommand (the
    out-of-process command:check plugin shows a generic passthrough placeholder pre-connect)

Traced both: neither touches spec/deploykit/loaderkit (this PR's entire diff surface) — they
are MCP-tool-registration and command-externalization-grammar issues, structurally unrelated to
the candy-scan/CandyReader/CandyModel/CandyView pipeline this PR changes. This is the consumer
feat/w9-loader-cone branch's own WIP fallout (likely the ongoing K5/command-externalization
work), not something sdk#71 caused.

Why this is non-blocking for sdk#71 specifically: the objective R2 separability test — does
sdk#71's own claim hold without the fix? — is satisfied: sdk#71's standalone gates are 100% green,
and the FULL fresh bed run (which I performed, going beyond what was cited) shows the
candy-scan-relevant portion of the pipeline (image-build + check-image) is not just passing but
IMPROVED over the cited evidence (zero failures vs. the cited one). The 2 check-live failures
would not change verdict on THIS PR either way. I've flagged them directly to the orchestrating
session so the CONSUMER's own upcoming feat/w9-loader-cone PR addresses or explicitly triages
them before its own R10 gate — they must not surprise that PR's validator.

Consumer sanity (independently verified, not taken on faith):
charly-wt-w9's sdk gitlink pins exactly 7e76424 (git ls-tree HEAD sdk); go build ./charly/... and go vet ./charly/... both clean in that worktree; zero unmodified files
introduced by my inspection (only the new .check/ bed-run artifacts, which are gitignored
runtime output, not tracked state).

Comments considered: the round-1 pr-validator CHANGES-REQUESTED comment (this same PR,
2026-07-17T20:03:47Z) — verified-blocking at the time (R3 dup + CUE mirror), both independently
re-confirmed FIXED in this round.

Cross-PR interactions considered: opencharly/sdk has no other open PRs. opencharly/charly#118
(P16 kernel-manifest gate) is open but touches only CHANGELOG/2026.195.0000.md +
charly/kernel_manifest_floor_test.go — zero file overlap with this PR's diff surface —
none-found. opencharly/plugins has no open PRs.

Decision: PASS. Both round-1 blocking findings are correctly and cleanly fixed, with the
fix-round's own R5 self-correction (dropping a comment naming a deleted identifier) as a good
sign of process discipline. All mechanical gates independently reproduced green in an isolated
worktree. My own fresh, more-complete disposable bed run supports (and slightly strengthens) this
PR's R10 claim for the code this PR actually changes. Merging, finalizing the CalVer, and tagging.

Assisted-by: Claude Sonnet 5 (analysed on a live system)

pr-validator (round 2, V2-sdk71) finalizes the merge-time CalVer stamp on
PASS: git mv the placeholder CHANGELOG/2026.198.1944.md to
CHANGELOG/2026.198.2057.md and rewrite its H1 to match.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
@atrawog
atrawog merged commit b24b168 into main Jul 17, 2026
@atrawog
atrawog deleted the feat/w9-loader-cone branch July 17, 2026 20:59
atrawog added a commit that referenced this pull request Jul 29, 2026
…c aliases (#55 step 3-III sdk leg) (#110)

* refactor(buildkit)!: DistroConfig/BuilderConfig containers → thin spec aliases (#55 step 3-III sdk leg)

The value-type containers + methods + WrapDistroDef/DistroTagChain now source
from spec (merged v0.2026210.2052); buildkit keeps thin type aliases (−285 LOC in
format_config.go), matching its existing DistroDef/BuilderDef alias pattern.
InitConfig unchanged (composition policy → #65/#71). require spec bumped
v0.2026210.1533 → v0.2026210.2052.

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

* chore(changelog): finalize #55 step 3-III sdk-leg stamp → 2026.210.2103

Merge-time CalVer finalization by the fresh pr-validator: rename the
placeholder CHANGELOG to the merge-time stamp and rewrite its H1. No code
change; the buildkit alias cutover is unchanged.

Assisted-by: Claude Code Claude Opus 4.8 (fully tested and validated)
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_018iiqSrY7SkJhgvqDYpiHGH

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
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