Skip to content

Default wrapped EXPLAIN to hanging indent#635

Merged
apstndb merged 4 commits into
mainfrom
feat/explain-hanging-indent
May 30, 2026
Merged

Default wrapped EXPLAIN to hanging indent#635
apstndb merged 4 commits into
mainfrom
feat/explain-hanging-indent

Conversation

@apstndb

@apstndb apstndb commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • enable hanging indent by default for wrapped EXPLAIN and query profile plan rendering
  • add CLI_EXPLAIN_HANGING_INDENT as a session-level opt-out for legacy tree-aligned wrapped continuations
  • document the new wrapped EXPLAIN behavior and cover both hanging-indent and opt-out rendering paths

Fixes #626

Validation

  • go test ./internal/mycli -run 'Test(ProcessPlanNodesUsesHangingIndentForWrappedPlans|newSystemVariablesWithDefaults|SystemVariables_SetGetOperations)'
  • mise x -- make check

Copilot AI review requested due to automatic review settings May 24, 2026 21:21
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown

Code Metrics Report

📊 View detailed coverage report (available for 7 days)

main (ddf2ce3) #635 (ee6fa58) +/-
Coverage 71.6% 71.6% +0.0%
Code to Test Ratio 1:1.3 1:1.3 +0.0
Test Execution Time 1m43s 56s -47s
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%)

Files Coverage +/- Status
internal/mycli/statements_explain_describe.go 61.3% +0.7% modified
internal/mycli/statements_query_profile.go 0.0% 0.0% modified
internal/mycli/system_variables.go 93.9% 0.0% modified
internal/mycli/var_registry.go 86.9% +0.0% modified

Reported by octocov

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

Copy link
Copy Markdown
Contributor

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 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 (default TRUE) to control hanging-indent behavior for wrapped plan lines.
  • Thread the new option through EXPLAIN/EXPLAIN ANALYZE and query-profile plan rendering (processPlanNodes now conditionally applies plantree.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.

Comment thread internal/mycli/statements_query_profile.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread internal/mycli/main_test.go Outdated
Comment thread internal/mycli/var_registry.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread README.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 9 out of 9 changed files in this pull request and generated no new comments.

@apstndb

apstndb commented May 25, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

1 similar comment
@apstndb

apstndb commented May 25, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 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.

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

Copy link
Copy Markdown
Contributor

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 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.

@apstndb apstndb merged commit 0d410f3 into main May 30, 2026
4 checks passed
@apstndb apstndb deleted the feat/explain-hanging-indent branch May 30, 2026 16:47
@apstndb apstndb added the enhancement New feature or request label Jun 12, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose hanging-indent EXPLAIN rendering

2 participants