Skip to content

Preserve integer precision in YAML output - #280

Draft
Kayvan-Zahiri wants to merge 1 commit into
timescale:mainfrom
Kayvan-Zahiri:codex/preserve-yaml-integer-precision
Draft

Kayvan-Zahiri wants to merge 1 commit into
timescale:mainfrom
Kayvan-Zahiri:codex/preserve-yaml-integer-precision

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Problem

YAML output normalizes values through JSON to honor JSON field tags, but decoding into any with encoding/json changes all numbers into float64. An int64 such as 9007199254740993 is silently rounded to 9007199254740992; signed and unsigned limits are affected too.

Change

Decode the JSON intermediate with the existing YAML decoder so integer values retain their precision while JSON field names, omissions, and custom marshaling remain authoritative. Add scalar/nested integer and string/fraction/boolean/null controls, plus a full CLI backup-list case. Update the existing YAML backup fixture to expect its exact integer size rather than floating-point notation.

Validation

  • Five serializer regressions fail before the fix; four controls pass.
  • Entire credential-free Go suite passes (1,929 test/subtest pass events, six integration skips).
  • gofumpt, go vet, go fix -diff, staticcheck, govulncheck, go build, and go generate pass; generation creates no additional changes.
  • Real command harness exercises YAML output with mocked API responses; no hosted services or credentials used.

@CLAassistant

Copy link
Copy Markdown

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.

@nathanjcochran nathanjcochran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the contribution. Please sign the contributor license agreement and mark this PR ready for review. After that, I'd be happy to merge 😃

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants