test: lift coverage 41% → 76% (+1068 tests across 36 files)

Service-level tests now exercise provider, permissions, project, journal,
messaging, work_session, metrics, kanban, extraction, learning, notification,
dashboard, llm_routing, a2a, task, repository_base, audit, db_seed,
branch_name, indexed_document, query_helpers, agent. API route tests cover
provider, journal, project, sessions, dashboard, work_session, tasks, a2a,
groups, notifications, agents, channels, messages, kanban, api_resources.
Pure-function helpers covered: handlers, deps_helpers, middleware,
middleware_docs, transcription, pr templates, agents_config, errors,
logging, journal/notification/channel/a2a access, task_lifecycle,
streaming, converters, crypto, schemas (common + websocket), events,
permissions extras.

pyproject ruff per-file-ignores extended for tests so PLR2004 (status code
magic values), PLC0415 (lazy imports), PLR0913 (fixture params), ARG001
(unused fixture deps), SIM105, and E501 don't fight test idioms.
This commit is contained in:
Renn F
2026-05-06 00:32:52 +02:00
parent b6903490f1
commit 64c48356d0
46 changed files with 2994 additions and 206 deletions
+9 -4
View File
@@ -43,9 +43,7 @@ class _StubOptimal:
)
return self.results
async def search_learnings(
self, *, query: str, top_k: int
) -> list[SearchResult]:
async def search_learnings(self, *, query: str, top_k: int) -> list[SearchResult]:
self.search_learnings_calls.append({"query": query, "top_k": top_k})
return self.results
@@ -146,6 +144,7 @@ async def test_get_learnings_for_agent_returns_filtered_results(
) -> None:
aid = uuid4()
other_id = uuid4()
def _r(metadata: dict, score: float = 0.7) -> SearchResult:
return SearchResult(
content="x",
@@ -171,7 +170,13 @@ async def test_get_learnings_for_agent_returns_filtered_results(
team_other_role = _r({"scope": "team", "agent_role": "qa"})
org_visible = _r({"scope": "org", "agent_role": "qa"}, score=0.5)
stub = _StubOptimal(
results=[own_personal, other_personal, team_visible, team_other_role, org_visible]
results=[
own_personal,
other_personal,
team_visible,
team_other_role,
org_visible,
]
)
await svc.initialize(stub)
out = await svc.get_learnings_for_agent(aid, "developer")