audit: Nacharbeit Umsetzungsaudit 25.09.2026 — Bildfreigabe, Beweisarchiv, KI-Atomarität, Berichte (Block 8, N01–N05, N07, N08, N10–N21, 5.1, 5.2)
Bilder (N01, N05, N07, N08): gemeinsamer Freigabezustand PressReleaseImage::isPubliclyDeliverable() für Seiten, OG und Medienroute (Bestand bleibt sichtbar, v2 nur mit Bestätigung, Admin-Upload bis zum Kundenklick nicht öffentlich); eigene Ability confirmImageRights nur für den Kontoinhaber, ohne Super-Admin-Kurzschluss, Identität und ausstehende Bestätigung auch im Service; Status-Regel unter der PM-Sperre; Cache-Flush nach dem Commit außerhalb der Dateibereinigung; Snapshot nach Bestätigung an veröffentlichter PM; Bestätigungstexte an die gezeigte Kennung gebunden. Beweisarchiv (N02, N10, N11, N12, N13, 5.1): Tombstone unter Zeilensperre mit erneuter Hold-/Fristprüfung; Dateioperationen ausgewertet, Commands mit FAILURE; record() über .tmp + move; Marker archive_pending_at mit archive:retry-pending und archive:sweep-orphans; Anonymisierung entfernt Bilder über den Remover mit Antragsbezug; Draft-Purge räumt Medien nie veröffentlichter abgelehnter Einreichungen; App-Kopien fallen mit dem Archiv-Tombstone; label_corrected nur für veröffentlichte Bilder; archive_entries.legal_request_id; FileDeletion-Helfer; Systemstatus-Checks. KI und Hintergrund (N03, N04, N14, N20, N21): Ergebnis-UPDATE und Audit in einer Transaktion; erwarteter Hash bis in reject()/holdForManualReview(); Ablaufmail per beanspruchtem Marker in einer Transaktion; strikte Schemaprüfung der Vision-Antwort; Fortschrittsmarke ungecacht. Berichte und Canonical (N15–N19, 5.2): lückenlose Alterskohorten; Feed-Identität mit Portal und Sprache; Sitemap-Rolle in der Kundenansicht; Indexverteilung auf einer Grundgesamtheit; Kopien nach Wegfall der Erstquelle neu bewertet; Kategorie-Admin leert Seiten-Caches; Dry-Run zählt alle Tabellen. Gesamtsuite: 2.122 Tests grün, einer übersprungen; Larastan und Pint sauber. Zwei Migrationen (nullable Spalten, INSTANT). N09 offen. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
34fa342c7f
commit
2a2215b3c3
66 changed files with 3092 additions and 368 deletions
|
|
@ -3,9 +3,11 @@
|
|||
use App\Enums\AiDeclarationSource;
|
||||
use App\Enums\AiImageDeclaration;
|
||||
use App\Enums\ImageProvenanceStatus;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\ImageRightsConfirmation;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\User;
|
||||
use App\Services\Image\ImageProvenanceInspector;
|
||||
use App\Services\PressRelease\Images\ImageSubmission;
|
||||
use App\Services\PressRelease\Images\ImageUploadActor;
|
||||
use App\Services\PressRelease\Images\ImageUploadException;
|
||||
|
|
@ -13,8 +15,11 @@ use App\Services\PressRelease\Images\PressReleaseImageUploader;
|
|||
use Database\Seeders\LegalDocumentSeeder;
|
||||
use Database\Seeders\LegalTextSeeder;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Exceptions;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Mockery\MockInterface;
|
||||
use Tests\TestCase;
|
||||
|
||||
beforeEach(function (): void {
|
||||
|
|
@ -255,3 +260,59 @@ test('a failed derivative generation never leaves the source file public', funct
|
|||
|
||||
expect(Storage::disk('local')->allFiles())->toBe([]);
|
||||
});
|
||||
|
||||
test('a status change during the image check is caught under the lock and leaves no files behind', function () {
|
||||
/** @var TestCase $this */
|
||||
$pressRelease = PressRelease::factory()->create(['status' => PressReleaseStatus::Draft->value]);
|
||||
$real = app(ImageProvenanceInspector::class);
|
||||
|
||||
// Die PM wird eingereicht und veröffentlicht, während die Herkunftsprüfung läuft.
|
||||
$this->instance(ImageProvenanceInspector::class, Mockery::mock(ImageProvenanceInspector::class, function (MockInterface $mock) use ($real, $pressRelease): void {
|
||||
$mock->shouldReceive('inspect')->andReturnUsing(function (string $path) use ($real, $pressRelease) {
|
||||
DB::table('press_releases')->where('id', $pressRelease->id)->update([
|
||||
'status' => PressReleaseStatus::Published->value,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
return $real->inspect($path);
|
||||
});
|
||||
}));
|
||||
|
||||
expect(fn () => app(PressReleaseImageUploader::class)->store(
|
||||
uploaderFixture('plain.png'),
|
||||
$pressRelease,
|
||||
uploaderSubmission(),
|
||||
uploaderActor($pressRelease),
|
||||
allowedStatuses: [PressReleaseStatus::Draft, PressReleaseStatus::Rejected],
|
||||
))->toThrow(ImageUploadException::class, 'Status der Meldung');
|
||||
|
||||
expect($pressRelease->images()->count())->toBe(0)
|
||||
->and(Storage::disk('local')->allFiles())->toBe([])
|
||||
->and(ImageRightsConfirmation::query()->count())->toBe(0);
|
||||
});
|
||||
|
||||
test('a cache failure after the commit is reported but keeps the stored image and its files', function () {
|
||||
/** @var TestCase $this */
|
||||
Exceptions::fake();
|
||||
$pressRelease = PressRelease::factory()->published()->create();
|
||||
|
||||
// Proxy auf den echten CacheManager: nur die Generations-Erhöhung des
|
||||
// Seiten-Caches (WebPageCache::flush) schlägt fehl, alles andere läuft.
|
||||
$cache = Mockery::mock(Cache::getFacadeRoot())->makePartial();
|
||||
$cache->shouldReceive('increment')->andThrow(new RuntimeException('cache down'));
|
||||
Cache::swap($cache);
|
||||
|
||||
$image = app(PressReleaseImageUploader::class)->store(
|
||||
uploaderFixture('plain.png'),
|
||||
$pressRelease,
|
||||
uploaderSubmission(),
|
||||
uploaderActor($pressRelease),
|
||||
);
|
||||
|
||||
Exceptions::assertReported(fn (RuntimeException $exception): bool => $exception->getMessage() === 'cache down');
|
||||
|
||||
expect($pressRelease->images()->count())->toBe(1)
|
||||
->and(Storage::disk('local')->exists($image->original_path))->toBeTrue()
|
||||
->and(Storage::disk('local')->exists($image->path))->toBeTrue()
|
||||
->and(ImageRightsConfirmation::query()->count())->toBe(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue