* feat(workspace): add Todos tab to workspace panel behind a setting (#2942) * fix(workspace): use DOM attribute to check active tab across script scope * Prefer the live todos snapshot in the workspace tab * Fill the missing workspace Todos locale keys * feat(workspace): add optional Todos tab to workspace panel (#3564) Rebased rodboev's #3564 onto current master + CHANGELOG entry. Co-authored-by: Rod Boev <rod.boev@gmail.com> * fix(#3564): apply workspace Todos tab visibility on cold boot Codex gate: boot.js set window._workspaceTodosTab from saved settings but never called _applyWorkspaceTodosTabVisibility(), so a previously-enabled Todos tab stayed hidden on a normal page reload (only re-appeared after opening Settings). Call the visibility helper after assigning the flag in both the settings-apply and the fallback/default paths. Co-authored-by: Rod Boev <rod.boev@gmail.com> * chore(release): stamp v0.51.422 (Release OI) for #3564 --------- Co-authored-by: Rod Boev <rod.boev@gmail.com> Co-authored-by: nesquena-hermes <agent@nesquena-hermes>
55 lines
2.2 KiB
Python
55 lines
2.2 KiB
Python
from pathlib import Path
|
|
|
|
|
|
REPO_ROOT = Path(__file__).parent.parent
|
|
|
|
|
|
def test_ensure_messages_loaded_hydrates_session_todo_state_sidecar():
|
|
src = (REPO_ROOT / "static" / "sessions.js").read_text(encoding="utf-8")
|
|
|
|
assert "if(data.session.todo_state !== undefined)" in src
|
|
assert "S.session.todo_state = data.session.todo_state" in src
|
|
assert "delete S.session.todo_state" in src
|
|
assert "_hydrateTodosFromSession(S.session)" in src
|
|
assert "scheduleTodosRefresh()" in src
|
|
|
|
|
|
def test_load_todos_renders_single_source_of_truth_before_legacy_scan():
|
|
src = (REPO_ROOT / "static" / "panels.js").read_text(encoding="utf-8")
|
|
start = src.find("function loadTodos()")
|
|
end = src.find("function _legacyTodosFromMessages()")
|
|
|
|
assert start != -1
|
|
assert end != -1
|
|
load_todos = src[start:end]
|
|
|
|
assert "if (S.todoStateMeta)" in load_todos
|
|
assert "todos = Array.isArray(S.todos) ? S.todos : [];" in load_todos
|
|
assert "todos = _legacyTodosFromMessages();" in load_todos
|
|
assert load_todos.find("todos = Array.isArray(S.todos) ? S.todos : [];") < load_todos.find("todos = _legacyTodosFromMessages();")
|
|
|
|
|
|
def test_legacy_todos_fallback_still_uses_raw_session_messages():
|
|
src = (REPO_ROOT / "static" / "panels.js").read_text(encoding="utf-8")
|
|
|
|
assert "function _legacyTodosFromMessages()" in src
|
|
assert "const sourceMessages = (S.session && Array.isArray(S.session.messages) && S.session.messages.length) ? S.session.messages : S.messages;" in src
|
|
|
|
|
|
def test_workspace_todos_tab_prefers_live_sse_snapshot_before_cold_load_sidecar():
|
|
src = (REPO_ROOT / "static" / "workspace.js").read_text(encoding="utf-8")
|
|
start = src.find("function _loadWorkspacePanelTodos()")
|
|
end = src.find("function _escHtml", start)
|
|
|
|
assert start != -1
|
|
assert end != -1
|
|
helper = src[start:end]
|
|
|
|
assert "if(S && Array.isArray(S.todos)){" in helper
|
|
assert "todos = S.todos;" in helper
|
|
assert "S.session.todo_state" in helper
|
|
assert helper.find("todos = S.todos;") < helper.find("S.session.todo_state"), (
|
|
"Workspace Todos must prefer the live S.todos snapshot so opening the tab "
|
|
"after todo_state SSE updates does not render the stale cold-load sidecar"
|
|
)
|