Skip to content

Conversation

@hmacr
Copy link

@hmacr hmacr commented Jan 25, 2026

Closes SER-541

Summary by CodeRabbit

  • Tests

    • Expanded coverage for team roles with project-based dimensions and added validation cases for DIMENSION_VERIFIED, DIMENSION_UNVERIFIED, and label role variants.
  • Refactor

    • Internal role validation routed through dedicated validator instances for clearer validation flow.
  • Bug Fixes

    • Validation message and allowed length for dimension values updated to reflect a 60-character limit.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

Refactors the Roles validator to replace inline validators with dedicated validator instances (identifierValidator, labelValidator, dimensionValidator with maxLength 60), adjusts error descriptions accordingly, and expands tests for team roles with project-based dimensions and updated dimension length expectations.

Changes

Cohort / File(s) Summary
Validator refactoring
src/Database/Validator/Roles.php
Replaced local Key/Label validator logic with dedicated identifierValidator, labelValidator, and dimensionValidator (dimension maxLength set to 60); routes label-specific checks to labelValidator; non-label checks to identifierValidator; error messages now sourced from these validators.
Role parsing and stringification tests
tests/unit/RoleTest.php
Added assertions for parsing and toString of team roles with project-scoped dimensions (e.g., team:123/project-456-owner, team:123/project-456) and corresponding Role constructions.
Role validator tests
tests/unit/Validator/RolesTest.php
Added tests covering DIMENSION_VERIFIED, DIMENSION_UNVERIFIED, team roles with custom IDs, project-scoped team roles, and label role cases; added ID helper import.
Permissions validator tests (error message update)
tests/unit/Validator/PermissionsTest.php
Updated expected validation message for "dimension" length from 36 to 60 characters in two assertions to match new dimensionValidator maxLength.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I swapped my tiny validators for three,
Identifier, label, dimension — hooray!
Project tags and team strings now play,
Errors speak clearly in a brighter way.
Hop, test, repeat — I celebrate today!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Dimension for project-specific role' directly aligns with the main changes: adding dimension support for project-specific roles, as evidenced by test cases for team roles with project-based dimensions (e.g., 'project-456-owner') and updated dimension validation rules.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@hmacr
Copy link
Author

hmacr commented Jan 25, 2026

CodeQL and Pool tests seem to be failing in other recent PRs as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants