Split YAML documents with the Kubernetes YAML reader - #56
Open
MPV wants to merge 1 commit into
Open
Conversation
MPV
force-pushed
the
claude/skip-non-workloads
branch
from
July 23, 2026 07:09
e896ac0 to
82b2362
Compare
MPV
force-pushed
the
claude/robust-yaml-splitting
branch
from
July 23, 2026 07:09
9941ad2 to
1fb8717
Compare
MPV
force-pushed
the
claude/skip-non-workloads
branch
from
July 23, 2026 08:17
82b2362 to
aad8d56
Compare
MPV
force-pushed
the
claude/robust-yaml-splitting
branch
2 times, most recently
from
July 23, 2026 08:24
7d70b66 to
dd5529b
Compare
This was referenced Jul 23, 2026
MPV
force-pushed
the
claude/skip-non-workloads
branch
from
July 24, 2026 06:45
aebe427 to
ab391dc
Compare
MPV
force-pushed
the
claude/robust-yaml-splitting
branch
from
July 24, 2026 06:45
dd5529b to
324f980
Compare
MPV
force-pushed
the
claude/skip-non-workloads
branch
from
August 2, 2026 08:00
ab391dc to
050d1ab
Compare
Document splitting used bytes.Split on the literal "\n---\n", which missed a leading "---" separator, separators with trailing whitespace, CRLF line endings, and a final document with no trailing newline. Replace it with apimachinery's YAMLReader via a new yamlparser.ProcessReader that streams documents from an io.Reader. Both the file and stdin paths now read through it, so their splitting behaves identically and correctly across these cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
MPV
force-pushed
the
claude/robust-yaml-splitting
branch
from
August 2, 2026 08:01
324f980 to
129d31d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replace
bytes.Split(data, []byte("\n---\n"))with apimachinery'sYAMLReadervia a newyamlparser.ProcessReaderthat streams documents from anio.Reader. Both the file and stdin paths read through it.Why
Splitting on the literal
"\n---\n"missed:---separator,Behavior change
Documents separated in any of those ways are now parsed correctly. The file and stdin paths share one splitting implementation, so they behave identically.
Testing
Added
TestProcessReadercovering each of the edge cases above; the obsoleteprocessDocumentshelper test is removed.go.mod/go.sumare unchanged (the reader lives in the already-required apimachinery module).Stack
Third of the parsing stack. Base:
claude/skip-non-workloads(#54). Merge order: #49 → #54 → this.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pc6NAURAqjU4LYJx93tgSC
Generated by Claude Code