Skip to content

charly candy set re-emits the whole candy document at indent 4 — a one-value pin bump becomes a 46/51-line diff #1021

Open

Description

@aitrawog

What happened

A single-value edit through the documented setter rewrites the whole candy document's layout. Nothing warns, and rc=0.

On a cp -a of opencharly/eval-omarchy at 4a2625fa, with charly 2026.295.0754 (plugin-candy v0.2026281.948):

$ charly -C . candy set eval-pr candy '["@github.com/opencharly/plugin-pipeline/candy/plugin-pipeline:v2026.295.0740"]'
$ echo $?
0
$ git diff --numstat
46	51	candy/eval-pr/charly.yml

The VALUE landed correctly — the eval-pr body's candy: composition list is the one entry I passed. What else moved is the entity's INDENTATION: the authored 2-space nesting of the eval-pr body reads back at 4 spaces, so a one-token pin bump is a 97-line diff. All 39 comment lines survive (grep -c '# ' → 39 before and after), and key order survives.

Mechanism

candy set mutates a yaml.Node tree through kit.SetByDotPath and then writes the document back with a whole-document re-encode:

candy/plugin-candy/command.go:163
	out, err := yaml.Marshal(&root)

yaml.Marshal re-emits at yaml.v3's default indent (4), which normalizes any authored layout narrower than that, anywhere in the document — not only in the touched entity. So the guarantee the command actually provides is comment-preserving and key-order-preserving, not layout-preserving, and a caller cannot tell from the command's own doc that a targeted edit is a whole-document rewrite.

Blast radius

Every consumer pin bump in a manifest authored at a narrower indent — which is most of them, since the skill/box entities in these files are hand-written — turns a reviewable one-line change into an unreviewable reformat. It also defeats the "the diff is the claim" discipline for anyone who uses the documented setter instead of a hand edit: the resulting PR carries 90+ lines nobody authored.

For this session it meant abandoning the setter and making the pin edit by hand, which is the workaround this issue is about.

Root fix

Either emit only the touched subtree, or detect the document's existing indent and hand it to an yaml.Encoder with SetIndent(...) so an unrelated entity's layout is never rewritten. If the reflow is intended, it must be stated in charly candy set's own help/description and in /charly-image:layer, and it should not fire when the detected indent already matches the authored one.

Filed from the eval-omarchy skill-body leg; not blocking it (the hand edit was measured green: charly box validate → 203 candies, 21 boxes, 21 deploys, 7 distros, 7 builders; 0 warnings, 0 errors).

Agent: charly

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

Activity

  1. added
    category:runtime
    type:fix
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions