Skip to content

fix(deploy): reset can remove an entry the loader dropped - #57

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/reset-dropped-entry
Nov 26, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/reset-dropped-entry

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

charly deploy reset <box> could not remove an entry the LOADER had dropped (a pod body written with
no image:). The entry is absent from the loaded DeployConfig, so the loaded-side mutation printed
No overrides for box "…" and exited 0 — a silent no-op — while the entry sat in the file and made
SaveDeployConfig's round-trip guard refuse every later write. The only escape was
charly deploy reset with no box, which deletes the whole file.

The fix removes the raw top-level key from the config's YAML node form — precisely that one entry,
leaving the good entries and the config's other sections intact — with a guard so a box named after a
reserved section (cache, provides, ledger, system, defaults) can never delete that section.

Head: 92ce9c757c1e82d78c0f6e0cbd83acf820c8c74b
Diff: 2 files changed, 196 insertions(+) — candy/plugin-fleet/config_cmd.go (+65),
candy/plugin-fleet/config_reset_dropped_test.go (+131)

How tested

Unit coverage (four tests, one of them the reserved-section guard):

$ cd candy/plugin-fleet && GOWORK=off go test ./ -run TestRemoveDroppedEntry -v
--- PASS: TestRemoveDroppedEntry_RemovesOnlyTheUnloadableKey
--- PASS: TestRemoveDroppedEntry_NeverTouchesAReservedSection
--- PASS: TestRemoveDroppedEntry_NoSuchKeyLeavesTheFileAlone
--- PASS: TestRemoveDroppedEntry_UnparseableFileIsLeftAlone
ok  	github.com/opencharly/plugin-fleet/candy/plugin-fleet

The live proof of the changed path (R10), both arms. A charly binary carrying this branch's
plugin-fleet through a local replace, run against a deliberately degraded per-host config
(good: with an image:, broken: with only resolved_image:):

$ GOWORK=off go mod edit -replace=github.com/opencharly/plugin-fleet/candy/plugin-fleet=<this tree>
$ GOWORK=off go build -buildvcs=false -o /tmp/charly-pf .
$ GOWORK=off go mod edit -dropreplace=github.com/opencharly/plugin-fleet/candy/plugin-fleet

# WITHOUT the change (the binary from the pinned plugin-fleet) — the defect:
$ CHARLY_DEPLOY_CONFIG=/tmp/pf-live/charly.yml ./charly/bin/charly deploy reset broken
No overrides for box "broken"                                       rc=0
$ grep -c '^broken:' /tmp/pf-live/charly.yml
1                                                                    ← still there, file still unwritable

# WITH the change — the entry is removed, the good one survives:
$ CHARLY_DEPLOY_CONFIG=/tmp/pf-live/charly.yml /tmp/charly-pf deploy reset broken
Removed the unloadable entry "broken" (the loader had dropped it; no overrides were applied)   rc=0
$ cat /tmp/pf-live/charly.yml
good:
    pod:
        image: good-image

# and a subsequent write is accepted (the config is loadable again):
$ CHARLY_DEPLOY_CONFIG=/tmp/pf-live/charly.yml /tmp/charly-pf deploy reset good
Removed overrides for "good" (charly.yml now empty, removed)         rc=0

That is the reviewer's asked-for run: the dropped key removed, the good entry intact, and a following
SaveDeployConfig write accepted.

$ GOWORK=off go build ./... && GOWORK=off go vet ./...
$ charly box validate            → OK, 0 warnings, 0 errors

Spike

Candidate Run + result
A — remove the raw dropped key (winner) the live run above: Removed the unloadable entry "broken", the good entry intact, the next write accepted
C — reset with no box (delete the file) measured, and it is the defect:
$ CHARLY_DEPLOY_CONFIG=/tmp/pf-c/charly.yml /tmp/charly-pf deploy reset
Removed charly.yml                                              rc=0
$ ls /tmp/pf-c/charly.yml
ls: cannot access '…': No such file or directory

the good entry is destroyed with the bad one — the whole state goes to remove one key |

B — "fail NONZERO with a charly migrate remedy" — is not a candidate: it does not remove the
dropped entry, which is the cause, so the operator is exactly as blocked as with the current silent
no-op. The remedy text would describe a path that cannot unblock; there is no run that makes it a
solution.

Rulebook compliance

  • R0 — /charly-internals:git-workflow, /charly-internals:go and the plugin-fleet repo rules
    loaded.
  • R1 — the RCA of the round's BLOCK: the missed control was that my pre-push gate ran the unit
    tests only, never a live deploy reset against a degraded config, so the case the change exists for
    was never executed — and the QUAL collision (a section named like the key) was not exercised by any
    test. Both controls are now in place: the live run above, and
    TestRemoveDroppedEntry_NeverTouchesAReservedSection.
  • R2 — one removal implementation: removeDroppedEntry. It deliberately does not go through
    SaveDeployConfig — that function's round-trip guard is the control this fix has to escape, and it
    refuses any write while the dropped key is present — so the helper reads the YAML node form and
    removes exactly one key itself (os.ReadFile/os.WriteFile). The bypass is the point.
  • R3 — no workaround: the raw key is removed through the YAML node API, not by editing text.
  • R4 — no documented command change.
  • R5 — no legacy path; the silent rc=0 no-op is gone for this case.
  • R6 — branch off fresh origin/main; no force-push.
  • R7 — four tests that fail without the change, plus the live two-arm run.
  • R8 — no live service mocked.
  • R9 — the proving binary was built from this tree plus the local replace, and its run is pasted.
  • R10 — the changed path ran live (above) with the unit gate green; this plugin's change class is
    its Go module, and the runtime path is exercised through the rebuilt binary.
  • R11 — no wire shape change.
  • R12 — A and C carry their runs; B is named as not shippable, with the reason.
  • DISP — no deploy or destroy; the runs are against temp config files.

Change classification

No breaking change. A reset of a dropped entry now succeeds where it silently failed; every other
reset path is unchanged.

Filed issues

None filed by this change; it resolves opencharly/plugin-fleet#56.

Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

`charly deploy reset <box>` mutated only the LOADED DeployConfig. An entry the loader
dropped (e.g. a pod body written with no `image:`) is absent from that map, so the
command printed `No overrides for box "…"` and exited 0 — while the entry stayed in the
file and kept SaveDeployConfig refusing EVERY later write ("holds 2 deploy entries but
only 1 load"). The refusal's own suggested remedies were both unreachable: the per-entry
reset was a no-op, and the bare reset deletes the whole file.

The miss branch now removes the raw node-form key for that entry: exactly one key, with
the loadable entries and the config's other sections untouched, and an unparseable file
left alone for `charly migrate`. A test fixture with one good and one unloadable entry
asserts the good one and a non-deploy section survive.

Refs #56

*Agent: `cdi-audit` · Claude Code session `f760307f-53b4-4f48-87da-00f95e5300ed`*
*Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)*
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 7c773093e8b9d8f57141d873872c557d587ea391 (branch: fix/reset-dropped-entry)
Change class: code change (Go; candy/plugin-fleet deploy-reset behavior + tests).

Blocks

  1. A2 / R10 — no fresh-rebuild or bed proof of the changed code path; end-to-end deferred as "will test later".
    This is a runtime/code change, so R10 requires a fresh-rebuild/bed run that actually EXECUTES the changed deploy reset path, with pasted output. The body supplies only a bare go test (the three unit tests), go build, and charly box validate — none of which exercise the runFleetReset miss-branch / removeDroppedEntry behavior on a live system (box validate cannot fail on this path). The only live artifact pasted is the "fails without the change" arm (the defect). The "passes with the change" arm is explicitly pushed to "the charly rebuild from this wave's pins (the plan's Step 6)" — i.e. deferred. A2 names "bare go test" and "will test later" as FRAUD.
    The author's structural argument (the command is compiled into the charly binary, so CHARLY_REPO_OVERRIDE cannot pick up the branch, and a charly rebuild is the only witness) is internally consistent and was even measured — but under rule 3 a proof that genuinely cannot exist on this head must be backed by an explicit operator/bootstrap sign-off for that portion, and/or a filed issue; neither exists here (## Filed issues lists only deploy reset is a silent no-op on an entry the loader dropped — the remedy the refusal names cannot be executed #56, the blocker). Fix: rebuild charly carrying this code and paste the deploy reset run showing the dropped key removed and a subsequent write accepted, OR provide the operator sign-off / a filed issue for the deferred end-to-end witness — for this change's own scope the rulebook requires the proof in-tree.

  2. R12 — candidates B and C are rejected in prose with no spiked output/exit code.
    The ### Spike block lists candidate A (winner) and B/C, but only A is backed by pasted, runnable evidence (the regression tests that fail on the unmodified tree). B ("fail NONZERO with the charly migrate remedy") and C ("remove the whole file") are rejected by assertion only — no instrument, no pasted command output, no exit code, no works/fails result. R12 requires "EVERY candidate spiked with its instrument, pasted command output, exit code and result"; a verdict asserted with no pasted output is not a spike. The body gives reasons B/C are worse, not a reason they cannot be spiked, so the "nor why none exists" allowance does not cover them. Fix: spike B and C with pasted output/exit codes, or state and justify why no other candidate is spikable.

(Non-blocking QUAL note: removeDroppedEntry matches by top-level key name alone — a box whose name equals a non-deploy section such as cache/provides/ledger would delete that section. Low likelihood, but worth a name-collision guard.)

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

The first verdict's QUAL finding: removeDroppedEntry matched a top-level key by name alone, so a reset aimed at a box named cache/provides/ledger/system/defaults would delete that section. A deploy entry cannot share those names; refuse them, with a test.

Refs #56
@aitrawog

Copy link
Copy Markdown
Contributor Author

STATUS

STATUS — both findings addressed, one still owes a run I cannot produce in this repo.

QUAL note (fixed): removeDroppedEntry matched a top-level key by name alone, so a reset aimed at a box named cache/provides/ledger/system/defaults would have deleted that section. Those names are now refused outright, with a test that seeds a cache: section and asserts it survives. New head 92ce9c757c1e82d78c0f6e0cbd83acf820c8c74b.

R12 (B and C): C is demonstrable on this tree, and I ran it — the bare charly deploy reset deletes the whole file:

$ cp /tmp/fleet-live-fixture.yml /tmp/fleet-live/charly.yml && wc -l < /tmp/fleet-live/charly.yml
8
$ CHARLY_DEPLOY_CONFIG=/tmp/fleet-live/charly.yml charly deploy reset
Removed charly.yml
$ ls /tmp/fleet-live/charly.yml
ls: cannot access '/tmp/fleet-live/charly.yml': No such file or directory

so C's rejection is measured, not asserted: it destroys the good entry along with the bad one. B ("fail NONZERO with a migrate remedy") is a behaviour this tree does not have and is rejected by design — it leaves the operator exactly as blocked as the current silent no-op, which the issue's own evidence shows.

R10: the reviewer is right that a go test suite is not the runtime witness, and my "compiled-in, so the rebuild is the only witness" argument is a statement of a real constraint rather than a proof. The witness is a charly binary built with this branch's plugin-fleet substituted in a local replace, run against a degraded temp config — I will produce that run and paste it rather than defer again.

Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 92ce9c757c1e82d78c0f6e0cbd83acf820c8c74b (branch: fix/reset-dropped-entry)

Change class: code change (Go; candy/plugin-fleet deploy-reset behavior + tests).

Blocks

  1. A1 — body is stale and does not account for the current head. The body names Head: 7c773093… and "2 files changed, 163 insertions(+)". The CURRENT head is 92ce9c7…, and the diff is +65/+131 = 196 insertions across two commits. The second commit's removeDroppedEntry reserved-section guard and its TestRemoveDroppedEntry_NeverTouchesAReservedSection are absent from the body's Summary and How-tested accounting — "three tests" are pasted, not the four the diff ships. Fix: update the body to the current head/diff and account for the reserved-section guard and its test.

  2. A2 / R10 — no fresh-rebuild/bed proof of the changed deploy reset path; end-to-end still deferred. The body supplies only go test (the unit tests), go build, and charly box validate — none exercise runFleetReset/removeDroppedEntry live; the only live artifact pasted is the defect ("fails without the change") arm. The "passes with the change" arm is pushed to "the charly rebuild from this wave's pins". The author's own follow-up comment concedes: "the reviewer is right that a go test suite is not the runtime witness … I will produce that run and paste it rather than defer again." That is the forbidden "will test later" — the proof CAN exist (a charly rebuild with a local replace, as the author states) and is simply not produced. Also name the required R10 change-class beds. Fix: build charly carrying this code and paste the deploy reset run showing the dropped key removed and a subsequent SaveDeployConfig write accepted.

  3. R12 — candidate B is still not spiked; C's spike is only in a comment, not the body. The body's ### Spike block lists A (winner), B ("fail NONZERO with the charly migrate remedy") and C ("remove the whole file"), but only A is backed by pasted, runnable evidence. B is rejected by prose with no instrument, command output, or exit code; C's measured output appears only in a follow-up comment, not in the body's spike block. R12 requires EVERY candidate spiked with pasted command output/exit code and result, in the body. Fix: paste the spike output for B and C into the body's ### Spike block (or state and justify why no other candidate is spikable).

  4. R1 — no fresh RCA naming the MISSED CONTROL on the review round. Commit 2 answers the earlier QUAL finding (reserved-section name collision) and the author comment says "both findings addressed", but neither the comment nor the body carries an RCA naming why the author's own pre-push gate did not catch the collision in the first place. Fix: add the round's RCA identifying the missed control.

Comment dispositions

  • Comment 1 (bot, BLOCK): its A2/R10 finding is verified-blocking and still reproduces against the current state (author concedes in comment 2); its R12 finding is partially verified-blocking — C is now spiked in comment 2 but B is not, and neither is in the body's spike block; its QUAL note is verified-non-blocking / resolved — the reserved-name guard is present in the current diff (switch key { case "cache", … }) with a test.
  • Comment 2 (@aitrawog, STATUS): its claim that the QUAL guard is fixed is verified from the diff; its admission that R10 is unproven and its "I will produce that run and paste it" is verified-blocking (an unresolved R10 gap, not proof).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 92ce9c757c1e82d78c0f6e0cbd83acf820c8c74b (branch: fix/reset-dropped-entry)

Change class: code change (Go; candy/plugin-fleet deploy-reset behaviour + tests). Placement: CORRECT — this is a capability in a plugin (candy/plugin-fleet), not core/sdk; the reserved-section guard and node-API removal are at the right layer.

Blocks

  1. R12 — the ### Spike block does not carry pasted command output + exit code for candidate C, and candidate B is asserted, not spiked.

    • C ("reset with no box / delete the file"): the body's block row reads only "measured, and it is the defect: Removed charly.yml …". That is a one-line summary, not "pasted command output, exit code and result". The actual run lives in the follow-up comment, and even there no exit code is shown. R12 requires the spike block under ## How tested to carry the command, output, exit code and result for each candidate.
    • B ("fail NONZERO with a charly migrate remedy"): rejected by assertion ("leaves the operator exactly as blocked") with no instrument, command output, or exit code. R12: "asserts a result with no pasted command output … is not a spike." Either spike B (implement the error path and paste the run showing the operator is still blocked) or remove it from the candidate list and justify in prose why "fail-with-remedy" is not a solution to the cause (it does not remove the dropped entry) — not merely "not shippable."
      Fix: paste A, C (and B, or its explicit non-candidate justification) with real command output and exit codes into the body's ### Spike block.
  2. R1/R2 — body claim "the locked config read/write cycle is reused" is contradicted by the diff. removeDroppedEntry does its own os.ReadFile/os.WriteFile (config_cmd.go +295–+313) — it deliberately bypasses SaveDeployConfig, whose round-trip guard is the very thing being escaped. The write path is not the locked cycle. State the raw bypass and why it is necessary (the guard would refuse the write) instead of claiming reuse; as written the R2 answer diverges from the code (R1).

Comment dispositions

  • Comment 7192681058 (bot BLOCK): its R10/"bare go test" finding is stale-superseded — the current body pastes a two-arm live run (rc=0, cat showing the good entry intact, next write accepted); its R12 finding is verified-blocking (still reproduces: B unspiked, C only summarized); its QUAL note is verified-non-blocking/resolved (reserved-section guard present with a test).
  • Comment 7192719091 (@aitrawog STATUS): QUAL fix verified from the diff; the "I will produce that run" admission is now stale-superseded — the run is in the current body; its C spike output is real but lives in this comment, not the body block, and lacks an exit code.
  • Comment 7192753841 (bot BLOCK): block 1 (body stale) stale-superseded — body now names 92ce9c7…, 196 insertions, and accounts for the guard + 4 tests; block 2 (R10 missing) stale-superseded — live two-arm proof now pasted; block 4 (no RCA) stale-superseded — R1 now names the missed control (unit-only pre-push gate, collision untested); block 3 (R12) verified-blocking and still survives.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 92ce9c757c1e82d78c0f6e0cbd83acf820c8c74b (branch: fix/reset-dropped-entry)

Security screen: PASS (no secrets, no egress, no guardrail weakening; placement is a plugin capability in candy/plugin-fleet, not core/sdk).
Checklist: All applicable rules PASS or NA. Body accounts for both files, the reserved-section guard, and all four tests; the live two-arm deploy reset run executes the changed removeDroppedEntry branch and the subsequent SaveDeployConfig write (rc=0); the ### Spike block carries A (live run), C (pasted output + rc=0), and B justified in prose as not a solution to the cause; R1 names the missed control (unit-only pre-push gate, collision untested).

Comment dispositions: 7192681058 (bot) R10 and R12 findings stale-superseded by the current live proof + in-body spike; QUAL collision note resolved (guard + test present). 7192719091 (@aitrawog) QUAL fix verified; "will produce that run" stale-superseded (run now in body). 7192753841 (bot) A1/A2/R10/R1 blocks stale-superseded (head/diff updated, live proof pasted, RCA present). 7205026083 (bot) R12 and R1/R2 blocks stale-superseded (C now in body with exit code, B explicitly justified as non-candidate, and the body now states the raw os.ReadFile/os.WriteFile bypass of SaveDeployConfig instead of claiming reuse).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 26, 2026 22:59
@github-actions
github-actions Bot merged commit 68ab74c into main Nov 26, 2026
7 of 9 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 26, 2026
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