Repository navigation
fix(loaderkit)!: scope candy-version arbitration + notice PER BOX, INFO not WARNING (#735) - #324
Conversation
…FO not WARNING (#735) The resolver arbitrated a bare ref GLOBALLY: candidates were keyed by bare ref alone, so every independent box in an assembled closure merged into ONE set and the closure emitted ~1602 spurious warnings that blocked R10's zero-warnings gate (opencharly/charly#733/#735 §9). Scope the arbitration to ONE BOX (a box is an independent, immutable composition): - refs_collect.go: keep each collected ref's SCOPE label(s). A box's own candy list labels its refs box=<qualified-name>; a layer's require:/candy: is attributed to the box(es) whose candy closure reaches it (the authoritative unit: '>=2 layers INSIDE one box'); kind:local and add_candy keep their own scopes. The former single global (repo,tag)->refs map is DELETED. - scan_orchestrate.go: the fetch fix-point accumulates the UNION of scope labels on each (repo,tag,ref) across rounds and builds one candidate per materialization carrying them (RemoteDownload.RefReferrers -> CandyCandidate.Referrers). - candy_version.go: winner stays the NEWEST REFERENCED tag; a diagnostic fires ONLY when ONE scope's own references name >=2 distinct tags AND their content differs, and it is emitted at DiagInfo (resolvable), never DiagWarning. Cross-box version differences are silent; DiagWarning is reserved for no-candidate (unresolvable). *Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)*
Review — BLOCKHead SHA: Change class: Go mechanism source ( Security screen: PASS — no secrets/exfiltration, no new network egress, no guardrail config touched (the Comment intake: 0 comments — nothing to disposition; and note the consequence in Block 1 (no sign-off exists). Blocks
Comment intake: no comments to disposition (0). Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…t/diff truth BLOCK 1 (A2/B12): the sdk leg cannot run the assembled charly bed (the sdk has no box), so add a LIVE MECHANISM BED (scan_live_bed_test.go) that drives the REAL changed path — CollectRemoteRefsOpts -> EnsureRepoDownloaded (the warmed git cache) -> ScanRemoteCandy/ParseCandyManifest -> PickCandyVersion — against REAL per-tag materializations of github.com/opencharly/layer-direnv (v2026.242.1147 vs v2026.272.0057, genuinely differing content). Two independent boxes -> SILENT; one box with the two layers -> INFO (never WARNING); newest REFERENCED wins. Live-gated (LIVE_SDK_MECHANISM_BED) with the paste in the PR body; skips cleanly otherwise. BLOCK 2 (A1/B10, B5): correct the refs_collect.go prose that claimed the global map was deleted and described a phantom byScope variable — the (repo,tag) fetch set is GLOBAL by design (one clone per (repo,tag)); the defect removed was the bare-ref-keyed CANDIDATE merge, which referrers now prevents. Comment matches code.
Review — BLOCKHead SHA: Change class: Go mechanism source ( Security screen: PASS — no secrets/egress/new deps, no guardrail config touched (the Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…may be empty) Block 2 of the #324 review: the doc block still asserted "cands is non-empty", which contradicted this PR's own new empty-set arm (emit DiagWarning + return the zero candidate, asserted by TestPickCandyVersionNoCandidatesWarns) and the SEVERITY paragraph. The precondition now states exactly the code's behaviour: cands may be empty (unresolvable -> DiagWarning), a resolvable set emits at most a DiagInfo scope-conflict notice. Assisted-by: OpenCode deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: Go mechanism source ( Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…nsts, one diag path BLOCK 1 (B5/B10): the refs_collect.go comment still claimed the candidate merge was "removed"; the candidate list is RETAINED (it is scope-annotated via referrers, and the arbiter's scopeConflicts does the scoping). Comment reworded to match the code. BLOCK 2 (B18/B14a): remove the unused oldRef/newRef constants and their _ = silencers in TestCollectScopesTwoLayersInOneBoxShareTheBoxScope. BLOCK 3 (B7/R3): route the local-shadow notice through the shared emitDiag helper instead of an inlined nil-sink fallback; drop the now-unused "os" import. Assisted-by: OpenCode deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no secrets/exfiltration, no new deps or network egress (the live bed serves the git hop from the existing warmed cache), no guardrail config touched. The Checklist: All applicable rules PASS or NA. Change class = Go mechanism source ( Comment intake: 3 comments, all Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The candy-version resolver arbitrated a bare ref globally.
spec's per-box scope (mergedopencharly/spec#186, tagv0.2026272.1512) made the SCOPE available; this PR makessdk'sloaderkitUSE it, so arbitration + the diagnostic are per box:(scope, bareRef), neveracross boxes. The
referrersmap carries SCOPE labels alongside the(repo, tag)fetchcoordinate; the fetch set stays global by design (one clone per
(repo, tag)), thecandidate merge is what is scoped.
INFO (resolvable) — never WARNING, and never the newest remote tag.
spec.DiagLevel,merged in
spec#186); no parallel advisory API.Root cause, evidence, and the formal 8-step RCA:
opencharly/charly#735. This is thesdklegof the
spec→sdk→charlychain.This clears
#733's zero-warnings gate, since the ~1602 advisories were spurious cross-box"conflicts" — independent boxes are not a conflict.
How tested
Gate — from the committed tree (
1bf3579)LIVE mechanism bed — the changed path, real materializations (
LIVE_SDK_MECHANISM_BED=1)The
sdkrepo has no box, so the assembledcharlybed cannot run on this leg. Instead thebed drives the real changed pipeline
(
CollectRemoteRefsOpts → EnsureRepoDownloaded → ScanRemoteCandy/ParseCandyManifest →candyVersionDecision) against two real per-tag materializations ofgithub.com/opencharly/layer-direnv(v2026.242.1147vsv2026.272.0057, genuinely differingcontent):
The bed is live-gated on
LIVE_SDK_MECHANISM_BEDand skips cleanly when unset (the honestskip contract); the paste above is a real run.
Rulebook compliance
/charly-internals:root-cause-analyzer,/charly-internals:strict-policy,/charly-internals:git-workflowloaded before editing.opencharly/charly#735(globalwhole-project resolve); no "transient" classification.
specleg is merged (#186) and thecharlypin-bump is the immediate next leg of the same cutover (named, owned) — not a deferral.
referrersrather than a secondcandidate map.
Precisely: the
(repo, tag)fetch set stays global by design (one clone per(repo, tag)),and the bare-ref-keyed candidate set is retained and scope-annotated (
referrerscarrieseach candidate's SCOPE labels); the scoping now lives in the arbiter (
scopeConflictsincandy_version.go), which only treats references sharing a scope as a conflict. So the globalconflict is gone while the global fetch/candidate plumbing is deliberately kept — the body
and the inline comments now say exactly that. No phantom
byScopereference remains inrefs_collect.go.go build/go vet/go testpasted above; the live mechanism bed pasted above.charlybedis structurally impossible on the non-deployable
sdkleg and runs on thecharlyleg ofthis same cutover (which is the immediate next leg). The live bed is the mechanism-level proof
for this leg.
Change classification
Change class: Go mechanism source (
loaderkit/) +go.mod/go.sumpin bump.Verification gate: gate (
gofmt/build/vet/test) + the live mechanism bed above.Attribution tier:
analysed on a live system(the live bed drives the real path; the assembledcharly bed runs on the
charlyleg).Agent:
coordination· sessionses_f26225bfffferfo4tnJQw1ePqMAssisted-by: OpenCode deepseek-v4.1-flash (analysed on a live system)