feat(explain): syntax highlighting for EXPLAIN output#749
Conversation
REV Review — fix/745-explain-vizAPPROVE Clean implementation, correct logic, no new dependencies. What's good
One gap: plain EXPLAIN queries not highlightedThe highlighting is wired into Minor technical note
No SOC2 items. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #749 +/- ##
==========================================
+ Coverage 69.17% 69.28% +0.11%
==========================================
Files 47 48 +1
Lines 32062 32216 +154
==========================================
+ Hits 22177 22320 +143
- Misses 9885 9896 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review: PR #749 — feat(explain): syntax highlighting for EXPLAIN outputSummarySolid first pass at EXPLAIN highlighting. The structure is clean, the no_color escape hatch is correct, and the unit tests cover the happy paths. Several real bugs need attention before merge. BLOCKINGB1 — Double
|
| Scenario | Covered |
|---|---|
| Seq Scan line | yes |
| Slow time (>=100ms) | yes |
| Fast time (<10ms) | yes |
| Filter: line | yes |
| no_color=true | yes |
| Execution Time bold | yes |
| Line with node type + actual time= | no (crashes, B3) |
| Hash vs Hash Join ambiguity | no |
| Plan ending with newline | no |
Bottom Line
B1 and B3 are the same root bug — ANSI injection in pass 1 corrupts byte offsets used in pass 2. Fix that first; everything else is cleanup. The feature direction is right and the code is readable. Would approve after B1–B3 are resolved.
|
Fixed REV blocking findings:
All tests pass (verified via standalone rustc compilation — full cargo build is too heavy for this env). |
REV Code Review Report
CI Status: ❌ FAILED (view run) BLOCKING ISSUES (1)CRITICAL Two
NON-BLOCKING (2)INFO
LOW
POTENTIAL ISSUES (1)MEDIUM
Summary
Note:
REV-assisted review (AI analysis by postgres-ai/rev) |
REV Code Review — PR #749PR: #749 — feat(explain): syntax highlighting for EXPLAIN output BLOCKING ISSUESNone. NON-BLOCKINGLOW
LOW
POTENTIAL ISSUESMEDIUM
MEDIUM
Summary
Tests are solid: 8 focused unit tests covering the core paths (happy path, slow/fast/moderate timing, filter highlighting, REV-assisted review (AI analysis by postgres-ai/rev) |
|
REV PR #749 — feat(explain): syntax highlighting for EXPLAIN output Summary: New Observations:
Verdict: Clean implementation, good test coverage. No blockers. |
|
REV #749 — feat(explain): syntax highlighting for EXPLAIN outputGood work. This makes EXPLAIN output actually readable at a glance. Implementation is clean. What's good
Concerns
Minor
Verdict: approve. Issues 3 and 4 are worth addressing before this gets heavy usage. |
REV Code Review — PR #749: feat(explain): syntax highlighting for EXPLAIN outputCI: green | Diff scope: Blocking findingsNone. Non-blocking findings[BUG / MEDIUM] Double-reset ANSI code on lines with both a slow node and actual time Pass 1 wraps the node name: [BEHAVIOR / LOW] Pass 3 (Filter/Index Cond/Recheck Cond) wraps the entire already-ANSI-modified When a line is both a slow node and a Filter line (unusual but theoretically possible if the explain output format changes), Pass 3 wraps [STYLE / LOW]
[DOCS / LOW] This is accurate for Pass 1, but Passes 3 and 4 wrap the entire line including indentation with ANSI codes. The doc comment should say "only wraps matching tokens or lines" to be precise. Potential issues (low confidence)[BEHAVIOR] The comment says "return Y" — this is the actual max time. For plans with many loops, SummaryClean, well-structured implementation. The |
|
CI is green and REV review found no blocking findings. This PR is ready for merge — awaiting Nik's approval. |
|
REV PR #749 — feat(explain): syntax highlighting for EXPLAIN output Solid implementation. The multi-pass approach with longest-match-first node list is the right call — that comment in the source about ordering is important and should stay. Observations:
Nothing blocking. The |
Testing evidence —
|
fix(explain): byte-offset panic fix — testing evidenceWhat was fixedRefactored
Also moved Filter/Index Cond/Planning Time whole-line wraps to early returns (they never coexist with node-type spans, so no need to participate in span collection). TestsAll 1819 tests pass (10 in New test cases added
Clippy + fmtCommit
|
|
CI is green (latest run: 2026-03-27T05:58 UTC, after byte-offset panic fix commit 10b0a93). REV review found no blocking findings. Testing evidence posted (includes evidence for the panic fix). This PR is ready for merge — awaiting Nik's approval. |
10b0a93 to
081d8d1
Compare
Closes #745
Adds terminal ANSI color highlighting to EXPLAIN/EXPLAIN ANALYZE output.
Colors applied:
Coloring disabled with --no-highlight or when stdout is not a TTY.
Inspired by Pygments PostgreSQL EXPLAIN lexer token patterns.