Repository navigation
refactor(api): pass ApiController its collaborators as four bundles - #576
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
ApiController took 25 constructor parameters. It now takes the app name, the request and four bundles: - AccessCollaborators: ApiCaller (session, group manager, clock), PatServices (mapper, manager, validator, expiry), the deeplink builder and the optional connection report - InstallCollaborators: installer, server version, app manager, cache - AutoUpdateStores: policies, pins, auto-update settings, attempt ledger - ReportCollaborators: ReportStores (advisory snapshot and settings, pending-updates snapshot, instance settings), discovery, audit log Every bundle holds at most 4 collaborators. The attempt ledger is now always present (the container always provided it), so the two nullsafe reads of it became plain reads. Behaviour is otherwise unchanged. The controller tests build it by parameter name, so they ran unchanged on the old and the new constructor. ApiReadEndpointsGoldenTest, recorded on the old code, pins the endpoints whose collaborator answer the existing tests never checked: apps, advisories, advisory interval, PAT list, discovery, deeplinks, cache clearing, pin and policy timestamps and the update channel. 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 | ❌ 999/1000 · 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 02:05 UTC
Download the full PDF report from the workflow artifacts.
This branch has not been deployed
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 (REVIEW: the bundles carry the auth, PAT and install collaborators)
ApiControllertook 25 constructor parameters. It now takes the app name, the request and four bundles:AccessCollaboratorsApiCaller(session, group manager, clock),PatServices(mapper, manager, validator, expiry evaluator), the deeplink builder, the optional connection reportInstallCollaboratorsAutoUpdateStoresReportCollaboratorsReportStores(advisory snapshot and settings, pending-updates snapshot, instance settings), discovery, audit logEvery bundle holds at most 4 collaborators (gate 122 flags new constructors with 5 or more). They live in
lib/Service/Api/, outsidelib/Controller, so route and OpenAPI scanning do not see them.What to review:
isAdmin()reads$this->access->caller->userSessionand->groupManager; the guard itself is unchanged and runs first in every endpoint, as before.?->. The container always provided it, so it is now a plain field ofAutoUpdateStoresand the two reads are plain calls. Nothing else changes behaviour.Stacked on #575 (and #574); the diff shows their commits until they merge.
SIG (gate 122 five-star report, PHP)
params >=3 rises 0.19 points: the bundles are new 3 and 4 parameter units. That band is far from its limit (15%) either way; the >=7 and >=5 bands are the ones this work targets.
How it was verified
BuildsByParameterNamefrom refactor(advisory): bundle the collaborators of AdvisoryService and AdvisoryRefreshJob #574), so they ran unchanged on the old and the new constructor: 88 controller tests green on both.ApiReadEndpointsGoldenTest(14 cases), recorded on the old code: response plus every collaborator call for apps, advisories, advisory interval, PAT list, discovery, deeplinks, cache clearing, pin and policy timestamps and the update channel. These were the accesses a first mutant round showed no test checked (9 survivors on the old code).'admin'mutant killed, no-user-allowed killed); no-op control survived on both.--fail-on-risky: 1007 tests OK, rc 0.--scope-to-diff --base origin/development: 33 of 33 applicable gates pass (gate 7 checks 0NoAdminRequiredmethods in this controller on both refs); gate 122 ratchet 0 findings; gate 119 0.Assisted-by: ClaudeCode:claude-opus-5-5