Some checks failed
Main Confidence / confidence (push) Failing after 51s
## Summary - converge finding, queued, and completed database notifications on one shared `OperationUxPresenter` presentation contract - preserve existing finding and operation deep-link authorities while standardizing title, body, status/icon treatment, and single primary action - add focused notification, findings, and guard coverage plus the full feature 230 spec artifacts ## Validation - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Notifications/SharedDatabaseNotificationContractTest.php tests/Feature/Notifications/OperationRunNotificationTest.php tests/Feature/Notifications/FindingNotificationLinkTest.php` - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Findings/FindingsNotificationEventTest.php tests/Feature/Findings/FindingsNotificationRoutingTest.php tests/Feature/OpsUx/Constitution/LegacyNotificationGuardTest.php` ## Filament / Platform Notes - Livewire v4.0+ compliance preserved on Filament v5 primitives - provider registration remains unchanged in `apps/platform/bootstrap/providers.php` - no globally searchable resource behavior changed in this feature - no destructive actions were introduced - asset strategy is unchanged; the existing `cd apps/platform && php artisan filament:assets` deploy step remains sufficient Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #265
119 lines
3.6 KiB
PHP
119 lines
3.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Tests\Support\OpsUx\SourceFileScanner;
|
|
|
|
it('does not reference the removed legacy run status notification', function (): void {
|
|
$root = SourceFileScanner::projectRoot();
|
|
$files = SourceFileScanner::phpFiles([$root.'/app', $root.'/tests'], [
|
|
__FILE__,
|
|
]);
|
|
|
|
$needle = 'RunStatus'.'ChangedNotification';
|
|
$violations = [];
|
|
|
|
foreach ($files as $file) {
|
|
$source = SourceFileScanner::read($file);
|
|
|
|
if (! str_contains($source, $needle)) {
|
|
continue;
|
|
}
|
|
|
|
$offset = 0;
|
|
|
|
while (($position = strpos($source, $needle, $offset)) !== false) {
|
|
$line = substr_count(substr($source, 0, $position), "\n") + 1;
|
|
|
|
$violations[] = [
|
|
'file' => SourceFileScanner::relativePath($file),
|
|
'line' => $line,
|
|
'snippet' => SourceFileScanner::snippet($source, $line),
|
|
];
|
|
|
|
$offset = $position + strlen($needle);
|
|
}
|
|
}
|
|
|
|
if ($violations !== []) {
|
|
$messages = array_map(static function (array $violation): string {
|
|
return sprintf(
|
|
"%s:%d\n%s",
|
|
$violation['file'],
|
|
$violation['line'],
|
|
$violation['snippet'],
|
|
);
|
|
}, $violations);
|
|
|
|
$this->fail(
|
|
"Legacy notification reference(s) found:\n\n".implode("\n\n", $messages)
|
|
);
|
|
}
|
|
|
|
expect($violations)->toBe([]);
|
|
})->group('ops-ux');
|
|
|
|
it('keeps in-scope database notifications routed through the shared presenter seam', function (): void {
|
|
$root = SourceFileScanner::projectRoot();
|
|
$files = [
|
|
$root.'/app/Notifications/Findings/FindingEventNotification.php',
|
|
$root.'/app/Notifications/OperationRunQueued.php',
|
|
$root.'/app/Notifications/OperationRunCompleted.php',
|
|
];
|
|
$needles = [
|
|
'FilamentNotification::make(',
|
|
'->getDatabaseMessage(',
|
|
];
|
|
$violations = [];
|
|
|
|
foreach ($files as $file) {
|
|
$source = SourceFileScanner::read($file);
|
|
|
|
foreach ($needles as $needle) {
|
|
if (! str_contains($source, $needle)) {
|
|
continue;
|
|
}
|
|
|
|
$offset = 0;
|
|
|
|
while (($position = strpos($source, $needle, $offset)) !== false) {
|
|
$line = substr_count(substr($source, 0, $position), "\n") + 1;
|
|
|
|
$violations[] = [
|
|
'file' => SourceFileScanner::relativePath($file),
|
|
'line' => $line,
|
|
'snippet' => SourceFileScanner::snippet($source, $line),
|
|
];
|
|
|
|
$offset = $position + strlen($needle);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($violations !== []) {
|
|
$messages = array_map(static function (array $violation): string {
|
|
return sprintf(
|
|
"%s:%d\n%s",
|
|
$violation['file'],
|
|
$violation['line'],
|
|
$violation['snippet'],
|
|
);
|
|
}, $violations);
|
|
|
|
$this->fail(
|
|
"Local database-notification payload composition found in in-scope consumers:\n\n".implode("\n\n", $messages)
|
|
);
|
|
}
|
|
|
|
expect($violations)->toBe([]);
|
|
})->group('ops-ux');
|
|
|
|
it('keeps alert email delivery outside the shared database notification contract boundary', function (): void {
|
|
$source = SourceFileScanner::read(
|
|
SourceFileScanner::projectRoot().'/app/Notifications/Alerts/EmailAlertNotification.php'
|
|
);
|
|
|
|
expect($source)->not->toContain('OperationUxPresenter')
|
|
->and($source)->not->toContain('FilamentNotification');
|
|
})->group('ops-ux');
|