Files
Nagendhra Madishetti dc12e0938f fix(frontmatter): a lone quote character is no longer parsed as an empty string (#4182)
* fix frontmatter parser coercing leading-zero values to numbers

The minimal YAML frontmatter parser (and its plugin-runtime mirror)
coerced any `-?\d+` token to a Number, so a leading-zero value like
`01234` (zip code, zero-padded id) silently became `1234`, and `007`
became `7`. Per YAML 1.2 a leading-zero decimal is a string — the zero is
significant. Restrict integer/float coercion to values without a redundant
leading zero (`0` alone still coerces to the number 0).

Also fix a related edge case where a value that is a single quote character
(`"`) was treated as an empty quoted string (slice(1,-1) of a 1-char
string), now requiring at least two characters before stripping quotes.

Both parser copies are kept in sync per their "mirror" contract.

Adds tests/frontmatter.test.ts for the daemon parser and extends the
existing plugin-runtime parsers test.

* fix(frontmatter): coerce leading-zero numerics per YAML 1.2 core schema

Restore numeric coercion for leading-zero scalars (01234, 007, -01, 00.5)
to match the YAML 1.2 core-schema int/float resolution, per review. The
lone-quote guard (require length >= 2 before stripping matching quotes)
stays in place. Tests updated to assert the numeric results.

Applies to both the daemon parser and the plugin-runtime mirror.

---------

Co-authored-by: Nagendhra <nagendhra405@gmail.com>
2026-06-19 03:19:19 +00:00
..