Skip to content

fix:replace gopkg.in/yaml.v3 to fix float serialization issue#2687

Merged
xhebox merged 3 commits intopingcap:masterfrom
WizardWuuu:fix-yaml_v3_decimal_serialization
Feb 27, 2026
Merged

fix:replace gopkg.in/yaml.v3 to fix float serialization issue#2687
xhebox merged 3 commits intopingcap:masterfrom
WizardWuuu:fix-yaml_v3_decimal_serialization

Conversation

@WizardWuuu
Copy link
Contributor

@WizardWuuu WizardWuuu commented Feb 25, 2026

The original yaml.v3 serializes float 1 as "1" (without decimal point), which causes deserialization to infer it as integer type. This can lead to type mismatch errors for callers expecting float.

Replace with fork that serializes float 1 as "1.0", preserving the float type during round-trip serialization.

What problem does this PR solve?

Fixes the float serialization issue where yaml.v3 serializes float values like 1.0 as 1 (without decimal point),
causing type inference issues during deserialization.

close #xxx

What is changed and how it works?

Replace gopkg.in/yaml.v3 with github.com/WizardWuuu/yaml (v3_decimal branch) which preserves float type during serialization by outputting 1.0 instead of 1.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

The original yaml.v3 serializes float 1 as "1" (without decimal point),
which causes deserialization to infer it as integer type. This can lead
to type mismatch errors for callers expecting float.

Replace with fork that serializes float 1 as "1.0", preserving the
float type during round-trip serialization.
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 25, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign bb7133 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot requested review from breezewish and nexustar February 25, 2026 02:19
@ti-chi-bot ti-chi-bot bot added contribution size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 25, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.34%. Comparing base (c567110) to head (86a976b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2687      +/-   ##
==========================================
- Coverage   42.37%   42.34%   -0.03%     
==========================================
  Files         424      424              
  Lines       47043    47043              
==========================================
- Hits        19932    19916      -16     
- Misses      24425    24440      +15     
- Partials     2686     2687       +1     

☔ 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.

…ation fix

Add a dedicated test to ensure the forked yaml.v3 correctly serializes
float values with decimal points preserved (e.g., 1.0 -> "1.0" not "1").

This prevents type mismatch errors during YAML round-trip serialization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 25, 2026
- Add test cases for 0.0 and 1000.1 float values
- Verify values are correctly parsed as float64
- Use require.Contains for cleaner assertions
- Remove unused bytes import
@ti-chi-bot ti-chi-bot bot added the lgtm label Feb 27, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 27, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-27 01:46:49.532046421 +0000 UTC m=+405882.046841030: ☑️ agreed by xhebox.

@xhebox xhebox merged commit f6b4dc8 into pingcap:master Feb 27, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution lgtm size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants