Skip to content

feat: add structured JSON output for run, list, and loadt commands#1401

Merged
k1LoW merged 1 commit intomainfrom
json-output
Feb 19, 2026
Merged

feat: add structured JSON output for run, list, and loadt commands#1401
k1LoW merged 1 commit intomainfrom
json-output

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Feb 19, 2026

This pull request introduces enhancements to the output formats and result reporting for both the list and loadt commands, and extends the details included in result summaries for runbooks and steps. The main improvements are the addition of JSON output options, richer result metadata in both code and tests, and internal refactoring to support these features.

Enhancements to output formats:

  • Added a --format flag to both list and loadt commands, allowing users to output results in JSON format in addition to the existing table or text formats. The list command outputs a structured array of runbook metadata, and the loadt command outputs detailed load test results as JSON. [1] [2] [3] [4] [5] [6] [7]

Richer result metadata:

  • Extended the runResultSimplified and stepResultSimplified structures to include additional fields such as desc, labels, index, runner_type, runner_key, and error, providing more context in JSON outputs and tests. [1] [2] [3] [4] [5] [6]
  • Added the Labels() method to the operator, exposing runbook labels for use in summaries and outputs.

Internal refactoring and support:

  • Refactored the step struct to provide a runnerType() method and ensure that StepResult includes runner type and key, which are now set in setResult and used in result reporting. [1] [2]
  • Updated tests and test helpers to account for the new metadata fields, and adjusted comparison options to ignore new fields where appropriate. [1] [2] [3]

These changes improve the usability of the CLI by offering machine-readable outputs and provide more detailed context for both users and automated systems consuming runbook and load test results.

@k1LoW k1LoW requested a review from Copilot February 19, 2026 12:55
@k1LoW k1LoW self-assigned this Feb 19, 2026
@k1LoW k1LoW added enhancement New feature or request tagpr:minor labels Feb 19, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @k1LoW, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the command-line interface by introducing machine-readable JSON output options for the list and loadt commands. It also enriches the detail level of runbook and step results by adding more metadata, which improves the context available for both human users and automated systems consuming these outputs. These changes streamline data processing and integration with other tools.

Highlights

  • Structured JSON Output: Introduced a --format json flag for the list and loadt commands, enabling users to receive output in a structured JSON format. The list command now outputs an array of runbook metadata, and loadt provides detailed load test results as JSON.
  • Enriched Result Metadata: Extended the runResultSimplified and stepResultSimplified structures to include additional fields such as desc, labels, index, runner_type, runner_key, and error, providing more comprehensive context in JSON outputs.
  • Operator Labels Method: Added a Labels() method to the operator, allowing runbook labels to be exposed and utilized in summaries and outputs.
  • Internal Refactoring for Step Results: Refactored the step struct to include a runnerType() method and ensured that StepResult correctly captures runner type and key, which are now set during result reporting.
  • Test Updates: Updated existing tests and golden files to accommodate the new metadata fields and adjusted comparison options to ignore these new fields where appropriate, ensuring test stability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • cmd/list.go
    • Added encoding/json and fmt imports.
    • Introduced listResultEntry struct for JSON serialization of list command output.
    • Implemented logic to output runbook metadata as JSON when the --format json flag is used.
    • Added --format flag to the listCmd.
  • cmd/loadt.go
    • Retrieved and handled the --format flag for the loadt command.
    • Modified loadtCmd to call lr.ReportJSON when the format is json.
    • Added --format flag to the loadtCmd.
  • kv_test.go
    • Updated cmpopts.IgnoreFields for runResultSimplified to ignore Desc and Labels.
    • Updated cmpopts.IgnoreFields for stepResultSimplified to ignore Index, Desc, RunnerType, RunnerKey, and Error.
  • loadt.go
    • Added encoding/json import.
    • Defined loadtResultJSON struct for structured JSON output of load test results.
    • Implemented ReportJSON method to serialize load test results into JSON format.
  • operator.go
    • Added a new Labels() method to the operator struct to return runbook labels.
  • operator_test.go
    • Updated cmpopts.IgnoreFields in TestRunN to ignore Desc and Labels for runResultSimplified and Index, Desc, RunnerType, RunnerKey, Error for stepResultSimplified.
    • Updated cmpopts.IgnoreFields in TestNeeds to ignore Desc and Labels for runResultSimplified and Index, Desc, RunnerType, RunnerKey, Error for stepResultSimplified.
  • result.go
    • Added RunnerType and RunnerKey fields to the StepResult struct.
    • Added Desc field to the runResultSimplified struct.
    • Added Index, Desc, RunnerType, RunnerKey, and Error fields to the stepResultSimplified struct.
    • Refactored simplifyRunResult to populate Desc and Labels from RunResult.
    • Refactored simplifyStepResults to populate Index, Desc, RunnerType, RunnerKey, and Error from StepResult.
  • step.go
    • Extracted runner type determination into a new runnerType() method.
    • Updated generateTrail() to use the new runnerType() method.
    • Modified setResult() to include RunnerType and RunnerKey when creating StepResult objects.
  • testdata/result_out_json_0.golden
    • Updated golden file to include desc for runbooks and index, desc, runner_type, runner_key, and error for steps in JSON output.
  • testdata/result_out_json_1.golden
    • Updated golden file to include desc for runbooks and index, desc, runner_type, runner_key, and error for steps in JSON output.
  • testdata/result_out_json_2.golden
    • Updated golden file to include index, runner_type, runner_key, and error for steps in JSON output.
  • testdata/result_out_json_3.golden
    • Updated golden file to include index, runner_type, runner_key, and error for steps in JSON output, including nested results.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable feature by adding structured JSON output for the list and loadt commands. The implementation is solid, with good refactoring to support the new functionality and enrichment of the result data structures. The tests have also been updated accordingly. I have one minor suggestion to improve code consistency.

@github-actions

This comment has been minimized.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request enhances output formats by adding JSON support to the list and loadt commands, and enriches result metadata throughout the codebase. The changes provide machine-readable structured output and more detailed context for both users and automated systems consuming runbook and load test results.

Changes:

  • Added --format flag to list and loadt commands to enable JSON output
  • Extended result structures (RunResult, StepResult, and their simplified versions) with additional fields: desc, labels, index, runner_type, runner_key, and error
  • Refactored step.runnerType() method for cleaner code and added operator.Labels() method to expose runbook labels

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
step.go Refactored runner type detection into dedicated runnerType() method and updated setResult() to populate new fields
result.go Extended simplified result structures with new fields and refactored simplification logic for better maintainability
operator.go Added Labels() method to expose runbook labels
loadt.go Added loadtResultJSON struct and ReportJSON() method for JSON output
cmd/list.go Added JSON output format support with structured runbook metadata
cmd/loadt.go Added format flag handling to output load test results as JSON
result_test.go Updated test data to include new fields in result structures
operator_test.go Updated test comparison options to ignore new fields
kv_test.go Updated test comparison options to ignore new fields
testdata/*.golden Updated golden files to reflect new JSON fields in output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

BenchmarkManyRunbooks-4

main (-) #1401 (f4ba809) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 3,750,804,382 ns/op 3,632,710,427 ns/op -118,093,955 ns/op
Bytes allocated per iteration 1,381,680,536 B/op 1,382,340,520 B/op 659,984 B/op
Allocs per iteration 19,288,931 allocs/op 19,289,818 allocs/op 887 allocs/op
Metadata
main (-) #1401 (f4ba809)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkOpenAPI3-4

main (-) #1401 (f4ba809) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 1,557,380,343 ns/op 1,602,170,739 ns/op 44,790,396 ns/op
Bytes allocated per iteration 818,913,552 B/op 818,538,480 B/op -375,072 B/op
Allocs per iteration 11,609,076 allocs/op 11,608,520 allocs/op -556 allocs/op
Metadata
main (-) #1401 (f4ba809)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkSingleRunbook-4

main (-) #1401 (f4ba809) +/-
Number of iterations 22 22 0
Nanoseconds per iteration 47,198,555 ns/op 46,535,054 ns/op -663,501 ns/op
Bytes allocated per iteration 23,016,641 B/op 23,055,694 B/op 39,053 B/op
Allocs per iteration 186,808 allocs/op 186,824 allocs/op 16 allocs/op
Metadata
main (-) #1401 (f4ba809)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

Reported by octocov

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

Code Metrics Report

main (788c87e) #1401 (f4ba809) +/-
Coverage 60.3% 60.1% -0.2%
Code to Test Ratio 1:0.8 1:0.8 -0.1
Test Execution Time 8m10s 8m28s +18s
Details
  |                     | main (788c87e) | #1401 (f4ba809) |  +/-  |
  |---------------------|----------------|-----------------|-------|
- | Coverage            |          60.3% |           60.1% | -0.2% |
  |   Files             |             81 |              81 |     0 |
  |   Lines             |           9246 |            9280 |   +34 |
+ |   Covered           |           5578 |            5585 |    +7 |
- | Code to Test Ratio  |          1:0.8 |           1:0.8 |  -0.1 |
  |   Code              |          17298 |           17396 |   +98 |
+ |   Test              |          14453 |           14457 |    +4 |
- | Test Execution Time |          8m10s |           8m28s |  +18s |

Code coverage of files in pull request scope (70.2% → 69.2%)

Files Coverage +/- Status
cmd/list.go 0.0% 0.0% modified
cmd/loadt.go 0.0% 0.0% modified
internal/expr/expr.go 65.9% +0.7% affected
loadt.go 19.2% -3.0% modified
operator.go 80.4% -0.1% modified
result.go 71.7% +1.5% modified
step.go 91.4% +0.1% modified
trail.go 85.0% 0.0% modified

Reported by octocov

@k1LoW k1LoW merged commit 7c86a2e into main Feb 19, 2026
15 checks passed
@k1LoW k1LoW deleted the json-output branch February 19, 2026 13:19
@github-actions github-actions bot mentioned this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tagpr:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants