Webcam menu gates on the app-wide identity (TASK 26)
This commit is contained in:
+25
-35
@@ -1,54 +1,44 @@
|
||||
# HANDOFF — Session State
|
||||
|
||||
## Branch
|
||||
`task25-backgrounds` @ `7dd140a` — **committed and pushed** (includes TASK 24 `b400ab5`). Working tree clean.
|
||||
`task26-webcam-menu-gate` @ working tree — **code + docs complete, NOT yet committed** (commit on your word). Parent: `task25-backgrounds` @ `7dd140a`, committed and pushed, clean.
|
||||
|
||||
## Shipped: TASK 25 background consolidation (+ TASK 24 toasts beneath it)
|
||||
## Shipped: TASK 26 — webcam (+) menu gates on the app-wide identity
|
||||
|
||||
Locked model (user directive): exactly ONE "Background" per screen at index 0, non-deletable/
|
||||
non-reorderable, NOT in the (+) menu; capture context-sensitivity only on the Live screen
|
||||
(Show Desktop/monitor switching kept intact); exactly five default images in the DB; stale rows cleaned.
|
||||
Creator's visual pass of TASK 25 came back green except one item: the (+) menu's Webcam row wasn't
|
||||
greyed out when a webcam was already deployed in another scene. Root cause: `CanAddWebcamToStagedScene`
|
||||
only checked the staged scene's config; the truth is the `_webcam` singleton.
|
||||
|
||||
1. **Seeders consolidated** (`ViewModels/MainViewModel.cs`): five clone seeders + `EnforceBackgroundPolicy`
|
||||
deleted. Now: `EnsureBackground` → `CreateBackground(name)` — Live = DisplayCapture row, others =
|
||||
static Background art row, all named "Background". `NormalizeBackgrounds(scenes)` heals any layout:
|
||||
correct-flavor keep (in-place Type conversion re-asserts `IsBackground` because `Source.Type`'s setter
|
||||
derives it), duplicates dropped, missing seeded + INSERTED, index 0, non-canonical stripped.
|
||||
`HealBackgrounds()` = Normalize + `StampDefaultBackgroundAsset` (pack-resource art via `AddAsset`;
|
||||
custom Browse wins). Called from LoadLayout, StagedScene setter, ReacquireScreenCaptures.
|
||||
2. **Settings purge:** `LayoutStore.Save` deletes orphaned `BackgroundUseDefault_{id}`/`BackgroundPath_{id}`
|
||||
keys (ids gone from Source). Fixes the real DB's 16 stale keys.
|
||||
3. **UI:** (+) menu Screen+Background items removed (`MainWindow.xaml`); `AddSource` refuses capture/background
|
||||
params. `CanChangeBackground` = staged-is-Live → gates preview CanvasGrid menu directly and the layer-row
|
||||
menu via new MultiBinding converter `Helpers/AllTrueToVisibilityConverter.cs` (row Tag carries VM bool).
|
||||
4. **Mini rule:** minis never render captures. `LoadBackgroundImage` is flavor-blind (`IsBackground`) — fixes
|
||||
green mini bug (was `Type==Background`, missed Live's DisplayCapture row → placeholder twin at old :951 too);
|
||||
`RefreshSnapshotsAsync` shows green placeholder only while Live is staged, otherwise its stored art.
|
||||
5. **Tests:** suite 221/218 → **223 total, 220 pass**. The ONE integration test:
|
||||
`BackgroundHealIntegrationTests.Dirty_Layout_Heals_To_One_Locked_Background_Per_Scene` (seeds dirty temp DB,
|
||||
real window, asserts heal + save purges keys). Unit: SceneCatalogTests rewritten (NormalizeBackgrounds heal +
|
||||
strip + per-scene flavor), BackgroundTests empty-scene flavor updated, SourceNamingTests filters IsBackground.
|
||||
The two stale landmine tests (#2/#3) are healed by this branch — see below.
|
||||
6. **Docs same commit:** ai.md (TASK 25 model section replaces backdrop-era text), TASKS.md TASK 25 entry,
|
||||
Services/index.md (LayoutStore purge), Helpers/index.md (new converter), this file.
|
||||
7. Build **0 warnings**.
|
||||
1. **Renamed + regated:** `CanAddWebcamToStagedScene` → **`CanAddWebcam`** =
|
||||
`StagedScene != null && _webcam == null` (`MainViewModel.cs:308`). Raised at all five sites:
|
||||
StagedScene setter, `ReacquireWebcam` (layout load), `OnElementsChanged`, `_webcam` create
|
||||
(`AddWebcamToStagedSceneAsync`), last-config removal (`RemoveElement`).
|
||||
2. **XAML:** the Webcam MenuItem's `IsEnabled` binding renamed to match; tooltip verbatim.
|
||||
3. **Test (Good Dog Rule — ONE):** `WebcamMenuGateTests.CanAddWebcam_Gates_On_The_AppWide_Webcam_Identity`
|
||||
— real window + temp DB seeded with a `Webcam` row + one config in Starting; asserts greyed while
|
||||
Live is staged (the old gate's false positive), greyed while Starting staged, re-enabled after
|
||||
`RemoveSourceCommand` drops the last config, and zero `Webcam` rows after save.
|
||||
4. **Suite: 224 total, 223 pass.** The only failure is the known pre-existing
|
||||
`AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback` (unrelated).
|
||||
Build 0 warnings.
|
||||
5. **Docs same commit:** ai.md (gate rule + rename; dropped the stale "empty-canvas right-click
|
||||
Show Webcam" claim — that XAML never shipped), TASKS.md TASK 3 row 27, this file.
|
||||
6. **Dead code flagged, not touched:** `ShowWebcamCommand` / `CanShowWebcamInStagedScene` are wired
|
||||
in the VM but bound nowhere — audit item, separate branch if wanted.
|
||||
|
||||
## ⚠️ Landmines
|
||||
|
||||
- **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 failure is now ONE (not caused by these branches):**
|
||||
1. `AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`
|
||||
- Former #2 SourceNaming / #3 SceneCatalog policy tests were repaired BY TASK 25 (expectation updates to the locked model) — not skipped, not deleted.
|
||||
- **Pre-existing test failure is ONE** (`AudioPipelineTests.Mix_HonorsProviderGains_AndGameMute_KillsTheLoopback`) — not caused by this branch.
|
||||
- **Real-MainWindow tests MUST set `LayoutPathOverride`** (ai.md) — DB pollution wiped real data once.
|
||||
- **`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 (`--tests:BackgroundHeal`), alternation regexes silently match nothing.
|
||||
- **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`.
|
||||
|
||||
## Next steps
|
||||
1. Commit this branch (code + docs, one commit), then merge/PR per Good Dog Rule (one integration test ✓).
|
||||
2. User visual pass on Windows: minis show art when unstaged (Live included), green placeholder while staged;
|
||||
no Game Capture rows in layer lists; (+) menu trimmed; capture controls only on staged Live.
|
||||
3. Then relaunch app once so the user's real `%APPDATA%` DB self-heals on load + first save purges stale keys.
|
||||
2. Creator visual pass on Windows: add a webcam to any scene → the (+) menu's Webcam row greys out everywhere; remove it → row re-enables.
|
||||
3. Then merge `task25-backgrounds` → main (still pending from last session), relaunch app once so the real `%APPDATA%` DB self-heals.
|
||||
|
||||
## Build
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user