Repository navigation
feat(kit,deploykit,loaderkit)!: one publication resolver; a box's ports are its endpoints (D-PUB) - #682
Conversation
…ts are its endpoints (D-PUB) The sdk leg of D-PUB over spec v0.2026336.1443. kit.ResolvePublications realizes a deployment's publish: entries (pinned, derived from the identity within port_range, or an auto lease that never takes a pinned or derived port), groups endpoints sharing a guest port (D-VAL-13) and refuses a held port naming its holder (D-PUB-2). deploykit.ResolveDeployPublications runs it over the per-host state; CollectBoxEndpoints/ExposePorts replace CollectBoxPorts and feed the endpoint label and EXPOSE; PublishMappings/ParsePublishFlags are the emitter and CLI forms; a VM's ssh is an ssh publication. Deletes ResolveDeployPorts, AllocateAutoPorts, IsAutoPort, ApplyPortOverrides, OccupiedHostPorts, ResolveVmSshPort, the port label writes and the PortSpec shorthand expander. Claude-Session: https://claude.ai/code/session_01Tvdn3tjf8tKajCd43DwENP Agent: claude-default-volume-design · Claude Code session session_01Tvdn3tjf8tKajCd43DwENP Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
Review — BLOCKHead SHA: Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…VM ssh nil-safety is tested Review round 2. CollectBoxEndpoints' conflict error now fails the projection (ProjectBoxAggregates, validate/inspect), the baked labels (buildBakedMetadata, render-prep) and the Containerfile EXPOSE (WriteExpose) instead of being discarded, with a test through all three. VmSshPublication's dead nil branch is removed (LoadDeployConfigForRead never returns nil); a test proves a nil config and an unreadable deploy state refuse with a port_range error and never panic. Claude-Session: https://claude.ai/code/session_01Tvdn3tjf8tKajCd43DwENP Agent: claude-default-volume-design · Claude Code session session_01Tvdn3tjf8tKajCd43DwENP Assisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)
|
STATUS Round 2, answering the BLOCK on head b72264c. Fixed in commit 500000d unless marked rebutted.
Missed controls: no test drove a conflict through the callers, and the nil-guard test was deleted with nothing replacing it. Both are covered now. Agent: |
Review — PASSHead SHA: Security screen: PASS — no secrets/egress/instruction-shaped content, no guardrail or design-file edit; no S4 sign-off required. Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The sdk leg of D-PUB (DESIGN §17.1), over spec
v0.2026336.1443(opencharly/spec#478 + #479). A deployment publishes the endpoints its box provides by name. The box's ports are its endpoints, and every host port is realized by ONE resolver.kit/publish.go):ResolvePublicationsrealizespublish:entries.port_rangeand probed in order on a collision. The deployment's own prior record is reused, so the port is stable across realizations (D-PUB-3).autoleases a free port ofport_rangethat no other deployment's pinned or derived publication names (D-PUB-3).deploykit.ResolveDeployPublicationsis the entry point every deploy plugin uses. It reads the local document'sport_rangeand every other deployment'spublicationrecord (HeldPublications), and refuses rather than invent a range whenport_rangeis unset.CollectBoxEndpointsreplacesCollectBoxPortsand feeds theai.opencharly.endpointlabel, the resolved box view and the Containerfile EXPOSE (ExposePorts) from one set.provide: {endpoint: …}ontoCandyModel.Endpoint.ProjectBoxAggregates, now returning an error, socharly box validate/inspect catch it), the baked labels (buildBakedMetadata, render-prep) and the EXPOSE emission (WriteExpose, now returning an error). Identical definitions merge.deploykit/capabilities.go) mapsEndpointtoai.opencharly.endpoint, replacing thePort/PortProtorows.CandyReader.Endpoint()replacesPort()/PortSpecs()/HasPorts().PublishMappingsrenders the realized records as engine mappings (<address>:<host>:<guest>[/udp]);ParsePublishFlagsparses--publish <endpoint>=<port|auto>[@<address>].sshendpoint's publication (ResolveVmSshPublication), with no special-case allocator. With no readable deploy state (a nil config, or an out-of-process plugin whereLoadDeployConfigForReaddegrades to an empty config) it refuses with aport_rangeerror and never panics. Such a plugin gets the realized record throughLifecyclePrepareInput.publication.kit/checkvars.go's host-networked branch now derivesHOST_PORT:<N> = <N>from the box's endpoints (meta.Endpoint, each endpoint's guest port) instead of the retiredmeta.Portlist. The bridged branch still reads the engine's live bindings. The${HOST_PORT:N}vars themselves are unchanged; replacing them with endpoint-by-name resolution is the check leg (D-VERB-8, http check: accept endpoint: <name> and resolve its address where the check runs (D-VERB-8) plugin-check#156).deploykit.TunnelConfigFromMetadataforwards spec'sTunnelConfigFromMetadata(meta, published). Its signature changed in feat(schema)!: publish endpoints by name — #Publication, #PortRange, publication state (D-PUB) spec#478: it takes the realized publications.ResolveDeployPorts,AllocateAutoPorts,IsAutoPort,ApplyPortOverrides,ContainerPortsFromMappings,SameStringSlice,OccupiedHostPorts,ResolveVmSshPort(kit and deploykit), theport/port_protolabel writes, and thePortSpecshorthand expander.Relates to opencharly/opencharly#1390 (the D-PUB wave). Consumers follow producer-first: charly core,
charly migrate(candyport:→provide.endpoint, VM forwards and ssh port →publish), deploy-pod/fleet (-pfromPublishMappings), vm/kubevirt, then check/status/tunnel.Files
.agents/skills/generate-source/references/labels-and-caching.mddeploykit/baked_box_label_test.godeploykit/bed_session.godeploykit/box_build_resolve.godeploykit/candy_env.godeploykit/candy_field_aliases.godeploykit/capabilities.godeploykit/config_candy_chain.godeploykit/deploy_config_cycle.godeploykit/deploy_derive.godeploykit/deploy_file.godeploykit/deploy_file_node_form_test.godeploykit/deploy_nodeform.godeploykit/deploy_nodeform_disc_test.godeploykit/deploy_state.godeploykit/deploy_state_test.godeploykit/endpoints_collect.godeploykit/generate.godeploykit/init_depends.godeploykit/init_depends_collect_test.godeploykit/init_runtime_build_test.godeploykit/namespace_collect_test.godeploykit/oci_packaging_test.godeploykit/ports_collect.godeploykit/render_generator.godeploykit/render_generator_from_project.godeploykit/render_parity_test.godeploykit/render_prep.godeploykit/resolved_project.godeploykit/spec_candy_adapter.godeploykit/tunnel_resolve.godeploykit/vm_deploy_addressing.godeploykit/vm_deploy_addressing_test.godeploykit/vm_deploy_state.godeploykit/vm_deploy_state_test.godeploykit/vm_ssh_port_nil_test.godeploykit/write_labels.gogo.modgo.sumkit/checkvars.gokit/ports.gokit/publish.gokit/publish_test.gokit/vm_ssh_port.gokit/vm_ssh_port_test.goloaderkit/decode_entity.goloaderkit/resolve_project.goloaderkit/scan_candy.goloaderkit/vm_state_test.govmshared/qemu_render_test.govmshared/spec_aliases.goHow tested
The change class is library (sdk): the module gate on the committed tree, head
500000d9373b7cb049d88ca27e158a2ab85b4626:The new and rewritten tests on this head:
Spike
RCA claim: host ports are allocated by three separate mechanisms (the deploy pin/auto list, the VM ssh
port_autoallocator, and the VM forward list), from ephemeral OS ports that overlap no range and are not reserved against each other. A box's ports are a bare list with no names, so nothing can publish or reach one by name (D-PUB, D-VERB-8).Candidates spiked :
-p 127.0.0.1::8080), run live on this host earlier in the wave. The containers were throwaway, outside any charly deployment, and removed after. It fails: the engine draws from the kernel's ephemeral range, and all three allocations landed inside the 40000–49999 range derived ports are taken from. So an engine-allocatedautoport can take a derived port, and a re-create gets a different port:port_range, with the derived hash, the prior-record reuse and theautoreservation set. Works:TestResolvePublications_DerivedDistinctAndStable(20 deployments on 8080 get distinct, stable ports),…AutoNeverTakesADefault,…PinnedConflictNamesHolder,…SharedGuestPortAndUnknownEndpointand…DerivedProbesPastBusyPortpass.The resolver tests fail on
origin/main(a throwaway detached worktree carrying onlykit/publish_test.go):Review round 2. The tests added for the conflict surfacing and the VM nil paths fail on the previous head
b72264c4cfcbe333203b1553c107e52a0d67bb5e(a throwaway worktree carrying only the two test files):Winner: (b).
RCA verdict: confirmed.
Rulebook compliance
Plan conformance
Winning candidate: (b), one charly lease allocator over
port_range.ResolvePublications: pinned / derived /autoport_range, stable across realizations and recorded in state;autoleases any free port ofport_rangeat each realization and never one another deployment's pinned or derived port names."publishkeyed by endpoint name;ParsePublishFlagspublishentry names a provided endpoint and carries a#Publication: an optionalport(a number orauto) and anaddress,127.0.0.1by default."CollectBoxEndpoints, the endpoint label,CandyModel.Endpointpublicationputwith astatekey) exists; this leg does not widen the gap beyond the placement spec#478 shippedAGENTS.md.port:key after I changed the pod indicators topublish/publication. That failed the gate once on this tree; I fixed it by dropping that case, sincepublish -> podcovers it. Missed control: I had changed the indicators after the last full run.publicationrecord sits on the per-host deploy node, not in the state root (D-DEP-5). The placement was introduced by feat(schema)!: publish endpoints by name — #Publication, #PortRange, publication state (D-PUB) spec#478 (merged).resolved_image,vm_state,kubevirt_stateandfirecracker_statesit on the same node today. The remedy needs the host state store (put/get), which another session is building (The bind wire has no host side:#BindInput/#BindOutputdescribe a dispatch that does not exist, and no leg resolves a binding to bytes spec#370, B1). By C1's test this is not blocking here: this change does not introduce it, no gate is red because of it, and every claim this body makes holds with the record where it is. It blocks the D-PUB wave's completion, so I claimed it and will fix it there, not file it away.Freeprobe is a bind check at the publication's own address, not a retry.generate-source/references/labels-and-caching.md) documentsai.opencharly.endpoint.origin/main, and the round-2 tests fail on the previous head (both above); all pass here.origin/main(f7c5a0ca2cd2e2d80f6010e5553d6a693f75db2d), one squashed commit, no force-push, no hook bypass.Change classification
Change class: library (sdk).
Gate:
go build,go vetandgo test ./...on the committed head.Tier:
fully tested and validated.Authoring runtime: Claude Code on model ID
claude-opus-5-5(Anthropic Claude Opus 5.5).Breaking change + rollback: every plugin that bumps to this sdk must move to the resolver in the same bump:
ResolveDeployPorts,ApplyPortOverrides,OccupiedHostPortsandCheckPortAvailabilitycallers move toResolveDeployPublications/PublishMappings/ParsePublishFlags;vm_util_copies.go;ResolveVmSshPortcallers move toVmSshPublication/ the seam record;ProjectBoxAggregates/WriteExpose(in-repo only; the org search finds none outside sdk), and of the tunnel resolver's spec#478 signature.Documents authoring candy
port:needcharly migrate(plugin-migrate leg) before they load. Roll back by reverting this squash commit; no consumer has bumped yet.Filed issues
https://claude.ai/code/session_01Tvdn3tjf8tKajCd43DwENP
Agent:
claude-default-volume-design· Claude Code sessionsession_01Tvdn3tjf8tKajCd43DwENPAssisted-by: Claude Code Anthropic Claude Opus 5.5 (fully tested and validated)