feat: add active_view to StatePatch model and patch_state handler

- Add optional active_view field to StatePatch Pydantic model
- Add active_view handling in patch_state to persist the field
- Add test_patch_state_sets_active_view: verifies PATCH persists active_view
- Add test_patch_state_active_view_defaults_to_all: verifies GET returns 'all' by default

Closes task-1: Add active_view to StatePatch Model
This commit is contained in:
Brian Krabach
2026-04-15 16:56:43 -07:00
parent ab5560a623
commit b69a1f8c15
2 changed files with 36 additions and 0 deletions
+3
View File
@@ -423,6 +423,7 @@ class StatePatch(BaseModel):
session_order: list[str] | None = None
active_session: str | None = None
active_remote_id: str | None = None
active_view: str | None = None
class HeartbeatPayload(BaseModel):
@@ -495,6 +496,8 @@ async def patch_state(patch: StatePatch) -> dict:
state["active_session"] = patch.active_session
if "active_remote_id" in changed:
state["active_remote_id"] = patch.active_remote_id
if "active_view" in changed:
state["active_view"] = patch.active_view
save_state(state)
return state