Skip to content

validate: a candy with a disallowed field can be reported with an ALLOWED field named as the offender #890

Open

Description

@aitrawog

What

A candy whose charly.yml carries a field the schema does not allow can be reported with the WRONG
field named, which sends the author to fix a field that is already correct.

Measured

A layer candy carrying version: <calver> — a field the current #Candy does not have — plus a
valid var: block, validated with charly box validate:

charly: error: command "validate": validation error: candy "layer-firecracker": CUE schema: …: candy "layer-firecracker": 2 errors in empty disjunction:
               3 errors in empty disjunction:
               var: field not allowed:
                   …/charly.yml: layer-firecracker:77:1
               version: field not allowed:
                   …/charly.yml: layer-firecracker:87:1

var: is allowed (spec/schema/candy.cue:69) and the block was valid; removing only version:
made the same command report OK — checked 1 candy, 1 box, 1 deploy, 7 distros, 7 builders; 0 warnings, 0 errors with var: untouched.

So the message cost real time: the first field listed was the innocent one, and the reported
line:col positions do not correspond to the offending keys in the authored file either (the
offending version: sits at line 3, the reported position was 87:1).

Why it matters

#Candy is a large permissive def, and unknown-field mistakes are the single most common authoring
error. A message that names a correct field as the offender turns a one-line fix into a hunt — and
an agent following it may "fix" var: (rename it, delete it) and break a working candy.

Where it likely lives

The multi-branch disjunction that produces "N errors in empty disjunction" — either the CUE
unification site in the validator's candy gate, or how the node is prepared before unification
(the positions suggest the flattened/re-emitted document, not the authored file).

Ask

Name the field that is actually disallowed, and report positions in the authored file.

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

Activity

  1. aitrawog commented on Nov 22, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — a second, measured instance of this defect, on a box node (the #CandyValue box⊻candy disjunction). It's from kde-cstream's unified-builder chain (opencharly/sdk#608), not fixed there.

    Measured. opencharly/spec#420 drops aur from _buildFormat, so a box's build: [pac, aur] is now refused. I ran a dev charly over that chain on an unmigrated distro-cachyos checkout. charly box validate, charly box generate charly-selftest and charly box inspect charly-selftest all exit 1 with:

    …/box/charly-selftest: node "charly-selftest": candy: #CandyValue: 11 errors in empty disjunction:
                   #CandyValue: 14 errors in empty disjunction:
                   #CandyValue.base: field not allowed:
                       node charly-selftest:1:3
    

    base: is correct. The only change that makes all three succeed is removing - aur from build: (charly migrate's aur-not-a-build-format step does exactly that). The first line shown is the candy arm's complaint about a field only the box arm allows. The real offender (build[1]: "aur" in the box arm) is buried below it.

    Where it lives (traced). Not loaderkit's #NodeDoc gate: through charly's compiled-in loader, ValidateNodeDocCUE accepts the unmigrated file (measured with a probe test). The refusal comes from charly/provider_kind_invoke.go validateKindValueCUE (foldCandyKind → node %q: %w), which unifies the body with the whole #CandyValue disjunction and returns errors.Details for every arm.

    Fix direction, kind-blind as that function's own comment requires. When the kind-value def is a disjunction, unify the body with each arm separately and report the errors of the arm that fails least: here one error, on build. A field-specific branch in the kernel would be the R-item that comment rules out.

    Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
    Assisted-by: Claude Code Claude Opus 5.5 (analysed on a live system)

  2. added
    category:verification
    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:verificationtype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions