Repository navigation
refactor(appstore): walk both catalogue endpoints with one page loop - #557
Merged
Merged
Conversation
…io set Assisted-by: ClaudeCode:claude-opus-5-5
The filtered and the platform endpoint ran the same page loop twice; they now share one, with a CatalogueQuery naming each endpoint and whether a bad body ends the lookup. Behaviour, every request and the connection outcome 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 10:01 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
AppStoreSource::fetchAppPayloadUncachedwas one 70-line unit with two copies of the same page loop: one over the filteredapps.json?filter=endpoint, one over the platformplatform/<version>/apps.jsonendpoint. They now share one loop:CatalogueQuery(new,lib/Service/Source/) holds the app id, a closure that builds each page's endpoint, and whether an empty or non-array body ends the whole lookup (the filtered endpoint, as before) or only skips that page (the platform endpoint, as before);searchCataloguewalks the pages up toMAX_PAGES: it marks the store as answered, caches every entry in the page, returns the app when found, and stops when no next page can exist;readCataloguePagefetches and decodes one page and notes each failure for the connection report with the same reasons as before.The filtered endpoint still reads the API base on every page, and the platform version is still read before the platform API base, so every request and config read happens in the same order. The difference between the two loops (a bad body on the filtered endpoint ends the lookup) is kept, not unified.
SIG numbers (gate 122, five-star profile, php)
The 70-line unit leaves the >30 and >60 bands; the largest new step is 23 lines, complexity 8, two parameters. The 0.01 rise in params >=3 is the denominator only: the unit LOC in that band stays at 2,629 while total unit LOC drops by 2 (8,367 to 8,365).
CatalogueQuerytakes two constructor arguments; the stop-on-bad-body flag is a property, so no new unit has three parameters.Verified
tests/unit/Service/Source/AppStoreFetchGoldenTest.phpruns 58 scenarios: 16 response shapes (transport error, 500, 404, a blank body, non-array JSON, invalid JSON, the app indata, in a plain list or inapps, and pages without the app that signal next throughpages.next,pagination.next_page,nextPageor a wrongpage, an empty list,datanot a list) on the filtered endpoint, on the platform endpoint and on the platform endpoint alone, plus endless next pages on one and both endpoints, endless errors, the app on page three, odd and short server versions and a mirror API base. Per case it compares, as JSON text, every request with its options, every config and app-config read and write (timestamps masked), the returned payload and the connection outcome. 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 15 of 15 killed, old code 5 of 5 killed, the no-op control survives in both.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 (5 inherited). Gate 16: count 0. Gate 119: 0.One difference that cannot be observed: before, an exception from caching, payload extraction or the next-page check inside a page was also caught as "no readable answer". Those helpers do not throw (the cache write already swallows its own errors), so only the request and the JSON decode sit inside the catch now.
AI-assisted (Claude Code, claude-opus-5-5).