Skip to content

Commit e6f13c3

Browse files
LEANDERANTONYclaude
andcommitted
Workspace quota: use string literal for 401 detail (lint fix)
The /workspace/quota route was raising HTTPException(detail=str(exc)) which the project's test_backend_http_exceptions_use_friendly_detail static-analysis test flags as "leaky" — exc.repr() can leak internal state if a future refactor changes the WorkspaceQuotaAuthRequired type. Replace with a fixed string literal that matches the message WorkspaceQuotaAuthRequired itself uses at both raise sites. No behavior change for end users; the response detail text is identical. Full backend test suite: 450 passed (was 449 + 1 failure). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c57d658 commit e6f13c3

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

backend/routers/workspace.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,17 @@ def get_workspace_quota_route(auth_tokens=Depends(get_optional_auth_tokens)):
490490
access_token=access_token or "",
491491
refresh_token=refresh_token or "",
492492
)
493-
except WorkspaceQuotaAuthRequired as exc:
494-
raise HTTPException(status_code=401, detail=str(exc))
493+
except WorkspaceQuotaAuthRequired:
494+
# The exception's message is already user-facing, but the
495+
# error_messages lint specifically forbids `str(exc)` as a
496+
# detail source (it allows an exception's raw repr to leak
497+
# if a future refactor changes the type). Use a fixed string
498+
# literal so the lint stays clean. Matches the message text
499+
# WorkspaceQuotaAuthRequired itself uses at both raise sites.
500+
raise HTTPException(
501+
status_code=401,
502+
detail="Sign in to view your workspace quota.",
503+
)
495504
except AppError as error:
496505
_raise_http_error(error)
497506

0 commit comments

Comments
 (0)