87509bcf99
TASKS.md is now the index (status table, open items, research pointer). 33 files: 32 task files + 1 research facts file. The full take-saga narrative and all design decisions are preserved verbatim; the catalog makes the queue readable without opening every task body. Schema and AGENTS.md updated to reflect the new layout.
4.5 KiB
4.5 KiB
TASK 5 — Layout Persistence (SQLite)
Catalog:
TASKS.md— status and requirements live here.
Goal: Scenes, sources, and asset bytes survive restarts; assets are always available.
Status: ✅ Done
- ✅ SQLite database (
Microsoft.Data.Sqlite) at%APPDATA%\ytLlive\ytLlive.db; schema versioned viaPRAGMA user_version(currently v8) - ✅ Assets live in the DB (BLOB keyed by SHA-256 content hash), never file paths — deleting the original file never breaks a scene
- ✅ File-model save/open — the active layout file is tracked (default is the AppData DB); Save Layout As… / Open Layout… switch the active file; auto-save writes to whatever is active
- ✅ Auto-save (invisible) — ~1.5s debounce on scene/source add/remove/reorder/rename/hide + any source transform change; flush on window close
- ✅ Startup — load the active file; seed the five canonical scenes only when the DB is empty; (+) re-adds a missing canonical scene and is hidden once all five are present; adding beyond the five is rejected
- ✅ Schema v1 → v9 — webcam columns (v2), singleton
Webcam+ per-sceneWebcamSceneConfig(v3),RectWidth/RectHeightround-to-rect restore (v4),Source.IsBackdrop+Source.CaptureKey(v5),Scene.HasBackdrop— backdrop Live-only by policy (v6, one-time backfill +EnforceBackdropPolicyon every load),Scene.HasSocialBar(v7, dropped per-scene toggle — column back-compat, unread),Socials.BarEnabled(v8); theSocialEntry.Softwarefediverse-software column is a column-presence migration (commented v8→v9, no version bump —user_versionstays 8); v9 = single-rowMusic. Load-time rule: sources load withIsBackgroundderived fromType(OR'd with the persisted column so legacy DisplayCapture backdrops keep their flag) — rows saved before the Type setter derived the flag heal on load - ✅ WindowHandle stays in-memory (per-session); save = transactional rewrite; orphaned assets pruned. v9 lands in the TASK 8 audio milestone (single-row
Music—TrackPath/IsEnabled)
Design decisions
- SQLite database (
Microsoft.Data.Sqlite) at%APPDATA%\ytLlive\ytLlive.db; schema versioned viaPRAGMA user_version. - Assets live in the DB, not on disk —
Assettable stores image bytes (BLOB) keyed by a SHA-256 content hash (unique). Identical image content collapses to one row regardless of file name — the 1:M resource memory model, enforced by the database. No file paths; deleting the original file never breaks a scene. - File-model save/open — the active layout file is tracked (default is the AppData DB). Save Layout As… / Open Layout… switch the active file; auto-save writes to whatever is active.
- Auto-save (invisible) — ~1.5s debounce on scene add/remove/reorder/rename/hide, source add/remove/reorder, and any source transform change; flush on window close.
- Schema —
Scene(Id, Name, IsHidden, IsChatScene, HasBackdrop, HasSocialBar, SortOrder),Asset(Id, Hash, Data, PixelWidth, PixelHeight),Source(Id, SceneId FK cascade, AssetId FK, Type, Name, IsEnabled, X/Y/Width/Height/Opacity, MonitorIndex, DeviceId, ClipShape, IsMirrored, SortOrder),Socials(Id, BarPosition, BarJustify — back-compat, unread, BarEnabled added viaALTER),SocialEntry(Id, SocialsId FK cascade, Service, Handle, ProfileUrl, SortOrder) —user_version8 (v1 → v2 =ALTER TABLEadds the two webcam columns; v3 = singletonWebcam+ per-sceneWebcamSceneConfig; v4 =WebcamSceneConfig.RectWidth/RectHeightfor the round-to-rect restore; v5 =Source.IsBackdropSource.CaptureKeyfor the live-capture backdrop; v6 =Scene.HasBackdrop— the backdrop is Live-only by policy (one-time backfill turns Starting/BRB/Chat/Ending off and drops their backdrop sources;EnforceBackdropPolicyre-normalizes every load); v7 =Scene.HasSocialBar(per-scene toggle dropped — column back-compat, unread); v8 =Socials.BarEnabled). TheSocialEntry.Softwarefediverse-software column is a column-presence migration (commented v8→v9, no version bump).WindowHandlestays in-memory (per-session). Save = transactional rewrite; orphaned assets pruned.
- Startup — load the active file; seed the five canonical scenes
(Starting/Live/BRB/Chat/Ending,
SceneCatalog) only when the DB is empty. The (+) button re-adds a missing canonical scene and is hidden once all five are present; adding beyond the five is rejected — work with less, never more.