From 01d99b4d8f63949e18e5ccac35704f7129d55911 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 03:08:10 +0000 Subject: [PATCH] style(steam): format the Steam sign-in change and drop a stale import Runs the formatters trunk pins over the files it flagged (black, isort and prettier), and removes the Steam Web API middleware import that the removed ResolveVanityURL tests left behind. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NH5s4gb7QNE7xa4pRUsBzx --- backend/adapters/services/steam.py | 4 +--- backend/endpoints/user.py | 7 +++---- backend/tests/adapters/services/test_steam_openid.py | 4 +++- backend/tests/adapters/services/test_steam_web_api.py | 6 +----- backend/tests/endpoints/test_user_steam.py | 4 +--- .../src/components/Settings/SteamLibrarySection.test.ts | 4 +++- frontend/src/components/Settings/SteamLibrarySection.vue | 2 +- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/backend/adapters/services/steam.py b/backend/adapters/services/steam.py index 383e409fa..05f091ab7 100644 --- a/backend/adapters/services/steam.py +++ b/backend/adapters/services/steam.py @@ -430,9 +430,7 @@ class SteamOpenIDService: log.error("Could not verify a Steam sign-in: %s", exc) return None - if not any( - line.strip() == "is_valid:true" for line in body.splitlines() - ): + if not any(line.strip() == "is_valid:true" for line in body.splitlines()): return None claimed = _STEAM_OPENID_CLAIMED_ID.match(params.get("openid.claimed_id", "")) diff --git a/backend/endpoints/user.py b/backend/endpoints/user.py index e85392f57..49fc3cbd1 100644 --- a/backend/endpoints/user.py +++ b/backend/endpoints/user.py @@ -1,13 +1,12 @@ import asyncio import json import secrets -from urllib.parse import quote from typing import Annotated, Any, Final, cast +from urllib.parse import quote from fastapi import Body, Form, HTTPException -from fastapi import Query from fastapi import Path as PathVar -from fastapi import Request, status +from fastapi import Query, Request, status from fastapi.responses import FileResponse, RedirectResponse from adapters.services.steam import SteamOpenIDService @@ -58,7 +57,6 @@ from handler.steam_library_handler import ( unlink_steam_profile, ) from logger.logger import log -from utils.urls import get_public_base_url from models.audit_event import AuditAction from models.notification import NotificationKind, NotificationLevel from models.user import TEXT_FIELD_LENGTH, Role, User @@ -68,6 +66,7 @@ from tasks.registry import ( enqueue_task, ) from utils.router import APIRouter +from utils.urls import get_public_base_url from utils.validation import ( ValidationError, validate_email, diff --git a/backend/tests/adapters/services/test_steam_openid.py b/backend/tests/adapters/services/test_steam_openid.py index d4dd5dd33..373c327aa 100644 --- a/backend/tests/adapters/services/test_steam_openid.py +++ b/backend/tests/adapters/services/test_steam_openid.py @@ -35,7 +35,9 @@ def test_the_login_url_asks_steam_to_pick_the_identity(): async def test_an_assertion_steam_signs_yields_its_steam_id(session: AsyncMock): - session.post.return_value = _response("ns:http://specs.openid.net/auth/2.0\nis_valid:true\n") + session.post.return_value = _response( + "ns:http://specs.openid.net/auth/2.0\nis_valid:true\n" + ) steam_id = await SteamOpenIDService().verify( {"openid.mode": "id_res", "openid.claimed_id": CLAIMED_ID} diff --git a/backend/tests/adapters/services/test_steam_web_api.py b/backend/tests/adapters/services/test_steam_web_api.py index 4bcba3103..7424ba66b 100644 --- a/backend/tests/adapters/services/test_steam_web_api.py +++ b/backend/tests/adapters/services/test_steam_web_api.py @@ -5,11 +5,7 @@ import aiohttp import pytest from tests.factories import STEAM_ID -from adapters.services.steam import ( - SteamWebAPIError, - SteamWebApiService, - web_api_key_middleware, -) +from adapters.services.steam import SteamWebAPIError, SteamWebApiService def _response(json_body: object) -> MagicMock: diff --git a/backend/tests/endpoints/test_user_steam.py b/backend/tests/endpoints/test_user_steam.py index d54f1d161..616eac6a9 100644 --- a/backend/tests/endpoints/test_user_steam.py +++ b/backend/tests/endpoints/test_user_steam.py @@ -69,9 +69,7 @@ def verify_sign_in(): def _start_login(client: TestClient, user: User, token: str) -> str: """Begin a sign-in and hand back the nonce it bound to the session.""" - response = client.get( - f"/api/users/{user.id}/steam/login", headers=_bearer(token) - ) + response = client.get(f"/api/users/{user.id}/steam/login", headers=_bearer(token)) assert response.status_code == status.HTTP_200_OK url = str(response.json()["url"]) return url.split("state%3D")[-1].split("&")[0] diff --git a/frontend/src/components/Settings/SteamLibrarySection.test.ts b/frontend/src/components/Settings/SteamLibrarySection.test.ts index cba948a79..50bae8067 100644 --- a/frontend/src/components/Settings/SteamLibrarySection.test.ts +++ b/frontend/src/components/Settings/SteamLibrarySection.test.ts @@ -23,7 +23,9 @@ vi.mock("@/services/api/user", () => ({ vi.mock("@/composables/useSnackbar", () => ({ useSnackbar: () => snackbar })); vi.mock("@/composables/useConfirm", () => ({ useConfirm: () => confirm })); vi.mock("@/composables/useSocketEvent", () => ({ useSocketEvent: vi.fn() })); -vi.mock("vue-router", () => ({ useRoute: () => ({ fullPath: "/settings/user/1" }) })); +vi.mock("vue-router", () => ({ + useRoute: () => ({ fullPath: "/settings/user/1" }), +})); function mountSection() { return mount(SteamLibrarySection, { diff --git a/frontend/src/components/Settings/SteamLibrarySection.vue b/frontend/src/components/Settings/SteamLibrarySection.vue index c90e80fe5..833338cc4 100644 --- a/frontend/src/components/Settings/SteamLibrarySection.vue +++ b/frontend/src/components/Settings/SteamLibrarySection.vue @@ -3,8 +3,8 @@ // the games it owns. The import runs as a task whose completion arrives as a // notification, which also refreshes the owned count shown here. import { computed, ref } from "vue"; -import { useRoute } from "vue-router"; import { useI18n } from "vue-i18n"; +import { useRoute } from "vue-router"; import SettingsSection from "@/components/Settings/SettingsSection.vue"; import { useConfirm } from "@/composables/useConfirm"; import { useSnackbar } from "@/composables/useSnackbar";