Repository navigation
refactor(pat): split PatValidator::validate into probe, status and scope steps - #556
Merged
Merged
Conversation
Assisted-by: ClaudeCode:claude-opus-5-5
…ope steps The forge probe, the status answers, and the scope and expiry evaluation are separate steps, each taking at most two parameters. Behaviour, the probe request and every result are unchanged (pinned by the golden scenario set). Assisted-by: ClaudeCode:claude-opus-5-5
Contributor
Quality Report — ConductionNL/versioniq @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| composer | ✅ | ✅ 32/32 | |||
| npm | ❌ | ✅ 302/302 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| lockfile sync | ✅ | ||||
| PHPUnit | ✅ 759/759 (8 legs) | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development. |
||||
| Hydra gates | ✅ |
Quality workflow — 2026-11-02 09:49 UTC
Download the full PDF report from the workflow artifacts.
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.
What
PatValidator::validatewas one 70-line unit with a cyclomatic complexity of 16. Its public signature is unchanged. It now runs the same steps in the same order:probe: the user-endpoint request withprobeHeaders(Authorization from the forge's scheme, the GitHub Accept and API-version headers),http_errorsoff and the local-address setting; an unreachable forge is logged and rejected;statusRejection: 401, 403 and any other non-200 status;scopeResultandclassicScopeResult: the scope and expiry headers, the least-privilege check for a classic token, the warning for a fine-grained one.Each new step takes at most two parameters. The token is only ever passed to
Forge::authHeaderValue, as before.Review requested (credentials): this is the token validation path (least-privilege scope enforcement, where the token is sent). It is behaviour-preserving by the golden test below, but please read it as a REVIEW PR.
SIG numbers (gate 122, five-star profile, php)
validateis now 23 lines, complexity 5. No check flips on its own.Verified
tests/unit/Service/Pat/PatValidatorGoldenTest.phpruns 147 scenarios: five forges (GitHub, Codeberg, a configured Forgejo host, an unknown and an empty id) x three token kinds x six probe outcomes, an unconfigured Forgejo, the local-address setting, and per token kind 13 scope-header shapes (missing, empty, blank, allowed, extra, several extra, string-valued, lowercase key, empty list, non-string values) and 5 expiry-header shapes. Per case it compares, as JSON text, the probe request (URL and every option, including the Authorization header), the config read, every logged warning and the wholeValidationResult. Recorded on the old code in the first commit, re-run plain on old and new: identical.prlimit --as=1.5G timeout 120, signal-safe runner, file restored after each round): new code 17 of 18 killed, old code 6 of 7 killed, the no-op control survives in both. The survivor in both is equivalent:=== KIND_CLASSICvs!== KIND_FINE_GRAINED, asdetectKindonly returns those two.tests/phpunit-unit-only.xml): 758 tests OK. Under pcov: 758 OK, 0 risky. Psalm (level 1, full lib): no errors. php-cs-fixer: 0 to fix. Gate 122 ratchet: 0 findings. Gate 16: count 0. Gate 119: 0.AI-assisted (Claude Code, claude-opus-5-5).