[GSOC] Add read-only diagnostics and transaction list - #21
Merged
Conversation
Signed-off-by: CAICAIIs <3360776475@qq.com>
There was a problem hiding this comment.
Pull request overview
This PR adds read-only diagnostics and listing/query capabilities for Seata Server, including a terminal TUI, backed by new console API wrappers and consistent table/JSON/YAML rendering.
Changes:
- Add console client wrappers for status, global session, and global lock queries (including formatting helpers for table/JSON/YAML).
- Add new CLI commands for
diagnose run,transaction list/show,lock list/check, plus a Bubble Tea-based TUI. - Harden HTTP/login behavior and REPL argument parsing, and add extensive test coverage for the new features.
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| seata/txn.go | Switch ad-hoc HTTP calls to a shared default HTTP client |
| seata/transaction.go | Add global session query + formatters |
| seata/transaction_test.go | Tests for global session query/formatting |
| seata/status.go | Refactor status fetch into console client + formatter |
| seata/status_test.go | Tests for status query/formatting |
| seata/render.go | Add shared output normalization + JSON/YAML rendering helpers |
| seata/lock.go | Add global lock query/check + formatters |
| seata/lock_test.go | Tests for global lock query/check/formatting |
| seata/http_client.go | Introduce shared default HTTP client with timeout |
| seata/diagnose.go | Add diagnostics snapshot collection + reporting/formatting |
| seata/diagnose_test.go | Tests for diagnostics snapshot/report behavior |
| seata/const.go | Add console endpoint constants for global session/lock APIs |
| seata/console_client.go | Add reusable console HTTP client with error handling |
| seata/config.go | Switch config HTTP calls to shared default HTTP client |
| seata/auth.go | Harden login request building and HTTP status handling |
| seata/auth_test.go | Tests for login JSON encoding and failure cases |
| go.mod | Add Bubble Tea (TUI) and pflag dependency |
| go.sum | Dependency checksum updates for new dependencies |
| docs/tui.md | Document TUI usage and key bindings |
| docs/troubleshooting.md | Document diagnostics usage and common failures |
| cmd/root.go | REPL input now uses a reusable scanner and EOF handling |
| changes/zh-cn/0.0.1.md | Changelog entry for diagnostics features (zh-cn) |
| changes/en-us/0.0.1.md | Changelog entry for diagnostics features (en-us) |
| action/tui/tui.go | Add TUI command implementation |
| action/tui/tui_test.go | Tests for TUI model navigation/refresh behavior |
| action/transaction/transaction.go | Add transaction command group |
| action/transaction/show.go | Add transaction show command |
| action/transaction/show_test.go | Tests for transaction show |
| action/transaction/list.go | Add transaction list command |
| action/transaction/list_test.go | Tests for transaction list |
| action/root.go | Register new commands in the root action command |
| action/lock/lock.go | Add lock command group |
| action/lock/lock_test.go | Tests for lock commands |
| action/lock/list.go | Add lock list command |
| action/lock/check.go | Add lock check command |
| action/diagnose/run.go | Add diagnose run command |
| action/diagnose/run_test.go | Tests for diagnose run |
| action/diagnose/diagnose.go | Add diagnose command group |
| action/common/flags.go | Add helpers to reset local flags after parse/help |
| action/common/args.go | Add scanner-based REPL arg parsing with EOF behavior |
| action/common/args_test.go | Tests for scanner-based REPL arg parsing |
Suppressed comments (2)
seata/txn.go:111
http.NewRequesterrors are ignored here. A malformed URL would leaverequestnil and cause a panic when setting headers. Handle the error to avoid a potential crash.
seata/txn.go:78http.NewRequesterrors are ignored here. If the URL is malformed,requestwill be nil andrequest.Header.Set(...)will panic. Please handle the error and return early.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
42
to
45
| request, _ := http.NewRequest("POST", url, nil) | ||
| request.Header.Set("authorization", token) | ||
| resp, err := (&http.Client{}).Do(request) | ||
| resp, err := defaultHTTPClient.Do(request) | ||
| if err != nil { |
Comment on lines
115
to
119
| request, _ := http.NewRequest("POST", url, nil) | ||
| request.Header.Set("authorization", token) | ||
| request.Header.Set("Content-Type", "application/json") | ||
| resp, err := (&http.Client{}).Do(request) | ||
| resp, err := defaultHTTPClient.Do(request) | ||
| if err != nil { |
Signed-off-by: CAICAIIs <3360776475@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
transaction list,transaction show,lock list,lock check,diagnose run, and the TUIValidation: