Skip to content

[GSOC] Add read-only diagnostics and transaction list - #21

Merged
thunguo merged 2 commits into
apache:mainfrom
CAICAIIs:codex/seata-ctl-diagnostics
Aug 24, 2026
Merged

[GSOC] Add read-only diagnostics and transaction list#21
thunguo merged 2 commits into
apache:mainfrom
CAICAIIs:codex/seata-ctl-diagnostics

Conversation

@CAICAIIs

Copy link
Copy Markdown
Contributor

Summary:

  • add REPL-only read-only diagnostics: transaction list, transaction show, lock list, lock check, diagnose run, and the TUI
  • add Seata console client wrappers for global session and global lock queries with table/json/yaml output
  • harden login/HTTP handling, REPL argument parsing, and diagnostic/TUI refresh behavior

Validation:

  • go test ./...
  • go vet ./...
  • go build -v ./...
  • git diff --check
  • REPL smoke: login -> transaction list --output json -> lock list --output json -> quit

Signed-off-by: CAICAIIs <3360776475@qq.com>
thunguo
thunguo previously approved these changes Aug 24, 2026

@thunguo thunguo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.NewRequest errors are ignored here. A malformed URL would leave request nil and cause a panic when setting headers. Handle the error to avoid a potential crash.
    seata/txn.go:78
  • http.NewRequest errors are ignored here. If the URL is malformed, request will be nil and request.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 thread seata/txn.go
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 thread seata/config.go
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>

@thunguo thunguo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@thunguo
thunguo merged commit 6cfe865 into apache:main Aug 24, 2026
4 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.

3 participants