fix(oauth): address Greptile P2 findings on #25923

- Drop the redundant decorator-level ``dependencies=[Depends(user_api_key_auth)]``
  on all 8 OAuth endpoints (4 each in chatgpt/copilot). The same dependency
  is already injected as a parameter, which runs it and binds the result —
  FastAPI's dependency cache makes the decorator-level duplicate a no-op at
  runtime, just visual noise.
- Finish the @tremor/react → antd migration in ``credentials.tsx``: rename
  the ``AntdButton`` alias to ``Button`` and remove the ``Button`` entry
  from the @tremor/react import, so the top-level "Add Credential" button
  also goes through antd. No rendered changes (antd Button's children +
  onClick API matches what that call site already used).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Cook 2026-04-16 20:53:22 -04:00
parent 98741dff72
commit 796e51713b
3 changed files with 4 additions and 13 deletions

View file

@ -114,7 +114,6 @@ def _get_session(session_id: str) -> Optional[Dict[str, Any]]:
@router.post(
"/start",
response_model=StartResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def start_oauth(
body: StartRequest,
@ -177,7 +176,6 @@ async def start_oauth(
@router.get(
"/status",
response_model=StatusResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_status(
session_id: str = Query(
@ -198,7 +196,6 @@ async def oauth_status(
@router.post(
"/cancel",
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_cancel(
session_id: str = Query(
@ -221,7 +218,6 @@ async def oauth_cancel(
@router.post(
"/refresh",
response_model=RefreshResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_refresh(
body: RefreshRequest,

View file

@ -101,7 +101,6 @@ def _get_session(session_id: str) -> Optional[Dict[str, Any]]:
@router.post(
"/start",
response_model=StartResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def start_oauth(
body: StartRequest,
@ -163,7 +162,6 @@ async def start_oauth(
@router.get(
"/status",
response_model=StatusResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_status(
session_id: str = Query(
@ -184,7 +182,6 @@ async def oauth_status(
@router.post(
"/cancel",
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_cancel(
session_id: str = Query(
@ -207,7 +204,6 @@ async def oauth_cancel(
@router.post(
"/refresh",
response_model=RefreshResponse,
dependencies=[Depends(user_api_key_auth)],
)
async def oauth_refresh(
body: RefreshRequest,

View file

@ -9,7 +9,6 @@ import {
import { PencilAltIcon, RefreshIcon, TrashIcon } from "@heroicons/react/outline";
import {
Badge,
Button,
Card,
Table,
TableBody,
@ -19,7 +18,7 @@ import {
TableRow,
Text,
} from "@tremor/react";
import { Button as AntdButton, Form, Tooltip } from "antd";
import { Button, Form, Tooltip } from "antd";
import { UploadProps } from "antd/es/upload";
import { useState } from "react";
import DeleteResourceModal from "../common_components/DeleteResourceModal";
@ -192,7 +191,7 @@ const CredentialsPanel: React.FC<CredentialsPanelProps> = ({ uploadProps }) => {
</TableCell>
<TableCell>
<Tooltip title="Edit">
<AntdButton
<Button
type="text"
size="small"
icon={<PencilAltIcon className="w-4 h-4" />}
@ -204,7 +203,7 @@ const CredentialsPanel: React.FC<CredentialsPanelProps> = ({ uploadProps }) => {
</Tooltip>
{getOAuthRefreshCall(credential) && (
<Tooltip title="Refresh OAuth tokens">
<AntdButton
<Button
type="text"
size="small"
icon={<RefreshIcon className="w-4 h-4" />}
@ -214,7 +213,7 @@ const CredentialsPanel: React.FC<CredentialsPanelProps> = ({ uploadProps }) => {
</Tooltip>
)}
<Tooltip title="Delete">
<AntdButton
<Button
type="text"
size="small"
icon={<TrashIcon className="w-4 h-4" />}