feat: introduce VerificationService orchestration layer#8
feat: introduce VerificationService orchestration layer#8
Conversation
- Created VerificationServiceInterface and VerificationService in `src/Application/Verification/`. - Implemented lightweight orchestration methods `startVerification`, `verifyCode`, and `resendVerification`. - Strictly enforced separation of concerns by delegating core logic to existing generator and validator components. - Avoided framework or delivery mechanisms as per architectural constraints. - Added comprehensive unit tests in `tests/Unit/Application/Verification/VerificationServiceTest.php`. - Ensured code passes max level PHPStan analysis and all PHPUnit tests. Co-authored-by: Maatify <130119162+Maatify@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Required `maatify/exceptions` via Composer. - Created `VerificationErrorCodeEnum` for specific verification error codes. - Created `VerificationException` base class extending `MaatifyException`. - Added specific child exceptions for invalid codes, expired codes, attempt limits, generation blocks, and internal errors. - Updated `VerificationService` to catch domain exceptions/results and throw the correct application exception. - Updated unit tests to assert proper exception throwing instead of evaluating scalar booleans. - The domain and infrastructure layers remain unchanged. Co-authored-by: Maatify <130119162+Maatify@users.noreply.github.com>
- Introduced `VerificationFailureEnum` (`INVALID_CODE`, `EXPIRED`, `ATTEMPTS_EXCEEDED`). - Updated `VerificationResult` DTO to securely encapsulate failure codes using the new enum. - Refactored `VerificationCodeValidator` to assign proper failure enum codes upon validation failures based on remaining attempts and current active status. - Added `VerificationGenerationRateLimitedException` in the domain layer to isolate generation-blocking errors cleanly. - Updated `VerificationCodeGenerator` to throw `VerificationGenerationRateLimitedException` on max window or cooldown breaches. - Re-architected `VerificationService` exception mapping layer to utilize robust `match ($result->failureCode)` structures, eliminating all unsafe `str_contains()` logic. - Updated unit and integration test assertions and mocks to match the structured validation DTO return types and generator exceptions. Co-authored-by: Maatify <130119162+Maatify@users.noreply.github.com>
Introduces a new lightweight orchestration layer,
VerificationService, to provide a clean workflow API around the verification engine.Architecture Check & Compliance:
Key Changes:
src/Application/Verification/VerificationServiceInterface.php: Defines the workflow API.src/Application/Verification/VerificationService.php: Implements orchestration using existingVerificationCodeGeneratorInterfaceandVerificationCodeValidatorInterface.tests/Unit/Application/Verification/VerificationServiceTest.php: Adds unit testing for orchestration behavior matching specification requirements.CI (
composer analyseandcomposer test) passes correctly.PR created automatically by Jules for task 12403240662160590175 started by @Maatify