Repository navigation
feat(spec): the system-package teardown delta — #Format.present_template + SystemPackagesStep.Installed - #191
Merged
Conversation
A per-format command whose stdout lists currently-installed package names, one per line. The step executor queries it at execution time to compute a deploy's teardown delta, so a declared package the venue already provides is never recorded for removal (opencharly/charly#771). Regenerated with the repo's documented pipeline (charly task cue-gen): spec/cue_types_gen.go gains only the InstalledTemplate field.
Add an execution-time Installed field: the subset of Packages a deploy ACTUALLY installed, set by the step executor after it queries the venue via the format's installed_template. Reverse() prefers it over Packages. nil = not determined -> Packages is the removal target (prior behaviour). non-nil EMPTY = authoritative -> every declared package was already present, so NO package-remove op is recorded. That nil-vs-empty distinction is what stops a venue-provided package (curl, iptables) from being torn down. Not serialized on the wire: it is execution-time state the executor sets locally before calling Reverse(), never plan data. Covers all four cases with TestSystemPackagesStepReverseInstalledDelta (opencharly/charly#771).
Format.InstalledTemplate and SystemPackagesStep.Installed are disjoint sets that shared a root word: Installed on the step is the packages THIS deploy will install (the delta), while the format field is the query for what is on the venue BEFORE the deploy. The near-identical names invite setting st.Installed to the template's output — the already-present set — which would record for removal exactly the packages that must not be removed. Rename the FORMAT field to present_template / PresentTemplate so the direction is unambiguous; the step field keeps Installed (issue #771's wording). Regenerated with charly task cue-gen (reproducibility check passes).
Review — PASSHead SHA: Security screen: PASS — T1/T2 clean (no embedded directives; PR does not touch the validator spec, rulebook, or any gate); T3 no scope mismatch (diff adds exactly the described Checklist: All applicable rules PASS or NA.
Comment thread: 0 comments — nothing to disposition. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
aitrawog
pushed a commit
to opencharly/charly
that referenced
this pull request
Oct 4, 2026
… the teardown delta (charly#771 leg 3) Leg 3 of #771: the per-format `present_template` queries (pac/deb/rpm — never apk, see #772) as siblings of `uninstall_template:` in charly/charly.yml, plus the R10 fixture's declared-minus-installed witness (`curl`, present on the eval-host-vm guest by cloud-init; `charly` is not). Each query emits STRIPPED names on stdout and exits 0 by construction. go.mod pins: spec v0.2026272.1512 -> v0.2026276.1337 (leg 1, opencharly/spec#191), plugin-installstep v0.2026272.244 -> v0.2026276.1353 (leg 2, opencharly/plugin-installstep#8); `go mod tidy` also advanced the indirect sdk pin to v0.2026276.48, forced by spec 1337. BLOCKED — this tree does not build or validate standalone, on two dependencies the brief did not anticipate (root-caused, see hand-back report): 1. spec >= v0.2026273.203 (which 1337 includes) carries the breaking typed ExtraCandyRef change; charly cannot compile until the adoption in the open PR #762 (head 9588d18) lands. 2. plugin-distro's self-contained schema/distro.cue `#DistroInput`/`#DsFormat` does not declare `present_template`; no released plugin-distro version (newest v0.2026272.29) accepts it, so `charly box validate` rejects the field. A plugin-distro schema release is required. (cherry picked from commit d71569c45f30861d749296c5aceae88c4a0186f6)
github-actions Bot
pushed a commit
to opencharly/charly
that referenced
this pull request
Oct 5, 2026
…eploy-del twin and the #771 teardown delta (#762) * fix(beds): nest intended in-guest members inside the vm kind body (#748) Members authored as a sibling of the vm: kind key are deploy-level (alongside) per sdk/loaderkit BuildResourceMemberChildren, so BringUpMembers deployed them on the host running charly instead of inside the disposable guest. Move each member whose stated intent is "inside the guest" into the kind body (in-substrate). Indentation only. Refs #748 Assisted-by: Claude Code Anthropic Claude Opus 5.5 (syntax check only) * fix(charly): gate the node's own kind value via EntityBodyJSON (#748) The closed #<Kind>Value gate (validateKindValueCUE) read the RAW authored body — the one body consumer that does not strip the parser-classified member children. Its siblings (discValue / EntityBodyJSON) both delete the pn.Children names, so the member path and this gate disagreed about the same node: an in-body member key survived into the value the closed CUE schema was unified against, and the rejection was the symptom reported as #748. Read the stripped body here too. R3 single-codepath form: the gate now consumes exactly what its siblings consume, with no new mechanism. * fix(deps)!: adopt the typed ExtraCandyRef across charly core (spec#188 consumer) spec#188 made an ExtraCandyRef carry its SCOPE, so every ExtraCandyRefs field is []spec.ExtraCandyRef{Ref, Scope}, not []string. The sdk main charly now pins consumed it (sdk#325), so charly's OWN core has to follow — the pin bump alone does NOT build (measured: 5 build errors in github.com/opencharly/charly/charly, plus 3 test-only sites that only the test compile reaches, since `go build` does not compile test files). The PIN and the ADOPTION are one commit, because neither half stands alone: - github.com/opencharly/sdk v0.2026272.1813 -> v0.2026276.48 (the leg-1 tag) - github.com/opencharly/spec v0.2026272.1512 -> v0.2026273.203 (forced by that sdk's own go.mod:16, which requires the spec release carrying the type change) - the three compiled-in plugin candies, which charly resolves as module pins from the proxy, so the same type change lands in them too. Measured: with ONLY the sdk+spec pins moved, the build fails in 7 sites across all three — [email protected] plugin.go:320, :397 [email protected] resolve_project_word.go:174 [email protected] compile.go:109, :231; dispatch.go:139, :159 so they move in the SAME commit: plugin-build/candy/plugin-build v0.2026272.2040 -> v0.2026276.438 plugin-fleet/candy/plugin-fleet v0.2026272.2039 -> v0.2026276.526 plugin-installstep/candy/plugin-installstep v0.2026272.244 -> v0.2026276.440 Every ExtraCandyRefs site now states WHERE its refs belong, through the spec's own constructors: - collectOverlayCandies tags each add_candy ref with the overlay's BOX (spec.ScopedExtraCandyRefs(spec.BoxScope(box))), and takes the box as a parameter. - deployNodePluginContext tags a deploy node's authored add_candy refs with the DEPLOY's box — the deploy IS the box (update_deploy_dispatch.go's "deployName := c.Box") — and gives an injected PROVIDER ref the EMPTY scope: a capability connect, not a composition, which the arbiter treats as silent. - hostBuildDeployPluginsConnect converts the wire's authored []string ONCE, at the boundary, with the same box scope. - connectPluginByWordRef's capability-connect scan: empty scope, same reason. None of them is a CONSTANT. A constant label is exactly the #739 defect (~724 false conflicts across the project); a bare string cannot carry a scope at all, which is why the field is typed rather than re-derived at the consumer. The plugin-word collector KEEPS its []string signature: it needs only the ref WORD for perf-scoping, so it is fed spec.ExtraCandyRefStrings(...) — the projection spec/resolve_opts.go names for this very consumer. * fix(tools): adopt the shared sdk/spec pins in the lockstep tools modules The leg-3 pin bump moved the SHARED sdk/spec pins in `charly/go.mod` (sdk v0.2026272.1813 -> v0.2026276.48, spec v0.2026272.1512 -> v0.2026273.203), but the in-repo `tools/*` modules carry their own `go.mod` and were left on the old pair. `tools/gomod-canonical`'s `TestContractPinsMatchShared` anchors on core's requires and asserts every lockstep module matches, so the CI `go` job's "Test tools modules" step failed on the pushed head: gomod_canonical_test.go:117: ../../tools/generate-packages/go.mod: requires sdk v0.2026272.1813, but the shared sdk pin is v0.2026276.48 - run `charly task mods-tidy` (likewise spec, and tools/golden-cloudinit + tools/golden-compile) Root cause: `tools/*` are separate GOWORK=off modules that are not workspace members, so `go test ./charly/...` - and a local `go test ./...` inside the charly module - never reach them. That is the exact detection hole ci.yml's "Test tools modules" comment records for `main`. Fixed with the sanctioned task rather than a hand-edit: $ ./bin/charly task mods-tidy task mods-tidy: 2 step(s), 0 failed [pass] run - adopt the shared pins and tidy every lockstep module [pass] check - every lockstep module now carries the shared pins Six files: the three `tools/*/go.mod` requires and their `go.sum` hashes. `charly/go.mod` is untouched - it is the anchor the task reads. * fix(charly): the teardown of a nested member keeps its venue (charly#765) `charly deploy del <root>.<member>` lost the member's venue. The del dispatch shipped the node but no ancestor context, so runDeployNodeDelDispatch resolved the target and called Del with nothing to re-derive the parent executor chain from — the plugin's resolveRootExecutor fell through to specexec.RootExecutorForDeployNode(node), THE OPERATOR'S HOST for an in-substrate member with no `host:` field, and replayed the member's reversible ops (`pacman -R` for a `package:` list) on the workstation while its `add` had landed correctly in the guest. This is the del twin of runResolveTargetAdd, and it is deliberately the same move: reconstruct the ancestor chain host-side with spec.ReconstructParentExec over the registry-coupled deriveChildExecutorForPath, then hand the resulting executor to the target as its venue. A live executor still never crosses the wire — only the root-first ancestor path/node lists do, and this half re-derives from them. applyDelParentExec writes t.exec AND t.venueJSON, sharing venueJSONFor with applyParentExecOverride so the two halves can never disagree about what a venue IS (that extraction is a pure refactor — the add path's observable behaviour, including its nil-on-undescribable return, is unchanged). It carries the same hasLifecycle guard for the same reason: a vm/pod composes its own nested venue inside PrepareVenue and reports it back on the teardown-executor op. Del's channel differs from Add's, and that is why this one must WRITE t.venueJSON rather than return a descriptor: Del builds its request from spec.DeployTargetDelOpts, which carries no venue, so t.venueJSON is the only place dispatch can pick one up. An empty ancestor list (a top-level or synthetic target) leaves the previous RootExecutorForDeployNode behaviour exactly as it was. The third variant of the #627/#680 mechanism. A check bed's cleanup step forks a FRESH `charly deploy del` process, so the in-process venue carry between add and del never applied there either. Refs #765 * feat(charly)!: supply the per-format present_template queries + prove the teardown delta (charly#771 leg 3) Leg 3 of #771: the per-format `present_template` queries (pac/deb/rpm — never apk, see #772) as siblings of `uninstall_template:` in charly/charly.yml, plus the R10 fixture's declared-minus-installed witness (`curl`, present on the eval-host-vm guest by cloud-init; `charly` is not). Each query emits STRIPPED names on stdout and exits 0 by construction. go.mod pins: spec v0.2026272.1512 -> v0.2026276.1337 (leg 1, opencharly/spec#191), plugin-installstep v0.2026272.244 -> v0.2026276.1353 (leg 2, opencharly/plugin-installstep#8); `go mod tidy` also advanced the indirect sdk pin to v0.2026276.48, forced by spec 1337. BLOCKED — this tree does not build or validate standalone, on two dependencies the brief did not anticipate (root-caused, see hand-back report): 1. spec >= v0.2026273.203 (which 1337 includes) carries the breaking typed ExtraCandyRef change; charly cannot compile until the adoption in the open PR #762 (head 9588d18) lands. 2. plugin-distro's self-contained schema/distro.cue `#DistroInput`/`#DsFormat` does not declare `present_template`; no released plugin-distro version (newest v0.2026272.29) accepts it, so `charly box validate` rejects the field. A plugin-distro schema release is required. (cherry picked from commit d71569c45f30861d749296c5aceae88c4a0186f6) * chore(charly)!: bump the compiled-in plugin-distro pin to the present_template release (charly#771) plugin-distro v2026.276.1457 mirrors spec's #Format.present_template, which charly's embedded defaults already declare. Without it the compiled-in provider rejected EVERY project load: #DistroInput.format.pac.present_template: field not allowed The tools/* lockstep modules move with the shared pins (charly task mods-tidy). * build(#762): record the checksums for the plugin-distro v0.2026276.1457 bump The conflict resolution kept this branch's plugin-distro pin (required by #771's present_template change, which #778 does not carry) while adopting #778's spec v0.2026276.1636 / sdk v0.2026276.1822. The module checksum was left behind by that resolution: charly/go.mod required .1457 while charly/go.sum still held only .29, so the CI build mode (GOWORK=off, ci.yml) failed with 'missing go.sum entry for module providing package github.com/opencharly/plugin-distro/candy/plugin-distro'. charly task mods-tidy does not repair this: it ran green (2/2 steps) with GOWORK=off in the environment and left charly/go.sum untouched, because it tidies with the workspace on. The two checksum files were therefore brought in step with the standard Go toolchain in CI's own mode: cd charly && GOWORK=off go mod tidy cd charly && GOWORK=off go build ./... # exit=0 The workspace checksum follows from the same build. * fix(#762): tidy charly/go.sum — drop the two superseded pin pairs `go mod tidy` on this branch's tree deletes exactly four lines and nothing else: plugin-command/candy/plugin-command v0.2026272.26 (h1: + /go.mod) superseded by v0.2026277.738, which main's #786 pinned and tidied; this branch's merge of origin/main unioned the old pair back in. plugin-distro/candy/plugin-distro v0.2026272.29 (h1: + /go.mod) the version this PR's own plugin-distro bump (to v0.2026276.1457) replaced — the bump added the new pair without removing the old one. Neither version resolves: neither appears in go.mod or go.work, and tidy's module graph reports no use of either. Verified: `go mod tidy -diff` prints exactly these four deletions and no other change; applying `go mod tidy` yields exactly this diff (4 deletions, 1 file). --------- Co-authored-by: atrawog <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
charly deploy delremoves the packages a deploy declared, not the ones it installed, so a teardown asks the package manager to remove packages the venue's base image already provides. This is the contract half of the fix; the tracked issue is opencharly/charly#771, and this is part 1 of 3 (part 2 is theplugin-installstepdelta that computes it at execution time; part 3 is thecharlyleg that supplies the per-format query and runs the bed).Root cause, measured (full RCA table with file:line on the issue):
(*SystemPackagesStep).Reverse()recordedTargets: s.Packages— the DECLARED list — while the install runs with--needed, so a base-provided package is SKIPPED at install and still named at teardown. pac then refuses the whole transaction, andkit.RunReverseOpslogs and continues, so the packages charly did install are left behind:apt/dnf are worse than pac here —
apt-get purge/dnf removeof a base package succeeds and cascade-removes its dependents.What lands
schema/distro.cue—#Format.present_template?: string(plus the regenerated Go): a command rendered for the format whose stdout lists, one per line, the packages from the rendered set that the venue ALREADY has (already installed or already satisfied). The per-format query belongs in config, not Go:deploykit.RenderHostPackageCommand's documented contract forbids hardcoded dnf/apt/pacman dispatch.spec/install_step_vocab.go—SystemPackagesStep.Installed []string, execution-time state set by the step executor, andReverse()prefers it:nil= not determined → fall back toPackages(prior behaviour, unchanged for every existing consumer);spec/install_step_vocab_test.go—TestSystemPackagesStepReverseInstalledDelta, covering all four cases (nil / non-empty / empty-non-nil / non-install phase).Deliberately NOT on the wire:
Installedis not added toInstallStepView/StepFromViewor any other serialized shape. It is execution-time state the executor sets on the step immediately before callingReverse(), not plan data, so it must not travel on the wire.No
#SchemaVersionbump, deliberately: this is a purely additive optional def, the shapeschema/llm.cue:17documents as needing no bump ("the same shape as the iso VmSource arm, #DiskLayout, and the desktop kinds (spec PR #74)").How tested
Everything below was run by me on this head,
14f1b2a, in the session worktree.worktrees/readme-truth/spec-ledger(branchfeat/pkg-teardown-ledger, offorigin/main, 0 commits behind).The repo's CI gates were discovered from the current workflow file (
.github/workflows/ci.yml), not assumed, and each was run locally:The schema→generated-code pipeline gate (this repo's own recipe: edit CUE, regenerate, a clean regen must be a no-op):
The regenerated diff is exactly the one new field, correctly spaced, with its comment carried through — the generated Go is not hand-edited:
Diff, from the merge-base with current
origin/main(classt from the diff, never from intent):Scope limit, stated plainly: this leg carries no standalone bed — it is the contract, and the live observation of the delta on the assembled disposable chain lands in the
charlyconsumer leg (part 3 of opencharly/charly#771), whose bed output is pasted there.Rulebook compliance
origin/main; the umbrella's tracked checkout is untouched.spec/AGENTS.mdwas read, and its schema-change recipe followed — authored CUE first, regenerate, clean regen is a no-op, no hand-transcribed wire struct.Reverse(); the venue query lives in per-format config rather than being hardcoded in Go (whichRenderHostPackageCommand's contract forbids);PkgNamein sdk/buildkit remains the one version-strip implementation, so no second normalizer is introduced.grep -rn 'installed_template\|InstalledTemplate' <worktree>exits 1 with empty output (no survivor).main; one branch, PR-only.14f1b2a, not on an edited state, and the regeneration gate proves the committed tree reproduces itself.TestSystemPackagesStepReverseInstalledDeltafails without theReverse()change and passes with it, covering both directions.Change classification
Reverse()covered by a new test. Not documentation-only; not a schema-version cutover (no#SchemaVersionbump — additive optional def, perschema/llm.cue:17and spec PR feat(desktop): the theme, session, displaymanager and desktopentry kinds #74).gofmt -l .,go build ./...,go vet ./...,go test ./..., and golangci-lint v2.13.2 (the exact binaryci.ymlpins by module version) — all zero on the final head — pluscharly task cue-gen's reproducibility check and a byte-identical clean regen.fully tested and validated— the changed behaviour is exercised in both directions by the four new subtests on this head, and the repo's full authoritative gate passes on the same head. The scope limit is stated above rather than glossed: this leg alone carries no bed, and the live end-to-end observation is pasted in thecharlyconsumer leg.Agent:
readme-truth· session2a317871-ba03-4713-89ba-8edbd4059c27Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (fully tested and validated)