Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: restore preview calendar and navigation workspace boundaries

Bingxi Zhao (Frank)be596676f7b1
diff --git a/deeptutor/api/router_index.json b/deeptutor/api/router_index.json
index cc062abc7..e560993e1 100644
--- a/deeptutor/api/router_index.json
+++ b/deeptutor/api/router_index.json
@@ -1,5 +1,5 @@
{
- "fingerprint": "39e095699ef95c409b94376835454f31477f80483d9720204b85d691a2d2b644",
+ "fingerprint": "81e22e02ef6afd3b4b0561d4df2d76624bfede2d1f35abef5d191b7ab435a862",
"routers": {
"deeptutor.api.routers.auth:router": [
{
diff --git a/deeptutor/api/routers/dashboard.py b/deeptutor/api/routers/dashboard.py
index f9a91ab13..a27728edd 100644
--- a/deeptutor/api/routers/dashboard.py
+++ b/deeptutor/api/routers/dashboard.py
@@ -8,12 +8,14 @@ any single segment, so every literal path must be declared above it or it will
never be reached.
"""
+import logging
from typing import Any
from fastapi import APIRouter, HTTPException
from deeptutor.services.session import get_session_store
+logger = logging.getLogger(__name__)
router = APIRouter()
@@ -108,7 +110,6 @@ async def get_learning_index():
from deeptutor.api.routers.mastery_path import list_topics
from deeptutor.api.routers.reading import list_workspaces
from deeptutor.multi_user.learning_access import learning_surface_allowed
- from deeptutor.services.workspace.navigation import read_workspace_indexes
async def books():
return (await list_books())["books"]
@@ -152,8 +153,10 @@ async def get_learning_index():
result[kind] = []
if not learning_surface_allowed(surface):
continue
- result[kind], unavailable = await read_workspace_indexes(reader)
- if unavailable:
+ try:
+ result[kind] = await _workspace_rows(reader)
+ except Exception:
+ logger.warning("Workspace learning index unavailable: %s", kind, exc_info=True)
failed.append(kind)
return {"sources": result, "failed": failed}
diff --git a/deeptutor/services/calendar/layers.py b/deeptutor/services/calendar/layers.py
index 9278dba66..c18c6b2b3 100644
--- a/deeptutor/services/calendar/layers.py
+++ b/deeptutor/services/calendar/layers.py
@@ -69,7 +69,8 @@ def read_layers(workspace_id, start, end, tzid):
footprint(row[0]).mastery_evidence += 1
practice = PracticeStore(get_sqlite_session_store().db_path)
- scope, _params = practice._scope(None)
+ # The database is already workspace-scoped; match PracticeStore’s live-entry filter.
+ scope = "(n.session_id IS NULL OR s.deleted_at IS NULL)"
with practice.connect() as db:
for row in db.execute(
f"SELECT {_DUE_AT_SQL} AS due FROM notebook_entries n LEFT JOIN sessions s ON s.id=n.session_id LEFT JOIN practice_review_state r ON r.entry_id=n.id WHERE {scope} AND {_DUE_AT_SQL}>=? AND {_DUE_AT_SQL}<?",
diff --git a/tests/app/test_multiworker_turn_application.py b/tests/app/test_multiworker_turn_application.py
index c06a6be00..03993cf1c 100644
--- a/tests/app/test_multiworker_turn_application.py
+++ b/tests/app/test_multiworker_turn_application.py
@@ -11,6 +11,10 @@ from deeptutor.runtime.coordination import MemoryCoordinator
from deeptutor.services.session.sqlite_store import SQLiteSessionStore
from deeptutor.services.session.turn_runtime import TurnRuntimeManager
from deeptutor.services.workspace.activity import data_activity
+from tests.services.workspace.test_data_scope import account as account
+
+# Each test owns its maintenance-lock database as well as its session database.
+pytestmark = pytest.mark.usefixtures("account")
class _ContextBuilder:
diff --git a/tests/services/session/test_turn_admission_lease.py b/tests/services/session/test_turn_admission_lease.py
index 02c1f4cf1..82c3111a0 100644
--- a/tests/services/session/test_turn_admission_lease.py
+++ b/tests/services/session/test_turn_admission_lease.py
@@ -30,7 +30,7 @@ async def test_rejected_admission_releases_coordinator_lease(tmp_path, monkeypat
}
if failure == "selection":
payload["config"] = {"selection_tutor_context": {"selected_text": " "}}
- expected = "requires selected text"
+ expected = "needs selected text or the conversation"
else:
async def reject(*args, **kwargs):
diff --git a/tests/services/test_subagent_backends.py b/tests/services/test_subagent_backends.py
index 28cf176b0..ee09e9e75 100644
--- a/tests/services/test_subagent_backends.py
+++ b/tests/services/test_subagent_backends.py
@@ -959,6 +959,7 @@ class _FakePartnerManager:
def __init__(
self, *, exists: bool = True, running: bool = True, reply: str = "Hi from partner."
) -> None:
+ self._partners = {}
self._exists = exists
self._running = running
self._reply = reply
diff --git a/tests/tools/test_kb_files_tool.py b/tests/tools/test_kb_files_tool.py
index f3fabfef0..b2289111f 100644
--- a/tests/tools/test_kb_files_tool.py
+++ b/tests/tools/test_kb_files_tool.py
@@ -103,6 +103,8 @@ class TestMountGate:
"workspace_read",
"workspace_search",
"workspace_present",
+ "write_note",
+ "search_notes",
"obsidian_read",
"rag",
"kb_files",