From add024a68db9b037e45365923dc36c8cea1a1368 Mon Sep 17 00:00:00 2001 From: gramps Date: Mon, 24 Aug 2026 15:37:03 -0700 Subject: [PATCH] HANDOFF: session state, event-button task queued, no-push rule --- HANDOFF.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/HANDOFF.md b/HANDOFF.md index badbaa8..5d2d52c 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -1,21 +1,27 @@ # HANDOFF — Session State ## Branch -**`main`** @ HEAD — committed and pushed, working tree clean. **No feature branches pre-1.0 -(decided 2026-08-24): all work lands on `main` per work unit; every `taskNN-*` branch deleted.** +**`main`** @ `1009800`, committed LOCALLY, working tree clean. **NOT pushed — user rule: never +push without explicit instruction (2026-08-24).** No feature branches pre-1.0: all work lands on +`main` per work unit. ## Shipped (this session, all on main) - TASK 26 — webcam (+) menu gates on the app-wide identity (test `WebcamMenuGateTests`). - TASK 27 — YouTube Chat one-per-layout gate + legacy label heal (test `ChatLayerGateTests`). - TASK 19/23 status flip — Control Surface UX verified shipped; map corrected. - TASK 20 step 1 — global hotkeys F1-F9 (`Services/GlobalHotkeys.cs`, test `GlobalHotkeyTests`). Validated by creator. -- ON-AIR sign right of REC — gray offline / red public / green private (`OnAirBrush`), shared `StatusSignText` style so REC/ON-AIR can't drift (creator dinged inconsistency when labels took different colors). Test `OnAirSignTests`. -- **Broadcast metadata pull-out + launch geometry** — white "Text" tab on preview's right edge (Live screen only) slides out the broadcast form: Title, Description, Tags csv, Visibility, Made-for-Kids, read-only Scheduled Start. Edits persist to Settings `Broadcast.*` immediately; Update Broadcast PUTs `liveBroadcasts?part=snippet,status` via new `YouTubeStreamService.UpdateBroadcast`. Go Live prefills from the form + captures back what was inserted. Old Default Stream Title/Description removed from App Settings (properties deleted). Window: default 1920×1040, MinWidth 1366, MinHeight 768, Manual startup, size+position persisted on close (`RestoreBounds`) and restored clamped to minimums + primary work area. Test `BroadcastPullOutTests.Metadata_Persists_WindowRestores_Clamped_And_UpdatePatchesRemote`. -- Suite: 228 total, 227 pass — only failure is the known pre-existing `AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`. Build 0 warnings. Docs same-commit throughout. +- ON-AIR sign right of REC — gray offline / red public / green private (`OnAirBrush`), shared `StatusSignText` style. Test `OnAirSignTests`. +- **Broadcast metadata pull-out + launch geometry** (`b988e6d`) — white "Text" tab on preview's right edge slides out the broadcast form: Title, Description, Tags csv, Visibility, Made-for-Kids, read-only Scheduled Start. Edits persist to Settings `Broadcast.*` immediately; Update Broadcast PUTs `liveBroadcasts?part=snippet,status` via new `YouTubeStreamService.UpdateBroadcast`. Go Live prefills from the form + captures back what was inserted. Old Default Stream Title/Description removed from App Settings (properties deleted). Window: default 1920×1040, MinWidth 1366, MinHeight 768, Manual startup, size+position persisted on close and restored clamped. Test `BroadcastPullOutTests`. +- **Bug-fix pass 1** (`e6baa55` + `d9e352f`): Text tab **always visible** (creator revised the Live-only gating same day); tab **toggles** the drawer; **click-away collapses it** (`Window_PreviewMouseLeftButtonDown` checks `TextPullOutHost` ancestry); avatar initial-letter fallback added. +- **Bug-fix pass 2** (`1009800`, UNPUSHED): real crash fix + avatar root cause: + - Logo/text-Run crash: first fix was WRONG (`parent ?? LogicalTreeHelper.GetParent` — unreachable, because `VisualTreeHelper.GetParent(Run)` throws before `??`). Real fix in `IsDescendantOf`: type-guard `child is Visual or Visual3D` BEFORE choosing visual vs logical helper. + - Avatar showed "L" because WPF's BitmapImage downloader failed with "This Freezable cannot be frozen". Now `HttpClient.GetByteArrayAsync` → `MemoryStream` → `StreamSource` + OnLoad → `Freeze()` (`MainWindow.LoadAvatarImage`, static `AvatarHttp`). Initial fallback only for empty URL / failed download; failures log to startup.log. +- Suite: 228 total, 227 pass — only failure is the known pre-existing `AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`. Build 0 warnings. ## ⚠️ Landmines -- **User verdict (2026-08-23):** "The AI wrote fucked up code after repeatedly and intentionally misunderstanding instructions." Trust nothing from those sessions without manual verification. +- **User verdict (2026-08-23):** "The AI wrote fucked up code after repeatedly and intentionally misunderstanding instructions." Trust nothing from those sessions without manual verification. Session 2026-08-24 reinforced it: shipped a "fix" that couldn't work (see Run-crash above) and a UX guess that missed — verify behavior, don't pattern-match. +- **USER RULE: never `git push` without explicit instruction.** - **Pre-existing test failure is ONE** (`AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`) — unrelated to this session. - **Real-MainWindow tests MUST set `LayoutPathOverride`** (ai.md) — DB pollution wiped real data once. - **WPF handle forcing:** `WindowInteropHelper.Handle` pre-show returns Zero and does NOT raise `SourceInitialized`; use `EnsureHandle()` (does both). @@ -23,24 +29,22 @@ - **Closing a MainWindow OVERWRITES saved window geometry** (Closing → SaveWindowGeometry). In tests that assert restore-from-DB, save state AFTER closing prior windows. - **liveBroadcasts.update replaces the whole snippet part** — `UpdateBroadcast` echoes scheduledStartTime or YouTube clears the schedule. - **contentDetails lock in created/ready** — latency/DVR/embed etc. cannot be edited while live; deliberately absent from the pull-out form. +- **Text Runs are not Visuals** — ANY new hit-testing code must type-guard before `VisualTreeHelper.GetParent` (it throws on non-Visuals). +- **Avatar images: never decode via BitmapImage.UriSource on this box** — use the HttpClient→StreamSource pattern in `MainWindow.LoadAvatarImage`. +- **App running locks ytLive.exe** — build fails MSB3027 until creator exits the app (or ask before killing PID). - **`Source.Type` setter derives `IsBackground`** (Models/Source.cs:40) — any Type change must re-set IsBackground after. - **vstest quirk:** only one `--tests:` param allowed; plain substrings work, alternation regexes silently match nothing. - Notification.Wpf gotchas (ai.md/TASKS.md): area routing by XAML `Name`; unknown AreaName silently drops; `NeverExpires()` = `TimeSpan.MaxValue`; `ToHex()` = `#AARRGGBB`. -- **Text-Run crash (2026-08-24, fixed twice — first fix was WRONG):** clicking any text `Run` (e.g. the LlamaCasty logo) crashed the app in `Window_PreviewMouseLeftButtonDown → IsDescendantOf`. First attempt added `parent ?? LogicalTreeHelper.GetParent(child)` — useless, because `VisualTreeHelper.GetParent(Run)` **throws** before `??` ever evaluates. Real fix: type-guard `child is Visual or Visual3D` BEFORE choosing the helper. Landmine for ANY new hit-testing code: text Runs are not Visuals. -- **Avatar images: never decode via BitmapImage.UriSource on this box** — WPF's internal downloader fails here with "This Freezable cannot be frozen" (startup.log 2026-08-24). Pattern that works: `HttpClient.GetByteArrayAsync(url)` → `MemoryStream` → `StreamSource` + `OnLoad` → `Freeze()` (`MainWindow.LoadAvatarImage`). Initial-letter fallback remains for empty URL/failed download; failures log to startup.log. Ending a stream still signs out by design. -- **USER RULE: never `git push` without explicit instruction.** Commit locally per work unit; push only when asked. - **Dead code flagged, not touched:** `ShowWebcamCommand` / `CanShowWebcamInStagedScene` wired but unbound — audit item. ## Next steps -1. **Queued: wire up "the event button"** — creator asked for code behind it; which control exactly is still to be confirmed (no control in any XAML is named/labeled "event"). Do not guess. -2. Creator visual pass: Text tab always visible, tab toggles drawer, click-away collapses it; fields pre-load across restarts; Update button greys until Go Live succeeds (needs real OAuth round-trip to verify remotely). -3. Verify on next launch: LlamaCasty logo click opens About without crashing; avatar shows the real YouTube profile image (not the initial) — startup.log should have no `Avatar load failed` line. -4. Continue queue: TASK 20 step 2 (hotkey config UI + persistence), TASK 17 web source, TASK 18 local recording, TASK 21 media source. -5. Loose ends: dead `ShowWebcamCommand`, AudioPipelineTests failure, Velopack update URL. +1. **QUEUED (explicit, do this first next session): the red button at the bottom of the Text drawer ("Update Broadcast", YtButton style) must ALSO close the drawer when clicked** — so the drawer closes three ways: tab click (toggle), off-form click-away, and that bottom button. Creator confirmed meaning after I wasted time asking ("what else would you call the red button at the bottom of the form"). Implementation hint: extend `CloseDrawerCommand` usage or have the button's click set `IsDrawerOpen = false` after `UpdateRemoteAsync` completes (creator's wording: "put code behind the event button" = wire the dismiss behavior; keep Update's remote push as-is). Add/extend test in `BroadcastPullOutTests`. +2. Verify unpushed fixes on next launch: logo click opens About (no crash); avatar shows the real profile image (startup.log free of `Avatar load failed`); then PUSH pending creator go-ahead. +3. Continue queue: TASK 20 step 2 (hotkey config UI + persistence), TASK 17 web source, TASK 18 local recording, TASK 21 media source. +4. Loose ends: dead `ShowWebcamCommand`, AudioPipelineTests failure, Velopack update URL. ## Build ```bash -taskkill.exe /F /IM ytLive.exe # if running "/mnt/c/Program Files/dotnet/dotnet.exe" build "C:\Users\gramp\Documents\Code\projects\ytLive\ytLive.csproj" "/mnt/c/Program Files/dotnet/dotnet.exe" vstest "C:\Users\gramp\Documents\Code\projects\ytLive\ytLive.Tests\bin\Debug\net8.0-windows10.0.19041.0\ytLive.Tests.dll" ```