Default wrapped EXPLAIN to hanging indent#635
Conversation
Code Metrics Report📊 View detailed coverage report (available for 7 days)
Details | | main (ddf2ce3) | #635 (ee6fa58) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 71.6% | 71.6% | +0.0% |
| Files | 81 | 81 | 0 |
| Lines | 7338 | 7341 | +3 |
+ | Covered | 5255 | 5259 | +4 |
+ | Code to Test Ratio | 1:1.3 | 1:1.3 | +0.0 |
| Code | 16930 | 16937 | +7 |
+ | Test | 22355 | 22445 | +90 |
+ | Test Execution Time | 1m43s | 56s | -47s |Code coverage of files in pull request scope (70.4% → 70.7%)
Reported by octocov |
There was a problem hiding this comment.
Code Review
This pull request introduces a new system variable, CLI_EXPLAIN_HANGING_INDENT, which enables hanging indents for wrapped lines in query plans. The changes include updating the documentation, registering the variable with a default value of true, and propagating the setting through the plan processing logic. New tests were added to verify the hanging indent behavior. I have no feedback to provide.
There was a problem hiding this comment.
Pull request overview
This PR updates query plan rendering so wrapped EXPLAIN (and query profile plan output) uses hanging-indent formatting by default, while adding a new session-level system variable to opt out and restore the legacy tree-aligned wrapped continuation lines.
Changes:
- Add
CLI_EXPLAIN_HANGING_INDENT(defaultTRUE) to control hanging-indent behavior for wrapped plan lines. - Thread the new option through EXPLAIN/EXPLAIN ANALYZE and query-profile plan rendering (
processPlanNodesnow conditionally appliesplantree.WithHangingIndent()when wrapping is enabled). - Update documentation and add targeted tests to cover both hanging-indent and opt-out rendering paths.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the default hanging-indent behavior and adds the new system variable to the README table. |
| internal/mycli/var_registry.go | Registers CLI_EXPLAIN_HANGING_INDENT in the variable registry. |
| internal/mycli/system_variables.go | Adds DisplayVars.ExplainHangingIndent and sets the default to true. |
| internal/mycli/system_variables_test.go | Extends boolean variable set/get coverage to include the new variable. |
| internal/mycli/statements_query_profile.go | Threads the new option into query profile plan rendering. |
| internal/mycli/statements_explain_describe.go | Threads the new option into EXPLAIN/EXPLAIN ANALYZE processing and applies plantree.WithHangingIndent() for wrapped output. |
| internal/mycli/statements_explain_describe_test.go | Adds tests validating hanging-indent vs legacy wrapped continuation formatting. |
| internal/mycli/main_test.go | Updates default expectations/ignores to account for the new display variable. |
| docs/query_plan.md | Documents CLI_EXPLAIN_HANGING_INDENT and its default/opt-out behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/gemini review |
1 similar comment
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new system variable, CLI_EXPLAIN_HANGING_INDENT, which enables hanging indents for wrapped query plan lines in EXPLAIN, EXPLAIN ANALYZE, and query profile outputs. The changes include updating the system variable registry, modifying the query plan processing logic to support this new display option, and adding comprehensive tests to verify the behavior. Documentation in the README and query plan guide has also been updated to reflect this new configuration option. I have no feedback to provide as there were no review comments to evaluate.
There was a problem hiding this comment.
Code Review
This pull request introduces a new system variable, CLI_EXPLAIN_HANGING_INDENT, which enables hanging indents for wrapped query plan lines in EXPLAIN, EXPLAIN ANALYZE, and query profile outputs. The changes include updating the system variable registry, modifying the plan processing logic to support this formatting option, and adding comprehensive tests to verify the new behavior. Documentation in the README and query plan guide has also been updated to reflect this new feature. I have no feedback to provide.
Summary
CLI_EXPLAIN_HANGING_INDENTas a session-level opt-out for legacy tree-aligned wrapped continuationsFixes #626
Validation
go test ./internal/mycli -run 'Test(ProcessPlanNodesUsesHangingIndentForWrappedPlans|newSystemVariablesWithDefaults|SystemVariables_SetGetOperations)'mise x -- make check