Skip to content

feat(panel): highlight SQL in the Log and Profiling grids by detecting the statement shape, not only the DB command category. - #65

Merged
terabytesoftw merged 1 commit into
mainfrom
feat/highlight-sql-log-profiling
Sep 19, 2026
Merged

terabytesoftw merged 1 commit into
mainfrom
feat/highlight-sql-log-profiling

Conversation

@terabytesoftw

Copy link
Copy Markdown
Contributor

Pull Request

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bugfix (non-breaking change that fixes an issue)
  • CI/build configuration
  • Documentation update
  • New feature (non-breaking change that adds functionality)
  • Refactoring (no functional changes)

…g the statement shape, not only the DB command category.
@terabytesoftw terabytesoftw added the enhancement New feature or request label Sep 19, 2026
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (182f03b) to head (523119d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #65   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity      2355      2358    +3     
===========================================
  Files            165       165           
  Lines           8737      8742    +5     
===========================================
+ Hits            8737      8742    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c035f147-3971-4f43-a7da-3b3df808eda1

📥 Commits

Reviewing files that changed from the base of the PR and between 182f03b and 523119d.

📒 Files selected for processing (38)
  • src/Panel/Asset/AssetBundleRow.php
  • src/Panel/Asset/AssetSnapshot.php
  • src/Panel/Asset/ViteChunk.php
  • src/Panel/Asset/ViteManifest.php
  • src/Panel/Db/DbSnapshot.php
  • src/Panel/Db/NPlusOneFinding.php
  • src/Panel/Db/QueryRow.php
  • src/Panel/Db/SqlHighlighter.php
  • src/Panel/Dump/DumpRow.php
  • src/Panel/Dump/DumpSnapshot.php
  • src/Panel/Event/EventCapture.php
  • src/Panel/Event/EventInspection.php
  • src/Panel/Event/EventRow.php
  • src/Panel/Event/EventSequence.php
  • src/Panel/Event/EventSnapshot.php
  • src/Panel/Log/LogCellRenderer.php
  • src/Panel/Log/LogRow.php
  • src/Panel/Log/LogSnapshot.php
  • src/Panel/PanelRenderer.php
  • src/Panel/Profile/ProfileCellRenderer.php
  • src/Panel/Profile/ProfileRow.php
  • src/Panel/Profile/ProfilingSnapshot.php
  • src/Panel/Queue/JobRecord.php
  • src/Panel/Queue/QueueSnapshot.php
  • src/Panel/Request/RequestDiagnosticValueRenderer.php
  • src/Panel/Request/RequestSnapshot.php
  • src/Panel/Request/Routing/CurrentRouteView.php
  • src/Panel/Request/Routing/RouteInventoryView.php
  • src/Panel/Router/CurrentRouteLogRow.php
  • src/Panel/Router/RouterSnapshot.php
  • src/Panel/Timeline/TimelineMemoryRenderer.php
  • src/Panel/Timeline/TimelineRenderer.php
  • src/Panel/Timeline/TimelineSnapshot.php
  • src/Panel/User/UserSnapshot.php
  • tests/Panel/Db/SqlHighlighterTest.php
  • tests/Panel/Log/LogCellRendererTest.php
  • tests/Panel/Profile/ProfileCellRendererTest.php
  • tests/Provider/SqlHighlighterProvider.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: Verify Vite build reproduces dist.
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
  • GitHub Check: Verify Vite build reproduces dist.
🧰 Additional context used
🪛 PHPMD (2.15.0)
tests/Panel/Log/LogCellRendererTest.php

[error] Avoid using static access to class '\PHPForge\Debug\Panel\Log\LogCellRenderer' in method 'testBuildRowOptionsMapsWarningAndInfoToTheirVariantClasses'. (undefined)

(StaticAccess)


[warning] 20-432: The class LogCellRendererTest has 21 public methods. Consider refactoring LogCellRendererTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 221-224: Avoid using static access to class '\PHPForge\Debug\Panel\Log\LogCellRenderer' in method 'testRenderMessageCellHighlightsSqlWhenTheMessageIsAStatement'. (undefined)

(StaticAccess)

tests/Panel/Db/SqlHighlighterTest.php

[warning] 20-178: The class SqlHighlighterTest has 16 public methods. Consider refactoring SqlHighlighterTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 170-170: Avoid using static access to class '\PHPForge\Debug\Panel\Db\SqlHighlighter' in method 'testIsStatementAcceptsRawSql'. (undefined)

(StaticAccess)


[error] 176-176: Avoid using static access to class '\PHPForge\Debug\Panel\Db\SqlHighlighter' in method 'testIsStatementRejectsProseBorrowingSqlVerbs'. (undefined)

(StaticAccess)

tests/Panel/Profile/ProfileCellRendererTest.php

[warning] 21-314: The class ProfileCellRendererTest has 18 public methods. Consider refactoring ProfileCellRendererTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 189-194: Avoid using static access to class '\PHPForge\Debug\Panel\Profile\ProfileCellRenderer' in method 'testRenderInfoCellHighlightsSqlWhenTheInfoIsAStatement'. (undefined)

(StaticAccess)

src/Panel/Log/LogCellRenderer.php

[error] 25-190: The class LogCellRenderer has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)


[error] 95-95: Avoid using static access to class '\PHPForge\Debug\Panel\Db\SqlHighlighter' in method 'renderMessageCell'. (undefined)

(StaticAccess)

src/Panel/Profile/ProfileCellRenderer.php

[error] 71-71: Avoid using static access to class '\PHPForge\Debug\Panel\Db\SqlHighlighter' in method 'renderInfoCell'. (undefined)

(StaticAccess)

src/Panel/Timeline/TimelineRenderer.php

[error] 25-367: The class TimelineRenderer has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

src/Panel/PanelRenderer.php

[warning] 64-773: The class PanelRenderer has an overall complexity of 58 which is very high. The configured complexity threshold is 50. (undefined)

(ExcessiveClassComplexity)


[error] 64-773: The class PanelRenderer has a coupling between objects value of 62. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

🔇 Additional comments (38)
src/Panel/Db/SqlHighlighter.php (1)

10-10: LGTM!

Also applies to: 16-16, 33-48, 102-115

src/Panel/Log/LogCellRenderer.php (1)

85-87: LGTM!

Also applies to: 94-97

src/Panel/Profile/ProfileCellRenderer.php (1)

58-60: LGTM!

Also applies to: 71-71, 94-100

tests/Panel/Db/SqlHighlighterTest.php (1)

8-9: LGTM!

Also applies to: 13-16, 167-177

tests/Panel/Log/LogCellRendererTest.php (1)

219-236: LGTM!

tests/Panel/Profile/ProfileCellRendererTest.php (1)

181-198: LGTM!

tests/Provider/SqlHighlighterProvider.php (1)

1-57: LGTM!

src/Panel/Asset/AssetBundleRow.php (1)

50-57: LGTM!

Also applies to: 103-104

src/Panel/Asset/AssetSnapshot.php (1)

19-25: LGTM!

Also applies to: 28-29, 37-44, 67-68

src/Panel/Asset/ViteChunk.php (1)

37-44: LGTM!

Also applies to: 68-69

src/Panel/Asset/ViteManifest.php (1)

20-35: LGTM!

Also applies to: 39-46, 76-77

src/Panel/Db/DbSnapshot.php (1)

42-43: LGTM!

Also applies to: 51-58, 69-70

src/Panel/Db/NPlusOneFinding.php (1)

18-18: LGTM!

Also applies to: 29-33

src/Panel/Db/QueryRow.php (1)

129-136: LGTM!

src/Panel/Dump/DumpRow.php (1)

39-46: LGTM!

Also applies to: 86-87

src/Panel/Dump/DumpSnapshot.php (1)

40-40: LGTM!

Also applies to: 49-56, 67-68

src/Panel/Log/LogRow.php (1)

63-70: LGTM!

Also applies to: 139-140

src/Panel/Log/LogSnapshot.php (1)

67-68: LGTM!

Also applies to: 76-83, 94-95

src/Panel/Profile/ProfileRow.php (1)

57-64: LGTM!

Also applies to: 117-118

src/Panel/Profile/ProfilingSnapshot.php (1)

30-36: LGTM!

Also applies to: 132-133, 141-148, 184-185, 202-203

src/Panel/Queue/JobRecord.php (1)

117-126: LGTM!

Also applies to: 207-208

src/Panel/Queue/QueueSnapshot.php (1)

41-41: LGTM!

Also applies to: 50-57, 68-69

src/Panel/Router/CurrentRouteLogRow.php (1)

34-41: LGTM!

Also applies to: 75-76

src/Panel/Router/RouterSnapshot.php (1)

22-32: LGTM!

Also applies to: 78-79, 87-94, 136-137

src/Panel/User/UserSnapshot.php (1)

17-18: LGTM!

Also applies to: 26-30

src/Panel/Event/EventRow.php (1)

51-52: LGTM!

Also applies to: 67-74, 102-115, 133-134, 151-154

src/Panel/Event/EventCapture.php (1)

26-30: LGTM!

Also applies to: 48-54, 81-87

src/Panel/Event/EventInspection.php (1)

19-21: LGTM!

Also applies to: 25-26, 31-33, 36-38, 41-43, 46-48, 52-53, 58-60, 63-72, 140-144, 151-153, 160-164, 170-174, 180-184, 190-194, 201-203, 210-214, 220-224, 244-245, 263-264, 282-283

src/Panel/Event/EventSequence.php (1)

25-26: LGTM!

Also applies to: 47-53, 59-65, 75-81, 89-92

src/Panel/Event/EventSnapshot.php (1)

17-19: LGTM!

Also applies to: 24-25, 33-40, 51-53

src/Panel/PanelRenderer.php (1)

7-7: LGTM!

Also applies to: 587-595

src/Panel/Request/RequestDiagnosticValueRenderer.php (1)

29-32: LGTM!

Also applies to: 41-44, 78-81, 92-97, 115-121

src/Panel/Request/RequestSnapshot.php (1)

16-31: LGTM!

Also applies to: 45-63, 84-86

src/Panel/Request/Routing/CurrentRouteView.php (1)

12-14: LGTM!

Also applies to: 17-19, 22-24, 27-29, 33-34, 40-41, 46-48, 53-59, 65-69, 75-79, 85-89, 95-99, 106-108, 115-119, 126-128, 135-141, 150-156, 165-171, 180-186, 196-200, 211-215

src/Panel/Request/Routing/RouteInventoryView.php (1)

31-33: LGTM!

Also applies to: 39-44, 51-53, 60-64, 71-74, 80-84, 90-94, 101-105, 115-121, 130-136, 145-151

src/Panel/Timeline/TimelineMemoryRenderer.php (1)

35-41: LGTM!

Also applies to: 91-95, 116-122, 131-137, 149-155, 168-169

src/Panel/Timeline/TimelineRenderer.php (1)

32-36: LGTM!

Also applies to: 66-70, 102-107, 162-167, 199-205, 215-221, 234-238, 254-262, 283-289, 330-334, 350-356

src/Panel/Timeline/TimelineSnapshot.php (1)

15-15: LGTM!

Also applies to: 23-30, 39-41


📝 Summary

Summary by CodeRabbit

  • New Features

    • SQL statements are now automatically recognized in log and profiling panels, even when they do not use a database-specific category.
    • Recognized SQL is displayed with syntax highlighting for improved readability.
  • Documentation

    • Expanded internal documentation across panel data, request, routing, timeline, event, queue, and user components to clarify behavior and data handling.

Walkthrough

The pull request adds SQL statement detection for log and profiling panel rendering. It also expands PHPDoc across panel models, snapshots, renderers, routing views, request diagnostics, events, and timeline APIs. Tests cover SQL classification and highlighted rendering.

Changes

SQL detection and rendering

Layer / File(s) Summary
Statement detection and renderer integration
src/Panel/Db/SqlHighlighter.php, src/Panel/Log/LogCellRenderer.php, src/Panel/Profile/ProfileCellRenderer.php
Adds SqlHighlighter::isStatement() and uses it to highlight raw SQL in log and profiling content.
SQL classification and rendering tests
tests/Panel/Db/SqlHighlighterTest.php, tests/Panel/Log/LogCellRendererTest.php, tests/Panel/Profile/ProfileCellRendererTest.php, tests/Provider/SqlHighlighterProvider.php
Adds statement and non-statement cases and verifies highlighted output outside DB-specific categories.

Panel data documentation

Layer / File(s) Summary
Panel models and snapshots
src/Panel/Asset/*, src/Panel/Db/*, src/Panel/Dump/*, src/Panel/Log/*, src/Panel/Profile/*, src/Panel/Queue/*, src/Panel/Router/*, src/Panel/User/*
Adds PHPDoc for existing constructors, hydration methods, accessors, serialization methods, and captured data shapes.

Supporting API documentation

Layer / File(s) Summary
Events, requests, routing, and rendering APIs
src/Panel/Event/*, src/Panel/Request/*, src/Panel/PanelRenderer.php, src/Panel/Timeline/*
Adds PHPDoc for existing event sanitization, request handling, routing views, preview behavior, and timeline rendering methods.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant LogCellRenderer
  participant ProfileCellRenderer
  participant SqlHighlighter
  LogCellRenderer->>SqlHighlighter: classify log message
  ProfileCellRenderer->>SqlHighlighter: classify profile info
  SqlHighlighter-->>LogCellRenderer: return SQL statement result
  SqlHighlighter-->>ProfileCellRenderer: return SQL statement result
  LogCellRenderer->>SqlHighlighter: highlight recognized SQL
  ProfileCellRenderer->>SqlHighlighter: highlight recognized SQL
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main feature: SQL highlighting in Log and Profiling grids based on statement-shape detection.
Description check ✅ Passed The description identifies the change as a non-breaking new feature, which matches the SQL highlighting functionality in the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 90.75% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 173 functions across 38 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads the comments bright
And spots SQL in plain sight
Rows gain docs, panels glow
Tests confirm the paths they show
The burrow ships a clearer flow

Comment @coderabbitai help to get the list of available commands.

@terabytesoftw
terabytesoftw merged commit 7727964 into main Sep 19, 2026
43 checks passed
@terabytesoftw
terabytesoftw deleted the feat/highlight-sql-log-profiling branch September 19, 2026 20:15
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.

1 participant