Repository navigation
fix(remove): tear down the podman secrets the deploy provisioned - #28
Conversation
Provisioning had a verb; teardown had none. `charly remove` stopped the container, deleted the quadlet, dropped the deploy entry — and left every podman secret the same deploy created in the engine store forever (opencharly/plugin-deploy-pod#64, measured on a disposable bed: the container and quadlet were gone while `charly status pod-secret-diag --json` still listed `charly-pod-secret-diag-webui-secret-key`). That residue is not cosmetic: it is indistinguishable from a live deployment's secret on a shared host, and the next run of the same bed REUSES it ("kept (already provisioned)"), so a stale value can mask a provisioning defect across runs. The cleanup dies at the right boundary. What is removed is this deploy's ENGINE object (`charly-<box>-*`); the credential STORE entry is deliberately untouched, because that coordinate may serve other deployments (opencharly/pod-openwebui#19) and teardown must never erase a credential another deploy resolves. Podman secret names are box-scoped, not instance-scoped, so two instances of one box SHARE them: the cleanup only fires when it is the last deployment of that box, and refuses with a warning when a sibling container is still present (or when the engine cannot be enumerated, because a shared secret is not recoverable). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: plugin behaviour change ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
… container names Round one's block is a real bug, and it is worse than one missed direction: any container-name scan is the wrong instrument here. The three names that must be told apart are charly-<box> the DEFAULT deployment charly-<box>-<instance> a NAMED instance charly-<box>-<sidecar> a SIDECAR of this very deploy so `HasPrefix(n, "charly-<box>-")` both MISSES the default deployment (no trailing dash) and MISTAKES our own sidecars for siblings. The first version of the guard did both: removing `app/blue` while the default `app` was configured deleted the box-scoped `charly-app-*` secrets the default still needed. The question is answered exactly now, from the host deploy config's ENTRIES (`box` = the default, `box/<instance>` = a named instance), which is the only source that knows what is deployed and what is a sidecar of it. An unreadable config still means "a sibling may exist" — conservative, because a shared podman secret is not recoverable. Tests: the missed direction is now a named regression test (`TestRemoveProvisionedSecrets_NamedInstanceKeepsThemWhenDefaultIsPresent`), its mirror direction stays, and a sidecar-vs-sibling test pins the exactness the config read buys. Mutation-verified: dropping the default-instance case makes the regression test fail. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
|
RCA — round one's block was a real bug, and its root cause was the instrument, not one missing branch. The finding: removing a NAMED instance ( Reconstructing why the guard was wrong at its core: three container names must be told apart here, and a so the scan missed the default (round one's finding) AND would have mistaken our own sidecars for siblings Root fix: the question is answered from the host deploy config's ENTRIES ( Missed control: I wrote the guard from the names the code already juggled ( Blast radius: only the new cleanup path (no released behaviour depended on it). Had it shipped, a named Evidence is in the body: six unit tests (both directions + sidecar exactness + unreadable-config Agent: charly Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) |
Review — PASSHead SHA: Security screen: PASS Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Pre-existing (from #28), unrelated to the shared-volume change, but it makes `gofmt -l .` non-empty and the gate requires a clean tree. No behavior change. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
* feat(pod): list the box's shared volumes and reset them explicitly `charly volume list` adds the image box's shared volumes with a `(shared)` suffix (resolved from the deploy's image, fail-closed); `charly volume reset --shared` targets `charly-shared-<box>-<name>` and refuses while another deployment of the box is configured. The module pins sdk v0.2026334.825 and spec v0.2026334.900. Agent: opencharly-77 · Claude Code session 12aa3769-08b4-47ce-81fd-bf539338caaf Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system) * fix(pod): testable shared-volume helpers; no %!w on a nil deploy config RCA of the QUAL finding: deployImageBox guarded `err != nil || dc == nil` with a single `%w` over err, so the dc==nil/err==nil branch rendered `reading the deploy config: %!w(<nil>)`. Split the guard: err keeps its `%w`; a nil config gets its own message. The same BLOCK found the R7 gap: the new helpers had no test that fails without them. Extract the pure seams (deployImageRef, volumeLS, formatVolume, sharedResetTarget) and cover each: the resolved image wins over the authored one, the missing-deploy and imageless errors, the shared-prefix filter, the `(shared)` line format, and the sibling-refusal path of a shared reset. The engine call is a package var so the test fakes it; production behaviour is unchanged. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system) * test(pod): prove the shared-volume surface live in check-pod The check-pod bed now carries a box-wide volume (`sharing: shared`) declared by a local fixture layer, and two host-side steps exercise the changed paths on the deployed pod: `volume list` must name `charly-shared-check-pod-shared-cache` and mark it `(shared)`, and `volume reset --shared` must resolve that shared name (the running deployment holds it, so the engine refuses the removal and the error names the volume — proving the flag without destroying data). The fixture also bumps plugin-example-builder to v2026.334.0728 and plugin-example-external to v2026.334.0727: the old pins were built against an sdk older than the host's #615 builder-reply discriminator, so the image build was refused. That is a pre-existing red gate on the fixture, fixed here because it blocks this bed. The `volume` skill documents the shared scope: `list` marks `(shared)`, `reset --shared` refuses while a sibling deployment is configured, a purge never deletes a shared volume, and a database directory is never shared. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system) * chore(deps): spec v0.2026334.1109 (the label decode fix) Pins the spec tag that keeps a volume label's sharing through ExtractMetadata, so deployImageBox and the deploy resolver see a shared volume as shared. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (analysed on a live system) * style(pod): drop a trailing blank line the gofmt gate flags Pre-existing (from #28), unrelated to the shared-volume change, but it makes `gofmt -l .` non-empty and the gate requires a clean tree. No behavior change. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * test(pod): cover the nil deploy-config arm of deployImageRef The QUAL fix's guard (a nil *DeployConfig gets its own message instead of %!w(nil)) had no case that reaches it. The test now asserts it; the arm fails without the guard. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * fix(pod): give the empty image inspect its own message The metadata guard admitted the (nil, nil) arm and rendered `%!w(<nil>)` — the same malformed-error class as the deploy-config arm. imageBoxFromMetadata splits the arms (an inspect error wraps its cause; an empty inspect names the missing metadata) and both are tested. Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated) --------- Co-authored-by: Andreas Trawoeger <[email protected]>
Summary
Head
ea9e9f4058723130a95c0524d921efd8026d94a7, based onorigin/main7a88281(0 behind, 2 ahead):4 files changed, 368 insertions(+), 73 deletions(-)across the two commits —candy/plugin-pod/remove_orchestration.go, the owning skill's prose, and two test files.Provisioning had a verb; teardown had none.
charly removestopped the container, deleted the quadletand dropped the deploy entry — and left every podman secret the same deploy created in the engine store
forever. Filed with its RCA as opencharly/plugin-deploy-pod#64, measured on a disposable bed:
The residue is not cosmetic: on a shared host it is indistinguishable from a live deployment's secret, and
the next run of the same bed REUSES it ("kept (already provisioned)"), so a stale value can mask a
provisioning defect across runs.
What the cleanup removes, and what it deliberately does not
charly-<box>-*(required, accepted and auto-generated, sidecars included)charly/secret/…,charly/api-key/…)charly-<box>-<slug>), so the cleanup fires only when this is the last deployment of that box incharly.ymlTwo call sites, both the full-teardown branches (quadlet and direct) —
--keep-deploykeeps the deployconfigured and therefore keeps its secrets, which is what
charly startneeds afterwards.Round two: the sibling question is answered from the deploy ENTRIES, not container names
Round one's block was right, and it exposed the deeper fault: no container-name scan can answer this. The
three names that must be told apart are
so
HasPrefix(n, "charly-<box>-")misses the default (removingapp/bluewhileappis configureddeleted the secrets
appstill needed) and mistakes our own sidecars for siblings (a default deploywith sidecars would never clean up). The guard now reads the host deploy config's entries
(
box= default,box/<instance>= named), the only source that knows what is deployed and what is asidecar of it; an unreadable config still refuses, with a warning.
How tested
Unit — the decision logic, five cases (
remove_secret_cleanup_test.go, injected seams in the same styleas the container reap's
containerExists/removeContainer): last instance removes exactly what the enginelists; a sibling deployment makes it refuse; an unlistable engine makes it refuse; nothing listed is a silent
no-op; the deploy's OWN container is not mistaken for a sibling.
Mutation — the tests can fail. Disabling the sibling guard makes the guard test fail, and it is restored
afterwards:
Two mutations, both restored afterwards:
Live — the changed path against the real engine, on the real leftover this session's bed run had left
(the
charly-pod-secret-diag-webui-secret-keyfrom #64's own measurement), so the fix was proved on thedefect:
The live test is opt-in and skips visibly without
CHARLY_LIVE_ENGINE=1(R8 — a test that needs acontainer engine never silently passes without one):
The live test pins the CONFIG seam to "this is the last deployment" (the host config is loaded over the
plugin's reverse channel and is not readable from a bare
go test); everything else in it is real — theengine listing, the delete, and the re-check. The config-driven decision itself is pinned by the unit tests
and by the bed, which drives the whole orchestration with a real config. (Also noted for the record: a
go testthat reads env vars must be run with-count=1, or Go serves a cached SKIP — that cost oneconfusing iteration.)
The repo's own structural gate and R10 witness (this repo's
AGENTS.mdnames them):The
[cleanup]phase ischarly remove, i.e. the bed drives the very path this change edits, and the runstill passes.
Skill kept in step —
candy/plugin-pod's ownskill: removeprose is the projection this repo authors(
.agents/skills/remove/SKILL.md): its Behavior list gains the secret cleanup as step 4 with thesibling/credential-store boundary, and its Instance Removal section states that a sibling instance keeps its
engine secrets.
Rulebook compliance
/charly-core:remove(this repo's projected owning skill for the command word) and thisrepo's
AGENTS.mdbefore touching the command;/charly-internals:plugin's placement rules are respected(the fix stays inside the pod-lifecycle candy, no host coupling, no new SDK dependency).
already recorded; this PR closes it. The owner was located by the rulebook's own instruction (the message
is owned by the module that built it — a module-cache grep found
plugin-pod/remove_orchestration.go,which is why the fix lands here and not in the repo the issue was filed against).
deploykit.ListProvisionedSecretNames(the same helpercharly statussurfaces) anddeploykit.RemovePodmanSecrets(the existing best-effort remover, previouslycalled from nowhere); no second naming rule is invented.
of silently deleting something shared.
and the credential store's exemption is explained where it matters.
git status --shortwas empty before the branch; freshorigin/mainin a session worktree; themutation experiment was on my own working tree and reverted (
git checkout --), never pushed.real engine on the real defect (pasted), with exit codes.
go build ./...,go test ./...in
candy/plugin-pod/).charly check run check-pod) ran greenon the committed tree.
Change classification
Plugin behaviour change (
command:remove). No schema change, no new dependency, no host-coupling change,no
plan:step. Gates:go build ./...+go test ./...+charly box validate+charly check run check-pod, all pasted above.Breaking change + rollback: none for callers —
charly removekeeps every documented flag and gains onecleanup step;
--keep-deploykeeps the secrets, and a sibling instance keeps them too. Rollback is a revertof the squash, which restores the residue (and the warning disappears with it).
Filed issues
Resolved by this PR and closed after the merge, with a note that the code lives in
opencharly/plugin-pod.credential resolves at, only which engine object a teardown removes. The sibling guard exists because
podman secret names are box-scoped today; if fix(remove): report what the deploy entry carries, and make --keep-deploy keep a working deployment #19 lands a per-deploy coordinate, the guard stays correct
(it is about engine objects, not credential keys).
A3 — attribution evidence
The runtime's own system message reads, verbatim:
Harness
DeepSeek Harness, modeldeepseek-v4.1-flash— the pair the footer names. Tierfully tested and validated: the change-class gate (build, unit + mutation, structural validate, R10 bed)ran on the committed tree, and the changed path executed live against a real container engine.
Agent: charly
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)