Skip to content

refactor(notifications): raise the auto-update and pin-drift admin notifications through one NotifiesAdmins trait - #570

Merged
rubenvdlinde merged 4 commits into
developmentfrom
refactor/admin-notices
Nov 2, 2026
Merged

rubenvdlinde merged 4 commits into
developmentfrom
refactor/admin-notices

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

AutoUpdateNotifier::fireAll (26 LOC, 4 params) and PinDriftHandler::notifyAdmins (29 LOC, 3 params) carried the same loop: build the admin settings link once, then for every admin create, address, describe and send a notification, logging a warning when one admin fails. That loop now lives once in the NotifiesAdmins trait. Each caller describes its notification as an AdminNotice (object, subject, link, log line and log context), built step by step with at most 2 parameters per step. Subjects, objects, links, log messages and log context keys are unchanged.

NotifierTest::sentSubjects reads the sent subjects from lib/ by pattern; it now also reads them from ->withSubject('…' and the auto-update ->notice('…' helper, so every subject still has to render.

SIG numbers (gate 122, five-star profile, PHP, against development 1955bdd)

check before after 5-star 4-star
params >=3 22.83% 22.15% 7.5% 15.0%
duplication 3.26% (327 lines) 2.96% (298 lines) 2.8% 5.6%
size >15 53.50% 52.76% 23.6% 47.1%
size >30 22.79% 22.74% 11.6% 23.1% (met)
McCabe >5 39.78% 39.71% 10.1% 20.2%
McCabe >10 15.85% 15.82% 3.7% 7.3%
params >=5 6.89% 6.87% 1.65% 3.3%

This adds about 29 lines of margin to the PHP duplication 5-star check that #568 brings within the limit. Every touched or new unit is within the 5-star unit bounds (at most 15 LOC, McCabe 4, 2 params), except the public notifySuccess/notifyFailure signatures (3 and 4 params), which AutoUpdateJob calls and which keep their shape. versioniq stays 37/44 at 4-star. Gate 122 ratchet: 0 findings (2 inherited constructors). Gate 123: 36 floored checks held.

Verification

  • Golden AdminNotificationsGoldenTest: 25 cases (success, failure and drift; no admin group, empty, two admins, a duplicate admin, a failure while addressing, while setting the subject and while sending; drift that matches the pin, is already recorded, or has no pin), comparing every group, URL, clock, notification-setter, send and logger call. Recorded on the old code; plain re-run green on old and new.
  • Capped mutants against the golden only: trait 9 of 9, AutoUpdateNotifier 5 of 5, PinDriftHandler 4 of 4, AdminNotice 5 of 6; the survivor (withLink mutating instead of cloning) is equivalent, because each notice is linked once. No-op control survived each round.
  • Full unit-only suite under pcov with --fail-on-risky: OK (907 tests). psalm on the whole project: no errors; php-cs-fixer flags only the inherited RemoveRetiredCronJobs pair. Hydra gates --scope-to-diff --base origin/development: exit 0.

AI assisted (Claude Code); reviewed against the golden before opening.

…tions with a golden

Assisted-by: ClaudeCode:claude-opus-5-5
…tifications through one NotifiesAdmins trait

AutoUpdateNotifier::fireAll and PinDriftHandler::notifyAdmins carried the same
linked per-admin notification loop. Both now describe their notification as an
AdminNotice (object, subject, log line) and hand it to the shared trait.

Assisted-by: ClaudeCode:claude-opus-5-5
…ler::handle

Assisted-by: ClaudeCode:claude-opus-5-5
…ders; tag AdminNotice with its specs

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde merged commit f614854 into development Nov 2, 2026
7 checks passed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/versioniq @ d25ea2d

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 ✅ 923/923 · 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-02 23:31 UTC

Download the full PDF report from the workflow artifacts.

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