Skip to content

Commit 064532c

Browse files
LEANDERANTONYclaude
andcommitted
fix(low): remove dead assistant client fn, keep route as fallback (L7)
Background: askWorkspaceAssistant (POST /workspace/assistant/answer) had no call site — the UI talks only to the SSE sibling — and was a parallel contract that could drift from the live stream (CONTRACT-1). Fix: delete the dead askWorkspaceAssistant client function and drop its now- unused WorkspaceAssistantResponse import from api.ts. Decision (surfaced for review): the report also suggested deleting the type and the backend route. I did NOT, because both are live/contradict the report's "dead" framing: - WorkspaceAssistantResponse is the streaming response shape rendered by the live AssistantPanel (and built in useAssistantHistory), so it stays. - The backend /assistant/answer route shares the SAME accounted path as the stream (one monthly assistant-turn counter) and is pinned by the quota / login-required / error-handling suites, so it can't silently drift. Per the report's sanctioned alternative I kept it and documented it as a tested lockstep fallback rather than deleting it plus its 5 test files (out of scope for a Low / would touch core assistant_service). Test: frontend vitest (33) + tsc + eslint clean; ruff clean on the backend docstring-only change. Fixes: L7 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7035d2f commit 064532c

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

backend/routers/workspace.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,17 @@ def answer_assistant_question(
11101110
payload: WorkspaceAssistantRequestModel,
11111111
auth_tokens=Depends(get_required_auth_tokens),
11121112
):
1113+
"""Non-streaming assistant answer — retained as a tested fallback (L1/L7).
1114+
1115+
The UI talks only to the SSE sibling below; the dead client wrapper
1116+
(``askWorkspaceAssistant``) was removed. This route is deliberately KEPT
1117+
rather than deleted (review L7): it shares the SAME accounted code path
1118+
(``answer_workspace_question`` -> assistant_service, one monthly
1119+
assistant-turn counter across both routes) and is pinned by the
1120+
quota / login-required / error-handling suites, so it cannot silently
1121+
drift from the stream. If a future change makes it a true parallel
1122+
contract instead of a thin sync mirror, delete it and its tests then.
1123+
"""
11131124
access_token, refresh_token = auth_tokens
11141125
try:
11151126
return answer_workspace_question(

frontend/src/lib/api.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import type {
3232
WorkspaceHandoffStartResponse,
3333
AssistantStreamEvent,
3434
WorkspaceAssistantRequest,
35-
WorkspaceAssistantResponse,
3635
WorkspaceJobDescriptionUploadResponse,
3736
WorkspaceQuotaResponse,
3837
WorkspaceResumeUploadResponse,
@@ -607,16 +606,6 @@ export async function getCustomerPortalUrl(): Promise<{ url: string }> {
607606
});
608607
}
609608

610-
export async function askWorkspaceAssistant(payload: WorkspaceAssistantRequest) {
611-
return request<WorkspaceAssistantResponse>("/workspace/assistant/answer", {
612-
method: "POST",
613-
headers: {
614-
"Content-Type": "application/json",
615-
},
616-
body: JSON.stringify(payload),
617-
});
618-
}
619-
620609
// ---------------------------------------------------------------------------
621610
// Streaming assistant: Server-Sent Events client.
622611
//

0 commit comments

Comments
 (0)