This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/rocketmq-studio by this push:
     new 7360f3e2b fix(rmqctl): keep numbers unquoted in YAML output (#6056)
7360f3e2b is described below

commit 7360f3e2b921604c9bfe5163d89da51dfde3bf7d
Author: lizhimins <[email protected]>
AuthorDate: Sat Oct 10 14:22:04 2026 +0800

    fix(rmqctl): keep numbers unquoted in YAML output (#6056)
---
 rmqctl/internal/output/output_test.go | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/rmqctl/internal/output/output_test.go 
b/rmqctl/internal/output/output_test.go
index 1f27a471b..e6f9b5e13 100644
--- a/rmqctl/internal/output/output_test.go
+++ b/rmqctl/internal/output/output_test.go
@@ -18,10 +18,42 @@ package output
 
 import (
        "bytes"
+       "encoding/json"
        "strings"
        "testing"
 )
 
+func TestYAMLRestoresJSONNumbersTest(t *testing.T) {
+       payload := map[string]any{
+               "items": []any{
+                       map[string]any{
+                               "msgId": "m1",
+                               "size":  json.Number("3"),
+                               "ratio": json.Number("0.25"),
+                               // 2^53+1: exact as an integer, not 
representable as a float64 - the case that
+                               // motivated decoding studio payloads with 
UseNumber() in the first place.
+                               "offset": json.Number("9007199254740993"),
+                       },
+               },
+               "skippedCount": json.Number("5"),
+       }
+       buf := &bytes.Buffer{}
+       if err := YAML(buf, payload); err != nil {
+               t.Fatal(err)
+       }
+       out := buf.String()
+       for _, want := range []string{"size: 3", "ratio: 0.25", "skippedCount: 
5", "offset: 9007199254740993"} {
+               if !strings.Contains(out, want) {
+                       t.Fatalf("YAML output missing %q:\n%s", want, out)
+               }
+       }
+       for _, quoted := range []string{`size: "3"`, `ratio: "0.25"`, 
`skippedCount: "5"`, `offset: "9007199254740993"`} {
+               if strings.Contains(out, quoted) {
+                       t.Fatalf("YAML quoted a number (%s):\n%s", quoted, out)
+               }
+       }
+}
+
 func TestToolCallSummary(t *testing.T) {
        buf := &bytes.Buffer{}
        result := map[string]any{

Reply via email to