Repository navigation
refactor(discovery): share the GitHub repository search steps of both GitHub providers - #568
Merged
Merged
Conversation
Assisted-by: ClaudeCode:claude-opus-5-5
… GitHub providers The public and the PAT-scoped GitHub search build the same request, decode the same items list and map repositories to hits the same way; those steps now live once in the MapsGithubRepositories trait. Each provider keeps its own error handling and its own allowlist hint. Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
marked this pull request as ready for review
November 2, 2026 18:33
…T-scoped search again Only the request and the JSON decoding are caught, as on development, so a failing status or body read reaches search() and is reported as a failed PAT-scoped search. The golden now pins unreadable status, unreadable body and a client Error for both providers, recorded on the old code. Assisted-by: ClaudeCode:claude-opus-5-5
…b-discovery-shared
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 | ✅ 947/947 · 7 skipped (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-03 00:28 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.
The public GitHub search (
GithubSearchDiscovery) and the PAT-scoped search (GithubPrivateDiscovery) each carried their own copy of the search request (URL, headers, timeout), the decoding of theitemslist and the mapping of a repository to a discovery hit. Those steps now live once in theMapsGithubRepositoriestrait. Each provider keeps its own error handling (the public search reports rate limits, HTTP errors and malformed JSON; the PAT search drops a failed request silently) and its own allowlist hint text.REVIEW: this touches how a PAT is used. The bearer token is still passed only into the request headers inside
PatManager::useToken; the newfetchItemsmarks it#[\SensitiveParameter]so it stays out of stack traces.SIG numbers (gate 122, five-star profile, PHP, against development 3e6e4b8)
The params shares rise only because about 90 lines of PHP left the measured code; no unit gained a parameter, and the LOC in units with 3+ parameters is unchanged. The next PR in this series (
AuditLogger::record) takes that band down. Both search units left the >30 band (51 and 53 LOC before; now at most 15). Every touched or new unit is within the 5-star unit bounds (at most 15 LOC, McCabe 5, 2 params). versioniq stays 36/44 at 4-star. Gate 122 ratchet: 0 findings (1 inherited,GithubPrivateDiscovery::__construct).Verification
GithubDiscoveryGoldenTest: 42 cases over bothsearch()methods (disabled, blank query, every response shape: items, no items, scalar, malformed, too deep, 403, 500, 301, unreachable; nine PAT patterns, two PATs with duplicate hits, a PAT whose token cannot be used), comparing the result and every HTTP, allowlist, PAT and logger call. Recorded on the old code; plain re-run green on old and new.$items === null ? [] : repoHits($items)torepoHits($items ?? [])) is equivalent. No-op control survived each round.--fail-on-risky: OK (811 tests).composer check:strict: lint and psalm clean; php-cs-fixer flags only the inheritedRemoveRetiredCronJobspair. Hydra gates--scope-to-diff --base origin/development: exit 0.AI assisted (Claude Code); reviewed against the golden before opening.
Update after review (head e622e75)
fetchItemsagain catches only the request (now insend()) and the JSON decoding, as on development, so an error reading the status or the body propagates tosearch(), which logs the failed PAT search and returns its error. The golden gained 5 cases recorded on the old code: unreadable status and unreadable body for both providers, a clientError, and a second PAT whose body cannot be read; the previous head fails 3 of them. Mutants on the new boundaries: 5 of 5 killed. Full unit-only suite under pcov: OK (931 tests); psalm clean; gate 122 ratchet 0 findings; gate 123 36 held.