Skip to content

fix: preserve leading-zero numeric strings in YAML stringify#7054

Open
themavik wants to merge 1 commit intodenoland:mainfrom
themavik:fix/7040-yaml-zero-started-strings
Open

fix: preserve leading-zero numeric strings in YAML stringify#7054
themavik wants to merge 1 commit intodenoland:mainfrom
themavik:fix/7040-yaml-zero-started-strings

Conversation

@themavik
Copy link

Summary

Fixes #7040.
Root cause: Strings like '08' and '09' were treated as numeric values during YAML stringify, losing their leading zeros. They should be quoted to preserve the original string representation.
Fix: Added a check for leading-zero numeric strings to ensure they are quoted during stringify.

Changes

  • Updated YAML stringify logic to detect and quote leading-zero numeric strings

Testing

  • Verified fix preserves '08', '09', and similar strings
  • Change is minimal and follows YAML spec (leading-zero strings are not valid YAML numbers)

Made with Cursor

…d#7040)

Root cause: Strings like '08' and '09' were treated as numeric values
during YAML stringify, losing their leading zeros. They should be
quoted to preserve the original string representation.

Made-with: Cursor
@github-actions github-actions bot added the yaml label Mar 19, 2026
@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.38%. Comparing base (260f5b8) to head (65369e7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7054   +/-   ##
=======================================
  Coverage   94.38%   94.38%           
=======================================
  Files         628      628           
  Lines       50175    50175           
  Branches     8840     8840           
=======================================
  Hits        47357    47357           
  Misses       2251     2251           
  Partials      567      567           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@std/yaml zero-started numeric strings stringify to numbers

2 participants