Skip to content

fix(manifest): parse same-indent block sequences instead of dropping them (issue #77) - #90

Merged
dndungu merged 1 commit into
mainfrom
task/t2-4-issue77-silent-drop
Aug 28, 2026
Merged

fix(manifest): parse same-indent block sequences instead of dropping them (issue #77)#90
dndungu merged 1 commit into
mainfrom
task/t2-4-issue77-silent-drop

Conversation

@dndungu

@dndungu dndungu commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

POST /api/v1/pods with a Pod manifest whose containers: list uses the
"dash at the same indentation as its key" YAML style (very common,
including in hand-written K8s manifests copy-pasted from docs) silently
dropped the entire container list. The pod was admitted, podman pod create ran, but no container was ever started -- the pod reported
completed/exitCode=0 within seconds with nothing having actually run.
This fixes internal/manifest's hand-rolled YAML parser to recognize that
style.

Changes

  • internal/manifest/yaml.go: parseYAMLLines's "key with no inline
    value" branch only treated the next line as a list when it was indented
    deeper than the key (nextIndent > baseIndent). A sequence at the
    same indentation as its key (nextIndent == baseIndent) fell through
    to the nextIndent <= baseIndent case, which means "key has no value" --
    silently setting the key to "" and, because the top-level parse loop
    then also saw the now-unconsumed - line as a dedent, truncating the
    rest of the document parse entirely. Added an explicit branch for
    nextIndent == baseIndent && strings.HasPrefix(nextTrimmed, "- ") ahead
    of the existing catch-all, routing it through the same parseYAMLList
    already used for the deeper-indented case. Purely additive: it only
    changes behavior for the previously-mishandled case, so it can't affect
    any manifest that parsed correctly before.
  • internal/manifest/yaml_test.go: TestParseYAML_SameIndentBlockList
    (bare-scalar sequence) and TestParseYAML_SameIndentBlockList_Nested
    (map-valued items under a nested key, matching the issue's actual
    shape) at the ParseYAML unit level.
  • internal/manifest/same_indent_list_test.go:
    TestIssue77_SameIndentContainersList, an end-to-end Parse()
    reproduction using the exact manifest text from the issue (the
    GitHub token/URL placeholders scrubbed; irrelevant to the parse path
    under test).

Root cause vs #73/#85

internal/executor/podman.go's buildRunArgs/GPU-env-injection family
(#73, #85) corrupts Command/Args after a successful parse. This bug
is upstream of that: spec.Containers was already empty by the time
CreatePod ran, so its per-container loop had nothing to iterate --
podman run/podman container create was never invoked for the
workload container, only podman pod create for the pod shell. Confirms
docs/plan.md's R2/T2.4 question that #77 does not share #73/#85's root
cause.

Every existing YAML test fixture in this package used the extra-indented
containers:\n - name: ... style, so the same-indent style had zero
coverage before this change -- same "silently defaults instead of
erroring" pattern previously seen in #43, #44, #52, #66, #74.

Testing

  • go build ./... -- clean.
  • go vet ./... -- clean.
  • staticcheck ./... -- clean.
  • go test ./... -race -timeout 120s -count=1 -- all 13 packages pass,
    no regressions (internal/manifest 1.9s, full suite ~37s dominated by
    internal/watcher).
  • go test ./internal/manifest/... -run 'TestIssue77|TestParseYAML_SameIndent' -v
    -- confirmed red before the fix (containers=0) and green after
    (containers=1, restartPolicy=Always) on all three new tests.
  • Not live-verified on the DGX in this PR -- that happens centrally after
    merge/release per this wave's operating procedure. The exact repro
    manifest from the issue is now covered by an automated test; DGX
    live-verify just needs the real manifest (with the real token/URL)
    submitted once the release carrying this fix is deployed.

Linked issues / tasks

parseYAMLLines only recognized a block sequence as a key's value when the
"-" markers were indented deeper than the key. A sequence at the SAME
indentation (e.g. `containers:` immediately followed by `- name: runner`
with no extra indent -- valid, common YAML/K8s style) fell into the
"key has no value" branch, silently zeroing the key and truncating the
rest of the document parse.

For issue #77's manifest this dropped spec.containers to empty while
spec.restartPolicy (parsed earlier in the same block) survived, so
CreatePod's container loop had nothing to iterate: podman only ever
received "pod create", never a "podman run", and the pod reported
completed/exitCode=0 within seconds with no workload container ever
having existed.

Every existing YAML test fixture in this package used the extra-indented
style, so this path had no coverage. Distinct from #73/#85, which corrupt
Command/Args after a successful parse rather than dropping Containers
before one.

fixes #77
@dndungu
dndungu merged commit b4bc9de into main Aug 28, 2026
1 check passed
@dndungu
dndungu deleted the task/t2-4-issue77-silent-drop branch August 28, 2026 18:15
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.

Pod completes instantly (exitCode=0) with zero container startup — container spec silently dropped

1 participant