refactor: migrate services and middleware away from ValidateHelper - #8366
Merged
vitormattos merged 1 commit intoSep 12, 2026
Merged
Conversation
Replace the ValidateHelper compatibility façade with the focused validators that already own each rule, in the four remaining central consumers: - RequestSignatureService: FileInputValidator::validateNewFile(), SigningRequestValidator::validateFileStatus(), SignerValidator::validateIdentifySigners() and normalizeRequestSigners() - AccountService: IdentityDocumentValidator:: userCanApproveValidationDocuments(), FileInputValidator:: validateBase64() and FileInputValidator::TYPE_VISIBLE_ELEMENT_USER - SignFileService: IdentityDocumentValidator:: userCanApproveValidationDocuments(), SigningRequestValidator:: fileCanBeSigned(), SignerValidator::validateUuidFormat(), validateSigner() and validateRenewSigner() - InjectionMiddleware: SigningRequestValidator::canRequestSign(), SignerValidator::validateSigner() and validateSignerUuid() Dependency migration only: no validation rule moves, no public signature changes, no new wrapper. The unit tests replace the façade mock with the focused validator mocks and keep every expectation. Resolves: LibreSign#8355 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
15 tasks
vitormattos
approved these changes
Sep 12, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #8355
📝 Summary
Replaces the
ValidateHelpercompatibility façade with the focused validators in the four remaining central consumers, following the mapping defined in the issue:RequestSignatureServiceFileInputValidator,SigningRequestValidator,SignerValidatorvalidateNewFile,validateFileStatus,validateIdentifySigners,normalizeRequestSigners(×3, sameSignerValidatorinstance)AccountServiceIdentityDocumentValidator,FileInputValidatoruserCanApproveValidationDocuments(×2),validateBase64(×2), constantTYPE_VISIBLE_ELEMENT_USERnow read fromFileInputValidatorSignFileServiceIdentityDocumentValidator,SigningRequestValidator,SignerValidatoruserCanApproveValidationDocuments,fileCanBeSigned,validateUuidFormat,validateSigner,validateRenewSignerInjectionMiddlewareSigningRequestValidator,SignerValidatorcanRequestSign,validateSigner,validateSignerUuidDependency migration only:
SignFileService::validateSigner()andvalidateRenewSigner()keep their signatures and only change the delegate;InjectionMiddlewareattributes, authorization flow, exception handling and redirects are untouched;ValidateHelperparameter had, so the positional constructor calls in the tests stay readable.After this change the only
ValidateHelperconsumers left inlib/are the three controllers covered by #8353, plus the façade itself. Intests/, onlyPageControllerTest(forPageController, also #8353) andValidateHelperTeststill reference it.🧪 How to test
Ran in the devcontainer (PHP 8.3):
php -lon the 8 filesphp-cs-fixer --dry-runon the 8 filespsalmon the 4 production files, before vs. afterMissingDependencyerrors (localpsr/*stubs), no new issueRequestSignatureServiceTest+AccountServiceTest+SignFileServiceTest+InjectionMiddlewareTestValidateHelperTest+PageControllerTest+Validation/*Search to confirm the remaining references:
⚙️ API / Back‑end changes
ValidateHelperto the focused validators (container-resolved; no public API change)ValidateHelpermock is replaced by one mock per focused validator, every existing expectation moved to the validator that owns the method, no assertion removed or weakened🚧 Tasks
$this->validateHelperinAccountServiceTest(userCanApproveValidationDocuments,validateBase64withValidateHelper::TYPE_VISIBLE_ELEMENT_USER). Whichever merges second needs a small rebase; I can do it on either side.✅ Checklist
🤖 AI (if applicable)