From 6799c4017527956e653211cd175818361bf729c3 Mon Sep 17 00:00:00 2001 From: gramps Date: Tue, 1 Sep 2026 19:33:31 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20first=20native=20launch=20since=20refact?= =?UTF-8?q?or=20crashed=20=E2=80=94=203=20stacked=20faults,=20all=20closed?= =?UTF-8?q?;=20RoundClip=20'known=20failure'=20root-caused=20and=20green?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User launch (2026-09-01 19:07) NRE'd in MainViewModel ctor: 1. SceneGraph (TASK 31) was 'null!'-declared, assigned mid-ctor, but Scenes is touched ~120 lines earlier — field-initialized now. 2. LeftPanel extraction (c9fd1bd) moved StaticResource users (EyeButton/EyeIconStyle) into a UserControl while the styles stayed window-scope — invisible at parse time; moved to Themes/Controls.xaml (app scope, the existing rule). Full audit: these were the only two offenders (grep of Controls/*.xaml StaticResource keys vs app dictionary). 3. RoundClipInteractionTests — the second 'known failure' the map never explained: it was two stale-test layers (window.FindName across the new UserControl namescope + VisualTreeHelper.HitTest, which returned the IsHitTestVisible=False WebViewHostPanel overlay for EVERY point; UIElement.InputHitTest — the real input pipeline — shows the corner IS grabbable in both Traditional and Round). Test fixed, no product bug. Verified: clean rebuild 0 warnings; app boots (log shows full MainWindow loaded; user clicked + closed, zero new exceptions; real DB Webcam row = the genuine C920, untouched); RoundClip + 6 RealApp classes pass natively per-class. Docs: ai.md known-failure note → 246/247 (audio only); TASK 31 verification paragraph corrected ('cannot run headless' overstated — per-class Windows-host vstest runs them); MyMistakes: InputHitTest-vs-VTH recipe + namescope/app-style + shared-log facts. Spin-guard citations: WPF Visual Tree Overview (InputHitTest vs VisualTreeHelper hit semantics) + XAML namescope docs, learn.microsoft.com. --- MainWindow.xaml | 22 +++----------- MyMistakes.md | 35 +++++++++++++++++++++++ TASKS.md | 12 ++++++-- Themes/Controls.xaml | 23 +++++++++++++++ ViewModels/MainViewModel.cs | 7 +++-- ai.md | 11 +++++-- ytLive.Tests/RoundClipInteractionTests.cs | 20 +++++++++---- 7 files changed, 100 insertions(+), 30 deletions(-) diff --git a/MainWindow.xaml b/MainWindow.xaml index 4c25257..b847181 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -45,24 +45,10 @@ - - - - + diff --git a/MyMistakes.md b/MyMistakes.md index 0d6a81c..5c11844 100644 --- a/MyMistakes.md +++ b/MyMistakes.md @@ -89,3 +89,38 @@ paths to `\\wsl.localhost\Debian\…` and throws "not a valid application for th OS" when handed a Linux ELF ffmpeg. So never plan to have dotnet exec a Linux ffmpeg here; verify the contract with shell/python instead, and leave the CLR→real-ffmpeg run to the native Windows suite. + +## WPF hit-test truth in tests: `UIElement.InputHitTest`, NOT `VisualTreeHelper.HitTest` + +(2026-09-01, the RoundClip "known failure" post-mortem — a failure the map carried as +"not a regression" for weeks without ever recording WHY.) + +**The trap:** `VisualTreeHelper.HitTest(window, pt)` returned the window's +`WebViewHostPanel` overlay (`IsHitTestVisible="False"`, `Opacity=0`, ZERO children) for +EVERY point in the window — so a "corner is grabbable" assertion could never pass, and +it looked like a real interaction bug. The actual input pipeline (`UIElement.InputHitTest`, +what Mouse routing uses) correctly returned the element's Grid at elem-center/corner-in/ +corner-exact and fell through to CanvasGrid just past the corner. The product was fine; +the TEST was probing an API that doesn't model input semantics. + +**Rule:** any test asserting "where does a click land" uses `window.InputHitTest(pt)` + +`IsDescendantOf` — never `VisualTreeHelper.HitTest`. + +**Diagnosis recipe (how the lie was caught in ~3 probe cycles, no guessing):** add a TEMP +probe `[Fact]` in the RealApp collection that hit-tests a spread of points +(elem-center / corner-in / corner-exact / corner-out / bg-center) and `Assert.Fail`s with a +composed dump: per-point VTH hit + `InputHitTest` hit + ancestor chain (`GetParent` walk +with `#Name`) + panel properties (`IsHitTestVisible/Opacity/children/actual size`) + +`TranslatePoint` origins. Run the class alone, read the message, delete the probe. + +**Two sibling facts learned the same session (record-once):** +1. A UserControl owns its own XAML namescope — after extracting a region out of a window, + `window.FindName("InnerPart")` returns null; resolve the UserControl by its window-level + name, then `pane.FindName("InnerPart")`. And window-scope STYLES are invisible to a + UserControl's `StaticResource` at parse time — move such styles to `Themes/Controls.xaml` + (the app-scope rule exists for this). +2. Per-class `dotnet.exe vstest` from WSL DOES execute the RealApp/`MainWindow` tests fine + (they passed natively 2026-09-01) — only the FULL suite hangs (WASAPI startup). And the + test process shares `%APPDATA%\ytLlive\startup.log` with the real app: lines like + `camera 'test-camera' failed` are test noise, not DB state — to check pollution, query + the DB directly (`python3 sqlite3`, `SELECT DeviceId FROM Webcam`), not the log. diff --git a/TASKS.md b/TASKS.md index a2d8537..9ab2605 100644 --- a/TASKS.md +++ b/TASKS.md @@ -1311,8 +1311,16 @@ What landed — core optimization + SceneGraph component, all in one commit: **Verification:** SceneCompositorTests 4, StretchMathTests 4, BackgroundTests 16, SceneCatalogTests 18, LayoutStorePersistenceTests 12, FramePumpTests 9, SceneGraphTests 1 all green. RealAppHost GUI/collection -tests (SourceNaming, RoundClip, BackgroundHeal, ...) construct a real `MainWindow` and cannot run in a -headless WSL session (pre-existing limitation, not caused by this change). +tests (SourceNaming, RoundClip, BackgroundHeal, ...) construct a real `MainWindow` — **CORRECTED +2026-09-01:** they DO run from WSL when invoked per-class through the Windows `dotnet.exe` vstest host +(the old "cannot run headless" claim conflated them with the full-suite WASAPI hang). Two first-launch +crashes this refactor shipped with were caught on the first real native launch and fixed same day: +ctor-order `SceneGraph` NRE (`null!` field assigned after first ctor use — now field-initialized) and +window-scope `EyeButton`/`EyeIconStyle` consumed via `StaticResource` from the extracted `LeftPanel` +(UserControl namescopes can't see window resources — styles moved to `Themes/Controls.xaml`, the +app-scope rule honored). The RoundClip "known failure" was then root-caused to stale test code +(`window.FindName` across namescopes + `VisualTreeHelper.HitTest` where `UIElement.InputHitTest` +models input) — test green 2026-09-01, the sole remaining known failure is the audio one. ### Design diff --git a/Themes/Controls.xaml b/Themes/Controls.xaml index 6db611c..6f35c14 100644 --- a/Themes/Controls.xaml +++ b/Themes/Controls.xaml @@ -66,6 +66,29 @@ + + + + + +