mirror of
https://github.com/nexu-io/open-design.git
synced 2026-07-03 12:27:55 +08:00
* 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>