Skip to content

fix(loaderkit): exempt a from: whose structural kind folded no template here - #300

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/kubevirt-unconnected-kind-fix
Sep 26, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/kubevirt-unconnected-kind-fix

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

fix(loaderkit): exempt a from: whose structural kind folded no template here

R1 — a real project-wide validation defect, found while wiring the KubeVirt R10 beds
(charly#676).

The anomaly

ValidateCheckBeds requires a kind:check bed's from: cross-ref to resolve. It
returns on the FIRST error, so ONE mis-resolving bed aborts validation for the WHOLE
project. Measured live:

$ charly deploy add <any-vm-bed>
charly: error: … plugin-deploy-vm prepare-venue: resolve vm entity "k3s-vm":
resolve kind:vm entity "k3s-vm": <charly.yml>: kind:check bed "check-kindcluster"
references kindcluster entity "check-kindcluster-cluster" which is not defined

Every VM bed becomes un-runnable, not just the kindcluster one. Reproduced on
pristine origin/main with a pre-existing main bed (check-charly-vm) — so it
is not a caller's fault.

Root cause

candy/plugin-deploy-vm's prepare-venue re-loads the project via
loaderkit.LoadUnifiedViaExecutor — a read-only plugin-side load that has no
connect pass
and does not compile in every structural-kind provider (plugin-kube,
which folds the kindcluster template, is absent). So in that process
PluginKinds["kindcluster"] is empty and the same-file from: cannot resolve — even
though the SAME file validated fine host-side, where the provider IS connected.

The existing declaredStructuralKindUnconnected helper only exempts a targetless
bed, not a bed with an unresolvable from:.

Summary of changes

  • loaderkit/validate_check_beds.go — when a bed's from: fails ResolveEntityRef
    and its target kind folded zero templates in this scope
    (kindTemplatesAbsentHere), the cross-ref cannot be judged here (the provider never
    ran) → exempt. The signal is local to the uf (folded templates), NOT the
    host-computed StructuralDeclaredFields snapshot: a plugin process receives the
    host's "connected" snapshot while its own PluginKinds[target] is empty.
    • A kind that folded some templates but not this ref is a real typo → still
      rejected.
    • A built-in resource kind (vm/pod/…) is never in t.StructuralKinds → never
      exempt.
  • loaderkit/validate_check_beds_unconnected_kind_test.go — new: the un-folded case
    is exempt (fails without the fix); the folded-but-bad-ref case is still rejected; the
    built-in case is unaffected.

How tested

$ GOWORK=off go build ./... && echo BUILD OK
BUILD OK
$ GOWORK=off go vet ./loaderkit/
(vet clean)
$ gofmt -l .
(empty)
$ GOWORK=off go test ./... -count=1
(no FAIL lines — full suite green)
$ GOWORK=off go test ./loaderkit/ -run TestValidateCheckBeds -count=1 -v
… all PASS
$ # with the exemption removed (the bug):
--- FAIL: TestValidateCheckBeds_UnconnectedKindFromExempt
    an un-folded structural kind's from: must be exempt, got: kind:check bed "check-kc"
    references kindcluster entity "check-kc-cluster" which is not defined

Live end-to-end — the real reproduction (a project with a kindcluster: bed + a
vm: bed), run against a plugin-deploy-vm built with this sdk (local override):

$ CHARLY_REPO_OVERRIDE=opencharly/plugin-deploy-vm=<worktree> charly deploy add my-vm-bed
# BEFORE: … kind:check bed "check-kcluster" references kindcluster entity … not defined
# AFTER : the kindcluster error is GONE — the run proceeds to the vm create leg.

Rulebook compliance

  • R0 — authored under the sdk/go rulebooks.
  • R1 — the anomaly is root-caused to the plugin-side load's absent connect pass; the
    fix removes the cause (an unresolvable-here cross-ref is no longer fatal), not the
    symptom.
  • R2 — the validator + its test land together.
  • R3 — one local-fold signal; reuses the existing ResolveEntityRef resolution.
  • R4 — no workaround; the exemption keys on process capability, not a bypass.
  • R4a — no doc routed around a defect.
  • R5 — no stale path; the folded-kind and built-in cases keep full enforcement.
  • R6 — branch-only, no force-push.
  • R7 — the regression test fails without the change (paste above).
  • R8 — the validator's decision is the asserted artifact.
  • R9 — built from the worktree source; go build/test at the shipped pin.
  • R10 — the fixed path ran live (the real reproduction above); the KubeVirt bed R10
    is the named kubevirt-check-beds batch.

Change classification

  • Change class: code (ValidateCheckBeds cross-ref exemption).
  • Verification gate: Go build/vet/test at the shipped pin + the live reproduction.
  • Attribution tier: analysed on a live system — the fixed path ran live against the
    real reproduction; the full KubeVirt bed R10 is the named batch.

Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

…te here

R1: a kind:check bed whose from: names a template folded by a STRUCTURAL kind whose
provider did not run in THIS process false-failed "not defined", and since
ValidateCheckBeds returns on the first error, that ONE bed aborted validation for
the whole project. Measured live: candy/plugin-deploy-vm prepare-venue re-loads the
project via LoadUnifiedViaExecutor (a read-only plugin-side load with NO connect
pass and without plugin-kube compiled in), so a project declaring a kindcluster: bed
made EVERY vm bed un-runnable ("resolve kind:vm entity k3s-vm: ... check-kindcluster
references kindcluster entity check-kindcluster-cluster which is not defined").

Fix: when a bed's from: does not resolve AND its target kind folded ZERO templates
in this scope (kindTemplatesAbsentHere), the cross-ref cannot be judged here -- the
provider never ran, so PluginKinds[target] is empty through no authoring fault. That
case is exempt. The signal is LOCAL to the uf (folded templates), NOT the
host-computed StructuralDeclaredFields snapshot: a plugin process receives the
host's "connected" snapshot while its own template map is empty. A kind that folded
SOME templates (but not this ref) is a real typo and stays rejected; a built-in
resource kind is never exempt.

Test: TestValidateCheckBeds_UnconnectedKindFromExempt fails without the fix.
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 5da5f507daf1c19ead4d6b872b93e521a454ca7b (branch: feat/kubevirt-unconnected-kind-fix)

Change class: code — sdk library change (loaderkit validator + test); gate is Go build/vet/test plus a live reproduction.

Security screen: PASS — no scope mismatch, secrets, exfiltration, supply-chain edit, or guardrail change in the T3 sense (ValidateCheckBeds is not the pre-push/pre-commit/branch-protection config, this review gate's spec, or the landing/attribution/no-force-push rules; the exemption is a justified false-positive fix, not a security-gate loosening).

Checklist: All applicable rules PASS or NA — diff↔body consistent (exemption keys on !ResolveEntityRef && !kindTemplatesAbsentHere; folded-kind and built-in cases still enforced, matching the tests); a genuine regression test ships and fails without the fix (pasted --- FAIL: TestValidateCheckBeds_UnconnectedKindFromExempt); body accounts for both changed files; valid italicized Assisted-by: … (analysed on a live system) footer; one atomic commit; placement correct (kind-blind reusable mechanism in sdk/loaderkit, not core, not a candy). Tool-limited disposition: I cannot re-run beds, so I cross-checked the pasted unit-test output (names/messages match the diff) and the live-repro before/after (consistent with the fix) for internal consistency — both reconcile. Comment thread: 0 comments, nothing to reconcile.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 26, 2026 11:57
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: a89f228cc9da57425fe85cc3af77eb848fecb6e2 (branch: feat/kubevirt-unconnected-kind-fix)

Security screen: PASS — no T3 scope mismatch, secrets, exfiltration, supply-chain edit, or guardrail weakening. loaderkit.ValidateCheckBeds is a charly project validator, not the pre-push/pre-commit/branch-protection config, this review gate's spec, or the landing/attribution/no-force-push rules, so T4 does not attach; the exemption is a justified false-positive fix, not a security-gate loosening.

Checklist: All applicable rules PASS or NA. Diff↔body reconcile: the exemption keys on !ResolveEntityRef(...) && !kindTemplatesAbsentHere(...); the folded-kind and built-in cases stay enforced, and each body claim maps 1:1 to a shipped test (…FromExempt, …ConnectedKindBadRefStillEnforced, …BuiltinKindUnaffected). The regression test's pasted --- FAIL … kind:check bed "check-kc" references kindcluster entity "check-kc-cluster" which is not defined matches the test's own error string exactly — internally coherent. Body accounts for both changed files, carries a valid italicized *Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)* footer, and the tier is not inflated. One atomic fix commit (plus a main-merge commit — collapse, not a partial-work split). Placement: CORRECT — kind-blind reusable mechanism in sdk/loaderkit, not core, not a candy; no alias growth, no new core import.

Comment intake: 1 comment (github-actions[bot] PASS) — stale-superseded: it reviewed head 5da5f507…, not the current post-merge head a89f228c…. Re-derived against the current 2-file diff, its diff-level claims still hold, so nothing survives from it in either direction.

Tool-limited: cannot re-run Go build/vet/test or the live repro; cross-checked the pasted outputs (BUILD OK, the FAIL block, the before/after repro) for internal consistency — bed/entity names, error strings, and test names all reconcile with the diff.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot merged commit ba73ab7 into main Sep 26, 2026
6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 26, 2026
github-actions Bot pushed a commit to opencharly/plugin-deploy-vm that referenced this pull request Sep 26, 2026
…on) (#24)

Consumes the merged loaderkit fix (opencharly/sdk#300): a check bed whose from
names a template folded by a structural kind whose provider did not run in THIS
process (plugin-kube is absent from this plugin) no longer false-fails not
defined. Because ValidateCheckBeds returns on the first error, that ONE bed
aborted validation for the whole project, so prepare-venue re-load made EVERY vm
deploy fail in a project that declares such a bed. Bumping the pin picks up the
exemption.

Co-authored-by: AI Worker <ai@local>
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