packages/runtime/src/parsers/yaml.zig:3002-3003:
const indent_indicator, const chomp = try self.scanBlockHeader();
_ = indent_indicator;
return self.scanAutoIndentedLiteralScalar(chomp, false, start, line);The explicit indentation indicator (|2, |1+, >3-, …) is parsed and then thrown away, so every block scalar falls back to auto-detection. When the content is indented further than the auto-detected indent, those extra spaces are content per the YAML spec, and Home strips them:
expected " x\n" received "x\n"
expected " x\n" received "x\n"scanFoldedScalar (:3010) does the same.
Scale
js/bun/yaml/yaml-block-scalar-matrix.test.ts is 762 pass / 322 fail after 81ae379c8 fixed chomping (was 598/486). Pinned Bun scores 1084 / 0. A large share of the remaining 322 look like this class. yaml-test-suite.test.ts is 364/38 against Bun's 402/0.
Map of Bun's live implementation
~/Code/bun/src/parsers/yaml.rs:
| line | what |
|---|---|
:4987 | let explicit_indent: Option<Indent> = match indent_indicator { … } |
:5002 | content_indent: explicit_indent.unwrap_or(Indent::NONE) — seeds the ctx instead of starting at NONE |
:5004 | explicit_indent: explicit_indent.is_some() — kept as a ctx flag |
:4944 | if !self.explicit_indent && … — guards the more-indented-line handling |
:5022 | at EOF, if explicit_indent.is_none() { ctx.content_indent = self.line_indent } |
:5054, :5080 | phase-1 detection must not overwrite an explicit indent |
Home's counterparts are all in scanAutoIndentedLiteralScalar (yaml.zig:2709), whose ctx has content_indent (:2715) and max_leading_indent (:2717) but no explicit_indent flag, and which initializes .content_indent = .none unconditionally at :2809.
Bun's own comment at :4865-4875 describes the two-phase loop the port needs to preserve: phase 1 finds content_indent and the first non-whitespace char, phase 2 accepts lines that are >= content_indent AND > parent block indent.
Note on the function name
scanAutoIndentedLiteralScalar is named for the behaviour it currently has. Once it honours an explicit indicator the name is wrong — Bun's is just scan_literal_scalar.
Refs #66