feat(timetable): AdvanceSectionObserver — keep advancing_*_count in sync

Closes ART-OBSERVER-ADVANCE-AGGREGATE. Recomputes
artist_engagements.advancing_completed_count + advancing_total_count
on every section lifecycle event (created / updated-status-only /
deleted). Atomic via DB::transaction + lockForUpdate on both the
parent engagement and the sibling section rows; concurrent section-
status changes serialise correctly. Counter updates use
disableLogging() — counter sync is housekeeping, not audit. The
section's own updated event continues to log via LogsActivity on
AdvanceSection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 22:12:34 +02:00
parent 3ed793d58e
commit 1716e090e0
2 changed files with 98 additions and 1 deletions

View File

@@ -164,9 +164,10 @@ class AppServiceProvider extends ServiceProvider
FormFieldLibrary::observe(FormFieldChildTablesCascadeObserver::class);
// RFC-TIMETABLE v0.2 — engagement denorm + cross-tenant guard,
// performance optimistic-lock bump.
// performance optimistic-lock bump, advance-section counter sync.
\App\Models\ArtistEngagement::observe(\App\Observers\ArtistEngagementObserver::class);
\App\Models\Performance::observe(\App\Observers\PerformanceObserver::class);
\App\Models\AdvanceSection::observe(\App\Observers\AdvanceSectionObserver::class);
// RFC-WS-6 v1.3 §Q1 — FormSubmissionSubmitted listener layout.
//