feat: add structured JSON output for run, list, and loadt commands#1401
feat: add structured JSON output for run, list, and loadt commands#1401
Conversation
Summary of ChangesHello @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 Highlights
🧠 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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
--formatflag tolistandloadtcommands to enable JSON output - Extended result structures (
RunResult,StepResult, and their simplified versions) with additional fields:desc,labels,index,runner_type,runner_key, anderror - Refactored
step.runnerType()method for cleaner code and addedoperator.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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
BenchmarkManyRunbooks-4
Metadata
BenchmarkOpenAPI3-4
Metadata
BenchmarkSingleRunbook-4
Metadata
Reported by octocov |
There was a problem hiding this comment.
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.
Code Metrics Report
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%)
Reported by octocov |
This pull request introduces enhancements to the output formats and result reporting for both the
listandloadtcommands, 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:
--formatflag to bothlistandloadtcommands, allowing users to output results in JSON format in addition to the existing table or text formats. Thelistcommand outputs a structured array of runbook metadata, and theloadtcommand outputs detailed load test results as JSON. [1] [2] [3] [4] [5] [6] [7]Richer result metadata:
runResultSimplifiedandstepResultSimplifiedstructures to include additional fields such asdesc,labels,index,runner_type,runner_key, anderror, providing more context in JSON outputs and tests. [1] [2] [3] [4] [5] [6]Labels()method to the operator, exposing runbook labels for use in summaries and outputs.Internal refactoring and support:
stepstruct to provide arunnerType()method and ensure thatStepResultincludes runner type and key, which are now set insetResultand used in result reporting. [1] [2]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.