iloveeyjafjalla opened a new pull request, #6726:
URL: https://github.com/apache/rocketmq-dashboard/pull/6726

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6725
   
   ### Brief Description
   
   The default (table) output of a paged listing printed one page and nothing 
else: `rmqctl audit list`
   rendered the server's default 20 rows as if they were the audit log, and 
`--output json` / `--output
   yaml` carry the page envelope, so the default output was the only place the 
information was missing.
   The server also caps `pageSize` at 100, so a longer log can never be shown 
in one page.
   
   - `rmqctl/cmd/catalog_renderers.go` writes one line to stderr when the 
rendered page is shorter than
     the payload's `total`, naming the page it printed and both ways to reach 
the rest. It is the same
     stream and the same style as the truncation warning the message tools 
already emit (the disclosure
     added in #4779 for `resultMayBeTruncated`), so there is one rule: a table 
that is not the whole
     answer says so.
   - The note is generic over the payload — any tool whose output carries 
`page`, `pageSize` and `total`
     gets it (today `rmq.audit.list`, `rmq.acl.list`, `rmq.message.query_dlq`). 
Payloads without the
     envelope and pages that already hold everything stay silent, and the 
message tools do not get a
     second warning because their payload carries no `total`.
   - stdout keeps the rows only and the structured formats are untouched, so 
nothing that consumes the
     default output changes shape.
   
   ### How Did You Test This Change?
   
   Red first, on the current `rocketmq-studio` tip (e2f815fb), with the added 
test in place and only the
   renderer reverted:
   
   ```
   $ cd rmqctl && go test ./cmd/ -run TestPagedTableDisclosureTest
   --- FAIL: TestPagedTableDisclosureTest (1.15s)
       --- FAIL: TestPagedTableDisclosureTest/rmq.audit.list/first_page_of_many 
(0.09s)
           catalog_renderers_test.go:263: stderr = "", want "WARNING: the table 
shows page 1 of 9 (1 of 180 rows); pass --page/--page-size to see the rest, or 
--output json for the full payload.\n"
       --- FAIL: 
TestPagedTableDisclosureTest/rmq.audit.list/last_page_still_short_of_the_total 
(0.08s)
           catalog_renderers_test.go:263: stderr = "", want "WARNING: the table 
shows page 9 of 9 (20 of 180 rows); ..."
       (the same two failures for rmq.acl.list and rmq.message.query_dlq)
   FAIL
   FAIL github.com/apache/rocketmq-dashboard/rmqctl/cmd 3.939s
   ```
   
   Green with the change:
   
   ```
   $ cd rmqctl && go test ./cmd/ -run TestPagedTableDisclosureTest
   --- PASS: TestPagedTableDisclosureTest (1.21s)   (14 subtests: three paged 
tools x four payload
                                                     shapes, plus json and yaml)
   $ go test ./...                                  all packages ok
   $ go vet ./...                                   clean
   $ gofmt -l cmd internal scripts                  clean
   ```
   
   Against a running Studio (this commit's binary, MySQL 8 + a 5.3.2 broker, 
~186 audit rows) with the
   instance credential configured:
   
   | command | before | after |
   | --- | --- | --- |
   | `audit list --page-size 5` | 5 rows, stderr empty | rows on stdout, 
stderr: `WARNING: the table shows page 1 of 37 (5 of 184 rows); pass 
--page/--page-size to see the rest, or --output json for the full payload.` |
   | `audit list --page-size 100` (the server's cap) | 100 rows, silent | 
stderr: `WARNING: the table shows page 1 of 2 (100 of 187 rows); …` |
   | `audit list --page-size 100 --page 2` | 88 rows, silent | stderr: 
`WARNING: the table shows page 2 of 2 (88 of 188 rows); …` |
   | `audit list --page-size 5 --output json` | envelope with `total` | 
unchanged, stderr empty |
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`fix(rmqctl): ...`)
   - [x] Tests added or updated for non-trivial changes — 
`TestPagedTableDisclosureTest` covers the three
         paged tools, a first page, a last page short of the total, a listing 
that fits one page, an
         unpaged payload, and both structured formats
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
— no web text changed
   - [x] Architecture constraints stay green — no Java/backend change, so the 
ArchUnit checks are untouched
   - [x] New source files carry the ASF license header — no new files
   - [x] Documentation touched where behaviour changed — the note explains 
itself at the point of use, and
         the CLI's documented output contract does not claim the table is 
complete
   
   Disclosed rather than left to be discovered on merge, because these open PRs 
touch the same area:
   
   - #5624 (`fix(rmqctl): pad tables to terminal display width`) edits 
`internal/output/output.go`; this
     change stays in `cmd/catalog_renderers.go` and adds no output helper, so 
the two do not overlap.
   - #6395 (`rmqctl table controls still alter row boundaries`) is about what a 
cell contains, not about
     which rows are printed; #6319 / #6318 are about number precision inside 
summaries.
   
   AI assistance: the analysis, the change and the tests were produced with AI 
assistance (an agent
   working in this repository) and reviewed by me before submission; the 
verification output above is
   from the actual runs.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to