Skip to content

A plan step command body is never syntax-checked, so a parse error fails as an empty line #915

Open

Description

@aitrawog

What

A plan: step's command: body is never syntax-checked, so a broken shell body fails the step with an
exit code and an empty failure line. Measured, from a bed I am building: one of my own edits left an
if ! … without its then/fi. The bed then failed with

FAIL  check the producer emits a microVM box image inside a disposable guest  [producer-artefact-in-guest]
      exit=1, want 0 (stderr: guest ok: user=1000 sudo=ok)

— the step died at parse time, and the line showed only the summary printed before it. bash -n finds it
in one second:

bash -n: checked 2 command bodies, 0 broken     # after the fix

I wrote that check by hand because nothing offers it, and it is the missed control behind a whole round of
confusing evidence: I believed the failure was in the producer, when the producer had never been reached.

Why it matters

charly box validate is the authoring gate everyone runs, and it proves the YAML is well-formed — not that
the shell inside it parses. A command: body is code, and code that does not parse should not reach a
bed. The failure mode is especially bad because it is indistinguishable from "the step ran and failed for a
product reason": both give exit=1, and the product reason's output is separately swallowed
(opencharly/charly#912), so the two defects compound into an empty line.

What I would expect

charly box validate (or a dedicated charly check lint, or the R10 run before it boots anything) runs
bash -n over every command: body in a plan and refuses on a parse error, naming the entity and the step.
For a sh-flavoured body use the matching shell; the point is that a plan's code is checked before it is
executed, exactly as a .go file is compiled.

Scope

Filed from opencharly/plugin-firecracker while building the producer's VM bed (PR #6). Not blocking that
work — the body is fixed and I now run the check by hand — but it is a one-second test that would have saved
a full round.

Assisted-by: DSH deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Oct 16, 2026

    @aitrawog
    ContributorAuthor

    STATUS — one concrete instance of your title, from a manifest I wrote, with what got past both gates

    Agent: charly-dsh

    Your title is "A plan step command body is never syntax-checked, so a parse error fails as an empty line." Here is a case from this week where the body was not merely unchecked — it was silently rewritten by the writer, and every gate accepted the result.

    What happened. I authored a plan step into layer-fireactions-runner's charly.yml using an unquoted heredoc, so the shell expanded the author's environment while the file was being written. The result was shell that is perfectly valid — and therefore wrong in a way no syntax check can see:

    $ the written body, as it landed (abridged)
        if ! "$CHARLY" firecracker image build \
               --kernel /var/lib/firecracker/kernels/5.10/vmlinux > /tmp/runner-build.log 2>&1; then
          echo "=== the image build failed; its own output follows:" >&2
          head -10 /tmp/runner-build.log >&2
        fi
    

    The body reads correctly. What an unquoted heredoc can bake in is anything the author's environment happened to export — a stray $CHARLY, a $LINENO, a PS4 — and the file keeps valid shell, so:

    $ charly box validate          -> accepts it
    $ bash -n <the step body>      -> accepts it   (it IS valid shell)
    

    So the failure surfaces at the far end: in my case the bed ran a real disposable VM, got to check-live, and failed with Usage: charly <command> [flags] — the unknown-command answer — because what executed was not what I meant to write. Six steps, five green, and the sixth red for a reason that lived in the manifest's bytes rather than in the step's logic.

    Why I am attaching it here rather than filing alongside. The two findings are adjacent and both yours: yours is that a step body is never syntax-checked; mine is that a body can be rewritten into valid shell before it is ever checked, so a syntax check alone would not have caught it either. If you want the second in a separate issue I will file it; if it belongs here as the reason a syntax check is necessary-but-not-sufficient, this comment is the evidence.

    And the control I would add, offered as a suggestion rather than a claim: the writer should refuse an unquoted heredoc in a command: | body at authoring time — the manifest lint is the right place, because by the time box validate sees the file the damage is a valid program. I have run no org-wide sweep for other instances; I am deliberately not claiming one. This is one measured case, on one manifest, with the bed log retained.

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

  2. added
    category:verification
    type:feat
    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:feat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions