Skip to content

feat(schema,deploykit,kit): K4 residual pod-deploy sdk leg (F12 wire types + ensure-image seam) - #66

Merged
atrawog merged 12 commits into
mainfrom
feat/k4-lanea-deploy-dispatch-seam
Jul 17, 2026
Merged

atrawog merged 12 commits into
mainfrom
feat/k4-lanea-deploy-dispatch-seam

Conversation

@atrawog

@atrawog atrawog commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Residual sdk leg for the K4 pod-lifecycle inversion, landing after sdk#64 (the
shared 9-function resolver extraction both K4 pod-deploy and K5 check-harness
consume). This branch independently authored the same 9-function extraction
~18 minutes apart from #64; #64 landed as canonical (it carries the extracted
functions' test coverage — R7). This PR merges origin/main (post-#64) and
keeps only what #64 does not carry:

  • schema/seam.cue + generated spec/cue_types_gen.go: #EnsureImageRequest/
    #EnsureImageReply (the F11 "ensure-image" HostBuild seam — a plugin's
    cold-start image-resolution fallback reaching the project-loader-coupled
    EnsureImagePresent without duck-typing across the module boundary), and
    #PodShellOpts/#PodCmdOpts/#PodAttachOpts/#PodLogsOpts (the F12
    charly shell/cmd/logs plugin-side self-resolution wire types —
    Interactive/WrapPTY are host-resolved booleans since the plugin's own
    stdout is not the operator's terminal). Removes the now-dead
    #ResolveStartDirectRequest transitional seam type.
  • deploykit/provides.go + tests: extended provides-template resolution
    helpers (FilterOwnProvides, AcceptedEnvSet, ResolveTemplate,
    ValidateProvidesTemplate, PortMapFromMappings, etc.) relocated from
    charly/provides.go (pure, K4).
  • deploykit/secret_declare.go + tests: SecretDeclaredOnBox/
    SecretDepNames/SecretKeyForDep relocated from
    charly/config_secret_migration.go (pure, K4).
  • deploykit/sidecar_resolve.go + tests: ResolvedSidecarFromSpec/
    SidecarTemplatesOf/FindPodSidecarQuadlets/HasTailscaleSidecar
    relocated from charly/sidecar.go (pure, K4).
  • kit/sidecar_naming.go: PodNameInstance/SidecarConfigDir (this branch's
    additions on top of feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64's PodName/SidecarContainerName/
    SidecarContainerNameInstance base) + kit/container_image.go:
    ContainerImage/ContainerImageRef relocated from charly/commands.go.
  • deploykit/quadlet_test.go: relocated TestLocalizePort from
    charly/shell_test.go alongside the LocalizePort helper it tests.

Change class

charly-or-sdk Go

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

  • The gate for this change class: sdk is a standalone-consumed contract
    module — GOWORK=off go build ./... && go test ./... && golangci-lint run ./... on the whole module, plus TestGenReproducible for the CUE
    regeneration. This module has no runtime bed of its own; its real gate is
    the CONSUMING charly pod-lifecycle chunk's charly check run check-sidecar-pod, which already passed against this exact tree (see that
    PR).
  • Eval beds run: N/A (sdk module, no disposable bed of its own) — the
    consuming charly chunk's check-sidecar-pod bed (12/12 steps, twice) is
    the real-world proof this sdk leg's types work end-to-end; pasted in the
    charly pod-lifecycle chunk PR.
  • Fresh rebuild: N/A (sdk module — no binary of its own).
  • Did the CHANGED code path execute live? Yes, transitively: the new
    #PodShellOpts/#PodCmdOpts/#PodAttachOpts/#PodLogsOpts types are
    marshaled/unmarshaled across the real host↔plugin wire in the
    check-sidecar-pod bed's charly cmd/charly logs steps (candy/plugin-
    deploy-pod, the consuming PR). #EnsureImageRequest exercises on every
    bed run that reaches resolvePodRuntimeImage's cold-start fallback.
  • Concurrency: N/A — no shared-state change in this module.
$ GOFLAGS="-buildvcs=false" go build ./...
(clean, no output)

$ GOFLAGS="-buildvcs=false" go test ./...
ok  	github.com/opencharly/sdk	0.144s
ok  	github.com/opencharly/sdk/deploykit	0.008s
ok  	github.com/opencharly/sdk/enginekit	0.003s
ok  	github.com/opencharly/sdk/kit	4.864s
ok  	github.com/opencharly/sdk/loaderkit	0.002s
ok  	github.com/opencharly/sdk/spec	(cached)
ok  	github.com/opencharly/sdk/vmshared	(cached)

$ GOFLAGS="-buildvcs=false" golangci-lint run ./...
0 issues.

$ GOFLAGS="-buildvcs=false" go test ./spec/... -run TestGenReproducible -v
--- PASS: TestGenReproducible (0.32s)

Attribution tier

analysed on a live system

Harness rulebook compliance

  • R0 skills: /charly-internals:go (CUE schema pipeline), /charly-internals:git-workflow (this landing sequence).
  • R1 RCA + zero warnings: golangci-lint's first run in this worktree showed 4 staticcheck findings referencing a sibling worktree path (sdk-wt-val64) that no longer exists — RCA'd as a stale golangci-lint cache entry from a concurrent lint run in another worktree (V-133's validator), confirmed by golangci-lint cache clean + re-run → 0 issues. Not a real code issue.
  • R2 no out-of-scope: the sdk#64/6897828 duplicate-extraction finding was escalated to the orchestrator immediately on discovery (not silently resolved), who made the reconciliation call (feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64 canonical, this branch rebases).
  • R3 no duplication: the whole point of this PR is resolving the R3 duplication with feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64 — merged onto feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64, kept only the non-overlapping additions; verified via git diff origin/main...HEAD --stat that none of feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64's 9 files appear as new/changed (only kit/sidecar_naming.go's 22-line delta, my unique additions on top of feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64's base).
  • R4 no workaround: N/A — no host operations in this module.
  • R5 hard cutover + grep: #ResolveStartDirectRequest fully removed; git grep confirms zero remaining references outside historical-provenance comments in the consuming charly repo (verified there, this PR carries only the sdk-side removal).
  • R6 git safety: checked git status/no stash needed before the merge; resolved the two real ADD/ADD conflicts (kit/box_metadata.go, kit/sidecar_naming.go) deliberately, verified the other 7 shared files auto-merged byte-identical via diff against my prior commit.
  • R7 runtime gate: N/A for this module directly — the runtime gate is the consuming charly PR's check-sidecar-pod bed.
  • R8 artifact invariants: N/A — no Containerfile/OCI-label change.
  • R9 binary == source + deps: N/A — sdk has no binary.
  • R10 disposable + coverage: the consuming charly pod-lifecycle chunk carries the disposable-bed proof; this leg's own coverage is TestGenReproducible + the relocated unit tests (provides/secret_declare/sidecar_resolve/quadlet all ported alongside their code).
  • RDD / ADE / SDD: SDD — schema/seam.cue changes regenerated spec/cue_types_gen.go via task cue:gen; TestGenReproducible confirms the regeneration is a no-op on a clean run.
  • Hard cutover: one atomic commit sequence on this branch; no Phase-2/deferred scope.
  • Kernel/plugin boundary law: N/A — this is the sdk contract module, not charly core.
  • Disposable-only autonomy: N/A.
  • Clean architecture + Go gates: gofmt -l . clean (part of the build), golangci-lint run ./... 0 issues, go vet clean (part of build), go test ./... green.
  • CHANGELOG: CHANGELOG/2026.198.0350.md staged (placeholder CalVer).

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

atrawog added 12 commits July 16, 2026 22:32
…nel externalization)

Adds the CUE-sourced wire types the K4 keystone RDD spike proved sufficient for
candy/plugin-bundle to own the `charly bundle add`/`del` dispatch control flow:
DeployTreeResolveRequest/Reply, DeployNodeDispatchRequest/Reply,
DeployMembersRequest/Reply, DeployDelResolveRequest/Reply, and
DeployNodeDelDispatchRequest/Reply — replacing the monolithic
DeployAddRequest/DeployDelRequest pair (deleted; the reconstruct-and-Run()-verbatim
pattern they served is gone). Generated via task cue:gen from sdk/schema/seam.cue.

Assisted-by: Claude Sonnet 5 (fully tested and validated)
…es → sdk

Relocates the genuinely pure, project-loader-free helpers pod_lifecycle_resolve.go's
quadlet path and charly core's remaining config_image.go/start.go/service.go/tunnel.go
call sites both need, so a plugin candy (candy/plugin-deploy-pod) can import them
directly instead of duplicating: the charly bridge-network mechanism (network.go),
SSH/GPG agent-forwarding resolution (agent_forward.go), runtime data provisioning
(data.go), the pod-security arg builders + direct-mode start argv (security.go,
start_args.go), the entrypoint/init-def resolution (entrypoint.go), the quadlet/
systemd path helpers (quadlet_paths.go), the deploy-time engine resolver
(box_engine.go), the tunnel label-metadata resolution (tunnel_metadata.go), the
direct-deploy marker probe (direct_deploy.go), and a shared append_unique helper.

kit cannot import deploykit (deploykit already imports kit), so anything needing a
deploykit-only type (ResolvedBindMount, LoadDeployConfigForRead) lives in deploykit;
everything else defaults to kit. Each file's owning unit tests moved with it.

Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
…roker set

Extracts the resolver primitives K4's pod-deploy subsystem and K5's check
harness both need, per the orchestrator's broker decision (union of the two
cones' shared-caller traces). Split between sdk/kit and sdk/deploykit per the
kit-cannot-import-deploykit constraint (deploykit already imports kit):

- sdk/kit: IsHostNetworked/ContainerRunning (container_probe.go), ResolveBoxName
  + its ref-parsing helpers (remote_ref.go), ExtractMetadata/InspectLabels
  (box_metadata.go, ~330 lines, fully portable — every dependency resolves to
  stdlib/kit/spec), SidecarContainerName(Instance) (sidecar_naming.go), and the
  plugin-primary registry + ResugarPlan (plugin_primary.go, needed by
  MarshalBundleNode's plan-step round-trip).
- sdk/deploykit: ResolveContainer/ResolveSidecarContainer (need
  ResolveBoxEngineForDeploy's LoadDeployConfigForRead), MarshalBundleNode +
  its bundleDiscForEntity/scalarFieldValue helpers (need SortedNestedKeys), and
  a new ResolveDeployBoxName(key, instance, *spec.ResolvedProject) — a portable
  twin of charly-core's existing LoadUnified-based resolver, for a caller (a
  plugin) that already holds a ResolvedProject envelope instead of a project
  loader; charly-core's own resolver stays unchanged (a cheap parse-only
  lookup every current caller, including the check harness, already uses).

Adds the "ensure-image" F11 host-builder (charly/host_build_ensure_image.go,
paired here as the CUE-sourced spec.EnsureImageRequest/Reply wire types) — a
thin seam wrapping the existing, UNCHANGED EnsureImagePresent/
loadProjectCfgFromCwd, so a plugin's cold-start image-resolution fallback
(after checking the two portable kit.LocalImageExists/TransferImage tiers
itself) reaches the project-loader-coupled logic without duck-typing Config/
BuildCmd across the module boundary.

The existing charly-core function bodies (resolveContainer, resolveBoxName,
ExtractMetadata, etc.) are UNCHANGED — the check harness still calls them
unqualified and hasn't moved to candy/plugin-check yet; deleting them now
would break that cone before it rebases onto this extraction.

Verified: go build/vet/test/lint clean (0 issues) on the whole sdk module;
TestGenReproducible passes after the seam.cue regeneration.

Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
…om charly

Adds the owning unit tests for deploykit.SecurityArgs (10 cases) and
deploykit.BuildStartArgs (11 cases, including the 2 encrypted-bind-mount
cases) — both functions already lived in sdk/deploykit from earlier K4 work,
but their charly-core test coverage hadn't moved with them. Migrated
verbatim (repointed to the exported deploykit names + spec.SecurityConfig),
enabling charly core's redundant SecurityArgs/buildStartArgs re-definitions
to be deleted in the paired charly commit.

Verified: go build/test/lint clean (0 issues) on sdk/deploykit.

Claude-Session: https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif
…+ relocations

Adds the deploy-overlay HostBuild seam (DeployOverlayRequest/Reply) the K4
pod-lifecycle inversion needs to fetch the per-host deploy-config overlay from
inside the out-of-process plugin (LoadDeployConfigForRead only works in
charly-core's own process today). Also adds the resolve-start-direct
transitional seam types (ResolveStartDirectRequest, PodStartOpts, PodStopOpts)
threading the raw CLI opts instead of a host-resolved plan.

Relocates the remaining pure Kind-2 helpers this session classified:
- deploykit/provides.go: FilterOwnProvides/AcceptedEnvSet/ResolveTemplate/
  ValidateProvidesTemplate/PortMapFromMappings (from charly/provides.go,
  now deleted).
- deploykit/secret_declare.go: SecretDeclaredOnBox/SecretDepNames/
  SecretKeyForDep (from charly/config_secret_migration.go's pure third).
- deploykit/sidecar_resolve.go: ResolvedSidecarFromSpec/SidecarTemplatesOf/
  FindPodSidecarQuadlets/HasTailscaleSidecar (from charly/sidecar.go).
- kit/sidecar_naming.go: PodNameInstance/SidecarConfigDir additions.
- kit/container_image.go: ContainerImage/ContainerImageRef (from
  charly/commands.go — shared with check_endpoint_resolve.go, not
  pod-exclusive).

Test coverage migrated with the code throughout.

Assisted-by: Claude Sonnet 5 (analysed on a live system)
…odAttachOpts/PodLogsOpts

Adds the CUE-sourced wire types for the F12 (charly shell/cmd/logs) plugin-side
self-resolution: #PodShellOpts/#PodCmdOpts/#PodAttachOpts/#PodLogsOpts
(sdk/schema/seam.cue), consumed by candy/plugin-deploy-pod's new resolve_f12.go.
Interactive/WrapPTY are HOST-RESOLVED booleans (force_tty||isTerminal();
force_tty&&!isTerminal()) since the plugin is a subprocess whose own stdout is
not the operator's terminal.

Removes the now-dead #ResolveStartDirectRequest transitional seam type (its
sole consumer, charly/host_build_resolve_start_direct.go, is deleted alongside
charly/pod_lifecycle_resolve.go in the paired charly-repo commit) and updates
the #PodLifecyclePlan/#PodLiveStdioPlan doc comments, which were stale
(claiming host-side resolution after the quadlet-mode inversion already moved
it plugin-side).

Relocates TestLocalizePort from charly/shell_test.go to deploykit/quadlet_test.go
alongside the LocalizePort helper it tests (a pure sdk function that never had
a test in its own module).

Verified: go build/vet/test/lint clean (0 issues); TestGenReproducible passes
on the regenerated CUE types.

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

Resolved: kit/box_metadata.go took origin/main's version (#64's own PR-validation
already deduplicated its InspectLabels default against kit/local_image.go's
InspectImageLabels — the R3 fix this exact race needed). kit/sidecar_naming.go
took origin/main's base (PodName/SidecarContainerName/SidecarContainerNameInstance,
canonical) plus my own PodNameInstance/SidecarConfigDir additions restored on top
(unique to this branch, not part of #64's scope; SidecarConfigDir is a load-bearing
charly/commands.go caller). Verified the other 7 shared files (box_engine.go,
container_resolve.go, deploy_box_name.go, deploy_nodeform.go, container_probe.go,
plugin_primary.go, remote_ref.go) auto-merged byte-identical to my prior content.
Renamed CHANGELOG/2026.198.0350.md to the actual merge-time CalVer
(evaluator step, computed via date -u).

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

atrawog commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Independent PR validation — PASS

Fresh worktree off merged main (efeac71, my #64 merge), trusting no author claims.

  • Branch currency: git rev-list --count HEAD..origin/main = 0. Not behind.
  • Dedup confirmed clean: git diff --name-only origin/main HEAD shows exactly the claimed 14 files. None of feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64's 9 extraction files appear, EXCEPT kit/sidecar_naming.go — confirmed its diff is purely additive (PodNameInstance/SidecarConfigDir, +22 lines), no reintroduction of feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64's scope. Confirmed kit/box_metadata.go is NOT in the diff at all — it carries origin/main's R3-fixed var InspectLabels = InspectImageLabels verbatim (my feat(kit,deploykit): K4 shared-resolver extraction — the 9-function broker set #64 fix survived the merge cleanly).
  • Full gate: go build/go vet/go test ./... (all sdk packages clean) + golangci-lint (cleared cache first per the last chunk's lesson — 0 issues) + gofmt -l (clean) + TestGenReproducible (PASS, cue CLI confirmed present, not skipped).
  • R7 confirmed: all 6 test files present and independently re-run — provides_test.go (6 tests), secret_declare_test.go (3), sidecar_resolve_test.go (6), security_test.go (10), start_args_test.go (11), quadlet_test.go (30, incl. the relocated TestLocalizePort) — all PASS.
  • CUE wire types verified: #EnsureImageRequest/#EnsureImageReply and #PodShellOpts/#PodCmdOpts/#PodAttachOpts/#PodLogsOpts present in both schema/seam.cue and the generated spec/cue_types_gen.go.
  • R5 self-test: #ResolveStartDirectRequest — zero remaining references anywhere in the repo (code or schema).

Renamed the placeholder CHANGELOG to the true merge-time CalVer before merging. Merging.

@atrawog
atrawog merged commit 28ee880 into main Jul 17, 2026
@atrawog
atrawog deleted the feat/k4-lanea-deploy-dispatch-seam branch July 17, 2026 03:59
atrawog added a commit that referenced this pull request Jul 17, 2026
…e-ref resolution

Producer commits for the W0 subsystem moves (consumer: charly PR #141 —
status_collector→plugin-substrate + `charly box merge`→plugin-box):

- `ops.go`: `OpStatusCollectAll` ("status-collect-all") — the verb:status-fanout
  wire selector the relocated flat status collector dispatches on.
- `kit/local_image.go`: `kit.ResolveShellImageRef` — shared image-ref resolution
  (registry/name/tag → full ref, newest-local-CalVer fallback) so the box-merge
  plugin and `charly/shell.go` share ONE source (R3), with 5-branch test coverage
  in `kit/local_image_test.go`.
- `enginekit/engine_test.go`: `ContainerSnapshot.HostPortFor` coverage ported
  from `charly/status_test.go` (sdk-only method, zero core coupling).
- Brought up to date with sdk main #66 via forward merge (no force-push).

Fresh independent validation: `go build`/`go vet`/`go test`/`golangci-lint`/
`go mod verify`/`go mod tidy` all clean on the merged head; consumer-side names
confirmed matching against charly PR #141.

Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
atrawog added a commit that referenced this pull request Jul 17, 2026
… (main-compat regression)

sdk main >= #66 broke charly main's candy/plugin-bundle (spec.DeployAddRequest/
DeployDelRequest undefined) — the 4 wire types were live on the consumer's main
and only dead on the unmerged K4 dispatch branch. Restored verbatim (byte-identical
to the pre-removal definitions) + task cue:gen; they retire for real with the K4
dispatch.go cutover that removes their seams. #ResolveStartDirectRequest correctly
stays removed (zero consumers on charly main).

Validated independently: consumer liveness confirmed against real charly origin/main,
restored text verified byte-identical, cue:gen reproducible (no-op), all Go gates
clean (build/vet/gofmt/test/mod-tidy/mod-verify/lint 0-issues), and an isolated
consumer-compile proof (candy/plugin-bundle fails against sdk@ab60ec6, passes clean
against this fix) reproduced independently by the validator.

Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
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