Repository navigation
feat(deploykit)!: move deploy state-model body into sdk/deploykit (K5-Unit-1, #67 keystone) - #54
Conversation
…e/merge/clean/export) out of charly core into sdk/deploykit (#67 keystone) K5-Unit-1 — relocate the 8 deploy state-model functions + SaveDeployStateInput + pure helpers (MarshalBundleNodeLegacy/ScopeVolumesToDeployKey/DescriptionInfo/ IsSameBaseBox/RemoveBySource/RemoveByExactSource/Named) from charly/deploy.go + charly/generate.go + charly/provides.go into sdk/deploykit (deploy_file.go + deploy_state.go). This is the S-K5 keystone that unblocks P13. The 4 core-coupled ops (LoadUnified / acquireDeployConfigLock / migrateDeployEntity / LatestSchemaVersion) reach core through the new DeployStateHost seam (StateHostMechanisms package var, filled by charly at init via RegisterDeployStateHost) — the DeployConfigPath = kit.DefaultDeployConfigPath precedent generalized. Nil-safe for SDK-only consumers. ExportAllBox is rewritten to take *spec.ResolvedProject (the envelope the 'resolved-project' HostBuild seam produces, K5-Unit-0) instead of the live *Config graph. #ResolvedBoxView grows description/env/env_file/security (SDD: CUE first, task cue:gen regen) so ExportAllBox projects the box-authored deploy-overlay fields from the envelope. BREAKING: charly/deploy.go no longer defines LoadBundleConfig/SaveBundleConfig/ MergeDeployOntoMetadata/loadDeployConfigForRead/loadDeployConfigForWrite/ cleanDeployEntry/saveDeployState/ExportAllBox/SaveDeployStateInput/marshalBundleNodeLegacy/ scopeVolumesToDeployKey/isSameBaseBox; charly/provides.go no longer defines Named/removeBySource/removeByExactSource; charly/generate.go no longer defines descriptionInfo. Call sites use the deploykit.X path directly (IMPORT-PURITY: no new charly/*_aliases.go; 3 dead aliases removed from deploykit_state_aliases.go). Assisted-by: Claude (analysed on a live system)
charly/pr-validator verdict — CHANGES REQUESTED (FAIL, not merged)Independent re-validation of this PR vs R0–R10 + the relevant skills. Head F1 — check-coverage gate FAILS (item 11 / Acceptance "check-coverage")The moved state-model code has NO sdk-level test that would fail without it. Verified by grep: The existing F2 — attribution tier inflated (item 3)The commit is at Fix (resolves both F1 + F2)Add sdk-level tests in
Paste the green Non-blocking observations (do not block the fix)
Next step (B1 step 2 — update in place, NEVER close + recreate)Append the fix as a new commit on Assisted-by: Claude (analysed on a live system) — the tier reflects the depth of review: every sdk foreground gate re-run live, the stale-cache warning RCA'd, SDD reproducibility verified by running |
…body (PR #54 F1+F2 fix) The fresh pr-validator on sdk PR #54 returned CHANGES REQUESTED: the moved state-model code had ZERO sdk-level tests (F1 — check-coverage gate: "a change whose new functionality has no test that would FAIL without it is not landable"), so the `analysed on a live system` tier was unsupported by the sdk gate evidence (F2 — the pasted sdk tests did not invoke the moved code). F1 + F2 are one defect: the moved code had no sdk-level coverage. Add sdk/deploykit/deploy_state_test.go exercising the moved functions LIVE: - ExportAllBox against a constructed *spec.ResolvedProject (the #67 keystone, incl. nil-safety + zero-box skip + determinism). - MarshalBundleNodeLegacy body test (target/nested/peer re-injection + descent drop via DropMappingKey + recursive children/members) — inspects the returned *yaml.Node body directly (the contract MigrateDeployEntity consumes). - SaveBundleConfig round-trip through a stub DeployStateHost + CHARLY_DEPLOY_CONFIG tempdir redirect (fail-safe LoadBundleConfig, LatestSchemaVersion stamp, MigrateDeployEntity, atomic tempfile+rename write) + the nil-host error guard. - RegisterDeployStateHost seam contract (non-nil stored, nil re-reg ignored). - Pure helpers DescriptionInfo / IsSameBaseBox / RemoveBySource / RemoveByExactSource. The green `go test ./deploykit/` output shows the new tests running the moved code live → check-coverage satisfied + `analysed on a live system` earned honestly. Assisted-by: Claude (analysed on a live system)
…state-model move Assisted-by: Claude (analysed on a live system)
K5-Unit-1 — move deploy.go BundleConfig state-model BODY into sdk/deploykit
Change class: shared-state deploy ledger (M→kit move). Kind-blind mechanism — no per-kind branches, no
spec.<Kind>field reads. This is the S-K5 keystone that unblocks P13 (bundle CLI → plugin-bundle cutover).What moves
The 8 deploy state-model functions (
LoadBundleConfig/SaveBundleConfig/LoadDeployConfigForRead/LoadDeployConfigForWrite/MergeDeployOntoMetadata/CleanDeployEntry/SaveDeployState/ExportAllBox) +SaveDeployStateInput+ pure helpers (MarshalBundleNodeLegacy/ScopeVolumesToDeployKey/DescriptionInfo/IsSameBaseBox/RemoveBySource/RemoveByExactSource/Named) relocate fromcharly/deploy.go+charly/generate.go+charly/provides.gointosdk/deploykit(deploy_file.go+deploy_state.go).The seam (the HOW)
Four of the relocated bodies reach core Mechanisms the SDK cannot import — the unified LOADER (
LoadUnified), the process-shared deploy-config FLOCK (acquireDeployConfigLock), the legacy→node-form MIGRATE transform (migrateDeployEntity), and the runtime VERSION stamp (LatestSchemaVersion). They reach core through the newDeployStateHostseam — a package-level*StateHostMechanismsvar insdk/deploykit, filled bycharly/atinit()viadeploykit.RegisterDeployStateHost(theDeployConfigPath = kit.DefaultDeployConfigPathprecedent generalized). Nil-safe: a plugin/SDK consumer that never writes the per-host ledger leaves the seam nil and the write paths no-op; the read-only validate/inspect paths work without it.ExportAllBox — the #67 keystone
ExportAllBoxis rewritten to take*spec.ResolvedProject(the envelope the "resolved-project" HostBuild seam produces, K5-Unit-0) instead of the live*Configgraph. The box-authored deploy-overlay fields (description/env/env_file/security) now ride#ResolvedBoxView(grown in this cutover) — filled byprojectBoxAggregatesfromcfg.BoxConfig(name), alongside the existingplan/authored_aliases. The deploy state model is built from the SAME envelope inspect/list/validate consume — no core*Configdep.Schema change (SDD)
sdk/schema/resolvedproject.cue:#ResolvedBoxViewgrewdescription?:/env?:/env_file?:/security?:(all existing CUE defs). Regenerated viatask cue:gen;sdk/spec/cue_types_gen.gocarries the new fields. No hand-written wire struct.Foreground R10 evidence
R10 — orchestrator-owned full roster
The full disposable bed roster (concurrent, max parallelism) is owned by the persistent orchestrator (shared-state change class). This PR is the sdk leg of a B2 multi-repo cutover; the superproject leg (charly/deploy.go deletions + call-site updates + go.mod require bump) opens after this sdk PR merges.
R0–R10 checklist
Fix (review round 1) — F1+F2 resolved: sdk-level test coverage for the moved state model
The fresh
pr-validatorreturned CHANGES REQUESTED: the moved state-model code had ZERO sdk-level tests (F1 — check-coverage gate), so theanalysed on a live systemtier was unsupported by the sdk gate evidence (F2 — the pasted sdk tests did not invoke the moved code). F1 + F2 are one defect: the moved code had no sdk-level coverage.Fix commit:
f061c0b(appended fast-forward onfeat/k5-unit-1-deploykit-state-move, per B1 step 2 — update in place; no force-push, no amend, no close+recreate).Added
sdk/deploykit/deploy_state_test.goexercising the moved functions LIVE:ExportAllBoxagainst a constructed*spec.ResolvedProject(the feat(sdk): K6 status-fanout op — verb:status-fanout wire selector #67 keystone, incl. nil-safety + zero-box skip + determinism).MarshalBundleNodeLegacybody test (target/nested/peer re-injection +descentdrop viaDropMappingKey+ recursive children/members) — inspects the returned*yaml.Nodebody directly (the contractMigrateDeployEntityconsumes).SaveBundleConfiground-trip through a stubDeployStateHost+CHARLY_DEPLOY_CONFIGtempdir redirect (fail-safeLoadBundleConfig,LatestSchemaVersionstamp,MigrateDeployEntity, atomic tempfile+rename write) + the nil-host error guard.RegisterDeployStateHostseam contract (non-nil stored, nil re-registration ignored).DescriptionInfo/IsSameBaseBox/RemoveBySource/RemoveByExactSource.These tests (a) FAIL without the moved code → check-coverage satisfied, (b) execute the moved code live in the sdk gate →
analysed on a live systemearned honestly.R10 evidence (sdk gate, head
f061c0b) — moved code executed liveNon-blocking observation surfaced during the fix (R1 RCA; not introduced by this move)
MarshalBundleNodeLegacy's inline comment claims the structural fields (target/nested/peer) areyaml:"-", but the generatedspec.Deploystruct carriesyaml:"target,omitempty"/yaml:"nested,omitempty"/yaml:"peer,omitempty"(the CUE def atschema/deploy.cue:69has a// loader-DERIVED (yaml:"-")COMMENT but no@go(yaml,…)attribute enforcing it). So the initialyaml.Marshal(node)emits those keys and the function's re-injection appends them again → duplicate keys in the rendered body. This is pre-existing (verbatim moved code), benign in production (the charly-sideMigrateDeployEntityreconciles the body into clean node-form before the file is written; the read path never re-parses the raw duplicated body), and not introduced by this move. It joins the next thematic batch (either add@go(yaml,…)attributes to make the fields trulyyaml:"-"+ drop the re-injection, OR update the stale comments). Reported to the orchestrator; not blocking this PR.Assisted-by: Claude (analysed on a live system)