Skip to content

fix(resolver): populate sdk submodule in the @main plugin cache + hint carries override - #12

Merged
atrawog merged 2 commits into
mainfrom
feat/resolver-sdk-submodule
Jul 8, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/resolver-sdk-submodule

Conversation

@atrawog

@atrawog atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes for the @main plugin-cache failures the concurrent 61-bed roster surfaced (pre-existing, independent of P1):

  1. sdk submodule not populated in the @main cache. The plugin-ref resolver's GitClone (git clone --depth 1 / git init+fetch) pulled no submodules, so ~/.cache/charly/repos/…@main/sdk/ was empty and go.work's use ./sdk broke every out-of-tree plugin build from the @main cache (cannot load module ../../sdk … no such file). The provider then failed to connect — the examplestructkind "provider did not connect" warning and the check-live "no provider registered". Added populateSDKSubmodule: after a fresh fetch it inits only the sdk submodule, rewriting the .gitmodules SSH url ([email protected]:) to HTTPS so no SSH key is needed in a headless run; a repo without an sdk submodule (a box/<distro>) is a clean no-op.

  2. debug hint didn't reproduce the bed env. A FAILED bed's inspect: charly check live <bed> hint dropped the CHARLY_REPO_OVERRIDE the bed ran with, so the operator's command resolved the @main-published candies/plugins — a different deployment. The hint now carries the active override.

Change class + gate (R10, code)

  • go test ./... green. New tests: TestGitClone_PopulatesSDKSubmodule (network integration — a real GitClone of the charly repo populates sdk/go.mod), TestPopulateSDKSubmodule_NoSDKRepoIsNoOp, TestDebugNotice_CarriesRepoOverride. golangci-lint 0 issues; task build:charly R9 (charly version 2026.189.0336).
  • RDD + concrete proof (pasted): the git command populates sdk via HTTPS with SSH forced off, and from a freshly-populated cache plugin-example-structkind (the connect-fail plugin) builds EXIT 0 the resolver's exact way (GOWORK=off go build ./cmd/serve) — before the fix it failed cannot load module ../../sdk.

Single-repo (no submodule pointer change).

Tier: fully tested and validated.

Assisted-by: Claude (fully tested and validated)

…t carries override

GitClone pulled no submodules, so the @main cache's sdk/ was empty and go.work's
`use ./sdk` broke every out-of-tree plugin build ("cannot load module ../../sdk"),
failing plugin providers to connect (examplestructkind connect-fail warning; the
check-live "no provider registered"). Add populateSDKSubmodule after a fresh
fetch: init only the sdk submodule, rewriting the .gitmodules SSH url to HTTPS
(no SSH key needed headless); a repo without sdk is a no-op. Verified: fresh
GitClone populates sdk/go.mod (integration test) and plugin-example-structkind
then builds EXIT 0 (GOWORK=off ./cmd/serve). Also: the failed-bed inspect hint
now carries the active CHARLY_REPO_OVERRIDE so `charly check live` reproduces the
bed's local-checkout state (was resolving @main-published plugins).

Assisted-by: Claude (fully tested and validated)
@atrawog

atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code/config (charly Go: plugin-ref resolver + check-bed debug hint)

Security & anti-tampering (T1–T4): PASS — no touch to the validator spec / CLAUDE.md / hooks / branch-protection; no embedded instructions to the validator in body/comments/code; diff (136+/5-) matches the description exactly, all 4 files accounted for; the insteadOf rewrite is scoped to a single -c git invocation (not persisted to global config); only sdk is inited (never the heavy box/*); no secrets/exfiltration, no new dependencies, no version-pin or CI changes.

Checklist:

  • [PASS] Description complete — Summary, change-class + gate, RDD/concrete proof pasted, tier stated.
  • [PASS] No submodule change — 4-file single-repo diff (CHANGELOG, charly/refs_git.go, charly/check_bed_run.go, charly/refs_git_submodule_test.go); no gitlink/Subproject commit bump.
  • [PASS] Change-class gate vs evidence — go build ./... 0; go test ./... 0 (50.7s, incl. internal/pluginsgen); the 3 named tests PASS with TestGitClone_PopulatesSDKSubmodule actually running the real-network clone (1.95s, not skipped); golangci-lint 0 issues; gofmt -l clean.
  • [PASS] Independently reproduced the core fix — a fresh @main clone + the resolver's exact HTTPS-forced submodule update --init --depth 1 sdk populates sdk/go.mod, and plugin-example-structkind then builds EXIT 0 the resolver's way (GOWORK=off go build ./cmd/serve) — the "cannot load module ../../sdk" failure is gone. On this host a local charly check run <bed> is diverted by CHARLY_REPO_OVERRIDE to the LOCAL tree, so the fresh-clone reproduction is the gate that can actually fail on the @main-cache path.
  • [PASS] Attribution tier justified — the changed runners (GitClone→populateSDKSubmodule, printDebugRetentionNotice) executed live with pasted output and ship failing-without-fix coverage.
  • [PASS] R5 grep self-test — additive change, no identifiers removed (N/A).
  • [PASS] R1–R4 / clean architecture — populateSDKSubmodule called on both clone success paths; box/ no-op guard; live prefix computed once (R3); no sleep/retry/magic-number.
  • [PASS] CHANGELOG present — CHANGELOG/2026.189.0340.md placeholder (finalized to the merge-time CalVer below).
  • [PASS] Skills honored — /charly-internals:go (resolver refs_git.go, R9 build), /charly-internals:check (bed debug hint / CHARLY_REPO_OVERRIDE).

Decision: APPROVED. Both fixes are real and correct, the resolver fix is independently reproduced live by the fresh evaluator (fresh @main clone → sdk populated → out-of-tree plugin build EXIT 0), every gate is green at zero warnings, and the change ships tests that fail without it. Finalizing the merge-time CalVer, merging --rebase, and tagging.

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

…sdk submodule + override hint)

Assisted-by: Claude (analysed on a live system)
@atrawog
atrawog merged commit eccebfc into main Jul 8, 2026
@atrawog
atrawog deleted the feat/resolver-sdk-submodule branch July 8, 2026 04:00
atrawog added a commit that referenced this pull request Jul 24, 2026
…warded kubeconfig port

BLOCKING regression (task #12): check-k8s-deploy's rebuild step failed with
k3s API connection-refused after `charly update` — Add() re-establishes a
k3s-server deploy's kubeconfig server-port rewrite via K3sPostProvision
(retrieveArtifactsAndK3s's artifactRegisterHandlers["kubeconfig"] dispatch,
which rewrites the retrieved kubeconfig's guest-local server URL to the
current host-forwarded port and merges it into ~/.kube/config), but
Update() never called it — a fresh update left the merged kubeconfig
context pointing at whatever forwarded port was current the LAST time Add
ran.

Fix: Update() now re-runs K3sPostProvision after a successful dispatch,
gated on the kube plugin already being connected (a pure
providerRegistry.ResolveVerb lookup — no connect attempt, no side effect).
Unlike Add, which only reaches K3sPostProvision when the deploy's OWN candy
list declares `register: kubeconfig`, Update has no candyList to run that
same check against; calling K3sPostProvision unconditionally hard-errors
for every OTHER deploy kind with "kube plugin not loaded" (caught live by
TestExternalDeployPlugin_ReverseChannelEndToEnd, a plain fixture with no
candy/plugin-kube composed at all — fixed in the same commit after the
first attempt regressed it). A k3s-server deploy's plugin connects during
the update path's own plugin-loading, so the registry already reflects
whether THIS deploy actually needs it.

Also extracted artifactKeyFrom(reply) as a shared helper (R3) — the
reply.ArtifactKey-with-t.name-fallback idiom Add already used inline, now
shared with Update.

Verified: go build/vet/test green (including the regressed-then-fixed
TestExternalDeployPlugin_ReverseChannelEndToEnd). Live proof: check-
githubrunner-pod's image-build step passes cleanly post the SIGSEGV fix
(3c8fe86) — confirms the build path is healthy end-to-end; the k3s-forward
fix here is unit-test-proven (no k3s-bearing bed run available in this
session's time budget beyond the VM beds team-lead already owns).
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