Toasts: non-blocking notifications replace MessageBoxes + log-only failures (TASK 24)

This commit is contained in:
2026-08-23 12:25:04 -07:00
parent 809c066184
commit b400ab59c5
12 changed files with 369 additions and 50 deletions
+17 -36
View File
@@ -1,49 +1,30 @@
# HANDOFF — Session State
## Branch
`main` — **dirty (2 files, uncommitted)**, HEAD `46da995`. Not pushed.
`task24-notifications` (from `main` @ `809c066`, which is pushed) — **dirty, uncommitted**, TASK 24 complete and green.
## Uncommitted work (this session): IsBackground load-time derivation fix
## Uncommitted work: TASK 24 toast notifications — COMPLETE, ready to commit
The user-reported bug "Background properties show for only Starting and Live" is FIXED:
1. **Root cause confirmed:** `Source.Type`'s setter derives `IsBackground` (`Type == Background`),
but `LayoutStore.Load()`'s object initializer assigned the DB **column** afterward — rows saved
before b74f15f carry `IsBackground=0` for `Type='Background'` and stayed false after load, so the
properties panel (`SelectedElement.IsBackground`) stayed hidden in BRB/Chat/Ending.
2. **Fix** (`Services/LayoutStore.cs` ~601): hoist the `Type` parse, then
`IsBackground = type == SourceType.Background || <column>`. The OR keeps the persisted bit for
legacy DisplayCapture backdrops (column=1 must survive so the live-capture layer stays flagged).
First save after load self-heals the columns.
3. **Test** (this branch's ONE integration test):
`LayoutStorePersistenceTests.Legacy_IsBackground_Zero_Rows_Derive_From_Type_On_Load` — saves a BRB
scene holding DisplayCapture + Background + Image, zeroes the legacy columns via raw SQL, reloads,
asserts Background→true / DisplayCapture→true / Image→false.
4. Build **0 warnings**; **212 total, 209 pass** (3 pre-existing failures, below).
1. **Library:** `Notification.Wpf` 11.0.0 added to `ytLive.csproj` (MIT; notice #10 in `THIRD-PARTY-NOTICES.txt`). Restore pulls `Notification.CoreUI` 11.0.0 + `Microsoft.Xaml.Behaviors.Wpf` 1.1.142 + DI.Abstractions 10.0.8.
2. **Seam:** `Services/INotificationService.cs` (`Show(title, message, AppNotificationSeverity)` + Info/Success/Warning/Error extensions); `Services/NotificationService.cs` impl — pure `BuildRequest` mapping + `Cards` tint table, Dispatcher-marshalled Show. Host: `NotificationArea x:Name="ToastArea"` last child of MainWindow root grid (`RowSpan=4`, bottom-right above footer, `Margin="0,0,12,96"`).
3. **Call sites** (`ViewModels/MainViewModel.cs`): 5 MessageBox migrations (webcam ×2 → Warning, image read → Warning, sign-in unsuccessful → Warning / failed → Error) + 7 log-only promotions (go-live prep ×3 Error, frame-pump death Error, mic-missing Warning, premium-lapse Warning, saved-session sign-out Info). Offline license re-validation skip left log-only on purpose; SocialsDialog slot-delete confirm stays modal. `_notifications` field initialized at declaration (VM built from XAML).
4. **Tests:** unit `NotificationServiceTests` (8 cases: routing/lifetimes/tints) + the ONE integration `NotificationAreaIntegrationTests.Info_Auto_Dismisses_And_Error_Sticks` (real window-hosted area; visual-tree reads marshalled via `_app.Run`).
5. Build **0 warnings**; **221 total, 218 pass** — only the 3 pre-existing failures below.
## ⚠️ Landmines
- **User verdict (2026-08-23):** "The AI wrote fucked up code after repeatedly and intentionally
misunderstanding instructions." This extends the ai.md 2026-08-22 audit flag — trust nothing from
those sessions without manual verification. User switched models.
- **Pre-existing test failures are THREE, not one (handoff correction — verified by stashing and
running clean HEAD):**
1. `AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback` (gain-math)
2. `SourceNamingTests.Duplicate_Sources_Get_Next_Free_Numbered_Name` — asserts StagedScene names ==
["Text","Text2","Text3"], but StagedScene now carries a seeded "Game Capture" element (d2114c7
made all five scenes background-enabled); the test must filter the background out.
3. `SceneCatalogTests.EnforceBackgroundPolicy_Sets_Flag_For_All_Scenes` — calls `EnsureBackground`
on scenes with `HasBackground=false`; that returns null **by design**, so it asserts against
elements never inserted.
All three are fallout of the audit-flagged sessions' background-policy churn. NOT fixed here
(Good Dog Rule — this branch carries its one test only).
- **Real-MainWindow tests MUST set `LayoutPathOverride`** (see ai.md) — DB pollution wiped real data once.
- **User verdict (2026-08-23):** "The AI wrote fucked up code after repeatedly and intentionally misunderstanding instructions." Extends the ai.md 2026-08-22 audit flag — trust nothing from those sessions without manual verification.
- **Pre-existing test failures are THREE (not caused by this branch):**
1. `AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`
2. `SourceNamingTests.Duplicate_Sources_Get_Next_Free_Numbered_Name` (StagedScene seeds a "Game Capture" the test doesn't filter)
3. `SceneCatalogTests.EnforceBackgroundPolicy_Sets_Flag_For_All_Scenes` (asserts against elements never inserted)
- **Real-MainWindow tests MUST set `LayoutPathOverride`** (ai.md) — DB pollution wiped real data once.
- Notification.Wpf gotchas (recorded in ai.md/TASKS.md): area routing by XAML `Name`; unknown AreaName silently drops; `NeverExpires()` = `TimeSpan.MaxValue`; `ToHex()` = `#AARRGGBB`.
## Next steps
1. Commit this fix (code + docs, one commit).
2. Fix the two stale background tests (tiny, separate commit each or together — they are unit-level repairs, not features).
3. Visual test on Windows display: pill sizing/alignment, sub-header hierarchy, Background properties panel in all five scenes (BRB/Chat/Ending should show it again).
4. Then: thumbnail drag-reorder → real compositor snapshots → transition dropdown UI (per previous plan).
1. Commit this branch (code + docs + notices, one commit), then merge/PR per Good Dog Rule (one integration test ✓).
2. User visual pass on Windows: toasts look right bottom-right, error sticky with close button, no overlap with footer/chat.
3. Then the stale background tests repair queue (unit-level): SourceNaming filter + SceneCatalog policy test.
## Build
```bash