Skip to content

ci: check architecture rules with StructArmed - #174

Merged
roxblnfk merged 3 commits into
1.xfrom
ci/structarmed
Oct 28, 2026
Merged

roxblnfk merged 3 commits into
1.xfrom
ci/structarmed

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

🔍 What was changed

  • Architecture rules now run on StructArmed: composer structarmed, after a one-time composer bin structarmed install; it lives isolated in tools/structarmed, as in Testo. A new blocking structarmed job in the static analysis workflow runs it on every PR.
  • Rules on top of the PSR-4, PER, YAGNI and CODEQUALITY presets: Kernel (Binary, Common, Config, Version, Service) does not reach into modules or the CLI shell, modules do not depend on the shell or cyclically on each other, an Internal namespace stays private to its module and out of public signatures, and src uses no exit/eval/superglobals/debug dumps.
  • The Internal rules come from Testo with one change: the @internal tag grants no exemption, since nearly every DLoad class carries it.
  • src fixes the rules asked for: missing @internal tags, final NyholmFactoryImpl, abstract BinaryException, and the unused Velox Strategy interface removed.

Review notes

Existing debt sits in tools/structarmed/baseline.php, so the check fails only on new violations. Each item needs a refactoring of its own:

  • Registry ↔ Repository cycle; the cheap cut is on the Registry side, where three classes depend on Repository only for RepositoryException.
  • Velox\Internal\DependencyChecker depends on the DLoad facade.
  • Software\ComposerPackages uses Common\Internal\Injection\ConfigInflector.

Checklist

  • How was this tested:
    • composer structarmed passes; a probe class with deliberate violations tripped every custom rule
    • composer psalm passes
    • Testo: 4 tests in DownloaderTest and PackageRegistryCommandsTest fail locally, with and without these changes

…chitecture rules

These classes broke the rules StructArmed starts enforcing in the next commit; `BinaryException` is never thrown on its own, and the Velox `Strategy` interface has no implementation.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
StructArmed runs isolated in `tools/structarmed` through bamarni/composer-bin-plugin, as in Testo, so its dependencies never touch the root lock beyond the plugin itself.

Rules: Kernel (Common, Config, Version, Service) must not reach into modules or the CLI shell, modules must not depend on the shell or cyclically on each other, an `Internal` namespace stays private to its module and out of public signatures; the `@internal` tag grants no exemption because nearly every class in DLoad carries it.

Known debt — the `Registry`/`Repository` cycle, `DloadResult` in Common, Velox reaching for the `DLoad` facade — sits in `baseline.php`, so the check blocks only new violations.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/Module/Binary/Internal/AbstractBinary.php 73.33% <ø> (+31.95%) ⬆️
...c/Module/HttpClient/Internal/NyholmFactoryImpl.php 58.33% <100.00%> (-41.67%) ⬇️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`DloadResult` is public API and hands out a `Binary`, so `Binary` is part of the shared contract rather than debt to move out; it already depends on kernel modules only.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk merged commit 3d6649c into 1.x Oct 28, 2026
27 checks passed
@roxblnfk
roxblnfk deleted the ci/structarmed branch October 28, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant