Skip to content

feat(panel): add UserRbacRow typed view-model so adapters render RBAC role and permission rows from a single normalized shape. - #9

Merged
terabytesoftw merged 1 commit into
mainfrom
feat/panel-ass-user-rbac-row
Aug 18, 2026
Merged

feat(panel): add UserRbacRow typed view-model so adapters render RBAC role and permission rows from a single normalized shape.#9
terabytesoftw merged 1 commit into
mainfrom
feat/panel-ass-user-rbac-row

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)

…AC role and permission rows from a single normalized shape.
@terabytesoftw terabytesoftw added the enhancement New feature or request label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 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: Pro Plus

Run ID: 397d3430-a6a5-414b-a52b-02f4e337d515

📥 Commits

Reviewing files that changed from the base of the PR and between a4159c4 and ddac2d3.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/Panel/User/UserRbacRow.php
  • tests/Panel/User/UserRbacRowTest.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. (4)
  • GitHub Check: mutation / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit / PHP 8.4-windows-2022
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-08-14T23:49:48.417Z
Learnt from: terabytesoftw
Repo: php-forge/debug-core PR: 1
File: tests/Storage/SnapshotStoreTest.php:122-128
Timestamp: 2026-08-14T23:49:48.417Z
Learning: In PHP tests that use xepozz/internal-mocker, use a MockerState::addCondition() condition with default: true when the configured result should apply regardless of the supplied arguments. Specify complete argument lists, including native default parameters, only for argument-specific conditions.

Applied to files:

  • tests/Panel/User/UserRbacRowTest.php
🪛 PHPMD (2.15.0)
tests/Panel/User/UserRbacRowTest.php

[error] 40-46: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayCastsNumericStringTimestampsToInt'. (undefined)

(StaticAccess)


[error] 54-63: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayCoercesNonStringTextualFieldsToEmptyStrings'. (undefined)

(StaticAccess)


[error] 73-73: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayDefaultsMissingKeysToEmptyStringsAndNullTimestamps'. (undefined)

(StaticAccess)


[error] 85-94: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayHydratesAllFieldsFromCompleteRow'. (undefined)

(StaticAccess)


[error] 106-111: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayRejectsNonNumericTimestamps'. (undefined)

(StaticAccess)


[error] 119-124: Avoid using static access to class '\PHPForge\Debug\Panel\User\UserRbacRow' in method 'testFromArrayTruncatesFloatTimestampsToInt'. (undefined)

(StaticAccess)

🔇 Additional comments (3)
src/Panel/User/UserRbacRow.php (1)

1-76: LGTM!

CHANGELOG.md (1)

18-18: LGTM!

tests/Panel/User/UserRbacRowTest.php (1)

1-129: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a structured RBAC row representation for displaying user roles and permissions.
    • Improved handling of incomplete or inconsistent role and permission data, including timestamps.
  • Tests

    • Added coverage for complete, missing, invalid, numeric, and decimal field values.
  • Documentation

    • Added a changelog entry describing the new RBAC row support.

Walkthrough

Added the readonly UserRbacRow value object. It normalizes adapter data and converts timestamps. Added PHPUnit tests for construction, defaults, invalid values, numeric strings, and fractional timestamps. Added a changelog entry.

Changes

RBAC row value object

Layer / File(s) Summary
RBAC row value object
src/Panel/User/UserRbacRow.php, CHANGELOG.md
Added typed readonly RBAC fields and fromArray() normalization. Missing or invalid text uses empty strings. Invalid timestamps use null. Numeric timestamps convert to integers.

RBAC row validation

Layer / File(s) Summary
RBAC row validation tests
tests/Panel/User/UserRbacRowTest.php
Added PHPUnit coverage for constructor values, complete and partial rows, text coercion, numeric timestamps, invalid timestamps, and float truncation.

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

Merge Risk: ⚪ Minimal · up to ddac2

This PR adds a localized typed view-model and its tests without any identified merge-blocking risk; it is merge-ready after normal checks and review.

Poem

A rabbit typed each RBAC row,
With empty fields where blanks may grow.
Timestamps hop to integers bright,
Bad ones rest as null at night.
Tests thump softly: all is right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the new UserRbacRow view-model and its purpose of normalizing RBAC rows for adapters.
Description check ✅ Passed The description identifies the change as a new non-breaking feature, which matches the added UserRbacRow functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/panel-ass-user-rbac-row

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.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.59%. Comparing base (a4159c4) to head (ddac2d3).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main       #9      +/-   ##
============================================
+ Coverage     90.56%   90.59%   +0.02%     
- Complexity     1334     1344      +10     
============================================
  Files           117      118       +1     
  Lines          5248     5264      +16     
============================================
+ Hits           4753     4769      +16     
  Misses          495      495              

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

@terabytesoftw
terabytesoftw merged commit d05f634 into main Aug 18, 2026
43 checks passed
@terabytesoftw
terabytesoftw deleted the feat/panel-ass-user-rbac-row branch August 18, 2026 22:10
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