Skip to content

Keep number types in JSON to YAML conversion - #2

Merged
hamrezoffic-source merged 2 commits into
copilot/extend-go-cli-with-tests-and-actionsfrom
claude/fix-yaml-numbers
Nov 23, 2026
Merged

hamrezoffic-source merged 2 commits into
copilot/extend-go-cli-with-tests-and-actionsfrom
claude/fix-yaml-numbers

Conversation

@hamrezoffic-source

@hamrezoffic-source hamrezoffic-source commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

What this fixes

devkit json to-yaml emitted numbers as quoted strings:

$ echo '{"a":1,"f":1.5}' | devkit json to-yaml
a: "1"
f: "1.5"

json.Number is a string type, so yaml.v3 marshalled it as a string. A JSON -> YAML -> JSON round trip silently changed numbers into strings. The existing round-trip test only checked that keys existed, so it missed this.

Changes

  • numbersToYAMLNodes converts json.Number values into YAML scalar nodes tagged !!int or !!float, keeping large integers exact (e.g. 12345678901234567890).
  • New test TestJSONToYAMLKeepsNumberTypes: checks no number is quoted, the string "5" stays a string, and the round trip returns identical JSON.
  • Fixed error messages that suggested a non-existent json tojson subcommand.
  • port check printed the dial error twice (stdout and stderr); stdout now prints just closed.

Checks

gofmt, go vet ./..., go test ./... all pass locally (coverage 45.2%).

This PR targets the Copilot branch so it lands in #1 before that is merged into main.

json.Number values were emitted as quoted YAML strings (1 -> "1"),
so a JSON -> YAML -> JSON round trip silently changed types.
Also fix misleading error messages and a duplicated port-check error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183H1i14AVAdwx5KFXBDo7Q
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6a143c4e-bd1e-4b95-91e0-1992bc490c24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Go 1.22 binaries lack the LC_UUID load command that current macOS
dyld requires, so the macOS test job aborted before running tests
(also failing on the base branch). go.mod still declares 1.22 as the
minimum language version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183H1i14AVAdwx5KFXBDo7Q
@hamrezoffic-source
hamrezoffic-source merged commit 0917714 into copilot/extend-go-cli-with-tests-and-actions Nov 23, 2026
7 checks passed
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.

2 participants