Skip to content

Correct line folding in quoted and plain YAML scalars - #257

Merged
quinnj merged 2 commits into
masterfrom
maintenance/scalar-line-folding
Oct 4, 2026
Merged

quinnj merged 2 commits into
masterfrom
maintenance/scalar-line-folding

Conversation

@quinnj

@quinnj quinnj commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Parsing a multiline single-quoted value in #241 returns a newline where YAML requires a folded space. The same error affects double-quoted and plain values: both scanners compare a normalized line-break String with the character '\n', so they never reach the ordinary folding branch.

Compare with the newline string, insert a folded space only when no blank lines follow, and append the blank-line breaks collected by the plain-scalar scanner. Escaped double-quoted continuations and the existing YAML 1.1 Unicode separator behavior are preserved.

All fixture files and test paths are retained. Three expected values encoded the old bug: the two values in spec-02-18 now use folded spaces, while issue36 retains one line feed from its blank line rather than counting the initial discarded break too. These corrections follow YAML 1.1 section 6.5 and YAML 1.2.2 section 6.5; both versions use flow folding in example 2.18. Every existing fixture was compared before changing these three values.

Validation:

  • All 52 new public checks pass; the preceding master has 16 passes and 36 failures. Cases cover plain/single/double-quoted values, LF/CRLF/CR/NEL, one and multiple blank lines, spaces beside line breaks, escaped continuations, doubled apostrophes, significant single-line spaces, and preserved Unicode line/paragraph separators.
  • Full integrated Julia 1.6.7 and 1.13.1 suites pass with four threads and forced bounds checks, including all 42 merged key-preservation regressions and the scanner/writer tests. git diff --check passes.
  • An independent source/fixture review found no blockers and passed 104 additional public cases on Julia 1.13: map/sequence containers, one–four normalized breaks, mixed line endings, document boundaries, escaped continuations with blank lines, and the unchanged issue36 YAML input.
  • All 22 exact-head checks passed in run 37181728746, including all 20 minimum/current/nightly Julia jobs on Linux, Windows and Intel macOS. Codecov accepted the current Linux upload at the correct commit/repository (11,208 bytes), and all 20 coverage sessions finished at 87.56%; both coverage checks passed.

Exact master merge a3a5213c7f3b42518f4c8c796a46eaa27e67cba1 also passes all 20 jobs in run 37182401871. The stable Linux upload was accepted at the correct destination (11,208 bytes), with all 20 sessions processed at 87.56%.

Fixes #241.

Co-authored by Codex

AI disclosure: This work was prepared with assistance from OpenAI Codex.

quinnj added 2 commits October 4, 2026 00:00
Compare normalized line-break strings with a string, condition folded spaces on the absence of blank lines, and retain collected plain-scalar breaks. Correct three fixture values that preserved the old bug, and cover 52 public line-break, blank-line, escape and Unicode-separator cases.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
Preserve both the 42 key roundtrips and 52 flow-folding assertions when incorporating current master. Functional folding changes are unchanged.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.56%. Comparing base (48ef364) to head (2944908).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #257      +/-   ##
==========================================
+ Coverage   87.19%   87.56%   +0.37%     
==========================================
  Files          15       15              
  Lines        1648     1649       +1     
==========================================
+ Hits         1437     1444       +7     
+ Misses        211      205       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj
quinnj merged commit a3a5213 into master Oct 4, 2026
22 checks passed
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.

Incorrect parsing of newlines within single quotes

1 participant