Skip to content

refactor: centralize exception messages and panel titles in typed enums while preserving diagnostics, labels, and configurable names. - #40

Merged
terabytesoftw merged 1 commit into
mainfrom
refactor/centralize-exception-message-and-add-pane;-titles
Sep 7, 2026
Merged

refactor: centralize exception messages and panel titles in typed enums while preserving diagnostics, labels, and configurable names.#40
terabytesoftw merged 1 commit into
mainfrom
refactor/centralize-exception-message-and-add-pane;-titles

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)

…ms while preserving diagnostics, labels, and configurable names.
@terabytesoftw terabytesoftw added the bug Something isn't working label Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (41f5334) to head (59b2e7e).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #40   +/-   ##
=========================================
  Coverage     99.95%   99.95%           
- Complexity     2176     2177    +1     
=========================================
  Files           162      163    +1     
  Lines          8664     8677   +13     
=========================================
+ Hits           8660     8673   +13     
  Misses            4        4           

☔ 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 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 4555f098-4cbf-47d2-b94e-e27cff181d0f

📥 Commits

Reviewing files that changed from the base of the PR and between 41f5334 and 59b2e7e.

📒 Files selected for processing (24)
  • CHANGELOG.md
  • src/Capture/CapturePolicy.php
  • src/Collector/CollectorCoordinator.php
  • src/Exception/Message.php
  • src/Helper/SensitiveDataRedactor.php
  • src/Helper/Tabs.php
  • src/Panel/Asset/AssetSectionRenderer.php
  • src/Panel/Db/DbExplainRenderer.php
  • src/Panel/Db/NPlusOneDetector.php
  • src/Panel/PanelTitle.php
  • src/Panel/Request/RequestHero.php
  • src/Panel/Request/Routing/CurrentRouteView.php
  • src/Panel/Request/Routing/RouteDefinition.php
  • src/Panel/Request/Routing/RouteInventoryView.php
  • src/Panel/Vite/ViteSectionRenderer.php
  • src/Storage/HydrationException.php
  • src/Storage/SnapshotStore.php
  • src/View/Sidebar/SidebarView.php
  • tests/Panel/Event/EventInspectionTest.php
  • tests/Panel/Event/EventRowTest.php
  • tests/Panel/Request/RequestHeroTest.php
  • tests/Panel/Request/RequestRoutingViewModelsTest.php
  • tests/Panel/Request/RouteDefinitionTest.php
  • tests/Toolbar/ToolbarDataTest.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. (3)
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
  • GitHub Check: Verify Vite build reproduces dist.
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
⚠️ CI failures not shown inline (2)

GitHub Actions: ecs / 0_easy-coding-standard _ PHP 8.5-ubuntu-latest.txt: refactor: centralize exception messages and panel titles in typed enums while preserving diagnostics, labels, and configurable names.

Conclusion: failure

View job details

##[group]Run bash -euo pipefail -c "$ECS_COMMAND"
 �[36;1mbash -euo pipefail -c "$ECS_COMMAND"�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   COMPOSER_PROCESS_TIMEOUT: 0
   COMPOSER_NO_INTERACTION: 1
   COMPOSER_NO_AUDIT: 1
   ECS_COMMAND: vendor/bin/ecs check --ansi
 ##[endgroup]
  [ERROR] Unknown named parameter $perCS30
 `#0` /home/runner/work/debug-core/debug-core/vendor/php-forge/coding-standard/src/ecs-83.php(23): require()
 `#1` /home/runner/work/debug-core/debug-core/ecs.php(6): require('...')
 `#2` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/src/DependencyInjection/ServiceContainerFactory.php(56): require('...')
 `#3` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/src/DependencyInjection/EasyCodingStandardContainerFactory.php(28): Symplify\EasyCodingStandard\DependencyInjection\ServiceContainerFactory->create()
 `#4` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/bin/ecs.php(138): Symplify\EasyCodingStandard\DependencyInjection\EasyCodingStandardContainerFactory->createFromArgv()
 `#5` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/bin/ecs(5): require('...')
 `#6` /home/runner/work/debug-core/debug-core/vendor/bin/ecs(119): include('...')
 `#7` {main}
 ##[error]Process completed with exit code 1.

GitHub Actions: ecs / easy-coding-standard _ PHP 8.5-ubuntu-latest: refactor: centralize exception messages and panel titles in typed enums while preserving diagnostics, labels, and configurable names.

Conclusion: failure

View job details

##[group]Run bash -euo pipefail -c "$ECS_COMMAND"
 �[36;1mbash -euo pipefail -c "$ECS_COMMAND"�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   COMPOSER_PROCESS_TIMEOUT: 0
   COMPOSER_NO_INTERACTION: 1
   COMPOSER_NO_AUDIT: 1
   ECS_COMMAND: vendor/bin/ecs check --ansi
 ##[endgroup]
  [ERROR] Unknown named parameter $perCS30
 `#0` /home/runner/work/debug-core/debug-core/vendor/php-forge/coding-standard/src/ecs-83.php(23): require()
 `#1` /home/runner/work/debug-core/debug-core/ecs.php(6): require('...')
 `#2` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/src/DependencyInjection/ServiceContainerFactory.php(56): require('...')
 `#3` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/src/DependencyInjection/EasyCodingStandardContainerFactory.php(28): Symplify\EasyCodingStandard\DependencyInjection\ServiceContainerFactory->create()
 `#4` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/bin/ecs.php(138): Symplify\EasyCodingStandard\DependencyInjection\EasyCodingStandardContainerFactory->createFromArgv()
 `#5` /home/runner/work/debug-core/debug-core/vendor/symplify/easy-coding-standard/bin/ecs(5): require('...')
 `#6` /home/runner/work/debug-core/debug-core/vendor/bin/ecs(119): include('...')
 `#7` {main}
 ##[error]Process completed with exit code 1.
🧰 Additional context used
🪛 ast-grep (0.45.2)
src/Storage/SnapshotStore.php

[info] 406-406: Avoid unsafe call to unlink
Context: unlink($temporary)
Note: [CWE-73] External Control of File Name or Path.

(avoid-unlink)

🪛 PHPMD (2.15.0)
src/Panel/Request/RequestHero.php

[warning] 87-87: Avoid variables with short names like $ip. Configured minimum length is 3. (undefined)

(ShortVariable)

tests/Panel/Event/EventInspectionTest.php

[warning] 20-620: The class EventInspectionTest has 14 public methods. Consider refactoring EventInspectionTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


[error] 337-337: Avoid using static access to class '\PHPForge\Debug\Panel\Event\EventInspection' in method 'testFluentMethodsReplaceOnlyTheirOwnGroup'. (undefined)

(StaticAccess)

src/Helper/SensitiveDataRedactor.php

[error] 243-252: Remove error control operator '@' on line 246. (undefined)

(ErrorControlOperator)

src/Storage/HydrationException.php

[warning] 23-28: Avoid using short method names like HydrationException::at(). The configured minimum method name length is 3. (undefined)

(ShortMethodName)

src/Panel/Db/DbExplainRenderer.php

[error] 21-114: The class DbExplainRenderer has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)


[warning] 45-113: The method renderPlan() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)

src/Panel/Vite/ViteSectionRenderer.php

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

(CouplingBetweenObjects)

src/Storage/SnapshotStore.php

[warning] 31-776: The class SnapshotStore has an overall complexity of 110 which is very high. The configured complexity threshold is 50. (undefined)

(ExcessiveClassComplexity)


[error] 58-84: Remove error control operator '@' on line 74. (undefined)

(ErrorControlOperator)


[error] 101-158: Remove error control operator '@' on line 128. (undefined)

(ErrorControlOperator)


[error] 179-251: Remove error control operator '@' on line 215. (undefined)

(ErrorControlOperator)


[warning] 179-251: The method readSnapshotResult() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)


[warning] 179-251: The method readSnapshotResult() has an NPath complexity of 228. The configured NPath complexity threshold is 200. (undefined)

(NPathComplexity)


[error] 229-229: Avoid using static access to class 'PHPForge\Debug\Storage\DebugSnapshot' in method 'readSnapshotResult'. (undefined)

(StaticAccess)


[error] 353-374: Remove error control operator '@' on line 357. (undefined)

(ErrorControlOperator)


[error] 353-374: Remove error control operator '@' on line 365. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 398. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 407. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 415. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 416. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 424. (undefined)

(ErrorControlOperator)


[error] 396-431: Remove error control operator '@' on line 425. (undefined)

(ErrorControlOperator)


[error] 505-524: Remove error control operator '@' on line 510. (undefined)

(ErrorControlOperator)


[error] 505-524: Remove error control operator '@' on line 519. (undefined)

(ErrorControlOperator)


[error] 552-567: Remove error control operator '@' on line 558. (undefined)

(ErrorControlOperator)


[error] 574-599: Remove error control operator '@' on line 582. (undefined)

(ErrorControlOperator)


[error] 655-715: Remove error control operator '@' on line 658. (undefined)

(ErrorControlOperator)


[error] 655-715: Remove error control operator '@' on line 689. (undefined)

(ErrorControlOperator)


[error] 655-715: Remove error control operator '@' on line 714. (undefined)

(ErrorControlOperator)


[warning] 655-715: The method recoverTransaction() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)


[warning] 655-715: The method recoverTransaction() has an NPath complexity of 1344. The configured NPath complexity threshold is 200. (undefined)

(NPathComplexity)


[error] 742-749: Remove error control operator '@' on line 744. (undefined)

(ErrorControlOperator)

🔇 Additional comments (22)
src/Exception/Message.php (1)

7-7: LGTM!

Also applies to: 14-235

src/Helper/SensitiveDataRedactor.php (1)

8-8: LGTM!

Also applies to: 207-209, 248-248

src/Helper/Tabs.php (1)

8-8: LGTM!

Also applies to: 30-30

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

8-8: LGTM!

Also applies to: 27-29

src/Storage/HydrationException.php (1)

7-7: LGTM!

Also applies to: 26-26

CHANGELOG.md (1)

45-45: LGTM!

src/Panel/PanelTitle.php (1)

10-130: LGTM!

tests/Panel/Request/RequestHeroTest.php (1)

77-77: LGTM!

Also applies to: 80-80

tests/Toolbar/ToolbarDataTest.php (1)

292-292: LGTM!

Also applies to: 296-296, 320-320

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

53-53: 🎯 Functional Correctness

No change is required for these content() calls.

UIAwesome html-mixin 0.8.1 accepts UnitEnum values in HasContent::content(). The PanelTitle cases are UnitEnum values, and the implementation normalizes them before encoding.

src/Capture/CapturePolicy.php (1)

8-8: LGTM!

Also applies to: 54-54

src/Collector/CollectorCoordinator.php (1)

8-8: LGTM!

Also applies to: 41-43, 47-48

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

8-8: LGTM!

Also applies to: 204-205, 207-207, 215-216, 218-218, 226-227, 229-229, 237-238, 240-240, 245-246, 248-248, 253-254, 256-256, 261-262, 264-264, 269-270, 272-272, 289-289

src/Storage/SnapshotStore.php (1)

8-8: LGTM!

Also applies to: 76-76, 105-107, 132-132, 138-138, 149-149, 182-187, 193-193, 219-219, 225-225, 233-233, 242-242, 361-361, 369-369, 385-385, 402-402, 410-410, 419-419, 428-428, 515-515, 521-521, 562-562, 586-586, 668-668, 685-685, 695-697, 746-746, 762-762

src/View/Sidebar/SidebarView.php (1)

8-8: LGTM!

Also applies to: 38-38

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

81-82: LGTM!

Also applies to: 84-84, 89-90, 92-92, 97-99, 101-101, 106-108, 110-110

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

82-83: LGTM!

Also applies to: 85-85, 90-91, 93-93, 98-99, 101-101, 106-107, 109-109, 117-118, 120-120, 128-129, 131-131

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

72-73: LGTM!

Also applies to: 75-75, 80-81, 83-83, 88-89, 91-91, 96-97, 99-99

tests/Panel/Event/EventInspectionTest.php (1)

318-318: LGTM!

Also applies to: 322-322, 332-332, 336-337

tests/Panel/Event/EventRowTest.php (1)

110-110: LGTM!

Also applies to: 114-114, 128-128, 133-133

tests/Panel/Request/RequestRoutingViewModelsTest.php (1)

164-164: LGTM!

Also applies to: 167-167, 275-275, 278-278

tests/Panel/Request/RouteDefinitionTest.php (1)

76-76: LGTM!

Also applies to: 79-79


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added shared, typed definitions for validation messages and built-in panel titles.
    • Standardized panel and page headings across the debug interface.
  • Bug Fixes

    • Preserved existing validation and diagnostic behavior while ensuring consistent error-message formatting.
  • Refactor

    • Centralized exception messages and panel labels for easier consistency and maintenance.
    • Clarified internal immutable-copy handling without changing application behavior.

Walkthrough

The refactor adds typed enums for exception messages and panel titles. Existing validation, storage, and renderer code now uses these enums. Immutable fluent methods and related tests rename local variables from copy to clone.

Changes

Centralized messages and panel labels

Layer / File(s) Summary
Exception message enum and validation usage
src/Exception/Message.php, src/Capture/*, src/Collector/*, src/Helper/*, src/Storage/*, src/View/Sidebar/*, CHANGELOG.md
The new Message enum defines formatted diagnostic templates. Validation, storage, hydration, sidebar, and collector code now uses the enum without changing exception types or control flow.
Panel title enum and renderer headings
src/Panel/PanelTitle.php, src/Panel/Asset/*, src/Panel/Db/*, src/Panel/Vite/*
The new PanelTitle enum defines shared labels. Asset, EXPLAIN, and Vite headings now use enum cases.
Immutable clone variable naming
src/Panel/Request/*, tests/Panel/Event/*, tests/Panel/Request/*, tests/Toolbar/*
Fluent methods and related tests rename local variables from $copy to $clone. Behavior and assertions remain unchanged.

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to 59b2e

This refactor centralizes diagnostic messages and panel labels while retaining existing validation behavior, rendered labels, and immutable fluent-method behavior. No merge-blocking production risk is identified.

Poem

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 23 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main refactoring: centralizing exception messages and panel titles in typed enums while preserving behavior.
Description check ✅ Passed The description identifies the change as a refactoring with no functional changes, which matches the pull request changeset.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 56.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 23 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/centralize-exception-message-and-add-pane;-titles

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

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

@terabytesoftw
terabytesoftw merged commit 33ee63d into main Sep 7, 2026
42 of 45 checks passed
@terabytesoftw
terabytesoftw deleted the refactor/centralize-exception-message-and-add-pane;-titles branch September 7, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant