Skip to content

refactor(archimate): delete the unreachable private getVoorzieningenConfig duplicate (gate-50 17 → 14) - #468

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/gate50-config-fail-mode
Aug 9, 2026
Merged

refactor(archimate): delete the unreachable private getVoorzieningenConfig duplicate (gate-50 17 → 14)#468
rubenvdlinde merged 1 commit into
developmentfrom
fix/gate50-config-fail-mode

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

hydra-gates 48c88ba1e0d049f8f38538c33e790d3e603c55d0. gate-50 security-config-fail-mode: 17 → 14.

What was deleted

ArchiMateService::getVoorzieningenConfig() is private and has zero $this-> call sites in its own file — the only thing that can reach a private method.

It is not reflected into either. The whole of lib/ contains exactly one ReflectionMethod call site (SettingsService:4644) and it targets getAmefConfig. So this method cannot execute.

It is also a stale duplicate: SettingsService::getVoorzieningenConfig() is the live resolver (13 references across the app) and it ends with normalizeVoorzieningenConfig(), which this copy never had. Anything wired to the copy would have received un-normalised config.

Three of gate-50's seventeen findings go away because the code that made them cannot run — not because a guard was moved into the checker's 10-line window.

The near-miss worth recording

The obvious read of this file is that both ArchiMateService::getAmefConfig() and getVoorzieningenConfig() are dead — neither has a ->getAmefConfig() / ->getVoorzieningenConfig() call site on an ArchiMateService instance anywhere in lib/, src/, tests/ or appinfo/routes.php.

That is wrong for getAmefConfig(). SettingsService::getAmefConfig() reaches it by reflection:

$archiMateService = $this->container->get(ArchiMateService::class);
$reflection = new \ReflectionClass($archiMateService);
$method     = $reflection->getMethod('getAmefConfig');
return $method->invoke($archiMateService);

No grep for a method call finds that. getAmefConfig() is live and heavily used; deleting it would have broken every AMEF consumer. Only the private sibling, which nothing reflects into, is dead.

The other 14 findings are left RED, deliberately

They are the two legacy-fallback blocks (7 in ArchiMateService, 7 in ArchiMateImportService). The fail-mode is already handled — outside the gate's 10-line window:

  • getAmefRegisterId(): is_numeric((string) $raw) === true and $id > 0, else return null.
  • getAmefSchemaIdForType(): same two conditions on every candidate, else return null.
  • ArchiMateService:1342: throw new \InvalidArgumentException('AMEF register ID is not configured…').

Those are stricter than the empty-string comparison gate-50 looks for. Restructuring working code so the guard lands within ten lines of the read would be satisfying a window heuristic, not fixing a defect.

And deleting the reads was checked, and rejected

getAmefSchemaIdForType() reads singular candidate keys (element_schema, view_schema, model_schema…) while the legacy fallback produces plural ones (elements_schema, views_schema…) — measured overlap between producer and consumer: empty set. That looked like six structurally unreachable reads per file.

It is not. src/store/modules/settings.js:942 reads ac.elements_schema as a fallback, and SettingsService:5723 reads $amefConfig['elements_schema'] for the configuration-status readout. Deleting them would have broken the admin settings UI's schema pre-selection and the status panel — the same shape as commit 651a055f, which satisfied PHPMD by deleting sixteen if bodies. Left alone.

The plural/singular split between what the fallback writes and what getAmefSchemaIdForType() reads is a real inconsistency and deserves its own issue; it is not something to resolve inside a quality-gate change.

Measurements

  • Can-fail: restoring lib/Service/ArchiMateService.php from origin/development puts gate-50 back to 17; with the deletion it reports 14.
  • phpcs, psalm, phpstan, phpmd (repo baseline): clean.
  • Unit suite: 512 tests, 1814 assertions, 0 failures.
  • No other gate count moved.

…onfig duplicate

`ArchiMateService::getVoorzieningenConfig()` is `private` and has zero
`$this->` call sites in its own file — the only thing that can reach a private
method. It is not reflected into either: the whole of `lib/` contains exactly
one `ReflectionMethod` call site (`SettingsService:4644`) and it targets
`getAmefConfig`, not this method. It cannot run.

It is also a STALE duplicate. `SettingsService::getVoorzieningenConfig()` is
the live resolver — 13 references across the app — and it ends with
`normalizeVoorzieningenConfig()`, which this copy never had. Anything that had
been wired to the copy would have received un-normalised config.

Removing it removes three of gate-50's seventeen unsafe config reads
(`voorzieningen_register`, `voorzieningen_organisatie_schema`,
`voorzieningen_contactpersoon_schema`) by removing code that cannot execute,
not by moving a guard into the checker's window.

Can-fail proof: restoring the file from origin/development puts gate-50 back to
17; with the deletion it reports 14.

phpcs clean, psalm clean, phpstan clean, phpmd clean against the repo baseline,
unit suite 512 tests green.
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/softwarecatalog @ eb5eb6a

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-manifest
check-vue-demi
test-l10n
composer ✅ 128/128
npm ✅ 718/718
PHPUnit
Newman ⏭️
Playwright
Hydra gates

Quality workflow — 2026-08-09 14:58 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit df0a21f into development Aug 9, 2026
27 of 29 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/gate50-config-fail-mode branch August 9, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant