From 6cc3c09e02b4ca335f06746359a7e56790b6ffed Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 07:50:55 -0500 Subject: [PATCH 01/52] fix(streaming): stack the fleet row actions under the details on phones The two action buttons never shrink, so at phone width they squeezed the container details to nothing: the name wrapped a character at a time and the host and session lines disappeared. On xs the actions now take their own line. The session line also lost the space before the username, since Vue condenses away whitespace between adjacent template blocks; it is now built in script. --- .../components/Settings/StreamingSection.vue | 91 ++++++++++++------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/frontend/src/v2/components/Settings/StreamingSection.vue b/frontend/src/v2/components/Settings/StreamingSection.vue index d735824b6..486e34da2 100644 --- a/frontend/src/v2/components/Settings/StreamingSection.vue +++ b/frontend/src/v2/components/Settings/StreamingSection.vue @@ -93,8 +93,22 @@ async function release(container: AdminStreamingContainer): Promise { function sessionLabel(container: AdminStreamingContainer): string { const session = container.session; if (!session) return t("settings.streaming-idle"); - if (session.desktop) return t("settings.streaming-desktop-session"); - return session.rom_name ?? t("settings.streaming-unknown-game"); + const parts = [ + session.desktop + ? t("settings.streaming-desktop-session") + : (session.rom_name ?? t("settings.streaming-unknown-game")), + ]; + if (session.claimed_at) { + parts.push( + t("settings.streaming-since", { + time: formatTimestamp(session.claimed_at, locale.value), + }), + ); + } + if (session.username) { + parts.push(t("settings.streaming-by", { user: session.username })); + } + return parts.join(" "); } onMounted(load); @@ -164,42 +178,32 @@ onMounted(load); {{ sessionLabel(container) }} - - - - {{ t("settings.streaming-open-desktop") }} - - - {{ t("settings.streaming-release") }} - +
+ + {{ t("settings.streaming-open-desktop") }} + + + {{ t("settings.streaming-release") }} + +
@@ -255,6 +259,23 @@ onMounted(load); white-space: nowrap; } +.r-v2-streaming__actions { + display: flex; + align-items: center; + gap: 12px; + flex-shrink: 0; +} + +/* The actions do not shrink, so on a phone they take their own line under + the details, indented past the icon (18px) and the row gap (12px). */ +html[data-bp~="xs"] .r-v2-streaming__row { + flex-wrap: wrap; +} +html[data-bp~="xs"] .r-v2-streaming__actions { + flex-basis: 100%; + padding-inline-start: 30px; +} + .r-v2-streaming__warning { font-size: var(--r-font-size-xs); color: var(--r-color-danger-fg); From 339308d586f6463d5004953e0ca30c13f7cb5f94 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 07:58:07 -0500 Subject: [PATCH 02/52] fix(streaming): resolve a named container by key, not through the pool An admin ending a session names the container, but the lookup went through containers_for_platform, which drops any container that disagrees with the head of the pool. A second container with a different emulator, card sync, save picker or protocol then 404'd on release, surfacing as "Could not end the session." in the fleet panel, while its session kept holding it. The named lookup now goes through containers_by_key and only checks that the container serves the platform. Owner checks are unchanged. --- backend/handler/streaming/access.py | 14 ++++++++----- backend/tests/endpoints/test_streaming.py | 25 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index c202c2a0a..20522f252 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -111,15 +111,19 @@ async def resolve_named_container( ) -> tuple[ResolvedContainer, str, dict[str, Any] | None]: """One named container serving a platform, plus whatever session it holds. + Looked up by key rather than through the platform's pool: a container left + out of the pool can still hold a session, and naming it is how that + session gets ended. + Returns (container, session_key, session), the session being None when the container is free or draining. Raises 404 when the key names no container serving this platform. """ - for candidate in containers_for_platform(platform): - session_key = candidate.key - if session_key != container_key: - continue - return candidate, session_key, await get_live_session(session_key) + entries = containers_by_key().get(container_key, []) if container_key else [] + lower = platform.lower() + for candidate in entries: + if candidate.platform.lower() == lower: + return candidate, container_key, await get_live_session(container_key) raise HTTPException( status_code=404, detail=f"No streaming container '{container_key}' for platform '{platform}'", diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index ba723c0f3..786c4fef2 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1374,6 +1374,31 @@ def test_admin_release_rejects_a_container_that_serves_another_platform( assert r.status_code == 404 +def test_admin_release_ends_a_session_on_a_container_outside_the_pool( + client, access_token +): + """A second container that disagrees with the first on an emulator is not + a pool member, but its desktop is still a session an admin must be able to + end by naming the container.""" + outside = _webstation( + host="http://192.168.1.11:3000", + broker_host="http://192.168.1.11:8000", + platforms={"ps2": "play", "ngc": "dolphin"}, + ) + with _streaming(_webstation(), outside): + key = _key_of(outside) + assert _desktop(client, access_token, key)[0].status_code == 200 + with patch("handler.streaming.commands.stop", return_value=None): + r = client.delete( + "/api/streaming/sessions/ps2", + params={"container": key}, + headers=_auth(access_token), + ) + assert r.status_code == 200 + assert r.json()["status"] == "released" + assert _session_raw(outside) is None + + def test_status_finds_the_termination_on_whichever_container_held_it( client, access_token, viewer_access_token, rom: Rom ): From 67b54c6663d35502cd8c78cb393a1b19222ce073 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 08:09:43 -0500 Subject: [PATCH 03/52] review(pr-ready step 2): lay the fleet row on a grid, pin the pool exclusion The phone indent no longer hard-codes the icon size plus the row gap: the row is a grid and the actions span from the details column. sessionState names what the helper now returns, and the regression test asserts the container really is outside the ps2 pool. --- backend/tests/endpoints/test_streaming.py | 1 + .../components/Settings/StreamingSection.vue | 21 +++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index 786c4fef2..c504fc669 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1387,6 +1387,7 @@ def test_admin_release_ends_a_session_on_a_container_outside_the_pool( ) with _streaming(_webstation(), outside): key = _key_of(outside) + assert key not in [c.key for c in streaming.containers_for_platform("ps2")] assert _desktop(client, access_token, key)[0].status_code == 200 with patch("handler.streaming.commands.stop", return_value=None): r = client.delete( diff --git a/frontend/src/v2/components/Settings/StreamingSection.vue b/frontend/src/v2/components/Settings/StreamingSection.vue index 486e34da2..3b7ddf996 100644 --- a/frontend/src/v2/components/Settings/StreamingSection.vue +++ b/frontend/src/v2/components/Settings/StreamingSection.vue @@ -90,7 +90,7 @@ async function release(container: AdminStreamingContainer): Promise { } } -function sessionLabel(container: AdminStreamingContainer): string { +function sessionState(container: AdminStreamingContainer): string { const session = container.session; if (!session) return t("settings.streaming-idle"); const parts = [ @@ -177,7 +177,7 @@ onMounted(load); {{ t("settings.streaming-unusable") }} - {{ sessionLabel(container) }} + {{ sessionState(container) }} @@ -219,7 +219,8 @@ onMounted(load); } .r-v2-streaming__row { - display: flex; + display: grid; + grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; @@ -231,7 +232,6 @@ onMounted(load); .r-v2-streaming__icon { color: var(--r-color-fg-muted); - flex-shrink: 0; } .r-v2-streaming__icon--busy { color: var(--r-color-brand-primary); @@ -241,8 +241,6 @@ onMounted(load); display: flex; flex-direction: column; gap: 2px; - flex: 1; - min-width: 0; } .r-v2-streaming__name { @@ -263,17 +261,12 @@ onMounted(load); display: flex; align-items: center; gap: 12px; - flex-shrink: 0; } -/* The actions do not shrink, so on a phone they take their own line under - the details, indented past the icon (18px) and the row gap (12px). */ -html[data-bp~="xs"] .r-v2-streaming__row { - flex-wrap: wrap; -} +/* On a phone the actions would squeeze the details to nothing, so they drop + to their own line under the details column. */ html[data-bp~="xs"] .r-v2-streaming__actions { - flex-basis: 100%; - padding-inline-start: 30px; + grid-column: 2 / -1; } .r-v2-streaming__warning { From bdd661d30ad9a1e17adc90f9bb64c1af13d28bc9 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 08:14:41 -0500 Subject: [PATCH 04/52] simplify(pr-ready step 3): share the per-platform entry lookup, build the state line in one place entry_for_platform backs both container_for_session and resolve_named_container, and the fleet row's state line is assembled in sessionState instead of split across template blocks. --- backend/handler/streaming/access.py | 8 ++++---- backend/handler/streaming/config.py | 16 ++++++++++------ .../v2/components/Settings/StreamingSection.vue | 16 ++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index 20522f252..9552c15d1 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -10,6 +10,7 @@ from handler.streaming.config import ( ResolvedContainer, containers_by_key, containers_for_platform, + entry_for_platform, ) from handler.streaming.session_store import get_live_session from models.rom import Rom @@ -120,10 +121,9 @@ async def resolve_named_container( serving this platform. """ entries = containers_by_key().get(container_key, []) if container_key else [] - lower = platform.lower() - for candidate in entries: - if candidate.platform.lower() == lower: - return candidate, container_key, await get_live_session(container_key) + candidate = entry_for_platform(entries, platform) + if candidate is not None: + return candidate, container_key, await get_live_session(container_key) raise HTTPException( status_code=404, detail=f"No streaming container '{container_key}' for platform '{platform}'", diff --git a/backend/handler/streaming/config.py b/backend/handler/streaming/config.py index db47f958f..6fff5d6f5 100644 --- a/backend/handler/streaming/config.py +++ b/backend/handler/streaming/config.py @@ -560,6 +560,14 @@ def containers_by_key() -> dict[str, list[ResolvedContainer]]: return grouped +def entry_for_platform( + entries: list[ResolvedContainer], platform: str +) -> ResolvedContainer | None: + """The record among one container's entries that serves this platform.""" + lower = platform.lower() + return next((e for e in entries if e.platform.lower() == lower), None) + + def container_for_session( grouped: dict[str, list[ResolvedContainer]], container_key: str, platform: Any ) -> ResolvedContainer | None: @@ -569,12 +577,8 @@ def container_for_session( entries = grouped.get(container_key) if not entries: return None - if isinstance(platform, str): - lower = platform.lower() - for entry in entries: - if entry.platform.lower() == lower: - return entry - return entries[0] + entry = entry_for_platform(entries, platform) if isinstance(platform, str) else None + return entry or entries[0] def configured_emulator(platform: str) -> str: diff --git a/frontend/src/v2/components/Settings/StreamingSection.vue b/frontend/src/v2/components/Settings/StreamingSection.vue index 3b7ddf996..49283c71b 100644 --- a/frontend/src/v2/components/Settings/StreamingSection.vue +++ b/frontend/src/v2/components/Settings/StreamingSection.vue @@ -93,22 +93,18 @@ async function release(container: AdminStreamingContainer): Promise { function sessionState(container: AdminStreamingContainer): string { const session = container.session; if (!session) return t("settings.streaming-idle"); - const parts = [ + return [ session.desktop ? t("settings.streaming-desktop-session") : (session.rom_name ?? t("settings.streaming-unknown-game")), - ]; - if (session.claimed_at) { - parts.push( + session.claimed_at && t("settings.streaming-since", { time: formatTimestamp(session.claimed_at, locale.value), }), - ); - } - if (session.username) { - parts.push(t("settings.streaming-by", { user: session.username })); - } - return parts.join(" "); + session.username && t("settings.streaming-by", { user: session.username }), + ] + .filter(Boolean) + .join(" "); } onMounted(load); From 398c088d4930d52ddef86318236dad9b812cace2 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 08:19:22 -0500 Subject: [PATCH 05/52] polish(pr-ready step 4): wrap the fleet row's state line and actions, trim prose At 320px the End session button ran past the row, and below md the state line truncated away who holds the session. The actions now wrap and the state line wraps at every width. Docstrings and the xs comment are cut to the repo's two-line limit. --- backend/handler/streaming/access.py | 5 ++--- backend/tests/endpoints/test_streaming.py | 5 ++--- frontend/src/v2/components/Settings/StreamingSection.vue | 6 ++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index 9552c15d1..9c0a31e13 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -112,9 +112,8 @@ async def resolve_named_container( ) -> tuple[ResolvedContainer, str, dict[str, Any] | None]: """One named container serving a platform, plus whatever session it holds. - Looked up by key rather than through the platform's pool: a container left - out of the pool can still hold a session, and naming it is how that - session gets ended. + Found by key rather than through the pool, so a session on a container left + out of the pool can still be ended. Returns (container, session_key, session), the session being None when the container is free or draining. Raises 404 when the key names no container diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index c504fc669..8295aabb4 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1377,9 +1377,8 @@ def test_admin_release_rejects_a_container_that_serves_another_platform( def test_admin_release_ends_a_session_on_a_container_outside_the_pool( client, access_token ): - """A second container that disagrees with the first on an emulator is not - a pool member, but its desktop is still a session an admin must be able to - end by naming the container.""" + """A container that disagrees with the pool on an emulator is left out of it, + but an admin can still end its session by naming it.""" outside = _webstation( host="http://192.168.1.11:3000", broker_host="http://192.168.1.11:8000", diff --git a/frontend/src/v2/components/Settings/StreamingSection.vue b/frontend/src/v2/components/Settings/StreamingSection.vue index 49283c71b..ee9eb6932 100644 --- a/frontend/src/v2/components/Settings/StreamingSection.vue +++ b/frontend/src/v2/components/Settings/StreamingSection.vue @@ -248,6 +248,8 @@ onMounted(load); .r-v2-streaming__state { font-size: var(--r-font-size-xs); color: var(--r-color-fg-muted); +} +.r-v2-streaming__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -255,12 +257,12 @@ onMounted(load); .r-v2-streaming__actions { display: flex; + flex-wrap: wrap; align-items: center; gap: 12px; } -/* On a phone the actions would squeeze the details to nothing, so they drop - to their own line under the details column. */ +/* On a phone the actions drop under the details instead of squeezing them out. */ html[data-bp~="xs"] .r-v2-streaming__actions { grid-column: 2 / -1; } From 753d7c5f43683734ea1edb35ac351c38b6007376 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 09:27:34 -0500 Subject: [PATCH 06/52] fix(streaming): let a desktop heartbeat name its container The heartbeat found the caller's session by scanning the platform's pool, so a desktop on a container the pool leaves out was never refreshed: its last_seen went stale and its claim lapsed with the 6h TTL while the admin was still configuring it. The heartbeat now takes the same optional container key as release and join, refreshes only a session the caller owns, and the desktop view sends its key. Game players still heartbeat by platform. --- backend/endpoints/streaming.py | 34 ++++++++++---- backend/tests/endpoints/test_streaming.py | 56 +++++++++++++++++++++-- frontend/src/services/api/streaming.ts | 8 +++- frontend/src/v2/views/Player/Desktop.vue | 2 +- 4 files changed, 82 insertions(+), 18 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index 8af12d740..b5b820276 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -905,7 +905,11 @@ async def save_and_exit_session( @protected_route(router.post, "/sessions/{platform}/heartbeat", [Scope.ROMS_USER_WRITE]) -async def heartbeat_session(request: Request, platform: str) -> SessionStatusSchema: +async def heartbeat_session( + request: Request, + platform: str, + container_key: str | None = Query(default=None, alias="container", max_length=300), +) -> SessionStatusSchema: """Refresh the session's liveness stamp and report whether it still exists. The frontend calls this every ~30s while a session is active. A session @@ -915,17 +919,27 @@ async def heartbeat_session(request: Request, platform: str) -> SessionStatusSch Reports `ended` rather than raising 404 when the caller no longer holds the session, so a force-released player learns why on the poll they are already making rather than watching a dead stream. + + `container` names the claim to refresh, needed for a desktop on a container + the platform's pool leaves out. """ - candidates = containers_for_platform(platform) - if not candidates: - raise HTTPException( - status_code=404, - detail=f"No streaming container configured for platform '{platform}'", + if container_key is not None: + _, session_key, session = await access.resolve_named_container( + platform, container_key ) - found = await access.find_session_for_user(candidates, request.user.id) - if found is None: - return SessionStatusSchema(**await _session_status(platform, request)) - _, session_key, _ = found + if session is None or session.get("user_id") != request.user.id: + return SessionStatusSchema(**await _session_status(platform, request)) + else: + candidates = containers_for_platform(platform) + if not candidates: + raise HTTPException( + status_code=404, + detail=f"No streaming container configured for platform '{platform}'", + ) + found = await access.find_session_for_user(candidates, request.user.id) + if found is None: + return SessionStatusSchema(**await _session_status(platform, request)) + _, session_key, _ = found # Merging rather than writing the copy read above keeps a swap that landed # in between; refusing a draining session keeps a heartbeat from making a diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index 8295aabb4..edef85797 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1374,16 +1374,22 @@ def test_admin_release_rejects_a_container_that_serves_another_platform( assert r.status_code == 404 +def _outside_the_ps2_pool() -> dict: + """A second webstation that disagrees with `_webstation()` on the ps2 + emulator, so the ps2 pool leaves it out.""" + return _webstation( + host="http://192.168.1.11:3000", + broker_host="http://192.168.1.11:8000", + platforms={"ps2": "play", "ngc": "dolphin"}, + ) + + def test_admin_release_ends_a_session_on_a_container_outside_the_pool( client, access_token ): """A container that disagrees with the pool on an emulator is left out of it, but an admin can still end its session by naming it.""" - outside = _webstation( - host="http://192.168.1.11:3000", - broker_host="http://192.168.1.11:8000", - platforms={"ps2": "play", "ngc": "dolphin"}, - ) + outside = _outside_the_ps2_pool() with _streaming(_webstation(), outside): key = _key_of(outside) assert key not in [c.key for c in streaming.containers_for_platform("ps2")] @@ -1399,6 +1405,46 @@ def test_admin_release_ends_a_session_on_a_container_outside_the_pool( assert _session_raw(outside) is None +def test_heartbeat_naming_the_container_refreshes_a_desktop_outside_the_pool( + client, access_token +): + """The platform's pool scan cannot see this container, so only the named key + keeps its desktop claim fresh.""" + outside = _outside_the_ps2_pool() + with _streaming(_webstation(), outside): + key = _key_of(outside) + assert _desktop(client, access_token, key)[0].status_code == 200 + _age_session_on(outside, session_store._STREAMING_SESSION_STALE_SECONDS + 60) + r = client.post( + "/api/streaming/sessions/ps2/heartbeat", + params={"container": key}, + headers=_auth(access_token), + ) + session = json.loads(_session_raw(outside)) + assert r.status_code == 200 + assert r.json()["status"] == "active" + assert not session_store.session_is_stale(session) + + +def test_heartbeat_naming_a_container_leaves_another_users_session_alone( + client, access_token, viewer_access_token +): + outside = _outside_the_ps2_pool() + with _streaming(_webstation(), outside): + key = _key_of(outside) + assert _desktop(client, access_token, key)[0].status_code == 200 + _age_session_on(outside, session_store._STREAMING_SESSION_STALE_SECONDS + 60) + r = client.post( + "/api/streaming/sessions/ps2/heartbeat", + params={"container": key}, + headers=_auth(viewer_access_token), + ) + session = json.loads(_session_raw(outside)) + assert r.status_code == 200 + assert r.json()["status"] == "ended" + assert session_store.session_is_stale(session) + + def test_status_finds_the_termination_on_whichever_container_held_it( client, access_token, viewer_access_token, rom: Rom ): diff --git a/frontend/src/services/api/streaming.ts b/frontend/src/services/api/streaming.ts index ea6d99996..644cd34e4 100644 --- a/frontend/src/services/api/streaming.ts +++ b/frontend/src/services/api/streaming.ts @@ -151,8 +151,12 @@ async function saveAndExit(platform: string, slot = 0, wait = true) { }); } -async function heartbeatSession(platform: string) { - return api.post(`/streaming/sessions/${platform}/heartbeat`); +async function heartbeatSession(platform: string, container?: string) { + return api.post( + `/streaming/sessions/${platform}/heartbeat`, + undefined, + { params: { container } }, + ); } async function sessionStatus(platform: string) { diff --git a/frontend/src/v2/views/Player/Desktop.vue b/frontend/src/v2/views/Player/Desktop.vue index be55162fa..ea22c0fdf 100644 --- a/frontend/src/v2/views/Player/Desktop.vue +++ b/frontend/src/v2/views/Player/Desktop.vue @@ -98,7 +98,7 @@ const HEARTBEAT_MS = 30_000; useIntervalFn(() => { if (!holdsClaim.value || !platform.value) return; void streamingApi - .heartbeatSession(platform.value) + .heartbeatSession(platform.value, containerKey.value) .catch((err) => console.warn("[streaming] Could not heartbeat the desktop session:", err), ); From 260d8f4f30c55e147880aa70a19bff28aa436b39 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 09:36:14 -0500 Subject: [PATCH 07/52] review(pr-ready step 2): scope a named heartbeat's status to its container, re-check the owner on write, drop the desktop claim once ended A named heartbeat now reports ended for its own container instead of the pool's status, the refresh refuses a claim that changed hands, and the desktop view stops holding a claim the backend says is gone so its exit cannot release the next holder. --- backend/endpoints/streaming.py | 44 ++++++++++++++++------- backend/tests/endpoints/test_streaming.py | 25 +++++++++++++ frontend/src/v2/views/Player/Desktop.vue | 7 ++++ 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index b5b820276..f09490798 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -215,11 +215,20 @@ async def _session_status(platform: str, request: Request) -> dict[str, Any]: webstation.launch_phase, container ) return status + return await _ended_status( + platform, request.user.id, [candidate.key for candidate in candidates] + ) + + +async def _ended_status( + platform: str, user_id: int, session_keys: list[str] +) -> dict[str, Any]: + """An ended session's status, carrying the caller's termination notice.""" # The tombstone is keyed per container, so with a pool the caller's notice # can sit under any of them. termination = None - for candidate in candidates: - termination = await get_termination(candidate.key, request.user.id) + for session_key in session_keys: + termination = await get_termination(session_key, user_id) if termination is not None: break return { @@ -923,12 +932,23 @@ async def heartbeat_session( `container` names the claim to refresh, needed for a desktop on a container the platform's pool leaves out. """ + user_id = request.user.id + + async def gone() -> SessionStatusSchema: + # A named claim answers for itself: another session the caller holds on + # the platform is not the one this client is beating. + if container_key is None: + return SessionStatusSchema(**await _session_status(platform, request)) + return SessionStatusSchema( + **await _ended_status(platform, user_id, [container_key]) + ) + if container_key is not None: _, session_key, session = await access.resolve_named_container( platform, container_key ) - if session is None or session.get("user_id") != request.user.id: - return SessionStatusSchema(**await _session_status(platform, request)) + if session is None or session.get("user_id") != user_id: + return await gone() else: candidates = containers_for_platform(platform) if not candidates: @@ -936,21 +956,21 @@ async def heartbeat_session( status_code=404, detail=f"No streaming container configured for platform '{platform}'", ) - found = await access.find_session_for_user(candidates, request.user.id) + found = await access.find_session_for_user(candidates, user_id) if found is None: - return SessionStatusSchema(**await _session_status(platform, request)) + return await gone() _, session_key, _ = found # Merging rather than writing the copy read above keeps a swap that landed - # in between; refusing a draining session keeps a heartbeat from making a - # container that is already being torn down look live. Either returns None, - # meaning the claim is gone and reporting "active" would leave the client - # beating a session it no longer holds. + # in between; refusing a draining session, or a claim that changed hands, + # keeps a heartbeat from making a container look live for the wrong holder. + # Either returns None, meaning the claim is gone and reporting "active" + # would leave the client beating a session it no longer holds. try: refreshed = await mutate_session( session_key, {"last_seen": datetime.now(timezone.utc).isoformat()}, - require=lambda s: not s.get("draining"), + require=lambda s: not s.get("draining") and s.get("user_id") == user_id, ) except StreamingSessionContended: # A key too busy to write is a key that exists, so the session is live @@ -958,7 +978,7 @@ async def heartbeat_session( log.warning("heartbeat could not stamp contended session %s", session_key) return SessionStatusSchema(status="active", platform=platform) if refreshed is None: - return SessionStatusSchema(**await _session_status(platform, request)) + return await gone() await lifecycle.refresh_session_activity(session_key, refreshed) return SessionStatusSchema(status="active", platform=platform) diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index edef85797..97d820091 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1426,6 +1426,31 @@ def test_heartbeat_naming_the_container_refreshes_a_desktop_outside_the_pool( assert not session_store.session_is_stale(session) +def test_heartbeat_naming_a_released_container_reports_ended(client, access_token): + """A session the caller holds on another of the platform's containers must + not answer for the named one.""" + outside = _outside_the_ps2_pool() + with _streaming(_webstation(), outside): + assert ( + _desktop(client, access_token, _key_of(_webstation()))[0].status_code == 200 + ) + assert _desktop(client, access_token, _key_of(outside))[0].status_code == 200 + with patch("handler.streaming.commands.stop", return_value=None): + released = client.delete( + "/api/streaming/sessions/ps2", + params={"container": _key_of(outside)}, + headers=_auth(access_token), + ) + assert released.status_code == 200 + r = client.post( + "/api/streaming/sessions/ps2/heartbeat", + params={"container": _key_of(outside)}, + headers=_auth(access_token), + ) + assert r.status_code == 200 + assert r.json()["status"] == "ended" + + def test_heartbeat_naming_a_container_leaves_another_users_session_alone( client, access_token, viewer_access_token ): diff --git a/frontend/src/v2/views/Player/Desktop.vue b/frontend/src/v2/views/Player/Desktop.vue index ea22c0fdf..2a977942f 100644 --- a/frontend/src/v2/views/Player/Desktop.vue +++ b/frontend/src/v2/views/Player/Desktop.vue @@ -99,6 +99,13 @@ useIntervalFn(() => { if (!holdsClaim.value || !platform.value) return; void streamingApi .heartbeatSession(platform.value, containerKey.value) + .then(({ data }) => { + // Ended elsewhere: dropping the claim keeps a later exit from releasing + // whoever holds the container next. + if (data.status !== "ended") return; + holdsClaim.value = false; + state.value = "exited"; + }) .catch((err) => console.warn("[streaming] Could not heartbeat the desktop session:", err), ); From e2e35835db7206c98e43f3927f309417876a891f Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 09:41:31 -0500 Subject: [PATCH 08/52] simplify(pr-ready step 3): run a named heartbeat through the pool's lookup, reuse the store heartbeat and entry_for_platform A named container is a one-entry candidate list, so the heartbeat has one lookup and one status answer instead of a closure branching on the key, and it no longer reads the session twice. The desktop view beats through the store wrapper, and configured_emulator shares the platform match. --- backend/endpoints/streaming.py | 65 +++++++++-------------- backend/handler/streaming/access.py | 35 +++++++----- backend/handler/streaming/config.py | 10 ++-- backend/tests/endpoints/test_streaming.py | 7 +-- frontend/src/stores/streaming.ts | 3 +- frontend/src/v2/views/Player/Desktop.vue | 27 +++++----- 6 files changed, 70 insertions(+), 77 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index f09490798..bd39d7d78 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -191,10 +191,16 @@ def _swappable_disc_file_ids(rom: Rom) -> set[int]: return {f.id for f in playlist_files(rom.files)} -async def _session_status(platform: str, request: Request) -> dict[str, Any]: +async def _session_status( + platform: str, + request: Request, + candidates: list[ResolvedContainer] | None = None, +) -> dict[str, Any]: """Whether the caller still holds this platform's session, and if not, why - it ended. Read-only, so it is safe to poll.""" - candidates = containers_for_platform(platform) + it ended. Read-only, so it is safe to poll. `candidates` defaults to the + platform's pool.""" + if candidates is None: + candidates = containers_for_platform(platform) if not candidates: raise HTTPException( status_code=404, @@ -215,20 +221,11 @@ async def _session_status(platform: str, request: Request) -> dict[str, Any]: webstation.launch_phase, container ) return status - return await _ended_status( - platform, request.user.id, [candidate.key for candidate in candidates] - ) - - -async def _ended_status( - platform: str, user_id: int, session_keys: list[str] -) -> dict[str, Any]: - """An ended session's status, carrying the caller's termination notice.""" # The tombstone is keyed per container, so with a pool the caller's notice # can sit under any of them. termination = None - for session_key in session_keys: - termination = await get_termination(session_key, user_id) + for candidate in candidates: + termination = await get_termination(candidate.key, request.user.id) if termination is not None: break return { @@ -933,33 +930,19 @@ async def heartbeat_session( the platform's pool leaves out. """ user_id = request.user.id - - async def gone() -> SessionStatusSchema: - # A named claim answers for itself: another session the caller holds on - # the platform is not the one this client is beating. - if container_key is None: - return SessionStatusSchema(**await _session_status(platform, request)) + # A named claim answers for itself: another session the caller holds on the + # platform is not the one this client is beating. + candidates = ( + [access.named_container(platform, container_key)] + if container_key is not None + else containers_for_platform(platform) + ) + found = await access.find_session_for_user(candidates, user_id) + if found is None: return SessionStatusSchema( - **await _ended_status(platform, user_id, [container_key]) + **await _session_status(platform, request, candidates) ) - - if container_key is not None: - _, session_key, session = await access.resolve_named_container( - platform, container_key - ) - if session is None or session.get("user_id") != user_id: - return await gone() - else: - candidates = containers_for_platform(platform) - if not candidates: - raise HTTPException( - status_code=404, - detail=f"No streaming container configured for platform '{platform}'", - ) - found = await access.find_session_for_user(candidates, user_id) - if found is None: - return await gone() - _, session_key, _ = found + _, session_key, _ = found # Merging rather than writing the copy read above keeps a swap that landed # in between; refusing a draining session, or a claim that changed hands, @@ -978,7 +961,9 @@ async def heartbeat_session( log.warning("heartbeat could not stamp contended session %s", session_key) return SessionStatusSchema(status="active", platform=platform) if refreshed is None: - return await gone() + return SessionStatusSchema( + **await _session_status(platform, request, candidates) + ) await lifecycle.refresh_session_activity(session_key, refreshed) return SessionStatusSchema(status="active", platform=platform) diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index 9c0a31e13..edf1b98e1 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -107,25 +107,34 @@ async def find_session_for_user( return None +def named_container(platform: str, container_key: str) -> ResolvedContainer: + """One named container serving a platform. + + Found by key rather than through the pool, so a session on a container left + out of the pool can still be reached. Raises 404 when the key names no + container serving this platform. + """ + candidate = entry_for_platform(containers_by_key().get(container_key, []), platform) + if candidate is None: + raise HTTPException( + status_code=404, + detail=f"No streaming container '{container_key}' for platform '{platform}'", + ) + return candidate + + async def resolve_named_container( platform: str, container_key: str ) -> tuple[ResolvedContainer, str, dict[str, Any] | None]: - """One named container serving a platform, plus whatever session it holds. - - Found by key rather than through the pool, so a session on a container left - out of the pool can still be ended. + """A named container plus whatever session it holds. Returns (container, session_key, session), the session being None when the - container is free or draining. Raises 404 when the key names no container - serving this platform. + container is free or draining. """ - entries = containers_by_key().get(container_key, []) if container_key else [] - candidate = entry_for_platform(entries, platform) - if candidate is not None: - return candidate, container_key, await get_live_session(container_key) - raise HTTPException( - status_code=404, - detail=f"No streaming container '{container_key}' for platform '{platform}'", + return ( + named_container(platform, container_key), + container_key, + await get_live_session(container_key), ) diff --git a/backend/handler/streaming/config.py b/backend/handler/streaming/config.py index 6fff5d6f5..7fd527263 100644 --- a/backend/handler/streaming/config.py +++ b/backend/handler/streaming/config.py @@ -9,6 +9,7 @@ from __future__ import annotations import json import secrets +from collections.abc import Sequence from dataclasses import dataclass from typing import Any from urllib.parse import urlparse, urlunparse @@ -561,7 +562,7 @@ def containers_by_key() -> dict[str, list[ResolvedContainer]]: def entry_for_platform( - entries: list[ResolvedContainer], platform: str + entries: Sequence[ResolvedContainer], platform: str ) -> ResolvedContainer | None: """The record among one container's entries that serves this platform.""" lower = platform.lower() @@ -583,11 +584,8 @@ def container_for_session( def configured_emulator(platform: str) -> str: """The emulator a configured container serves this platform with, if any.""" - lower = platform.lower() - for container in resolve_containers(): - if container.platform.lower() == lower: - return container.emulator - return "" + entry = entry_for_platform(resolve_containers(), platform) + return entry.emulator if entry else "" def streaming_enabled() -> bool: diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index 97d820091..f260497b3 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1431,20 +1431,21 @@ def test_heartbeat_naming_a_released_container_reports_ended(client, access_toke not answer for the named one.""" outside = _outside_the_ps2_pool() with _streaming(_webstation(), outside): + key = _key_of(outside) assert ( _desktop(client, access_token, _key_of(_webstation()))[0].status_code == 200 ) - assert _desktop(client, access_token, _key_of(outside))[0].status_code == 200 + assert _desktop(client, access_token, key)[0].status_code == 200 with patch("handler.streaming.commands.stop", return_value=None): released = client.delete( "/api/streaming/sessions/ps2", - params={"container": _key_of(outside)}, + params={"container": key}, headers=_auth(access_token), ) assert released.status_code == 200 r = client.post( "/api/streaming/sessions/ps2/heartbeat", - params={"container": _key_of(outside)}, + params={"container": key}, headers=_auth(access_token), ) assert r.status_code == 200 diff --git a/frontend/src/stores/streaming.ts b/frontend/src/stores/streaming.ts index 12b189e99..4ad1cdf7f 100644 --- a/frontend/src/stores/streaming.ts +++ b/frontend/src/stores/streaming.ts @@ -302,10 +302,11 @@ export const useStreamingStore = defineStore("streaming", () => { */ async function heartbeatSession( platform: string, + container?: string, ): Promise { if (!platform) return null; try { - const { data } = await streamingApi.heartbeatSession(platform); + const { data } = await streamingApi.heartbeatSession(platform, container); return data; } catch (err) { console.warn("[streaming] Could not heartbeat session:", err); diff --git a/frontend/src/v2/views/Player/Desktop.vue b/frontend/src/v2/views/Player/Desktop.vue index 2a977942f..43bc8a93a 100644 --- a/frontend/src/v2/views/Player/Desktop.vue +++ b/frontend/src/v2/views/Player/Desktop.vue @@ -15,6 +15,7 @@ import { useI18n } from "vue-i18n"; import { onBeforeRouteLeave, useRoute, useRouter } from "vue-router"; import { ROUTES } from "@/plugins/router"; import streamingApi from "@/services/api/streaming"; +import { useStreamingStore } from "@/stores/streaming"; import StreamStage from "@/v2/components/Player/StreamStage.vue"; import { useConfirm } from "@/v2/composables/useConfirm"; import { usePageTitle } from "@/v2/composables/usePageTitle"; @@ -23,6 +24,7 @@ const { t } = useI18n(); const route = useRoute(); const router = useRouter(); const confirm = useConfirm(); +const streamingStore = useStreamingStore(); const containerKey = computed(() => String(route.query.container ?? "")); @@ -95,20 +97,17 @@ async function release(): Promise { // stale window, and nothing else here touches the claim. const HEARTBEAT_MS = 30_000; -useIntervalFn(() => { - if (!holdsClaim.value || !platform.value) return; - void streamingApi - .heartbeatSession(platform.value, containerKey.value) - .then(({ data }) => { - // Ended elsewhere: dropping the claim keeps a later exit from releasing - // whoever holds the container next. - if (data.status !== "ended") return; - holdsClaim.value = false; - state.value = "exited"; - }) - .catch((err) => - console.warn("[streaming] Could not heartbeat the desktop session:", err), - ); +useIntervalFn(async () => { + if (!holdsClaim.value) return; + const status = await streamingStore.heartbeatSession( + platform.value, + containerKey.value, + ); + // Ended elsewhere: dropping the claim keeps a later exit from releasing + // whoever holds the container next. + if (status?.status !== "ended") return; + holdsClaim.value = false; + state.value = "exited"; }, HEARTBEAT_MS); function backToAdministration(): void { From c62af756214299082228a0e75f200d95e5412b61 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 09:53:01 -0500 Subject: [PATCH 09/52] polish(pr-ready step 4): trim the heartbeat and named-container comments --- backend/endpoints/streaming.py | 12 ++++-------- backend/handler/streaming/access.py | 8 ++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index bd39d7d78..a3d077f5e 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -196,9 +196,8 @@ async def _session_status( request: Request, candidates: list[ResolvedContainer] | None = None, ) -> dict[str, Any]: - """Whether the caller still holds this platform's session, and if not, why - it ended. Read-only, so it is safe to poll. `candidates` defaults to the - platform's pool.""" + """Whether the caller holds a session among `candidates` (the platform's pool + by default), and if not, why it ended. Read-only, so it is safe to poll.""" if candidates is None: candidates = containers_for_platform(platform) if not candidates: @@ -944,11 +943,8 @@ async def heartbeat_session( ) _, session_key, _ = found - # Merging rather than writing the copy read above keeps a swap that landed - # in between; refusing a draining session, or a claim that changed hands, - # keeps a heartbeat from making a container look live for the wrong holder. - # Either returns None, meaning the claim is gone and reporting "active" - # would leave the client beating a session it no longer holds. + # Merging keeps a swap that landed since the read. Refusing a draining or + # re-claimed session returns None, so the client stops beating a dead claim. try: refreshed = await mutate_session( session_key, diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index edf1b98e1..c070231b1 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -108,12 +108,8 @@ async def find_session_for_user( def named_container(platform: str, container_key: str) -> ResolvedContainer: - """One named container serving a platform. - - Found by key rather than through the pool, so a session on a container left - out of the pool can still be reached. Raises 404 when the key names no - container serving this platform. - """ + """A container serving a platform, found by key so one the pool leaves out + stays reachable. Raises 404 when the key names no such container.""" candidate = entry_for_platform(containers_by_key().get(container_key, []), platform) if candidate is None: raise HTTPException( From f947da377803104b7f52e3c2f78bd5e87a088d25 Mon Sep 17 00:00:00 2001 From: Stuart Anderson Date: Thu, 17 Sep 2026 10:50:28 -0500 Subject: [PATCH 10/52] chore: typecheck frontend/scripts via tsconfig.node.json --- docs/FRONTEND_ARCHITECTURE.md | 19 ++++++++++--------- frontend/package.json | 2 +- frontend/tsconfig.node.json | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 frontend/tsconfig.node.json diff --git a/docs/FRONTEND_ARCHITECTURE.md b/docs/FRONTEND_ARCHITECTURE.md index 47b2468a0..c3cc246ed 100644 --- a/docs/FRONTEND_ARCHITECTURE.md +++ b/docs/FRONTEND_ARCHITECTURE.md @@ -123,7 +123,8 @@ frontend/ ├── index.html # HTML entry point (
) ├── package.json # Dependencies & scripts ├── vite.config.js # Vite build config with plugins -├── tsconfig.json # TypeScript configuration +├── tsconfig.json # Vue app TypeScript (vue-tsc) +├── tsconfig.node.json # Node/Vite tooling TypeScript (tsc -p) ├── eslint.config.js # ESLint flat config ├── .nvmrc # Node 24 │ @@ -1099,14 +1100,14 @@ Procedural SVG generation for: ### Scripts -| Script | Command | Purpose | -| ----------- | ---------------------------- | ----------------------------------- | -| `dev` | `vite --host` | Development server | -| `build` | `vite build` | Production build | -| `preview` | `vite preview` | Preview production build | -| `typecheck` | `vue-tsc` | TypeScript validation | -| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | -| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | +| Script | Command | Purpose | +| ----------- | -------------------------------------------------------- | ----------------------------------------------------------------------- | +| `dev` | `vite --host` | Development server | +| `build` | `vite build` | Production build | +| `preview` | `vite preview` | Preview production build | +| `typecheck` | `vue-tsc --noEmit && tsc --noEmit -p tsconfig.node.json` | App SFCs (`tsconfig.json`) and Node/Vite tooling (`tsconfig.node.json`) | +| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | +| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | ### OpenAPI Code Generation diff --git a/frontend/package.json b/frontend/package.json index 27073b501..feeca9d46 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,7 +26,7 @@ "dev": "vite --host", "build": "vite build", "preview": "vite preview", - "typecheck": "vue-tsc --noEmit", + "typecheck": "vue-tsc --noEmit && tsc --noEmit -p tsconfig.node.json", "generate": "openapi --input http://127.0.0.1:3000/openapi.json --output ./src/__generated__ --client axios --useOptions --useUnionTypes --exportServices false --exportSchemas false --exportCore false", "test": "vitest run", "test:watch": "vitest", diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json new file mode 100644 index 000000000..c9a97cfe0 --- /dev/null +++ b/frontend/tsconfig.node.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "bundler", + "strict": true, + "noEmit": true, + "skipLibCheck": true, + "types": ["node"] + }, + // Aids `npm run typecheck` in expanding typechecking + // to Node/Vite tooling that vue-tsc does not cover. + "include": ["scripts/**/*.ts"] +} From 9c1e9f4d75a0617c53be93cff8a01e5d8d5778da Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 11:42:18 -0500 Subject: [PATCH 11/52] fix(streaming): put every container in a pool, claim from the first A platform's containers are now grouped into pools of interchangeable members (same emulator, memory card sync, save picker and protocol), so a lone container is a pool of one instead of a skipped non-member. Game claims, status, heartbeats and joins still walk only the first pool, which matches the containers they reached before. The "not a pool member" warning fired on every lookup, one container at a time. It now fires once per config and names every container a game claim can never reach. Named lookups (desktop, admin release, named heartbeat) already reach a container in any pool. --- backend/endpoints/streaming.py | 4 +- backend/handler/streaming/access.py | 4 +- backend/handler/streaming/config.py | 75 +++++++++++------ backend/tests/endpoints/test_streaming.py | 99 +++++++++++++++-------- 4 files changed, 120 insertions(+), 62 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index a3d077f5e..4f9b187d3 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -625,7 +625,7 @@ async def claim_session( The ROM's filesystem path is derived server-side from its database row - the client only supplies a ROM id, never a path. Returns 404 if the ROM doesn't exist or no container serves its platform. - Returns 409 if every container serving the platform is occupied. + Returns 409 if every container in the platform's first pool is occupied. Returns 428 if the container's pre-existing memory card needs a decision. """ rom = db_rom_handler.get_rom(req.rom_id) @@ -926,7 +926,7 @@ async def heartbeat_session( making rather than watching a dead stream. `container` names the claim to refresh, needed for a desktop on a container - the platform's pool leaves out. + outside the platform's first pool. """ user_id = request.user.id # A named claim answers for itself: another session the caller holds on the diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index c070231b1..24f9da43c 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -108,8 +108,8 @@ async def find_session_for_user( def named_container(platform: str, container_key: str) -> ResolvedContainer: - """A container serving a platform, found by key so one the pool leaves out - stays reachable. Raises 404 when the key names no such container.""" + """A container serving a platform, found by key so one in a later pool stays + reachable. Raises 404 when the key names no such container.""" candidate = entry_for_platform(containers_by_key().get(container_key, []), platform) if candidate is None: raise HTTPException( diff --git a/backend/handler/streaming/config.py b/backend/handler/streaming/config.py index 7fd527263..259b4118d 100644 --- a/backend/handler/streaming/config.py +++ b/backend/handler/streaming/config.py @@ -3,13 +3,15 @@ The raw YAML is loose: a container may serve one platform or a map of them, and may leave its broker host to be derived. Resolution is memoized until the config changes, so an unusable container is reported once rather than once per lookup. +A platform's containers form pools of interchangeable members, and a game claim +only walks the first. """ from __future__ import annotations import json import secrets -from collections.abc import Sequence +from collections.abc import Iterable, Sequence from dataclasses import dataclass from typing import Any from urllib.parse import urlparse, urlunparse @@ -518,38 +520,61 @@ def resolve_containers() -> tuple[ResolvedContainer, ...]: for row, platform in _platform_entries(dict(entry)): resolved.append(_resolve_one(row, platform, entry.get("label"))) + _warn_about_later_pools(resolved) _cache_fingerprint = fingerprint _cached = tuple(resolved) return _cached -def containers_for_platform(platform: str) -> list[ResolvedContainer]: - """Every container serving a platform, in config order. +def _pools(containers: Iterable[ResolvedContainer]) -> list[list[ResolvedContainer]]: + """Group containers into pools of interchangeable members. A pool sits at its + first member's config position, and members keep config order.""" + pools: list[list[ResolvedContainer]] = [] + for container in containers: + pool = next((p for p in pools if p[0].interchangeable_with(container)), None) + if pool is None: + pools.append([container]) + else: + pool.append(container) + return pools - More than one entry is a pool and the claim takes the first free one, so a - container that disagrees with the head on emulator or card sync is not a - pool member and is left out. - """ - lower = platform.lower() - candidates: list[ResolvedContainer] = [] - for container in resolve_containers(): - if container.platform.lower() != lower: - continue - if not container.key: - # Nothing to dial, so a claim would have nowhere to go. The fleet - # view still lists it, which is where the operator sees why. - continue - if candidates and not candidates[0].interchangeable_with(container): + +def _warn_about_later_pools(resolved: Sequence[ResolvedContainer]) -> None: + """Name every container a game claim can never reach, once per config.""" + by_platform: dict[str, list[ResolvedContainer]] = {} + for container in resolved: + if container.key: + by_platform.setdefault(container.platform.lower(), []).append(container) + for containers in by_platform.values(): + later = [c.key for pool in _pools(containers)[1:] for c in pool] + if later: log.warning( - "container for platform '%s' disagrees with the first one on " - "emulator, memory card sync or protocol, so it is not a pool " - "member, skipping: %s", - platform, - container.key, + "containers for platform '%s' disagree on emulator, memory card " + "sync, save picker or protocol, so game claims only use the first " + "pool; never claimed for a game: %s", + containers[0].platform, + ", ".join(later), ) - continue - candidates.append(container) - return candidates + + +def pools_for_platform(platform: str) -> list[list[ResolvedContainer]]: + """Every container serving a platform, grouped into pools. A container that + matches no other is a pool of one.""" + lower = platform.lower() + return _pools( + container + for container in resolve_containers() + # Nothing to dial, so a claim would have nowhere to go. The fleet view + # still lists it, which is where the operator sees why. + if container.key and container.platform.lower() == lower + ) + + +def containers_for_platform(platform: str) -> list[ResolvedContainer]: + """The platform's first pool, which a game claim walks for the first free + container, in config order.""" + pools = pools_for_platform(platform) + return pools[0] if pools else [] def containers_by_key() -> dict[str, list[ResolvedContainer]]: diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index f260497b3..432f621b0 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -54,6 +54,7 @@ from handler.streaming.config import ( ResolvedContainer, _derive_broker_host, emulator_display_label, + pools_for_platform, reset_cache, resolve_entry, ) @@ -536,7 +537,7 @@ def test_clears_stale_saves_has_no_picker_to_gate_on_a_legacy_container(caplog): assert "clears_stale_saves" in caplog.text -def test_a_container_that_disagrees_on_clearing_saves_is_not_a_pool_member(caplog): +def test_a_container_that_disagrees_on_clearing_saves_is_a_pool_of_its_own(caplog): """The picker is advertised from the head of the pool, so a member that keeps its own newer files would take the pick and silently discard it.""" first = { @@ -562,7 +563,7 @@ def test_a_container_that_disagrees_on_clearing_saves_is_not_a_pool_member(caplo finally: romm_logger.removeHandler(caplog.handler) assert [c.clears_stale_saves for c in candidates] == [True] - assert "not a pool" in caplog.text + assert "never claimed for a game" in caplog.text def test_legacy_containers_still_pool_under_an_inert_clearing_flag(): @@ -1223,6 +1224,21 @@ def test_pool_409s_only_once_every_container_is_held( assert "2 containers" in r3.json()["detail"]["message"] +def test_a_claim_never_lands_in_a_later_pool( + client, access_token, viewer_access_token, rom: Rom +): + """Only the first pool matches the settings a claim is validated against, + so a later pool stays out of reach even when it is the only one free.""" + later = {**_pool_member(rom, 1), "emulator": "other"} + with _streaming(_pool_member(rom, 0), later): + r1 = _claim_ok(client, access_token, rom.id) + r2 = _claim_ok(client, viewer_access_token, rom.id) + assert _session_raw(later) is None + assert r1.status_code == 202 + assert r1.json()["container"] == _key_of(_pool_member(rom, 0)) + assert r2.status_code == 409 + + def test_a_pool_does_not_roll_its_own_holder_onto_a_second_container( client, access_token, rom: Rom ): @@ -1374,9 +1390,9 @@ def test_admin_release_rejects_a_container_that_serves_another_platform( assert r.status_code == 404 -def _outside_the_ps2_pool() -> dict: +def _in_a_later_ps2_pool() -> dict: """A second webstation that disagrees with `_webstation()` on the ps2 - emulator, so the ps2 pool leaves it out.""" + emulator, so it forms a later ps2 pool.""" return _webstation( host="http://192.168.1.11:3000", broker_host="http://192.168.1.11:8000", @@ -1384,14 +1400,14 @@ def _outside_the_ps2_pool() -> dict: ) -def test_admin_release_ends_a_session_on_a_container_outside_the_pool( +def test_admin_release_ends_a_session_on_a_container_in_a_later_pool( client, access_token ): - """A container that disagrees with the pool on an emulator is left out of it, - but an admin can still end its session by naming it.""" - outside = _outside_the_ps2_pool() - with _streaming(_webstation(), outside): - key = _key_of(outside) + """A game claim never reaches a later pool, but an admin can still end a + session there by naming the container.""" + later = _in_a_later_ps2_pool() + with _streaming(_webstation(), later): + key = _key_of(later) assert key not in [c.key for c in streaming.containers_for_platform("ps2")] assert _desktop(client, access_token, key)[0].status_code == 200 with patch("handler.streaming.commands.stop", return_value=None): @@ -1402,25 +1418,25 @@ def test_admin_release_ends_a_session_on_a_container_outside_the_pool( ) assert r.status_code == 200 assert r.json()["status"] == "released" - assert _session_raw(outside) is None + assert _session_raw(later) is None -def test_heartbeat_naming_the_container_refreshes_a_desktop_outside_the_pool( +def test_heartbeat_naming_the_container_refreshes_a_desktop_in_a_later_pool( client, access_token ): - """The platform's pool scan cannot see this container, so only the named key - keeps its desktop claim fresh.""" - outside = _outside_the_ps2_pool() - with _streaming(_webstation(), outside): - key = _key_of(outside) + """The platform's lookup only walks the first pool, so only the named key + keeps this desktop claim fresh.""" + later = _in_a_later_ps2_pool() + with _streaming(_webstation(), later): + key = _key_of(later) assert _desktop(client, access_token, key)[0].status_code == 200 - _age_session_on(outside, session_store._STREAMING_SESSION_STALE_SECONDS + 60) + _age_session_on(later, session_store._STREAMING_SESSION_STALE_SECONDS + 60) r = client.post( "/api/streaming/sessions/ps2/heartbeat", params={"container": key}, headers=_auth(access_token), ) - session = json.loads(_session_raw(outside)) + session = json.loads(_session_raw(later)) assert r.status_code == 200 assert r.json()["status"] == "active" assert not session_store.session_is_stale(session) @@ -1429,9 +1445,9 @@ def test_heartbeat_naming_the_container_refreshes_a_desktop_outside_the_pool( def test_heartbeat_naming_a_released_container_reports_ended(client, access_token): """A session the caller holds on another of the platform's containers must not answer for the named one.""" - outside = _outside_the_ps2_pool() - with _streaming(_webstation(), outside): - key = _key_of(outside) + later = _in_a_later_ps2_pool() + with _streaming(_webstation(), later): + key = _key_of(later) assert ( _desktop(client, access_token, _key_of(_webstation()))[0].status_code == 200 ) @@ -1455,17 +1471,17 @@ def test_heartbeat_naming_a_released_container_reports_ended(client, access_toke def test_heartbeat_naming_a_container_leaves_another_users_session_alone( client, access_token, viewer_access_token ): - outside = _outside_the_ps2_pool() - with _streaming(_webstation(), outside): - key = _key_of(outside) + later = _in_a_later_ps2_pool() + with _streaming(_webstation(), later): + key = _key_of(later) assert _desktop(client, access_token, key)[0].status_code == 200 - _age_session_on(outside, session_store._STREAMING_SESSION_STALE_SECONDS + 60) + _age_session_on(later, session_store._STREAMING_SESSION_STALE_SECONDS + 60) r = client.post( "/api/streaming/sessions/ps2/heartbeat", params={"container": key}, headers=_auth(viewer_access_token), ) - session = json.loads(_session_raw(outside)) + session = json.loads(_session_raw(later)) assert r.status_code == 200 assert r.json()["status"] == "ended" assert session_store.session_is_stale(session) @@ -1511,9 +1527,9 @@ def test_heartbeat_refreshes_the_session_on_the_container_that_holds_it( assert after > before -def test_a_container_that_disagrees_on_the_emulator_is_not_a_pool_member(caplog): +def test_a_container_that_disagrees_on_the_emulator_is_a_later_pool(caplog): """Pool members file states and cards in one place, so an entry naming a - different emulator is a separate setup rather than a spare container.""" + different emulator is a pool of its own rather than a spare container.""" first = { "platform": "ps2", "host": "http://192.168.1.10:3000", @@ -1523,16 +1539,33 @@ def test_a_container_that_disagrees_on_the_emulator_is_not_a_pool_member(caplog) second = {**first, "host": "http://192.168.1.11:3000"} second["broker_host"] = "http://192.168.1.11:8000" second["emulator"] = "play" + third = {**first, "host": "http://192.168.1.12:3000"} + third["broker_host"] = "http://192.168.1.12:8000" romm_logger = logging.getLogger("romm") romm_logger.addHandler(caplog.handler) try: - with _streaming(first, second): + with _streaming(first, second, third): with caplog.at_level(logging.WARNING, logger="romm"): + pools = pools_for_platform("ps2") candidates = streaming.containers_for_platform("ps2") finally: romm_logger.removeHandler(caplog.handler) - assert [c.emulator for c in candidates] == ["pcsx2"] - assert "not a pool" in caplog.text + assert [[c.emulator for c in pool] for pool in pools] == [ + ["pcsx2", "pcsx2"], + ["play"], + ] + assert candidates == pools[0] + # Once per config, not once per lookup. + assert caplog.text.count("never claimed for a game") == 1 + assert _key_of(second) in caplog.text + + +def test_a_lone_container_is_a_pool_of_one(rom: Rom): + with _streaming(_pool_member(rom, 0)): + pools = pools_for_platform(rom.platform_slug) + assert [[c.key for c in pool] for pool in pools] == [ + [_key_of(_pool_member(rom, 0))] + ] def test_webstation_pool_members_at_different_subfolders_are_still_a_pool(caplog): @@ -1564,7 +1597,7 @@ def test_webstation_pool_members_at_different_subfolders_are_still_a_pool(caplog "http://192.168.1.10:8000", "http://192.168.1.11:8000", ] - assert "not a pool" not in caplog.text + assert "never claimed for a game" not in caplog.text def test_a_proxied_host_disagreeing_with_its_subfolder_cannot_be_claimed(caplog): From 33aa9080c278a22ba0fd26b158f5031d9b41fa7f Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 11:43:29 -0500 Subject: [PATCH 12/52] review(pr-ready step 2): pin that the later-pool claim test really has two pools --- backend/tests/endpoints/test_streaming.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index 432f621b0..f45bff061 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1234,6 +1234,7 @@ def test_a_claim_never_lands_in_a_later_pool( r1 = _claim_ok(client, access_token, rom.id) r2 = _claim_ok(client, viewer_access_token, rom.id) assert _session_raw(later) is None + assert len(pools_for_platform(rom.platform_slug)) == 2 assert r1.status_code == 202 assert r1.json()["container"] == _key_of(_pool_member(rom, 0)) assert r2.status_code == 409 From 08f1e0001eff3b6df605a7a09baa57e930158625 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 11:46:22 -0500 Subject: [PATCH 13/52] simplify(pr-ready step 3): group dialable containers per platform in one place, point the claim comment at interchangeable_with --- backend/endpoints/streaming.py | 9 ++++---- backend/handler/streaming/access.py | 2 +- backend/handler/streaming/config.py | 28 ++++++++++++----------- backend/tests/endpoints/test_streaming.py | 7 ++++-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/backend/endpoints/streaming.py b/backend/endpoints/streaming.py index 4f9b187d3..44ab71ae4 100644 --- a/backend/endpoints/streaming.py +++ b/backend/endpoints/streaming.py @@ -196,8 +196,8 @@ async def _session_status( request: Request, candidates: list[ResolvedContainer] | None = None, ) -> dict[str, Any]: - """Whether the caller holds a session among `candidates` (the platform's pool - by default), and if not, why it ended. Read-only, so it is safe to poll.""" + """Whether the caller holds a session among `candidates` (the platform's first + pool by default), and if not, why it ended. Read-only, so it is safe to poll.""" if candidates is None: candidates = containers_for_platform(platform) if not candidates: @@ -645,9 +645,8 @@ async def claim_session( detail=f"No streaming container configured for platform '{platform}'", ) - # Pool members are interchangeable on emulator and card sync (enforced by - # containers_for_platform), so the pre-claim validation below holds for - # whichever one the walk ends up winning. + # Pool members are interchangeable (`ResolvedContainer.interchangeable_with`), + # so the pre-claim validation below holds for whichever one the walk wins. reference = candidates[0] # Validate the resume pick before claiming so a bad state_id cannot diff --git a/backend/handler/streaming/access.py b/backend/handler/streaming/access.py index 24f9da43c..fefb2cbe4 100644 --- a/backend/handler/streaming/access.py +++ b/backend/handler/streaming/access.py @@ -137,7 +137,7 @@ async def resolve_named_container( async def resolve_owned_session( platform: str, request: Request ) -> tuple[ResolvedContainer, str, dict[str, Any]]: - """Find the caller's session among the platform's containers. + """Find the caller's session in the platform's first pool. Returns (container, session_key, session). Raises 404 when the platform has no configured container or nothing is active, 403 when every active session diff --git a/backend/handler/streaming/config.py b/backend/handler/streaming/config.py index 259b4118d..f27435342 100644 --- a/backend/handler/streaming/config.py +++ b/backend/handler/streaming/config.py @@ -539,20 +539,29 @@ def _pools(containers: Iterable[ResolvedContainer]) -> list[list[ResolvedContain return pools -def _warn_about_later_pools(resolved: Sequence[ResolvedContainer]) -> None: - """Name every container a game claim can never reach, once per config.""" +def _pools_by_platform( + resolved: Iterable[ResolvedContainer], +) -> dict[str, list[list[ResolvedContainer]]]: + """Every platform's pools, keyed by the lowercased platform.""" by_platform: dict[str, list[ResolvedContainer]] = {} for container in resolved: + # Nothing to dial, so a claim would have nowhere to go. The fleet view + # still lists it, which is where the operator sees why. if container.key: by_platform.setdefault(container.platform.lower(), []).append(container) - for containers in by_platform.values(): - later = [c.key for pool in _pools(containers)[1:] for c in pool] + return {platform: _pools(members) for platform, members in by_platform.items()} + + +def _warn_about_later_pools(resolved: Sequence[ResolvedContainer]) -> None: + """Name every container a game claim can never reach, once per config.""" + for pools in _pools_by_platform(resolved).values(): + later = [c.key for pool in pools[1:] for c in pool] if later: log.warning( "containers for platform '%s' disagree on emulator, memory card " "sync, save picker or protocol, so game claims only use the first " "pool; never claimed for a game: %s", - containers[0].platform, + pools[0][0].platform, ", ".join(later), ) @@ -560,14 +569,7 @@ def _warn_about_later_pools(resolved: Sequence[ResolvedContainer]) -> None: def pools_for_platform(platform: str) -> list[list[ResolvedContainer]]: """Every container serving a platform, grouped into pools. A container that matches no other is a pool of one.""" - lower = platform.lower() - return _pools( - container - for container in resolve_containers() - # Nothing to dial, so a claim would have nowhere to go. The fleet view - # still lists it, which is where the operator sees why. - if container.key and container.platform.lower() == lower - ) + return _pools_by_platform(resolve_containers()).get(platform.lower(), []) def containers_for_platform(platform: str) -> list[ResolvedContainer]: diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index f45bff061..6e87f3ded 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1540,8 +1540,11 @@ def test_a_container_that_disagrees_on_the_emulator_is_a_later_pool(caplog): second = {**first, "host": "http://192.168.1.11:3000"} second["broker_host"] = "http://192.168.1.11:8000" second["emulator"] = "play" - third = {**first, "host": "http://192.168.1.12:3000"} - third["broker_host"] = "http://192.168.1.12:8000" + third = { + **first, + "host": "http://192.168.1.12:3000", + "broker_host": "http://192.168.1.12:8000", + } romm_logger = logging.getLogger("romm") romm_logger.addHandler(caplog.handler) try: From 5eb94afd6adfa074715eb09727c61c5da32fc987 Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Thu, 17 Sep 2026 11:50:59 -0500 Subject: [PATCH 14/52] polish(pr-ready step 4): build the lone-pool test's member once --- backend/tests/endpoints/test_streaming.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/tests/endpoints/test_streaming.py b/backend/tests/endpoints/test_streaming.py index 6e87f3ded..7c6494cb0 100644 --- a/backend/tests/endpoints/test_streaming.py +++ b/backend/tests/endpoints/test_streaming.py @@ -1565,11 +1565,10 @@ def test_a_container_that_disagrees_on_the_emulator_is_a_later_pool(caplog): def test_a_lone_container_is_a_pool_of_one(rom: Rom): - with _streaming(_pool_member(rom, 0)): + member = _pool_member(rom, 0) + with _streaming(member): pools = pools_for_platform(rom.platform_slug) - assert [[c.key for c in pool] for pool in pools] == [ - [_key_of(_pool_member(rom, 0))] - ] + assert [[c.key for c in pool] for pool in pools] == [[_key_of(member)]] def test_webstation_pool_members_at_different_subfolders_are_still_a_pool(caplog): From 6c7e5875ba829917c8770b31e89e33c3c7605771 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 17 Sep 2026 13:08:10 -0400 Subject: [PATCH 15/52] fix(docker): take the Alpine security patches the pinned bases do not carry The base images are pinned by digest, so the image ships whatever packages were current when upstream last rebuilt them. Alpine backports fixes to its 3.23 repo well ahead of that, leaving known-vulnerable curl, openssl, libexpat, util-linux, libpng and nghttp2 in the published image. `apk upgrade` in production-stage takes those patches, and the same call in python-alias keeps the /usr/lib copy from putting stale libs back. The Alpine digest is also refreshed to 3.23.5, for the builder stages. Co-Authored-By: Claude Opus 5 (1M context) --- docker/Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cb113bb7e..74d47ac46 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,7 @@ # ARGUMENT DECLARATIONS ARG ALPINE_VERSION=3.23 -ARG ALPINE_SHA256=25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 +ARG ALPINE_SHA256=fd791d74b68913cbb027c6546007b3f0d3bc45125f797758156952bc2d6daf40 # Pins the base image tag, so it cannot read ../.python-version; keep the two in sync. ARG PYTHON_VERSION=3.14 ARG PYTHON_ALPINE_SHA256=8caa2adfeb414dfe68d8b257f7aea9e205a400521c2b13b2d2e5e731fb8e70e5 @@ -29,6 +29,10 @@ ARG UV_SHA256=eb47c391d3a252d9d912270dd2b5e234af5493e92039fedb483f1dd1cb5659ce FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}@sha256:${PYTHON_ALPINE_SHA256} AS python-alias +# production-stage copies /usr/lib from here over its own, so this stage needs +# the same patches, or the stale libs land in the final image. +RUN apk upgrade --no-cache + # FRONTEND BUILD # Built on the native build platform: the output (/front/dist) is static JS/CSS, @@ -217,7 +221,9 @@ RUN git clone https://github.com/evanmiller/mod_zip.git && \ FROM nginx:${NGINX_VERSION}-alpine${ALPINE_VERSION}@sha256:${NGINX_SHA256} AS production-stage ARG WEBSERVER_FOLDER=/var/www/html -RUN apk add --no-cache \ +# Alpine backports security fixes to its repo faster than the base image is +# rebuilt, so the digest pin alone leaves known-vulnerable packages in the image. +RUN apk upgrade --no-cache && apk add --no-cache \ bash \ libarchive-tools \ libmagic \ From cdbc33f65f83506f878eb3c1b6094d8a05b4163e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 17 Sep 2026 13:08:16 -0400 Subject: [PATCH 16/52] chore(ci): scope workflow permissions to what each job actually uses `read-all` grants the token read on every scope, not just the one a job needs, so replace it with `contents: read`. The job-level `checks: write` and `pull-requests: write` in typecheck, pytest and migrations were writes no step makes; trunk-check keeps `checks: write` for its annotations, and update-hltb-api-url moves its write scopes down to the job that opens the PR. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/e2e.yml | 3 ++- .github/workflows/frontend-v1-frozen.yml | 3 ++- .github/workflows/frontend.yml | 3 ++- .github/workflows/i18n.yml | 3 ++- .github/workflows/migrations.yml | 9 ++------- .github/workflows/pytest.yml | 6 ++---- .github/workflows/trunk-check.yml | 3 ++- .github/workflows/typecheck.yml | 6 ++---- .github/workflows/update-hltb-api-url.yml | 6 ++++-- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 82f4f7785..1d09e8279 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -22,7 +22,8 @@ on: - uv.lock - .python-version -permissions: read-all +permissions: + contents: read jobs: e2e: diff --git a/.github/workflows/frontend-v1-frozen.yml b/.github/workflows/frontend-v1-frozen.yml index 9a7fb3593..abe0b50f8 100644 --- a/.github/workflows/frontend-v1-frozen.yml +++ b/.github/workflows/frontend-v1-frozen.yml @@ -16,7 +16,8 @@ on: - "frontend/src/console/**" - "frontend/src/layouts/**" -permissions: read-all +permissions: + contents: read jobs: check-v1-frozen: diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 30cb2af0e..f6369f515 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -10,7 +10,8 @@ on: paths: - "frontend/**" -permissions: read-all +permissions: + contents: read jobs: test: diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 6d3323820..6d93df816 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -5,7 +5,8 @@ on: paths: - "frontend/src/locales/**/*.json" -permissions: read-all +permissions: + contents: read jobs: check-translations: diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 1d603225a..601f49ea9 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -9,14 +9,12 @@ on: - uv.lock - .python-version -permissions: read-all +permissions: + contents: read jobs: migrate-postgres: runs-on: ubuntu-latest - permissions: - checks: write - pull-requests: write services: postgres: image: postgres:18 @@ -68,9 +66,6 @@ jobs: # migration SQL that a default utf8mb4 server accepts (issue #4350). name: migrate-mariadb (${{ matrix.mariadb }}, ${{ matrix.collation }}) runs-on: ubuntu-latest - permissions: - checks: write - pull-requests: write strategy: fail-fast: false matrix: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c127fc30f..5e96c1b27 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -22,14 +22,12 @@ on: - Dockerfile - docker/Dockerfile -permissions: read-all +permissions: + contents: read jobs: pytest: runs-on: ubuntu-latest - permissions: - checks: write - pull-requests: write strategy: fail-fast: false matrix: diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index 7f21098cb..443778ff8 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -10,7 +10,8 @@ concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true -permissions: read-all +permissions: + contents: read jobs: trunk_check: diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index aa505a17f..756a0aa27 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -10,14 +10,12 @@ on: paths: - "frontend/**" -permissions: read-all +permissions: + contents: read jobs: typecheck: runs-on: ubuntu-latest - permissions: - checks: write - pull-requests: write steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/update-hltb-api-url.yml b/.github/workflows/update-hltb-api-url.yml index 9b45293c3..df0a9e9ff 100644 --- a/.github/workflows/update-hltb-api-url.yml +++ b/.github/workflows/update-hltb-api-url.yml @@ -8,12 +8,14 @@ on: - cron: "0 6 * * 1" permissions: - contents: write - pull-requests: write + contents: read jobs: update-hltb-api-url: runs-on: ubuntu-latest + permissions: + contents: write # For create-pull-request to push the branch + pull-requests: write # For create-pull-request to open the PR steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 From 43ad55624b13e58cf075694989e989c6a715a94f Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 17 Sep 2026 13:18:51 -0400 Subject: [PATCH 17/52] fix(docker): keep the release cache from serving a stale apk upgrade Release builds import a persistent registry cache, and an `apk upgrade` off a fixed base digest has no changing input, so the layer would be reused from a previous release and reship its package set. `no-cache-filters` forces both upgrade stages to run on every release. The Python-side upgrade moves into its own `python-runtime` stage so that busting it does not also rebuild the venv and the sigil bindings. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/build.yml | 5 +++++ docker/Dockerfile | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2341a4b81..70e480857 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,6 +125,10 @@ jobs: labels: ${{ steps.meta-slim.outputs.labels }} target: slim-image outputs: type=image,name=${{ env.DIGEST_IMAGE }},push-by-digest=true,name-canonical=true,push=true + # Both stages run `apk upgrade` off a fixed base digest, so nothing in + # them changes between releases and the cache would serve the package + # set of whenever the layer was first built. + no-cache-filters: python-runtime,production-stage # Deliberately not seeded from the preview cache: those layers are # built from PR head content and must not reach a release image. cache-from: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }} @@ -144,6 +148,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} target: full-image outputs: type=image,name=${{ env.DIGEST_IMAGE }},push-by-digest=true,name-canonical=true,push=true + no-cache-filters: python-runtime,production-stage cache-from: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }} cache-to: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }},mode=max build-args: | diff --git a/docker/Dockerfile b/docker/Dockerfile index 74d47ac46..76628a258 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,5 @@ # Stages: +# - python-runtime: Patch the Python image's libraries before they ship # - frontend-build: Build frontend # - backend-build: Build backend environment # - backend-dev-build: Similar to `backend-build`, but also compiles and installs development dependencies @@ -29,8 +30,13 @@ ARG UV_SHA256=eb47c391d3a252d9d912270dd2b5e234af5493e92039fedb483f1dd1cb5659ce FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}@sha256:${PYTHON_ALPINE_SHA256} AS python-alias -# production-stage copies /usr/lib from here over its own, so this stage needs -# the same patches, or the stale libs land in the final image. + +# PATCHED PYTHON RUNTIME +# production-stage copies /usr/lib from here over its own, so these libraries +# need the same patches, or the stale ones land in the final image. Kept apart +# from python-alias so that busting this layer's cache (see `no-cache-filters` +# in build.yml) does not also rebuild the venv and the sigil bindings. +FROM python-alias AS python-runtime RUN apk upgrade --no-cache @@ -240,11 +246,11 @@ RUN apk upgrade --no-cache && apk add --no-cache \ # TODO: Replace with a bundled installation of Python using `uv`, when it is supported. # Related issue: https://github.com/astral-sh/uv/issues/7865 ARG PYTHON_VERSION -COPY --from=python-alias /usr/lib/* /usr/lib/ -COPY --from=python-alias /usr/local/bin/* /usr/local/bin/ -COPY --from=python-alias /usr/local/include/python${PYTHON_VERSION} /usr/local/include/python${PYTHON_VERSION} -COPY --from=python-alias /usr/local/lib/libpython* /usr/local/lib/ -COPY --from=python-alias /usr/local/lib/python${PYTHON_VERSION} /usr/local/lib/python${PYTHON_VERSION} +COPY --from=python-runtime /usr/lib/* /usr/lib/ +COPY --from=python-runtime /usr/local/bin/* /usr/local/bin/ +COPY --from=python-runtime /usr/local/include/python${PYTHON_VERSION} /usr/local/include/python${PYTHON_VERSION} +COPY --from=python-runtime /usr/local/lib/libpython* /usr/local/lib/ +COPY --from=python-runtime /usr/local/lib/python${PYTHON_VERSION} /usr/local/lib/python${PYTHON_VERSION} COPY --from=rahasher-build /RALibretro/bin64/RAHasher /usr/bin/RAHasher COPY --from=nginx-build ./nginx/objs/ngx_http_zip_module.so /usr/lib/nginx/modules/ From 5fe383641f38316cd638b217a35867607db99709 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Thu, 17 Sep 2026 15:44:10 -0500 Subject: [PATCH 18/52] fix(docker): move the bases to Alpine 3.24 and nginx 1.30.5 The image logs a spurious notice on every start: [notice] 113#113: js vm init njs: 00007F16E1CA0B00 njs logs one line per config VM it initialises (nginx/ngx_js.c) and the config imports a single VM at the http level, so it is noise rather than a symptom. njs 0.9.7 removed the line (nginx/njs#1042, nginx/njs#1047), but nginx:1.29.8-alpine was built six days earlier and ships njs 0.9.6. nginx:1.30.5-alpine3.24 ships njs 1.0.1. 1.30 is nginx's stable branch: 1.29.8 was the last mainline of that tree and 1.30.0 the same code a week later. Both branches carry the same-day CVE-2026-90439 fix, so the move gives up no security fix. The nginx tag is what forces the Alpine move: each nginx release ships one Alpine flavour and there is no 1.29.8-alpine3.24. Alpine 3.24 is supported to 2028-06-01, 3.23 only to 2027-11-01. Verified: the repo's own config logs the notice on 1.29.8-alpine and does not on 1.30.5-alpine3.24; mod_zip compiles against release-1.30.5 on the new base; every apk add list in this file resolves on 3.24. Co-Authored-By: Claude Sonnet 5 --- docker/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cb113bb7e..c32ed8db2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,15 +14,15 @@ # ARGUMENT DECLARATIONS -ARG ALPINE_VERSION=3.23 -ARG ALPINE_SHA256=25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 +ARG ALPINE_VERSION=3.24 +ARG ALPINE_SHA256=28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b # Pins the base image tag, so it cannot read ../.python-version; keep the two in sync. ARG PYTHON_VERSION=3.14 -ARG PYTHON_ALPINE_SHA256=8caa2adfeb414dfe68d8b257f7aea9e205a400521c2b13b2d2e5e731fb8e70e5 +ARG PYTHON_ALPINE_SHA256=c6ead215bfd31f1e433d968853b7a769989117115b728874824e6c0a27cb96fc ARG NODE_VERSION=24.16 -ARG NODE_ALPINE_SHA256=2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 -ARG NGINX_VERSION=1.29.8 -ARG NGINX_SHA256=5616878291a2eed594aee8db4dade5878cf7edcb475e59193904b198d9b830de +ARG NODE_ALPINE_SHA256=21f403ab171f2dc89bad4dd69d7721bfd15f084ccb46cdd225f31f2bc59b5c9a +ARG NGINX_VERSION=1.30.5 +ARG NGINX_SHA256=25820c39dba41369486df729ad6697de2fab631ca809e0503e1d1e0c73d9a232 ARG UV_VERSION=0.12.13 ARG UV_SHA256=eb47c391d3a252d9d912270dd2b5e234af5493e92039fedb483f1dd1cb5659ce From c1183109c640c70ae8812ed01df3d4d94f144a6c Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Fri, 18 Sep 2026 00:52:31 +0000 Subject: [PATCH 19/52] build(frontend): prefix CSS in dev as well as production Vendor prefixes were generated only on the build's minify path, so the dev server served `backdrop-filter` with no `-webkit-` twin. caniuse has Safari 16.3-17.6 as supported-with-prefix, which left every glass surface unblurred while developing in Safari below 18.4. Two rules papered over it by hand, and that made production worse: Lightning CSS collapses such a pair to whichever is declared last, dropping the standard property for Chrome, Edge and Firefox. Lightning CSS as the CSS transformer covers both paths from one setting. Dev now serves both properties, verified against the running server. That also retires the hand-rolled browserslist-to-esbuild conversion. It existed because `target: "esnext"` was inherited by `cssTarget`, and Vite's `convertTargets` skips the `esnext` entry, leaving Lightning CSS with no targets at all. Vite's default target resolves to chrome111, edge111, firefox114, safari16.4, ios16.4, which both the transformer and the minifier read, so the converter, both explicit targets and the `browserslist` dependency all go. `.browserslistrc` goes with them: nothing reads it once the conversion is gone. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BEtFQ17BQDS52wXosTjcUU --- frontend/.browserslistrc | 11 -------- frontend/package-lock.json | 1 - frontend/package.json | 1 - frontend/vite.config.js | 54 +++++++------------------------------- 4 files changed, 10 insertions(+), 57 deletions(-) delete mode 100644 frontend/.browserslistrc diff --git a/frontend/.browserslistrc b/frontend/.browserslistrc deleted file mode 100644 index e8391d6f3..000000000 --- a/frontend/.browserslistrc +++ /dev/null @@ -1,11 +0,0 @@ -# Browser support baseline for the RomM frontend. Matches Tailwind v4's -# minimum targets. This is the single source of truth for browser support: -# vite.config.js derives Lightning CSS's `build.cssTarget` from it (so the -# production build prefixes/down-levels CSS for exactly these browsers), and -# any other tooling reads the same file. Expressed as floors, not pinned -# versions, and the actual version data comes from caniuse-lite. -chrome >= 111 -edge >= 111 -firefox >= 128 -safari >= 16.4 -ios_saf >= 16.4 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 4c1953a30..103b4b64f 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -52,7 +52,6 @@ "@vue/test-utils": "^2.4.9", "@vue/tsconfig": "^0.7.0", "axe-core": "^4.12.1", - "browserslist": "^4.28.8", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", diff --git a/frontend/package.json b/frontend/package.json index 27073b501..b14214ccf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -81,7 +81,6 @@ "@vue/test-utils": "^2.4.9", "@vue/tsconfig": "^0.7.0", "axe-core": "^4.12.1", - "browserslist": "^4.28.8", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", diff --git a/frontend/vite.config.js b/frontend/vite.config.js index a72aed72d..fe971f7d3 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,6 +1,5 @@ import tailwindcss from "@tailwindcss/vite"; import vue from "@vitejs/plugin-vue"; -import browserslist from "browserslist"; import { URL, fileURLToPath } from "node:url"; import { defineConfig, loadEnv } from "vite"; import mkcert from "vite-plugin-mkcert"; @@ -58,43 +57,6 @@ const VUETIFY_COMPONENTS = [ "vuetify/components/VWindow", ]; -// Maps browserslist browser ids to the esbuild-style ids that Vite's -// `build.cssTarget` understands. Engines not listed here (and_chr, samsung, -// kaios, ...) share a rendering engine with one of these or track "latest", -// so skipping them does not change the emitted prefixes. -const BROWSERSLIST_TO_ESBUILD = { - chrome: "chrome", - edge: "edge", - firefox: "firefox", - ios_saf: "ios", - opera: "opera", - safari: "safari", -}; - -// Translate the shared `.browserslistrc` baseline into Vite's CSS target -// format. Vite 8 minifies CSS with Lightning CSS, which auto-prefixes and -// down-levels from the standard property based on browser targets, but on the -// minify path it only reads `build.cssTarget` (esbuild-style ids), never -// `css.lightningcss.targets`. Deriving it here keeps `.browserslistrc` the -// single source of truth. Without targets Lightning CSS drops the generated -// `-webkit-backdrop-filter`, breaking every glass/blur surface in Safari. -function cssTargetsFromBrowserslist() { - const lowest = {}; - for (const entry of browserslist()) { - const [id, range] = entry.split(" "); - const name = BROWSERSLIST_TO_ESBUILD[id]; - if (!name) continue; - const version = range.split("-")[0]; // "16.4-16.5" -> "16.4" - const asNumber = Number.parseFloat(version); - if (lowest[name] === undefined || asNumber < lowest[name].asNumber) { - lowest[name] = { asNumber, version }; - } - } - return Object.entries(lowest).map( - ([name, { version }]) => `${name}${version}`, - ); -} - // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { // Load ENV variables from the parent directory and the current directory. @@ -113,16 +75,10 @@ export default defineConfig(({ mode }) => { include: VUETIFY_COMPONENTS, }, build: { - target: "esnext", // AudioWorklet.addModule is only dependable with a real URL, and Vite // inlines any asset under 4KB as a data: URI, so keep the worklet out. assetsInlineLimit: (filePath) => filePath.endsWith("pico8AudioWorklet.js") ? false : undefined, - // Browser targets for CSS (prefixing + down-leveling) come from the - // shared `.browserslistrc`. Never hand-write a `-webkit-` twin next to a - // standard property: Lightning CSS collapses the pair to whichever is - // declared last, so let it generate the prefixes from these targets. - cssTarget: cssTargetsFromBrowserslist(), }, plugins: [ tailwindcss(), @@ -157,6 +113,16 @@ export default defineConfig(({ mode }) => { hosts: ["localhost", "127.0.0.1", "romm.dev"], }), ], + // Lightning CSS transforms dev and build alike, so the vendor prefixes it + // generates from Vite's baseline targets reach the dev server too. With + // Vite's default postcss transformer they only appear on the build's + // minify path, and Safari below 18.4 loses every backdrop-filter surface + // while developing. Never hand-write a `-webkit-` twin to paper over that: + // Lightning CSS keeps only the last of the pair, dropping the standard + // property from the bundle. + css: { + transformer: "lightningcss", + }, define: { "process.env": {}, __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: true, From ff3cbce1e9c047a2372b94669c5e3634cbe766cb Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Fri, 18 Sep 2026 01:03:27 +0000 Subject: [PATCH 20/52] test(frontend): cover the dev server's CSS prefixing Nothing exercised the dev CSS path: CI's e2e run serves a production build, and vitest.config.ts never loads vite.config.js, so dropping `css.transformer` would leave every check green while Safari below 18.4 lost its blur again. Drives the real config through Vite's programmatic server and asserts both the standard and prefixed properties. Removing the transformer fails it. Also trims the comment above the setting to the two lines the repo allows. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BEtFQ17BQDS52wXosTjcUU --- frontend/test/devCssPrefixing.test.ts | 30 +++++++++++++++++++++++++ frontend/test/fixtures/prefix-probe.css | 5 +++++ frontend/vite.config.js | 9 ++------ 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 frontend/test/devCssPrefixing.test.ts create mode 100644 frontend/test/fixtures/prefix-probe.css diff --git a/frontend/test/devCssPrefixing.test.ts b/frontend/test/devCssPrefixing.test.ts new file mode 100644 index 000000000..afc7e1dc5 --- /dev/null +++ b/frontend/test/devCssPrefixing.test.ts @@ -0,0 +1,30 @@ +import path from "node:path"; +import { createServer, type ViteDevServer } from "vite"; +import { afterAll, beforeAll, describe, expect, it } from "vitest"; + +// The dev server is the only place this is observable: CI's e2e run serves a +// production build, and vitest.config.ts never loads vite.config.js, so a +// dropped `css.transformer` would leave every other check green. +describe("dev server CSS", () => { + let server: ViteDevServer; + + beforeAll(async () => { + server = await createServer({ + configFile: path.resolve(process.cwd(), "vite.config.js"), + server: { middlewareMode: true }, + logLevel: "error", + }); + }, 60_000); + + afterAll(async () => { + await server?.close(); + }); + + it("generates vendor prefixes, not only on the build's minify path", async () => { + const result = await server.transformRequest( + "/test/fixtures/prefix-probe.css", + ); + expect(result?.code).toMatch(/-webkit-backdrop-filter:\s*blur\(1px\)/); + expect(result?.code).toMatch(/[^-]backdrop-filter:\s*blur\(1px\)/); + }); +}); diff --git a/frontend/test/fixtures/prefix-probe.css b/frontend/test/fixtures/prefix-probe.css new file mode 100644 index 000000000..c68eb67ad --- /dev/null +++ b/frontend/test/fixtures/prefix-probe.css @@ -0,0 +1,5 @@ +/* Probed by test/devCssPrefixing.test.ts. `backdrop-filter` needs a + `-webkit-` prefix below Safari 18.4, and the build targets cover it. */ +.prefix-probe { + backdrop-filter: blur(1px); +} diff --git a/frontend/vite.config.js b/frontend/vite.config.js index fe971f7d3..6d36eb58c 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -113,13 +113,8 @@ export default defineConfig(({ mode }) => { hosts: ["localhost", "127.0.0.1", "romm.dev"], }), ], - // Lightning CSS transforms dev and build alike, so the vendor prefixes it - // generates from Vite's baseline targets reach the dev server too. With - // Vite's default postcss transformer they only appear on the build's - // minify path, and Safari below 18.4 loses every backdrop-filter surface - // while developing. Never hand-write a `-webkit-` twin to paper over that: - // Lightning CSS keeps only the last of the pair, dropping the standard - // property from the bundle. + // Prefixes dev too, not just the build's minify path. Never hand-write a + // `-webkit-` twin: Lightning CSS keeps only the last of the pair. css: { transformer: "lightningcss", }, From 0c67e50e1307797ba05f6854fff68de9d66903ae Mon Sep 17 00:00:00 2001 From: Zach Clendenen Date: Fri, 18 Sep 2026 20:15:13 -0500 Subject: [PATCH 21/52] test(streaming): pin the desktop heartbeat's named container and its ended claim drop (Greptile review) --- frontend/src/v2/views/Player/Desktop.test.ts | 135 +++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 frontend/src/v2/views/Player/Desktop.test.ts diff --git a/frontend/src/v2/views/Player/Desktop.test.ts b/frontend/src/v2/views/Player/Desktop.test.ts new file mode 100644 index 000000000..83d1aa926 --- /dev/null +++ b/frontend/src/v2/views/Player/Desktop.test.ts @@ -0,0 +1,135 @@ +import { flushPromises, mount, type VueWrapper } from "@vue/test-utils"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { defineComponent } from "vue"; +import Desktop from "./Desktop.vue"; + +const mocks = vi.hoisted(() => ({ + claimDesktop: vi.fn(), + releaseSession: vi.fn(), + releaseSessionKeepalive: vi.fn(), + heartbeatSession: vi.fn(), + heartbeatTick: null as (() => Promise) | null, + routeLeave: null as (() => Promise | boolean) | null, +})); + +vi.mock("vue-i18n", () => ({ + useI18n: () => ({ t: (key: string) => key }), +})); + +vi.mock("vue-router", () => ({ + onBeforeRouteLeave: (guard: () => Promise) => { + mocks.routeLeave = guard; + }, + useRoute: () => ({ query: { container: "WEBSTATION-DEV" } }), + useRouter: () => ({ push: vi.fn() }), +})); + +vi.mock("@vueuse/core", async (importOriginal) => ({ + ...(await importOriginal()), + // The beat is driven by hand; the pagehide listener stays real. + useIntervalFn: (tick: () => Promise) => { + mocks.heartbeatTick = tick; + }, +})); + +vi.mock("@/plugins/router", () => ({ + ROUTES: { ADMINISTRATION: "administration" }, +})); + +vi.mock("@/services/api/streaming", () => ({ + default: { + claimDesktop: mocks.claimDesktop, + releaseSession: mocks.releaseSession, + releaseSessionKeepalive: mocks.releaseSessionKeepalive, + }, +})); + +vi.mock("@/stores/streaming", () => ({ + useStreamingStore: () => ({ heartbeatSession: mocks.heartbeatSession }), +})); + +vi.mock("@/v2/composables/useConfirm", () => ({ + useConfirm: () => () => Promise.resolve(true), +})); + +vi.mock("@/v2/composables/usePageTitle", () => ({ usePageTitle: vi.fn() })); + +const StreamStageStub = defineComponent({ + props: { active: { type: Boolean, default: false } }, + setup(_, { expose }) { + expose({ + leaveFullscreen: () => Promise.resolve(), + focusStream: () => {}, + }); + return () => null; + }, +}); + +// The view listens on window, so a mount left standing would answer the next +// test's pagehide too. +let mounted: VueWrapper | null = null; + +beforeEach(() => { + vi.clearAllMocks(); +}); + +afterEach(() => { + mounted?.unmount(); + mounted = null; +}); + +async function openDesktop(): Promise { + mocks.claimDesktop.mockResolvedValue({ + data: { host: "http://webstation-dev:8080", label: "PS2", platform: "ps2" }, + }); + mounted = mount(Desktop, { + shallow: true, + global: { stubs: { StreamStage: StreamStageStub } }, + }); + await flushPromises(); + return mounted; +} + +function streamIsLive(wrapper: VueWrapper): boolean | undefined { + return wrapper.findComponent(StreamStageStub).props("active"); +} + +describe("Desktop heartbeats", () => { + it("beats for the container it claimed", async () => { + // Unnamed, the beat only reaches the platform's first pool. + const wrapper = await openDesktop(); + mocks.heartbeatSession.mockResolvedValue({ status: "active" }); + + await mocks.heartbeatTick?.(); + + expect(mocks.heartbeatSession).toHaveBeenCalledWith( + "ps2", + "WEBSTATION-DEV", + ); + expect(streamIsLive(wrapper)).toBe(true); + }); + + it("stops the stream when the beat reports the session ended", async () => { + const wrapper = await openDesktop(); + mocks.heartbeatSession.mockResolvedValue({ status: "ended" }); + + await mocks.heartbeatTick?.(); + await flushPromises(); + + expect(streamIsLive(wrapper)).toBe(false); + }); + + it("releases nothing once the beat ended the claim", async () => { + // The claim is gone, so an exit must not hand back whoever holds the + // container next. + await openDesktop(); + mocks.heartbeatSession.mockResolvedValue({ status: "ended" }); + + await mocks.heartbeatTick?.(); + window.dispatchEvent(new Event("pagehide")); + + expect(await mocks.routeLeave?.()).toBe(true); + expect(mocks.releaseSessionKeepalive).not.toHaveBeenCalled(); + expect(mocks.releaseSession).not.toHaveBeenCalled(); + }); +}); From d476723241b4c6cc884caca00e393171fc23fa43 Mon Sep 17 00:00:00 2001 From: Stuart Anderson Date: Sat, 19 Sep 2026 15:42:26 -0500 Subject: [PATCH 22/52] chore: surface circular dependencies via dpdm --- .github/workflows/typecheck.yml | 2 +- docs/FRONTEND_ARCHITECTURE.md | 16 +- frontend/dpdm.config.ts | 19 ++ frontend/package-lock.json | 450 ++++++++++++++++++++++++++++++++ frontend/package.json | 4 +- 5 files changed, 481 insertions(+), 10 deletions(-) create mode 100644 frontend/dpdm.config.ts diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index aa505a17f..ad673321d 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -33,7 +33,7 @@ jobs: run: npm ci working-directory: frontend - - name: Run typecheck + - name: Run typecheck (vue-tsc and circular dependency check) run: npm run typecheck working-directory: frontend diff --git a/docs/FRONTEND_ARCHITECTURE.md b/docs/FRONTEND_ARCHITECTURE.md index 8a1c05560..ab1432a9f 100644 --- a/docs/FRONTEND_ARCHITECTURE.md +++ b/docs/FRONTEND_ARCHITECTURE.md @@ -1099,14 +1099,14 @@ Procedural SVG generation for: ### Scripts -| Script | Command | Purpose | -| ----------- | ---------------------------- | ----------------------------------- | -| `dev` | `vite --host` | Development server | -| `build` | `vite build` | Production build | -| `preview` | `vite preview` | Preview production build | -| `typecheck` | `vue-tsc` | TypeScript validation | -| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | -| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | +| Script | Command | Purpose | +| ----------- | ------------------------------ | ----------------------------------- | +| `dev` | `vite --host` | Development server | +| `build` | `vite build` | Production build | +| `preview` | `vite preview` | Preview production build | +| `typecheck` | `vue-tsc`, `dpdm` (`circular`) | Types plus static import cycle gate | +| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | +| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | ### OpenAPI Code Generation diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts new file mode 100644 index 000000000..a43b414c3 --- /dev/null +++ b/frontend/dpdm.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from "dpdm"; + +export default defineConfig({ + files: [ + // Production app bootstrap (router, plugins, stores). + "src/main.ts", + // API client hub; catches api ↔ router ↔ rom static cycles. + "src/services/api/index.ts", + // Every Storybook story file; covers import paths Vitest does not run. + "src/**/*.stories.ts", + // Shared Storybook runtime (Pinia, i18n, permissions seed), not main.ts. + ".storybook/preview.ts", + ], + circular: true, + tree: false, + warning: false, + exitCode: "circular:1", + transform: true, +}); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e53e7ae49..cbe925db4 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -53,6 +53,7 @@ "@vue/tsconfig": "^0.9.1", "axe-core": "^4.12.1", "browserslist": "^4.28.8", + "dpdm": "^4.3.0", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", @@ -6529,6 +6530,19 @@ "node": ">=18" } }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/character-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", @@ -6549,6 +6563,35 @@ "node": ">= 16" } }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-3.4.0.tgz", + "integrity": "sha512-bXfOC4QcT1tKXGorxL3wbJm6XJPDqEnij2gQ2m7ESQuE+/z9YFIWnl/5RpTiKWbMq3EVKR4fRLJGn6DVfu0mpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -7009,6 +7052,216 @@ "license": "MIT", "peer": true }, + "node_modules/dpdm": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/dpdm/-/dpdm-4.3.0.tgz", + "integrity": "sha512-2ZrP5B3MHHo7mXWgNxntU5DhJIvXNP4hcMBdCJsuxEWenKMdf4h6XouuKMf3Sj2SAUNBy/ajcWAVIyiOZly6rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.6.2", + "fs-extra": "^11.3.3", + "glob": "^13.0.0", + "ora": "^9.1.0", + "tslib": "^2.8.1", + "typescript": "^5.9.3", + "yargs": "^18.0.0" + }, + "bin": { + "dpdm": "lib/bin/dpdm.js" + } + }, + "node_modules/dpdm/node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/dpdm/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/dpdm/node_modules/cliui": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/dpdm/node_modules/cliui/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dpdm/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "dev": true, + "license": "MIT" + }, + "node_modules/dpdm/node_modules/glob": { + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/dpdm/node_modules/string-width": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", + "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.5.0", + "strip-ansi": "^7.1.2" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dpdm/node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/dpdm/node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/dpdm/node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dpdm/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/dpdm/node_modules/yargs": { + "version": "18.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.1.0.tgz", + "integrity": "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^9.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "string-width": "^8.2.1", + "y18n": "^5.0.5", + "yargs-parser": "^22.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "node_modules/dpdm/node_modules/yargs-parser": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -7962,6 +8215,19 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-east-asian-width": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz", + "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -8603,6 +8869,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", @@ -8792,6 +9071,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-unicode-supported": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-weakmap": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", @@ -9617,6 +9909,23 @@ "dev": true, "license": "MIT" }, + "node_modules/log-symbols": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-7.0.1.tgz", + "integrity": "sha512-ja1E3yCr9i/0hmBVaM0bfwDjnGy8I/s6PP4DFp+yP+a+mrHO4Rm7DtmnqROTUkHIkqffC84YY7AeqX6oFk0WFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-unicode-supported": "^2.0.0", + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/loupe": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", @@ -9779,6 +10088,19 @@ "node": ">= 0.6" } }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -9993,6 +10315,22 @@ "node": ">=12.20.0" } }, + "node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/open": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", @@ -10047,6 +10385,75 @@ "node": ">= 0.8.0" } }, + "node_modules/ora": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-9.4.1.tgz", + "integrity": "sha512-6VlU9MLXbjVQD04AZCMX28hVtA5bUoadvUqO76MUCVA0ilwJbMiHsITRPfyVm6p/BC0Av/BXMujx39WCe1LEqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.6.2", + "cli-cursor": "^5.0.0", + "cli-spinners": "^3.2.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^2.1.0", + "log-symbols": "^7.0.1", + "stdin-discarder": "^0.3.2", + "string-width": "^8.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ora/node_modules/string-width": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", + "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.5.0", + "strip-ansi": "^7.1.2" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/own-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", @@ -10874,6 +11281,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/rfdc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", @@ -11302,6 +11726,19 @@ "dev": true, "license": "MIT" }, + "node_modules/stdin-discarder": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.3.2.tgz", + "integrity": "sha512-eCPu1qRxPVkl5605OTWF8Wz40b4Mf45NY5LQmVPQ599knfs5QhASUm9GbJ5BDMDOXgrnh0wyEdvzmL//YMlw0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/stop-iteration-iterator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", @@ -13754,6 +14191,19 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/yoctocolors": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.2.0.tgz", + "integrity": "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/frontend/package.json b/frontend/package.json index fbf0d8184..5fc3db65c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,7 +26,7 @@ "dev": "vite --host", "build": "vite build", "preview": "vite preview", - "typecheck": "vue-tsc --noEmit", + "typecheck": "vue-tsc --noEmit && npm run circular", "generate": "openapi --input http://127.0.0.1:3000/openapi.json --output ./src/__generated__ --client axios --useOptions --useUnionTypes --exportServices false --exportSchemas false --exportCore false", "test": "vitest run", "test:watch": "vitest", @@ -34,6 +34,7 @@ "storybook": "storybook dev -p 6006", "storybook:build": "storybook build", "storybook:test": "vitest run test/storybook.test.ts", + "circular": "dpdm", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui" }, @@ -82,6 +83,7 @@ "@vue/tsconfig": "^0.9.1", "axe-core": "^4.12.1", "browserslist": "^4.28.8", + "dpdm": "^4.3.0", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", From 4dcc640e26168510ad7ed16a8396186c0c33fcd4 Mon Sep 17 00:00:00 2001 From: Stuart Anderson Date: Sat, 19 Sep 2026 15:59:18 -0500 Subject: [PATCH 23/52] chore: remove comments per constitution --- frontend/dpdm.config.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts index a43b414c3..1fd3c0ba0 100644 --- a/frontend/dpdm.config.ts +++ b/frontend/dpdm.config.ts @@ -2,13 +2,9 @@ import { defineConfig } from "dpdm"; export default defineConfig({ files: [ - // Production app bootstrap (router, plugins, stores). "src/main.ts", - // API client hub; catches api ↔ router ↔ rom static cycles. "src/services/api/index.ts", - // Every Storybook story file; covers import paths Vitest does not run. "src/**/*.stories.ts", - // Shared Storybook runtime (Pinia, i18n, permissions seed), not main.ts. ".storybook/preview.ts", ], circular: true, From 76309225c19edeb7ccd54db7b29d831e34cd2897 Mon Sep 17 00:00:00 2001 From: Stuart Anderson Date: Sat, 19 Sep 2026 16:24:34 -0500 Subject: [PATCH 24/52] fix(frontend): break static import cycles for dpdm gate --- frontend/src/plugins/routeNames.ts | 61 ++++++++++++++++++++++++++++ frontend/src/plugins/router.ts | 64 +----------------------------- frontend/src/services/api/index.ts | 10 ++++- frontend/src/services/api/rom.ts | 2 +- frontend/src/stores/navigation.ts | 2 +- frontend/src/utils/downloadPath.ts | 54 +++++++++++++++++++++++++ frontend/src/utils/index.ts | 53 +------------------------ 7 files changed, 128 insertions(+), 118 deletions(-) create mode 100644 frontend/src/plugins/routeNames.ts create mode 100644 frontend/src/utils/downloadPath.ts diff --git a/frontend/src/plugins/routeNames.ts b/frontend/src/plugins/routeNames.ts new file mode 100644 index 000000000..0a6b16895 --- /dev/null +++ b/frontend/src/plugins/routeNames.ts @@ -0,0 +1,61 @@ +export const ROUTES = { + SETUP: "setup", + LOGIN: "login", + RESET_PASSWORD: "reset-password", + REGISTER: "register", + MAIN: "main", + HOME: "home", + SEARCH: "search", + MUSIC: "music", + PLATFORM: "platform", + COLLECTION: "collection", + VIRTUAL_COLLECTION: "virtual-collection", + SMART_COLLECTION: "smart-collection", + ROM: "rom", + EMULATORJS: "emulatorjs", + JSDOS: "jsdos", + PICO8: "pico8", + RUFFLE: "ruffle", + STREAM: "stream", + STREAM_DESKTOP: "stream-desktop", + SCAN: "scan", + UPLOAD: "upload", + ACTIVITY: "activity", + USER_PROFILE: "user-profile", + USER_INTERFACE: "user-interface", + LIBRARY_MANAGEMENT: "library-management", + SCAN_SETTINGS: "scan-settings", + METADATA_SOURCES: "metadata-sources", + CLIENT_API_TOKENS: "client-api-tokens", + ADMINISTRATION: "administration", + SERVER_STATS: "server-stats", + LOGS: "logs", + PAIR: "pair", + PAIR_DEVICE: "pair-device", + APRIL_FOOLS: "april-fools", + CONSOLE_HOME: "console-home", + CONSOLE_PLATFORM: "console-platform", + CONSOLE_COLLECTION: "console-collection", + CONSOLE_SMART_COLLECTION: "console-smart-collection", + CONSOLE_VIRTUAL_COLLECTION: "console-virtual-collection", + CONSOLE_ROM: "console-rom", + CONSOLE_PLAY: "console-play", + PLATFORMS_INDEX: "platforms-index", + COLLECTIONS_INDEX: "collections-index", + CONTROLLER_DEBUG: "controller-debug", + NOT_FOUND: "404", +} as const; + +const authExemptRoutes = [ + ROUTES.LOGIN, + ROUTES.SETUP, + ROUTES.RESET_PASSWORD, + ROUTES.REGISTER, + ROUTES.PAIR, +] as const; + +type AuthExemptRoute = (typeof authExemptRoutes)[number]; + +export function isAuthExemptRoute(route: string): route is AuthExemptRoute { + return (authExemptRoutes as readonly string[]).includes(route); +} diff --git a/frontend/src/plugins/router.ts b/frontend/src/plugins/router.ts index 2a87c9f82..55cd1fa9c 100644 --- a/frontend/src/plugins/router.ts +++ b/frontend/src/plugins/router.ts @@ -7,6 +7,7 @@ import { type RouteLocationNormalized, } from "vue-router"; import i18n, { loadLocale } from "@/locales"; +import { isAuthExemptRoute, ROUTES } from "@/plugins/routeNames"; import { startViewTransition } from "@/plugins/transition"; import romApi from "@/services/api/rom"; import storeAuth from "@/stores/auth"; @@ -19,54 +20,7 @@ import { v2RouteComponents, } from "@/v2/router/routes"; -export const ROUTES = { - SETUP: "setup", - LOGIN: "login", - RESET_PASSWORD: "reset-password", - REGISTER: "register", - MAIN: "main", - HOME: "home", - SEARCH: "search", - MUSIC: "music", - PLATFORM: "platform", - COLLECTION: "collection", - VIRTUAL_COLLECTION: "virtual-collection", - SMART_COLLECTION: "smart-collection", - ROM: "rom", - EMULATORJS: "emulatorjs", - JSDOS: "jsdos", - PICO8: "pico8", - RUFFLE: "ruffle", - STREAM: "stream", - STREAM_DESKTOP: "stream-desktop", - SCAN: "scan", - UPLOAD: "upload", - ACTIVITY: "activity", - USER_PROFILE: "user-profile", - USER_INTERFACE: "user-interface", - LIBRARY_MANAGEMENT: "library-management", - SCAN_SETTINGS: "scan-settings", - METADATA_SOURCES: "metadata-sources", - CLIENT_API_TOKENS: "client-api-tokens", - ADMINISTRATION: "administration", - SERVER_STATS: "server-stats", - LOGS: "logs", - PAIR: "pair", - PAIR_DEVICE: "pair-device", - APRIL_FOOLS: "april-fools", - CONSOLE_HOME: "console-home", - CONSOLE_PLATFORM: "console-platform", - CONSOLE_COLLECTION: "console-collection", - CONSOLE_SMART_COLLECTION: "console-smart-collection", - CONSOLE_VIRTUAL_COLLECTION: "console-virtual-collection", - CONSOLE_ROM: "console-rom", - CONSOLE_PLAY: "console-play", - // V2-only routes (no v1 equivalent — v1 uses its drawer for these). - PLATFORMS_INDEX: "platforms-index", - COLLECTIONS_INDEX: "collections-index", - CONTROLLER_DEBUG: "controller-debug", - NOT_FOUND: "404", -} as const; +export { isAuthExemptRoute, ROUTES } from "@/plugins/routeNames"; // Resolve the v2 component for a given route name, falling back to the 404 // view so every route renders something when the user is on uiVersion=v2. @@ -618,20 +572,6 @@ const routePermissions: RoutePermissions[] = [ { path: ROUTES.LOGS, requiredScopes: ["logs.read"] }, ]; -const authExemptRoutes = [ - ROUTES.LOGIN, - ROUTES.SETUP, - ROUTES.RESET_PASSWORD, - ROUTES.REGISTER, - ROUTES.PAIR, -] as const; - -type AuthExemptRoute = (typeof authExemptRoutes)[number]; - -export function isAuthExemptRoute(route: string): route is AuthExemptRoute { - return (authExemptRoutes as readonly string[]).includes(route); -} - function checkRoutePermissions(route: string, user: User | null): boolean { // No checks needed for login and setup pages if (isAuthExemptRoute(route)) { diff --git a/frontend/src/services/api/index.ts b/frontend/src/services/api/index.ts index 7152593c3..7481112dd 100644 --- a/frontend/src/services/api/index.ts +++ b/frontend/src/services/api/index.ts @@ -1,8 +1,6 @@ import axios from "axios"; import { default as Cookies } from "js-cookie"; import { debounce } from "lodash"; -import router from "@/plugins/router"; -import { ROUTES, isAuthExemptRoute } from "@/plugins/router"; const api = axios.create({ // This will keep the url query params on refresh @@ -133,6 +131,14 @@ api.interceptors.response.use( const params = new URLSearchParams(search); const fullPath = pathname + search; + // Static router import created api ↔ router TDZ; dynamic load only on 401. + // @dpdm-ignore + const { + default: router, + ROUTES, + isAuthExemptRoute, + } = await import("@/plugins/router"); + // Don't redirect to login if already on an auth-exempt route. // Also resolve the route from the browser URL to handle the case where // the router hasn't been started yet (e.g., during app initialization), diff --git a/frontend/src/services/api/rom.ts b/frontend/src/services/api/rom.ts index 2cdd167b6..f78e71de9 100644 --- a/frontend/src/services/api/rom.ts +++ b/frontend/src/services/api/rom.ts @@ -23,7 +23,7 @@ import { type CustomLimitOffsetPage_SimpleRomSchema_ as GetRomsResponse } from " import api from "@/services/api"; import socket from "@/services/socket"; import storeUpload from "@/stores/upload"; -import { getDownloadPath } from "@/utils"; +import { getDownloadPath } from "@/utils/downloadPath"; import { buildFormInput, type FormInputField } from "@/utils/formData"; export const romApi = api; diff --git a/frontend/src/stores/navigation.ts b/frontend/src/stores/navigation.ts index 295ed7497..68e02bc81 100644 --- a/frontend/src/stores/navigation.ts +++ b/frontend/src/stores/navigation.ts @@ -1,6 +1,6 @@ import { useLocalStorage } from "@vueuse/core"; import { defineStore } from "pinia"; -import { ROUTES } from "@/plugins/router"; +import { ROUTES } from "@/plugins/routeNames"; const mainBarCollapsed = useLocalStorage("ui.mainBarCollapsed", false); diff --git a/frontend/src/utils/downloadPath.ts b/frontend/src/utils/downloadPath.ts new file mode 100644 index 000000000..9abe806f2 --- /dev/null +++ b/frontend/src/utils/downloadPath.ts @@ -0,0 +1,54 @@ +import type { SimpleRomSchema } from "@/__generated__"; + +type DownloadRom = Pick< + SimpleRomSchema, + "id" | "fs_name" | "has_nested_single_file" | "files" +>; + +/** + * Generate a download link for ROM content. + */ +export function getDownloadPath({ + rom, + fileIDs = [], +}: { + rom: DownloadRom; + fileIDs?: number[]; +}) { + const queryParams = new URLSearchParams(); + if (fileIDs.length > 0) { + queryParams.append("file_ids", fileIDs.join(",")); + } + const queryString = queryParams.toString(); + + const selectedFile = + fileIDs.length === 1 + ? rom.files?.find((f) => f.id === fileIDs[0]) + : undefined; + const nestedFile = + fileIDs.length === 0 && + rom.has_nested_single_file && + rom.files?.length === 1 + ? rom.files[0] + : undefined; + const contentFile = selectedFile ?? nestedFile; + const contentName = contentFile + ? encodeURIComponent(contentFile.file_name) + : rom.fs_name; + + return `/api/roms/${rom.id}/content/${contentName}${ + queryString ? `?${queryString}` : "" + }`; +} + +export function getDownloadLink({ + rom, + fileIDs = [], +}: { + rom: DownloadRom; + fileIDs?: number[]; +}) { + return `${window.location.origin}${encodeURI( + getDownloadPath({ rom, fileIDs }), + )}`; +} diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 60ec7c5ee..b1dcf73c8 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -107,58 +107,7 @@ export function convertCronExperssion(expression: string) { return convertedExpression; } -/** - * Generate a download link for ROM content. - * - * @param rom The ROM object. - * @param files Optional array of file names to include in the download. - * @returns The download link. - */ -export function getDownloadPath({ - rom, - fileIDs = [], -}: { - rom: SimpleRom; - fileIDs?: number[]; -}) { - const queryParams = new URLSearchParams(); - if (fileIDs.length > 0) { - queryParams.append("file_ids", fileIDs.join(",")); - } - const queryString = queryParams.toString(); - - // If a single file is selected, use its name for the download path - const selectedFile = - fileIDs.length === 1 - ? rom.files?.find((f) => f.id === fileIDs[0]) - : undefined; - const nestedFile = - fileIDs.length === 0 && - rom.has_nested_single_file && - rom.files?.length === 1 - ? rom.files[0] - : undefined; - const contentFile = selectedFile ?? nestedFile; - const contentName = contentFile - ? encodeURIComponent(contentFile.file_name) - : rom.fs_name; - - return `/api/roms/${rom.id}/content/${contentName}${ - queryString ? `?${queryString}` : "" - }`; -} - -export function getDownloadLink({ - rom, - fileIDs = [], -}: { - rom: SimpleRom; - fileIDs?: number[]; -}) { - return `${window.location.origin}${encodeURI( - getDownloadPath({ rom, fileIDs }), - )}`; -} +export { getDownloadLink, getDownloadPath } from "@/utils/downloadPath"; /** * Format bytes as human-readable text. From 01be1850b9149fb298b03bd13e29bbc177a33ded Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 20 Sep 2026 10:28:02 -0400 Subject: [PATCH 25/52] fix(frontend): widen the dpdm gate and harden the 401 redirect code-review pass. dpdm cannot parse Vue SFCs, so the four entry points only reached 133 of the frontend's modules: every `.vue` import was an unresolved dead end and traversal stopped there. Make every `.ts` module an entry instead, which brings the analysed graph to 771 modules. Frozen v1 `src/console` is carved out because it still holds cycles we are not refactoring. Take `ROUTES` and `isAuthExemptRoute` from the leaf module statically, and keep only the router instance lazy. Guard the dynamic import so a failed chunk load still rejects with the original AxiosError. Move the `getDownloadPath` tests next to the module that now owns them. Co-Authored-By: Claude Opus 5 (1M context) --- docs/FRONTEND_ARCHITECTURE.md | 17 ++--- frontend/dpdm.config.ts | 11 ++- frontend/src/services/api/index.ts | 13 ++-- frontend/src/utils/downloadPath.test.ts | 89 +++++++++++++++++++++++++ frontend/src/utils/index.test.ts | 78 ---------------------- 5 files changed, 110 insertions(+), 98 deletions(-) create mode 100644 frontend/src/utils/downloadPath.test.ts diff --git a/docs/FRONTEND_ARCHITECTURE.md b/docs/FRONTEND_ARCHITECTURE.md index ab1432a9f..c3af63b01 100644 --- a/docs/FRONTEND_ARCHITECTURE.md +++ b/docs/FRONTEND_ARCHITECTURE.md @@ -1099,14 +1099,15 @@ Procedural SVG generation for: ### Scripts -| Script | Command | Purpose | -| ----------- | ------------------------------ | ----------------------------------- | -| `dev` | `vite --host` | Development server | -| `build` | `vite build` | Production build | -| `preview` | `vite preview` | Preview production build | -| `typecheck` | `vue-tsc`, `dpdm` (`circular`) | Types plus static import cycle gate | -| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | -| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | +| Script | Command | Purpose | +| ----------- | -------------------------------------- | ----------------------------------------- | +| `dev` | `vite --host` | Development server | +| `build` | `vite build` | Production build | +| `preview` | `vite preview` | Preview production build | +| `typecheck` | `vue-tsc --noEmit && npm run circular` | TypeScript validation plus the cycle gate | +| `circular` | `dpdm` | Fail on import cycles in the `.ts` graph | +| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | +| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | ### OpenAPI Code Generation diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts index 1fd3c0ba0..fe1b28f73 100644 --- a/frontend/dpdm.config.ts +++ b/frontend/dpdm.config.ts @@ -1,12 +1,11 @@ import { defineConfig } from "dpdm"; export default defineConfig({ - files: [ - "src/main.ts", - "src/services/api/index.ts", - "src/**/*.stories.ts", - ".storybook/preview.ts", - ], + // dpdm cannot parse SFCs, so a `.vue` import is a dead end: every `.ts` + // module is an entry so the graph does not stop at the first component. + files: ["src/**/*.ts", ".storybook/*.ts"], + // `src/console` is frozen v1 and still holds cycles we are not refactoring. + exclude: "node_modules|/src/console/", circular: true, tree: false, warning: false, diff --git a/frontend/src/services/api/index.ts b/frontend/src/services/api/index.ts index 7481112dd..f7c32a43a 100644 --- a/frontend/src/services/api/index.ts +++ b/frontend/src/services/api/index.ts @@ -1,6 +1,7 @@ import axios from "axios"; import { default as Cookies } from "js-cookie"; import { debounce } from "lodash"; +import { isAuthExemptRoute, ROUTES } from "@/plugins/routeNames"; const api = axios.create({ // This will keep the url query params on refresh @@ -131,13 +132,13 @@ api.interceptors.response.use( const params = new URLSearchParams(search); const fullPath = pathname + search; - // Static router import created api ↔ router TDZ; dynamic load only on 401. + // The router instance is pulled in lazily so the module graph stays + // acyclic; a failed chunk load just leaves the caller with the 401. // @dpdm-ignore - const { - default: router, - ROUTES, - isAuthExemptRoute, - } = await import("@/plugins/router"); + const router = await import("@/plugins/router") + .then((m) => m.default) + .catch(() => null); + if (!router) return Promise.reject(error); // Don't redirect to login if already on an auth-exempt route. // Also resolve the route from the browser URL to handle the case where diff --git a/frontend/src/utils/downloadPath.test.ts b/frontend/src/utils/downloadPath.test.ts new file mode 100644 index 000000000..626b5b75f --- /dev/null +++ b/frontend/src/utils/downloadPath.test.ts @@ -0,0 +1,89 @@ +import { describe, expect, it } from "vitest"; +import type { SimpleRom } from "@/stores/roms"; +import { getDownloadPath } from "./downloadPath"; + +function makeRom(overrides: Partial): SimpleRom { + return { + id: 1, + fs_name: "Game", + files: [], + ...overrides, + } as SimpleRom; +} + +describe("getDownloadPath", () => { + it("uses fs_name for a flat single-file rom", () => { + const rom = makeRom({ + id: 14, + fs_name: "Maniac Mansion (1989).adf", + has_nested_single_file: false, + files: [ + { id: 19, file_name: "Maniac Mansion (1989).adf" }, + ] as SimpleRom["files"], + }); + expect(getDownloadPath({ rom })).toBe( + "/api/roms/14/content/Maniac Mansion (1989).adf", + ); + }); + + it("uses the file name for a nested single-file rom", () => { + const rom = makeRom({ + id: 21, + fs_name: "Art Of Fighting", + has_nested_single_file: true, + files: [{ id: 26, file_name: "aof.zip" }] as SimpleRom["files"], + }); + expect(getDownloadPath({ rom })).toBe("/api/roms/21/content/aof.zip"); + }); + + it("uses fs_name for an unselected multi-file rom", () => { + const rom = makeRom({ + id: 24, + fs_name: "B.A.T.", + has_nested_single_file: false, + files: [ + { id: 29, file_name: "B.A.T. Disk1.adf" }, + { id: 30, file_name: "B.A.T. Disk2.adf" }, + ] as SimpleRom["files"], + }); + expect(getDownloadPath({ rom })).toBe("/api/roms/24/content/B.A.T."); + }); + + it("uses the selected file name (with extension) for a single file", () => { + // Multi-file rom: fs_name is the folder name with no extension. The URL + // path segment must carry the selected file's real name so the emulator + // receives a file with the correct extension. + const rom = makeRom({ + id: 24, + fs_name: "B.A.T.", + files: [ + { id: 29, file_name: "B.A.T. Disk1.adf" }, + { id: 30, file_name: "B.A.T. Disk2.adf" }, + ] as SimpleRom["files"], + }); + expect(getDownloadPath({ rom, fileIDs: [29] })).toBe( + "/api/roms/24/content/B.A.T.%20Disk1.adf?file_ids=29", + ); + }); + + it("falls back to fs_name when multiple files are selected (zip)", () => { + const rom = makeRom({ + id: 24, + fs_name: "B.A.T.", + files: [ + { id: 29, file_name: "B.A.T. Disk1.adf" }, + { id: 30, file_name: "B.A.T. Disk2.adf" }, + ] as SimpleRom["files"], + }); + expect(getDownloadPath({ rom, fileIDs: [29, 30] })).toBe( + "/api/roms/24/content/B.A.T.?file_ids=29%2C30", + ); + }); + + it("falls back to fs_name when the selected file id is unknown", () => { + const rom = makeRom({ id: 24, fs_name: "B.A.T." }); + expect(getDownloadPath({ rom, fileIDs: [999] })).toBe( + "/api/roms/24/content/B.A.T.?file_ids=999", + ); + }); +}); diff --git a/frontend/src/utils/index.test.ts b/frontend/src/utils/index.test.ts index 560f4f1c5..32344fbc4 100644 --- a/frontend/src/utils/index.test.ts +++ b/frontend/src/utils/index.test.ts @@ -3,7 +3,6 @@ import type { Config } from "@/stores/config"; import type { Heartbeat } from "@/stores/heartbeat"; import type { SimpleRom } from "@/stores/roms"; import { - getDownloadPath, isJsDosBundle, isJsDosEmulationSupported, isPico8EmulationSupported, @@ -19,83 +18,6 @@ function makeRom(overrides: Partial): SimpleRom { } as SimpleRom; } -describe("getDownloadPath", () => { - it("uses fs_name for a flat single-file rom", () => { - const rom = makeRom({ - id: 14, - fs_name: "Maniac Mansion (1989).adf", - has_nested_single_file: false, - files: [ - { id: 19, file_name: "Maniac Mansion (1989).adf" }, - ] as SimpleRom["files"], - }); - expect(getDownloadPath({ rom })).toBe( - "/api/roms/14/content/Maniac Mansion (1989).adf", - ); - }); - - it("uses the file name for a nested single-file rom", () => { - const rom = makeRom({ - id: 21, - fs_name: "Art Of Fighting", - has_nested_single_file: true, - files: [{ id: 26, file_name: "aof.zip" }] as SimpleRom["files"], - }); - expect(getDownloadPath({ rom })).toBe("/api/roms/21/content/aof.zip"); - }); - - it("uses fs_name for an unselected multi-file rom", () => { - const rom = makeRom({ - id: 24, - fs_name: "B.A.T.", - has_nested_single_file: false, - files: [ - { id: 29, file_name: "B.A.T. Disk1.adf" }, - { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); - expect(getDownloadPath({ rom })).toBe("/api/roms/24/content/B.A.T."); - }); - - it("uses the selected file name (with extension) for a single file", () => { - // Multi-file rom: fs_name is the folder name with no extension. The URL - // path segment must carry the selected file's real name so the emulator - // receives a file with the correct extension. - const rom = makeRom({ - id: 24, - fs_name: "B.A.T.", - files: [ - { id: 29, file_name: "B.A.T. Disk1.adf" }, - { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); - expect(getDownloadPath({ rom, fileIDs: [29] })).toBe( - "/api/roms/24/content/B.A.T.%20Disk1.adf?file_ids=29", - ); - }); - - it("falls back to fs_name when multiple files are selected (zip)", () => { - const rom = makeRom({ - id: 24, - fs_name: "B.A.T.", - files: [ - { id: 29, file_name: "B.A.T. Disk1.adf" }, - { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); - expect(getDownloadPath({ rom, fileIDs: [29, 30] })).toBe( - "/api/roms/24/content/B.A.T.?file_ids=29%2C30", - ); - }); - - it("falls back to fs_name when the selected file id is unknown", () => { - const rom = makeRom({ id: 24, fs_name: "B.A.T." }); - expect(getDownloadPath({ rom, fileIDs: [999] })).toBe( - "/api/roms/24/content/B.A.T.?file_ids=999", - ); - }); -}); - function makeHeartbeat( emulation: Partial = {}, ): Heartbeat { From b9163d46b7e99b40754a9d2bc8e531783f14b4ff Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 20 Sep 2026 10:36:14 -0400 Subject: [PATCH 26/52] refactor(frontend): collect the payoff of the routeNames extraction simplify pass. `v2/router/routes.ts` hand-maintained 34 route-name string literals and a comment saying ROUTES could not be imported without a cycle. `routeNames.ts` is a leaf, so that constraint is gone: key the registry off ROUTES and type it with the new `RouteName`, which turns a mistyped key into a compile error instead of a silent fall-through to the 404 view. Drop the unreachable chunk-load guard in the 401 interceptor: `main.ts` imports the router statically, so it is in the entry chunk and the dynamic import resolves from memory. Restate why that import is lazy. Take `SimpleRom` instead of re-narrowing it, reuse the import specifier already in `router.ts`, drop `circular: true` (already the default), and inline the test roms so the factory is not duplicated across two files. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/dpdm.config.ts | 1 - frontend/src/plugins/routeNames.ts | 2 + frontend/src/plugins/router.ts | 10 +++- frontend/src/services/api/index.ts | 9 +-- frontend/src/utils/downloadPath.test.ts | 48 +++++++-------- frontend/src/utils/downloadPath.ts | 15 ++--- frontend/src/utils/index.ts | 4 +- frontend/src/v2/router/routes.ts | 80 +++++++++++++------------ 8 files changed, 80 insertions(+), 89 deletions(-) diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts index fe1b28f73..667843569 100644 --- a/frontend/dpdm.config.ts +++ b/frontend/dpdm.config.ts @@ -6,7 +6,6 @@ export default defineConfig({ files: ["src/**/*.ts", ".storybook/*.ts"], // `src/console` is frozen v1 and still holds cycles we are not refactoring. exclude: "node_modules|/src/console/", - circular: true, tree: false, warning: false, exitCode: "circular:1", diff --git a/frontend/src/plugins/routeNames.ts b/frontend/src/plugins/routeNames.ts index 0a6b16895..1e7a6e7d8 100644 --- a/frontend/src/plugins/routeNames.ts +++ b/frontend/src/plugins/routeNames.ts @@ -46,6 +46,8 @@ export const ROUTES = { NOT_FOUND: "404", } as const; +export type RouteName = (typeof ROUTES)[keyof typeof ROUTES]; + const authExemptRoutes = [ ROUTES.LOGIN, ROUTES.SETUP, diff --git a/frontend/src/plugins/router.ts b/frontend/src/plugins/router.ts index 55cd1fa9c..f19d6fd7e 100644 --- a/frontend/src/plugins/router.ts +++ b/frontend/src/plugins/router.ts @@ -7,7 +7,11 @@ import { type RouteLocationNormalized, } from "vue-router"; import i18n, { loadLocale } from "@/locales"; -import { isAuthExemptRoute, ROUTES } from "@/plugins/routeNames"; +import { + isAuthExemptRoute, + ROUTES, + type RouteName, +} from "@/plugins/routeNames"; import { startViewTransition } from "@/plugins/transition"; import romApi from "@/services/api/rom"; import storeAuth from "@/stores/auth"; @@ -20,11 +24,11 @@ import { v2RouteComponents, } from "@/v2/router/routes"; -export { isAuthExemptRoute, ROUTES } from "@/plugins/routeNames"; +export { isAuthExemptRoute, ROUTES }; // Resolve the v2 component for a given route name, falling back to the 404 // view so every route renders something when the user is on uiVersion=v2. -function v2For(routeName: string) { +function v2For(routeName: RouteName) { const component = v2RouteComponents[routeName]; if (!component && import.meta.env.DEV) { console.warn(`[v2] route "${routeName}" has no v2 component; showing 404`); diff --git a/frontend/src/services/api/index.ts b/frontend/src/services/api/index.ts index f7c32a43a..d301a8cf3 100644 --- a/frontend/src/services/api/index.ts +++ b/frontend/src/services/api/index.ts @@ -132,13 +132,10 @@ api.interceptors.response.use( const params = new URLSearchParams(search); const fullPath = pathname + search; - // The router instance is pulled in lazily so the module graph stays - // acyclic; a failed chunk load just leaves the caller with the 401. + // Loaded lazily: a static import evaluates the router while this module + // is still initialising, so `router` reads as undefined. // @dpdm-ignore - const router = await import("@/plugins/router") - .then((m) => m.default) - .catch(() => null); - if (!router) return Promise.reject(error); + const { default: router } = await import("@/plugins/router"); // Don't redirect to login if already on an auth-exempt route. // Also resolve the route from the browser URL to handle the case where diff --git a/frontend/src/utils/downloadPath.test.ts b/frontend/src/utils/downloadPath.test.ts index 626b5b75f..6f28250a3 100644 --- a/frontend/src/utils/downloadPath.test.ts +++ b/frontend/src/utils/downloadPath.test.ts @@ -2,50 +2,39 @@ import { describe, expect, it } from "vitest"; import type { SimpleRom } from "@/stores/roms"; import { getDownloadPath } from "./downloadPath"; -function makeRom(overrides: Partial): SimpleRom { - return { - id: 1, - fs_name: "Game", - files: [], - ...overrides, - } as SimpleRom; -} - describe("getDownloadPath", () => { it("uses fs_name for a flat single-file rom", () => { - const rom = makeRom({ + const rom = { id: 14, fs_name: "Maniac Mansion (1989).adf", has_nested_single_file: false, - files: [ - { id: 19, file_name: "Maniac Mansion (1989).adf" }, - ] as SimpleRom["files"], - }); + files: [{ id: 19, file_name: "Maniac Mansion (1989).adf" }], + } as SimpleRom; expect(getDownloadPath({ rom })).toBe( "/api/roms/14/content/Maniac Mansion (1989).adf", ); }); it("uses the file name for a nested single-file rom", () => { - const rom = makeRom({ + const rom = { id: 21, fs_name: "Art Of Fighting", has_nested_single_file: true, - files: [{ id: 26, file_name: "aof.zip" }] as SimpleRom["files"], - }); + files: [{ id: 26, file_name: "aof.zip" }], + } as SimpleRom; expect(getDownloadPath({ rom })).toBe("/api/roms/21/content/aof.zip"); }); it("uses fs_name for an unselected multi-file rom", () => { - const rom = makeRom({ + const rom = { id: 24, fs_name: "B.A.T.", has_nested_single_file: false, files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); + ], + } as SimpleRom; expect(getDownloadPath({ rom })).toBe("/api/roms/24/content/B.A.T."); }); @@ -53,35 +42,40 @@ describe("getDownloadPath", () => { // Multi-file rom: fs_name is the folder name with no extension. The URL // path segment must carry the selected file's real name so the emulator // receives a file with the correct extension. - const rom = makeRom({ + const rom = { id: 24, fs_name: "B.A.T.", files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); + ], + } as SimpleRom; expect(getDownloadPath({ rom, fileIDs: [29] })).toBe( "/api/roms/24/content/B.A.T.%20Disk1.adf?file_ids=29", ); }); it("falls back to fs_name when multiple files are selected (zip)", () => { - const rom = makeRom({ + const rom = { id: 24, fs_name: "B.A.T.", files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ] as SimpleRom["files"], - }); + ], + } as SimpleRom; expect(getDownloadPath({ rom, fileIDs: [29, 30] })).toBe( "/api/roms/24/content/B.A.T.?file_ids=29%2C30", ); }); it("falls back to fs_name when the selected file id is unknown", () => { - const rom = makeRom({ id: 24, fs_name: "B.A.T." }); + const rom = { + id: 24, + fs_name: "B.A.T.", + has_nested_single_file: false, + files: [] as SimpleRom["files"], + } as SimpleRom; expect(getDownloadPath({ rom, fileIDs: [999] })).toBe( "/api/roms/24/content/B.A.T.?file_ids=999", ); diff --git a/frontend/src/utils/downloadPath.ts b/frontend/src/utils/downloadPath.ts index 9abe806f2..14f8cf180 100644 --- a/frontend/src/utils/downloadPath.ts +++ b/frontend/src/utils/downloadPath.ts @@ -1,18 +1,11 @@ -import type { SimpleRomSchema } from "@/__generated__"; +import type { SimpleRom } from "@/stores/roms"; -type DownloadRom = Pick< - SimpleRomSchema, - "id" | "fs_name" | "has_nested_single_file" | "files" ->; - -/** - * Generate a download link for ROM content. - */ +/** Build the `/api` path that serves a ROM's content. */ export function getDownloadPath({ rom, fileIDs = [], }: { - rom: DownloadRom; + rom: SimpleRom; fileIDs?: number[]; }) { const queryParams = new URLSearchParams(); @@ -45,7 +38,7 @@ export function getDownloadLink({ rom, fileIDs = [], }: { - rom: DownloadRom; + rom: SimpleRom; fileIDs?: number[]; }) { return `${window.location.origin}${encodeURI( diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index b1dcf73c8..1be356bd7 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -9,6 +9,8 @@ import type { Heartbeat } from "@/stores/heartbeat"; import storeNavigation from "@/stores/navigation"; import type { DetailedRom, SimpleRom } from "@/stores/roms"; +export { getDownloadLink, getDownloadPath } from "@/utils/downloadPath"; + /** * Views configuration object. */ @@ -107,8 +109,6 @@ export function convertCronExperssion(expression: string) { return convertedExpression; } -export { getDownloadLink, getDownloadPath } from "@/utils/downloadPath"; - /** * Format bytes as human-readable text. * diff --git a/frontend/src/v2/router/routes.ts b/frontend/src/v2/router/routes.ts index 671235e99..fc25b789e 100644 --- a/frontend/src/v2/router/routes.ts +++ b/frontend/src/v2/router/routes.ts @@ -10,11 +10,8 @@ // v2 AppLayout renders the v2 component. Routes without a v2 entry fall // through to `notFoundComponent`, which is correct now that every route the // v2 UI links to is migrated: an unregistered name leads nowhere in v2. -// -// NOTE: We use string keys instead of importing ROUTES from @/plugins/router -// to avoid a circular import (router.ts ↔ v2/router/routes.ts). Keys here -// MUST match the string values in the ROUTES constant in plugins/router.ts. import type { Component } from "vue"; +import { ROUTES, type RouteName } from "@/plugins/routeNames"; export type V2Route = () => Promise; @@ -23,53 +20,58 @@ export type V2Route = () => Promise; export const notFoundComponent: V2Route = () => import("@/v2/views/NotFound.vue"); -export const v2RouteComponents: Partial> = { - home: () => import("@/v2/views/Home.vue"), - activity: () => import("@/v2/views/Activity.vue"), +export const v2RouteComponents: Partial> = { + [ROUTES.HOME]: () => import("@/v2/views/Home.vue"), + [ROUTES.ACTIVITY]: () => import("@/v2/views/Activity.vue"), // Wave 1 — Auth flows - login: () => import("@/v2/views/Auth/Login.vue"), - "reset-password": () => import("@/v2/views/Auth/ResetPassword.vue"), - register: () => import("@/v2/views/Auth/Register.vue"), - setup: () => import("@/v2/views/Auth/Setup.vue"), + [ROUTES.LOGIN]: () => import("@/v2/views/Auth/Login.vue"), + [ROUTES.RESET_PASSWORD]: () => import("@/v2/views/Auth/ResetPassword.vue"), + [ROUTES.REGISTER]: () => import("@/v2/views/Auth/Register.vue"), + [ROUTES.SETUP]: () => import("@/v2/views/Auth/Setup.vue"), // Wave 3 — Gallery - platform: () => import("@/v2/views/Gallery/Platform.vue"), - search: () => import("@/v2/views/Gallery/Search.vue"), - music: () => import("@/v2/views/Jukebox/index.vue"), - collection: () => import("@/v2/views/Gallery/Collection.vue"), - "virtual-collection": () => import("@/v2/views/Gallery/Collection.vue"), - "smart-collection": () => import("@/v2/views/Gallery/Collection.vue"), + [ROUTES.PLATFORM]: () => import("@/v2/views/Gallery/Platform.vue"), + [ROUTES.SEARCH]: () => import("@/v2/views/Gallery/Search.vue"), + [ROUTES.MUSIC]: () => import("@/v2/views/Jukebox/index.vue"), + [ROUTES.COLLECTION]: () => import("@/v2/views/Gallery/Collection.vue"), + [ROUTES.VIRTUAL_COLLECTION]: () => + import("@/v2/views/Gallery/Collection.vue"), + [ROUTES.SMART_COLLECTION]: () => import("@/v2/views/Gallery/Collection.vue"), // Wave 4 — Game details - rom: () => import("@/v2/views/GameDetails.vue"), + [ROUTES.ROM]: () => import("@/v2/views/GameDetails.vue"), // Wave 5 — Players - emulatorjs: () => import("@/v2/views/Player/EmulatorJS.vue"), - jsdos: () => import("@/v2/views/Player/JsDos.vue"), - pico8: () => import("@/v2/views/Player/Pico8.vue"), - ruffle: () => import("@/v2/views/Player/Ruffle.vue"), - stream: () => import("@/v2/views/Player/Stream.vue"), - "stream-desktop": () => import("@/v2/views/Player/Desktop.vue"), + [ROUTES.EMULATORJS]: () => import("@/v2/views/Player/EmulatorJS.vue"), + [ROUTES.JSDOS]: () => import("@/v2/views/Player/JsDos.vue"), + [ROUTES.PICO8]: () => import("@/v2/views/Player/Pico8.vue"), + [ROUTES.RUFFLE]: () => import("@/v2/views/Player/Ruffle.vue"), + [ROUTES.STREAM]: () => import("@/v2/views/Player/Stream.vue"), + [ROUTES.STREAM_DESKTOP]: () => import("@/v2/views/Player/Desktop.vue"), // Wave 6 — Library Tools (Scan / Upload) + Pair - scan: () => import("@/v2/views/Scan.vue"), - upload: () => import("@/v2/views/Upload.vue"), + [ROUTES.SCAN]: () => import("@/v2/views/Scan.vue"), + [ROUTES.UPLOAD]: () => import("@/v2/views/Upload.vue"), // Pair is wired via a top-level PairDispatcher (see plugins/router.ts); no // named-view entry is needed — the dispatcher picks v1 or v2 itself. // Wave 7 — Settings suite - "user-profile": () => import("@/v2/views/Settings/UserProfile.vue"), - "user-interface": () => import("@/v2/views/Settings/UserInterface.vue"), - "library-management": () => + [ROUTES.USER_PROFILE]: () => import("@/v2/views/Settings/UserProfile.vue"), + [ROUTES.USER_INTERFACE]: () => + import("@/v2/views/Settings/UserInterface.vue"), + [ROUTES.LIBRARY_MANAGEMENT]: () => import("@/v2/views/Settings/LibraryManagement.vue"), - "scan-settings": () => import("@/v2/views/Settings/ScanSettings.vue"), - "metadata-sources": () => import("@/v2/views/Settings/MetadataSources.vue"), - "client-api-tokens": () => import("@/v2/views/Settings/ClientApiTokens.vue"), - administration: () => import("@/v2/views/Settings/Administration.vue"), - "server-stats": () => import("@/v2/views/Settings/ServerStats.vue"), - logs: () => import("@/v2/views/Settings/Logs.vue"), + [ROUTES.SCAN_SETTINGS]: () => import("@/v2/views/Settings/ScanSettings.vue"), + [ROUTES.METADATA_SOURCES]: () => + import("@/v2/views/Settings/MetadataSources.vue"), + [ROUTES.CLIENT_API_TOKENS]: () => + import("@/v2/views/Settings/ClientApiTokens.vue"), + [ROUTES.ADMINISTRATION]: () => + import("@/v2/views/Settings/Administration.vue"), + [ROUTES.SERVER_STATS]: () => import("@/v2/views/Settings/ServerStats.vue"), + [ROUTES.LOGS]: () => import("@/v2/views/Settings/Logs.vue"), // V2-only index pages (no v1 equivalent — the v1 UI uses its drawer) - "platforms-index": () => import("@/v2/views/PlatformsIndex.vue"), - "collections-index": () => import("@/v2/views/CollectionsIndex.vue"), + [ROUTES.PLATFORMS_INDEX]: () => import("@/v2/views/PlatformsIndex.vue"), + [ROUTES.COLLECTIONS_INDEX]: () => import("@/v2/views/CollectionsIndex.vue"), // V2-only dev tool — live gamepad input inspector. - "controller-debug": () => import("@/v2/views/ControllerDebug.vue"), + [ROUTES.CONTROLLER_DEBUG]: () => import("@/v2/views/ControllerDebug.vue"), // v1-only easter egg: no v2 component links here, so the URL is a dead end. - "april-fools": notFoundComponent, + [ROUTES.APRIL_FOOLS]: notFoundComponent, }; export const v2Layouts = { From b4cd7306fc936509ea58280c7fffeab61ab25352 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 20 Sep 2026 10:40:51 -0400 Subject: [PATCH 27/52] test(frontend): give the rom fixture one home review-polish pass. Both `src/utils` test files built the same rom literal, so move the typed factory into `rom.fixtures.ts` and import it from each. Tighten two comments that had grown past the two-line limit. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/dpdm.config.ts | 4 +-- frontend/src/utils/downloadPath.test.ts | 44 +++++++++++++------------ frontend/src/utils/index.test.ts | 11 +------ frontend/src/utils/rom.fixtures.ts | 10 ++++++ 4 files changed, 36 insertions(+), 33 deletions(-) create mode 100644 frontend/src/utils/rom.fixtures.ts diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts index 667843569..c8bb3a6c4 100644 --- a/frontend/dpdm.config.ts +++ b/frontend/dpdm.config.ts @@ -1,8 +1,8 @@ import { defineConfig } from "dpdm"; export default defineConfig({ - // dpdm cannot parse SFCs, so a `.vue` import is a dead end: every `.ts` - // module is an entry so the graph does not stop at the first component. + // dpdm cannot parse SFCs, so a `.vue` import is a dead end. Every `.ts` + // file is an entry, or the graph would stop at the first component. files: ["src/**/*.ts", ".storybook/*.ts"], // `src/console` is frozen v1 and still holds cycles we are not refactoring. exclude: "node_modules|/src/console/", diff --git a/frontend/src/utils/downloadPath.test.ts b/frontend/src/utils/downloadPath.test.ts index 6f28250a3..52cf8c015 100644 --- a/frontend/src/utils/downloadPath.test.ts +++ b/frontend/src/utils/downloadPath.test.ts @@ -1,81 +1,83 @@ import { describe, expect, it } from "vitest"; import type { SimpleRom } from "@/stores/roms"; import { getDownloadPath } from "./downloadPath"; +import { makeRom } from "./rom.fixtures"; describe("getDownloadPath", () => { it("uses fs_name for a flat single-file rom", () => { - const rom = { + const rom = makeRom({ id: 14, fs_name: "Maniac Mansion (1989).adf", has_nested_single_file: false, - files: [{ id: 19, file_name: "Maniac Mansion (1989).adf" }], - } as SimpleRom; + files: [ + { id: 19, file_name: "Maniac Mansion (1989).adf" }, + ] as SimpleRom["files"], + }); expect(getDownloadPath({ rom })).toBe( "/api/roms/14/content/Maniac Mansion (1989).adf", ); }); it("uses the file name for a nested single-file rom", () => { - const rom = { + const rom = makeRom({ id: 21, fs_name: "Art Of Fighting", has_nested_single_file: true, - files: [{ id: 26, file_name: "aof.zip" }], - } as SimpleRom; + files: [{ id: 26, file_name: "aof.zip" }] as SimpleRom["files"], + }); expect(getDownloadPath({ rom })).toBe("/api/roms/21/content/aof.zip"); }); it("uses fs_name for an unselected multi-file rom", () => { - const rom = { + const rom = makeRom({ id: 24, fs_name: "B.A.T.", has_nested_single_file: false, files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ], - } as SimpleRom; + ] as SimpleRom["files"], + }); expect(getDownloadPath({ rom })).toBe("/api/roms/24/content/B.A.T."); }); it("uses the selected file name (with extension) for a single file", () => { - // Multi-file rom: fs_name is the folder name with no extension. The URL - // path segment must carry the selected file's real name so the emulator - // receives a file with the correct extension. - const rom = { + // fs_name is the extensionless folder name here, so the path segment has + // to carry the file's real name for the emulator to get the extension. + const rom = makeRom({ id: 24, fs_name: "B.A.T.", files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ], - } as SimpleRom; + ] as SimpleRom["files"], + }); expect(getDownloadPath({ rom, fileIDs: [29] })).toBe( "/api/roms/24/content/B.A.T.%20Disk1.adf?file_ids=29", ); }); it("falls back to fs_name when multiple files are selected (zip)", () => { - const rom = { + const rom = makeRom({ id: 24, fs_name: "B.A.T.", files: [ { id: 29, file_name: "B.A.T. Disk1.adf" }, { id: 30, file_name: "B.A.T. Disk2.adf" }, - ], - } as SimpleRom; + ] as SimpleRom["files"], + }); expect(getDownloadPath({ rom, fileIDs: [29, 30] })).toBe( "/api/roms/24/content/B.A.T.?file_ids=29%2C30", ); }); it("falls back to fs_name when the selected file id is unknown", () => { - const rom = { + const rom = makeRom({ id: 24, fs_name: "B.A.T.", has_nested_single_file: false, - files: [] as SimpleRom["files"], - } as SimpleRom; + files: [], + }); expect(getDownloadPath({ rom, fileIDs: [999] })).toBe( "/api/roms/24/content/B.A.T.?file_ids=999", ); diff --git a/frontend/src/utils/index.test.ts b/frontend/src/utils/index.test.ts index 32344fbc4..b91debfc7 100644 --- a/frontend/src/utils/index.test.ts +++ b/frontend/src/utils/index.test.ts @@ -1,22 +1,13 @@ import { describe, expect, it } from "vitest"; import type { Config } from "@/stores/config"; import type { Heartbeat } from "@/stores/heartbeat"; -import type { SimpleRom } from "@/stores/roms"; import { isJsDosBundle, isJsDosEmulationSupported, isPico8EmulationSupported, isPico8Rom, } from "./index"; - -function makeRom(overrides: Partial): SimpleRom { - return { - id: 1, - fs_name: "Game", - files: [], - ...overrides, - } as SimpleRom; -} +import { makeRom } from "./rom.fixtures"; function makeHeartbeat( emulation: Partial = {}, diff --git a/frontend/src/utils/rom.fixtures.ts b/frontend/src/utils/rom.fixtures.ts new file mode 100644 index 000000000..ae1cfe965 --- /dev/null +++ b/frontend/src/utils/rom.fixtures.ts @@ -0,0 +1,10 @@ +import type { SimpleRom } from "@/stores/roms"; + +export function makeRom(overrides: Partial): SimpleRom { + return { + id: 1, + fs_name: "Game", + files: [], + ...overrides, + } as SimpleRom; +} From 0fcf674045a4f81d9ae45f5e37763b942eb8a8c8 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 20 Sep 2026 11:07:53 -0400 Subject: [PATCH 28/52] build(frontend): detect import cycles with eslint instead of dpdm dpdm cannot resolve or parse Vue SFCs, so it saw none of the ~519 components: `.vue` imports were dead ends and the graph stopped at the first one. `import-x/no-cycle` runs on the ESLint config that already parses `.vue` with type awareness, and Trunk already runs ESLint in CI, so the check needs no separate tool, config file or CI step. Lazy route components make the router reachable from the views it renders, so dynamic edges are excluded; without that the rule reports 390 files instead of the real 3. Those 3 are the frozen-v1 `src/console` cycles dpdm also found, so the two tools agree on today's graph and the swap is not a cleanup. Drop the `circular` script, `dpdm.config.ts`, the `@dpdm-ignore` directive and dpdm itself. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/typecheck.yml | 2 +- docs/FRONTEND_ARCHITECTURE.md | 17 +- frontend/dpdm.config.ts | 13 - frontend/eslint.config.js | 44 ++ frontend/package-lock.json | 989 ++++++++++++++++------------- frontend/package.json | 6 +- frontend/src/services/api/index.ts | 1 - 7 files changed, 600 insertions(+), 472 deletions(-) delete mode 100644 frontend/dpdm.config.ts diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index ad673321d..aa505a17f 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -33,7 +33,7 @@ jobs: run: npm ci working-directory: frontend - - name: Run typecheck (vue-tsc and circular dependency check) + - name: Run typecheck run: npm run typecheck working-directory: frontend diff --git a/docs/FRONTEND_ARCHITECTURE.md b/docs/FRONTEND_ARCHITECTURE.md index c3af63b01..758484892 100644 --- a/docs/FRONTEND_ARCHITECTURE.md +++ b/docs/FRONTEND_ARCHITECTURE.md @@ -1099,15 +1099,14 @@ Procedural SVG generation for: ### Scripts -| Script | Command | Purpose | -| ----------- | -------------------------------------- | ----------------------------------------- | -| `dev` | `vite --host` | Development server | -| `build` | `vite build` | Production build | -| `preview` | `vite preview` | Preview production build | -| `typecheck` | `vue-tsc --noEmit && npm run circular` | TypeScript validation plus the cycle gate | -| `circular` | `dpdm` | Fail on import cycles in the `.ts` graph | -| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | -| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts` files | +| Script | Command | Purpose | +| ----------- | ---------------------------- | ---------------------------------------- | +| `dev` | `vite --host` | Development server | +| `build` | `vite build` | Production build | +| `preview` | `vite preview` | Preview production build | +| `typecheck` | `vue-tsc --noEmit` | TypeScript validation | +| `generate` | `openapi-typescript-codegen` | Generate types from backend OpenAPI | +| `lint` | `eslint` | Lint `.vue`, `.js`, `.ts`; import cycles | ### OpenAPI Code Generation diff --git a/frontend/dpdm.config.ts b/frontend/dpdm.config.ts deleted file mode 100644 index c8bb3a6c4..000000000 --- a/frontend/dpdm.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from "dpdm"; - -export default defineConfig({ - // dpdm cannot parse SFCs, so a `.vue` import is a dead end. Every `.ts` - // file is an entry, or the graph would stop at the first component. - files: ["src/**/*.ts", ".storybook/*.ts"], - // `src/console` is frozen v1 and still holds cycles we are not refactoring. - exclude: "node_modules|/src/console/", - tree: false, - warning: false, - exitCode: "circular:1", - transform: true, -}); diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index b43b8ec1b..55903d52b 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -1,5 +1,7 @@ import eslint from "@eslint/js"; import prettierConfig from "eslint-config-prettier/flat"; +import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript"; +import importX from "eslint-plugin-import-x"; import vue from "eslint-plugin-vue"; import vuea11y from "eslint-plugin-vuejs-accessibility"; import globals from "globals"; @@ -10,6 +12,21 @@ export default tseslint.config( ...tseslint.configs.recommended, ...vue.configs["flat/recommended"], ...vuea11y.configs["flat/recommended"], + importX.flatConfigs.recommended, + importX.flatConfigs.typescript, + { + // Only the cycle rule below earns its keep; the rest of the preset + // re-reports what vue-tsc already catches, at a module graph per rule. + rules: { + "import-x/no-unresolved": "off", + "import-x/named": "off", + "import-x/namespace": "off", + "import-x/default": "off", + "import-x/export": "off", + "import-x/no-named-as-default": "off", + "import-x/no-named-as-default-member": "off", + }, + }, // Global ignore (object with only `ignores` = applies everywhere). // Storybook config files live outside `src/` and aren't part of the // app tsconfig, so type-aware linting can't resolve them. @@ -75,6 +92,33 @@ export default tseslint.config( ], }, }, + // Import cycles. The resolver has to be the one that reads tsconfig `paths`, + // or `@/*` and `@v2/*` go unresolved and the rule silently passes. + { + files: ["src/**/*.ts", "src/**/*.vue"], + settings: { + "import-x/resolver-next": [ + createTypeScriptImportResolver({ + project: "./tsconfig.json", + extensions: [".ts", ".tsx", ".vue", ".js", ".mjs", ".json"], + }), + ], + }, + rules: { + // Lazy route components make the router reachable from the views it + // renders; that edge is resolved at runtime, so it is not a real cycle. + "import-x/no-cycle": [ + "error", + { maxDepth: 15, allowUnsafeDynamicCyclicDependency: true }, + ], + }, + }, + { + // Frozen v1: two cycles between the console theme helpers predate the + // rule and cannot be refactored under the freeze. + files: ["src/console/**"], + rules: { "import-x/no-cycle": "off" }, + }, // Keep last: Prettier owns formatting, so this switches off every // stylistic rule the two tools would otherwise fight over. prettierConfig, diff --git a/frontend/package-lock.json b/frontend/package-lock.json index cbe925db4..f63fc5d70 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -53,9 +53,10 @@ "@vue/tsconfig": "^0.9.1", "axe-core": "^4.12.1", "browserslist": "^4.28.8", - "dpdm": "^4.3.0", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", + "eslint-import-resolver-typescript": "^4.4.5", + "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-vue": "^10.8.0", "eslint-plugin-vuejs-accessibility": "^2.5.0", "globals": "^16.0.0", @@ -5375,6 +5376,349 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.12.2.tgz", + "integrity": "sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.12.2.tgz", + "integrity": "sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.12.2.tgz", + "integrity": "sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.12.2.tgz", + "integrity": "sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.12.2.tgz", + "integrity": "sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.12.2.tgz", + "integrity": "sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.12.2.tgz", + "integrity": "sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.12.2.tgz", + "integrity": "sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.12.2.tgz", + "integrity": "sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-gnu/-/resolver-binding-linux-loong64-gnu-1.12.2.tgz", + "integrity": "sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-musl/-/resolver-binding-linux-loong64-musl-1.12.2.tgz", + "integrity": "sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.12.2.tgz", + "integrity": "sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.12.2.tgz", + "integrity": "sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.12.2.tgz", + "integrity": "sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.12.2.tgz", + "integrity": "sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.12.2.tgz", + "integrity": "sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.12.2.tgz", + "integrity": "sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-openharmony-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-openharmony-arm64/-/resolver-binding-openharmony-arm64-1.12.2.tgz", + "integrity": "sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.12.2.tgz", + "integrity": "sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz", + "integrity": "sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.12.2.tgz", + "integrity": "sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.12.2.tgz", + "integrity": "sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@vavt/copy2clipboard": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@vavt/copy2clipboard/-/copy2clipboard-1.0.3.tgz", @@ -6530,19 +6874,6 @@ "node": ">=18" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-parser": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/character-parser/-/character-parser-2.2.0.tgz", @@ -6563,35 +6894,6 @@ "node": ">= 16" } }, - "node_modules/cli-cursor": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", - "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", - "dev": true, - "license": "MIT", - "dependencies": { - "restore-cursor": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cli-spinners": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-3.4.0.tgz", - "integrity": "sha512-bXfOC4QcT1tKXGorxL3wbJm6XJPDqEnij2gQ2m7ESQuE+/z9YFIWnl/5RpTiKWbMq3EVKR4fRLJGn6DVfu0mpw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -6658,6 +6960,16 @@ "node": ">=18" } }, + "node_modules/comment-parser": { + "version": "1.4.9", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.9.tgz", + "integrity": "sha512-+2AvZKjJaNq9GQljm3tr0utwrig5BL+jgJGvz5rDpGKNIp+ojcRXWUwBbh/sGIi1QCprR6PsKFakub+w1v+4hQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/common-tags": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", @@ -7052,216 +7364,6 @@ "license": "MIT", "peer": true }, - "node_modules/dpdm": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/dpdm/-/dpdm-4.3.0.tgz", - "integrity": "sha512-2ZrP5B3MHHo7mXWgNxntU5DhJIvXNP4hcMBdCJsuxEWenKMdf4h6XouuKMf3Sj2SAUNBy/ajcWAVIyiOZly6rw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^5.6.2", - "fs-extra": "^11.3.3", - "glob": "^13.0.0", - "ora": "^9.1.0", - "tslib": "^2.8.1", - "typescript": "^5.9.3", - "yargs": "^18.0.0" - }, - "bin": { - "dpdm": "lib/bin/dpdm.js" - } - }, - "node_modules/dpdm/node_modules/ansi-regex": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", - "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/dpdm/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/dpdm/node_modules/cliui": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", - "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^7.2.0", - "strip-ansi": "^7.1.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/dpdm/node_modules/cliui/node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/dpdm/node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "dev": true, - "license": "MIT" - }, - "node_modules/dpdm/node_modules/glob": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", - "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "minimatch": "^10.2.2", - "minipass": "^7.1.3", - "path-scurry": "^2.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/dpdm/node_modules/string-width": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", - "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", - "dev": true, - "license": "MIT", - "dependencies": { - "get-east-asian-width": "^1.5.0", - "strip-ansi": "^7.1.2" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/dpdm/node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/dpdm/node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/dpdm/node_modules/wrap-ansi/node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/dpdm/node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/dpdm/node_modules/yargs": { - "version": "18.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.1.0.tgz", - "integrity": "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^9.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "string-width": "^8.2.1", - "y18n": "^5.0.5", - "yargs-parser": "^22.0.0" - }, - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=23" - } - }, - "node_modules/dpdm/node_modules/yargs-parser": { - "version": "22.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", - "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", - "dev": true, - "license": "ISC", - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=23" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -7698,6 +7800,103 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-import-context": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/eslint-import-context/-/eslint-import-context-0.1.9.tgz", + "integrity": "sha512-K9Hb+yRaGAGUbwjhFNHvSmmkZs9+zbuoe3kFQ4V1wYjrepUFYM2dZAfNtjbbj3qsPfUfsA68Bx/ICWQMi+C8Eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-tsconfig": "^4.10.1", + "stable-hash-x": "^0.2.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-context" + }, + "peerDependencies": { + "unrs-resolver": "^1.0.0" + }, + "peerDependenciesMeta": { + "unrs-resolver": { + "optional": true + } + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.5.tgz", + "integrity": "sha512-nbE5XLph6TLtGYcu/U6e6ZVXyKBhbDWK5cLGk76eJ7NdZpwf1P9EFkpt1Z01mNZNrrilsAYWKH6zUkL4reoXbw==", + "dev": true, + "license": "ISC", + "dependencies": { + "debug": "^4.4.1", + "eslint-import-context": "^0.1.8", + "get-tsconfig": "^4.10.1", + "is-bun-module": "^2.0.0", + "stable-hash-x": "^0.2.0", + "tinyglobby": "^0.2.14", + "unrs-resolver": "^1.7.11" + }, + "engines": { + "node": "^16.17.0 || >=18.6.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-import-x": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-4.17.1.tgz", + "integrity": "sha512-4cdstYkKCyjumM2Q9NSI03K8D2a9F4Ssz33K2lv2hQa4KmR9jPLwk3uWGtNvclfqBrPGfGuMBwsGMbe6dMRbfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "^8.56.0", + "comment-parser": "^1.4.1", + "debug": "^4.4.1", + "eslint-import-context": "^0.1.9", + "is-glob": "^4.0.3", + "minimatch": "^9.0.3 || ^10.1.2", + "semver": "^7.7.2", + "stable-hash-x": "^0.2.0", + "unrs-resolver": "^1.9.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-import-x" + }, + "peerDependencies": { + "@typescript-eslint/utils": "^8.56.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "eslint-import-resolver-node": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/utils": { + "optional": true + }, + "eslint-import-resolver-node": { + "optional": true + } + } + }, "node_modules/eslint-plugin-vue": { "version": "10.8.0", "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.8.0.tgz", @@ -8215,19 +8414,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-east-asian-width": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz", - "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -8290,6 +8476,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.3.tgz", + "integrity": "sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", @@ -8678,6 +8877,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.7.1" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -8869,19 +9078,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-interactive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", - "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-map": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", @@ -9071,19 +9267,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-unicode-supported": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", - "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-weakmap": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", @@ -9909,23 +10092,6 @@ "dev": true, "license": "MIT" }, - "node_modules/log-symbols": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-7.0.1.tgz", - "integrity": "sha512-ja1E3yCr9i/0hmBVaM0bfwDjnGy8I/s6PP4DFp+yP+a+mrHO4Rm7DtmnqROTUkHIkqffC84YY7AeqX6oFk0WFg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-unicode-supported": "^2.0.0", - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/loupe": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", @@ -10088,19 +10254,6 @@ "node": ">= 0.6" } }, - "node_modules/mimic-function": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", - "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -10194,6 +10347,22 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-postinstall": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.4.tgz", + "integrity": "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -10315,22 +10484,6 @@ "node": ">=12.20.0" } }, - "node_modules/onetime": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", - "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-function": "^5.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/open": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", @@ -10385,75 +10538,6 @@ "node": ">= 0.8.0" } }, - "node_modules/ora": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-9.4.1.tgz", - "integrity": "sha512-6VlU9MLXbjVQD04AZCMX28hVtA5bUoadvUqO76MUCVA0ilwJbMiHsITRPfyVm6p/BC0Av/BXMujx39WCe1LEqw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^5.6.2", - "cli-cursor": "^5.0.0", - "cli-spinners": "^3.2.0", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^2.1.0", - "log-symbols": "^7.0.1", - "stdin-discarder": "^0.3.2", - "string-width": "^8.1.0" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/ansi-regex": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", - "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ora/node_modules/string-width": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", - "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", - "dev": true, - "license": "MIT", - "dependencies": { - "get-east-asian-width": "^1.5.0", - "strip-ansi": "^7.1.2" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/own-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", @@ -11281,21 +11365,14 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/restore-cursor": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", - "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", "dev": true, "license": "MIT", - "dependencies": { - "onetime": "^7.0.0", - "signal-exit": "^4.1.0" - }, - "engines": { - "node": ">=18" - }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, "node_modules/rfdc": { @@ -11712,6 +11789,16 @@ "node": ">=0.10.0" } }, + "node_modules/stable-hash-x": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/stable-hash-x/-/stable-hash-x-0.2.0.tgz", + "integrity": "sha512-o3yWv49B/o4QZk5ZcsALc6t0+eCelPc44zZsLtCQnZPDwFpDYSWcDnrv2TtMmMbQ7uKo3J0HTURCqckw23czNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -11726,19 +11813,6 @@ "dev": true, "license": "MIT" }, - "node_modules/stdin-discarder": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.3.2.tgz", - "integrity": "sha512-eCPu1qRxPVkl5605OTWF8Wz40b4Mf45NY5LQmVPQ599knfs5QhASUm9GbJ5BDMDOXgrnh0wyEdvzmL//YMlw0A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stop-iteration-iterator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", @@ -12524,6 +12598,44 @@ "node": ">=18.12.0" } }, + "node_modules/unrs-resolver": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.12.2.tgz", + "integrity": "sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.3.4" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.12.2", + "@unrs/resolver-binding-android-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-x64": "1.12.2", + "@unrs/resolver-binding-freebsd-x64": "1.12.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.12.2", + "@unrs/resolver-binding-linux-loong64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-loong64-musl": "1.12.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.12.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-musl": "1.12.2", + "@unrs/resolver-binding-openharmony-arm64": "1.12.2", + "@unrs/resolver-binding-wasm32-wasi": "1.12.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.12.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.12.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.12.2" + } + }, "node_modules/upath": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", @@ -14191,19 +14303,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "node_modules/yoctocolors": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.2.0.tgz", - "integrity": "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } } } } diff --git a/frontend/package.json b/frontend/package.json index 5fc3db65c..b2f0de5d2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -26,7 +26,7 @@ "dev": "vite --host", "build": "vite build", "preview": "vite preview", - "typecheck": "vue-tsc --noEmit && npm run circular", + "typecheck": "vue-tsc --noEmit", "generate": "openapi --input http://127.0.0.1:3000/openapi.json --output ./src/__generated__ --client axios --useOptions --useUnionTypes --exportServices false --exportSchemas false --exportCore false", "test": "vitest run", "test:watch": "vitest", @@ -34,7 +34,6 @@ "storybook": "storybook dev -p 6006", "storybook:build": "storybook build", "storybook:test": "vitest run test/storybook.test.ts", - "circular": "dpdm", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui" }, @@ -83,9 +82,10 @@ "@vue/tsconfig": "^0.9.1", "axe-core": "^4.12.1", "browserslist": "^4.28.8", - "dpdm": "^4.3.0", "eslint": "^10.0.3", "eslint-config-prettier": "^10.1.8", + "eslint-import-resolver-typescript": "^4.4.5", + "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-vue": "^10.8.0", "eslint-plugin-vuejs-accessibility": "^2.5.0", "globals": "^16.0.0", diff --git a/frontend/src/services/api/index.ts b/frontend/src/services/api/index.ts index d301a8cf3..45074a00b 100644 --- a/frontend/src/services/api/index.ts +++ b/frontend/src/services/api/index.ts @@ -134,7 +134,6 @@ api.interceptors.response.use( // Loaded lazily: a static import evaluates the router while this module // is still initialising, so `router` reads as undefined. - // @dpdm-ignore const { default: router } = await import("@/plugins/router"); // Don't redirect to login if already on an auth-exempt route. From 242af819ad0f2cb3e10147884ac0b1195a2a5eaa Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 15:15:39 +0000 Subject: [PATCH 29/52] fix(security): revoke the target account's sessions on a credential change `update_user` cleared only the caller's session, so an admin resetting a compromised account left every attacker session on it live. It now revokes the sessions of the account the change was applied to, keyed on the username the account held before the update, and still clears the caller's own session when they are that account. `set_user_new_password` already did this; the update endpoint was the gap. A revocation could also be undone by any request already in flight: the session middleware rewrote its copy unconditionally on the way out. An existing session now refreshes with `SET ... XX`, so a record deleted mid-request is not recreated, and the response clears the cookie instead. `clear_user_sessions` also builds its delete keys from decoded members. The configured clients pass `decode_responses=True`, so this changes nothing in production, but the key is now right for any client, and the whole set goes in one `delete` rather than a call per session. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NouZquWDxNBqxYyu2E2GF8 --- backend/endpoints/user.py | 14 +++- .../middleware/redis_session_middleware.py | 42 +++++++---- backend/tests/endpoints/test_identity.py | 43 ++++++++++++ .../auth/test_redis_session_middleware.py | 70 +++++++++++++++++++ 4 files changed, 153 insertions(+), 16 deletions(-) create mode 100644 backend/tests/handler/auth/test_redis_session_middleware.py diff --git a/backend/endpoints/user.py b/backend/endpoints/user.py index 246df940c..b414253da 100644 --- a/backend/endpoints/user.py +++ b/backend/endpoints/user.py @@ -12,6 +12,7 @@ from endpoints.permissions import emit_permissions_changed from endpoints.responses.identity import InviteLinkSchema, UserSchema from handler.auth import auth_handler from handler.auth.constants import Scope +from handler.auth.middleware.redis_session_middleware import RedisSessionMiddleware from handler.database import db_user_handler from handler.filesystem import fs_asset_handler from handler.filesystem.assets_handler import ( @@ -471,18 +472,25 @@ async def update_user( cleaned_data["avatar_path"] = file_location if cleaned_data: + # Sessions are keyed by username, so the old one is what identifies + # them once the update has renamed the account. + previous_username = db_user.username + db_user_handler.update_user(id, cleaned_data) # A role change alters the user's effective permissions; tell their UI. if "role" in cleaned_data: await emit_permissions_changed(id) - # Log out the current user if username or password changed + # The target's sessions, not the caller's: an admin resetting a + # compromised account has to lock its attacker out. creds_updated = cleaned_data.get("username") or cleaned_data.get( "hashed_password" ) - if request.user.id == id and creds_updated: - request.session.clear() + if creds_updated: + await RedisSessionMiddleware.clear_user_sessions(previous_username) + if request.user.id == id: + request.session.clear() db_user = db_user_handler.get_user(id) if not db_user: diff --git a/backend/handler/auth/middleware/redis_session_middleware.py b/backend/handler/auth/middleware/redis_session_middleware.py index d575d2de2..5dad19921 100644 --- a/backend/handler/auth/middleware/redis_session_middleware.py +++ b/backend/handler/auth/middleware/redis_session_middleware.py @@ -31,10 +31,16 @@ class RedisSessionMiddleware: Clears all active sessions for a given user. """ session_ids = await async_cache.smembers(f"user_sessions:{user_id}") - if session_ids: - for session_id in session_ids: - await async_cache.delete(f"session:{session_id}") - await async_cache.delete(f"user_sessions:{user_id}") + if not session_ids: + return + + # A member arrives as bytes from a client that does not decode, and its + # repr in a key name would miss the session and leave it live. + keys = [ + f"session:{sid.decode() if isinstance(sid, bytes) else sid}" + for sid in session_ids + ] + await async_cache.delete(*keys, f"user_sessions:{user_id}") async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] not in ("http", "websocket"): @@ -66,19 +72,29 @@ class RedisSessionMiddleware: user_id = scope["session"].get("sub") if scope["session"]: - session_id = scope["session"].pop("session_id", None) or str( - uuid.uuid4() - ) # Retrieve or create session_id + existing_id = scope["session"].pop("session_id", None) + session_id = existing_id or str(uuid.uuid4()) session_data_json = json.dumps(scope["session"]) - await async_cache.set( - f"session:{session_id}", session_data_json, ex=self.max_age + # Refreshed only while its record is still there, so a + # session revoked mid-request is not written back. + stored = await async_cache.set( + f"session:{session_id}", + session_data_json, + ex=self.max_age, + xx=existing_id is not None, ) - # Add session_id to user set of sessions - if user_id: - await async_cache.sadd(f"user_sessions:{user_id}", session_id) + if stored: + # Add session_id to user set of sessions + if user_id: + await async_cache.sadd( + f"user_sessions:{user_id}", session_id + ) + + header_value = f"{self.session_cookie}={session_id}; path=/; Max-Age={self.max_age}; {self.security_flags}" + else: + header_value = f"{self.session_cookie}=null; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; {self.security_flags}" - header_value = f"{self.session_cookie}={session_id}; path=/; Max-Age={self.max_age}; {self.security_flags}" headers.append("Set-Cookie", header_value) elif session_id: await async_cache.delete(f"session:{session_id}") diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index 4cf6374c4..e03bb7eb4 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -260,6 +260,49 @@ def test_delete_user(client, access_token: str, editor_user: User): assert response.status_code == HTTPStatus.OK +@pytest.mark.asyncio +async def test_admin_password_reset_invalidates_the_target_user_sessions( + client, access_token: str, editor_user: User +): + """The reason the revocation is not scoped to the caller: an admin resetting + a compromised account has to end that account's sessions, not their own.""" + basic_auth = base64.b64encode( + f"{editor_user.username}:test_editor_password".encode("ascii") + ).decode("ascii") + response = client.post( + "/api/login", headers={"Authorization": f"Basic {basic_auth}"} + ) + assert response.status_code == HTTPStatus.OK + target_session = response.cookies.get("romm_session") + assert target_session is not None + + target_cookie = {"Cookie": f"romm_session={target_session}"} + assert client.get("/api/users/me", headers=target_cookie).status_code == ( + HTTPStatus.OK + ) + + # The bearer has to be the only credential on the reset: HybridAuthBackend + # resolves a session cookie ahead of it, and the jar still holds the + # target's, which would make this a self-update. + client.cookies.clear() + + response = client.put( + f"/api/users/{editor_user.id}", + data={"password": "reset_by_admin_password"}, + headers={"Authorization": f"Bearer {access_token}"}, + ) + assert response.status_code == HTTPStatus.OK + + response = client.get("/api/users/me", headers=target_cookie) + assert response.status_code in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN) + + # The admin's own credentials still work. + response = client.get( + "/api/users", headers={"Authorization": f"Bearer {access_token}"} + ) + assert response.status_code == HTTPStatus.OK + + @pytest.mark.asyncio async def test_password_change_invalidates_sessions(client, admin_user: User): # Get the user's session cookie diff --git a/backend/tests/handler/auth/test_redis_session_middleware.py b/backend/tests/handler/auth/test_redis_session_middleware.py new file mode 100644 index 000000000..49e318013 --- /dev/null +++ b/backend/tests/handler/auth/test_redis_session_middleware.py @@ -0,0 +1,70 @@ +"""Test suite for RedisSessionMiddleware's Redis-backed session persistence.""" + +from starlette.applications import Starlette +from starlette.middleware import Middleware +from starlette.requests import Request +from starlette.responses import JSONResponse +from starlette.routing import Route +from starlette.testclient import TestClient + +from handler.auth.constants import SESSION_COOKIE_NAME +from handler.auth.middleware.redis_session_middleware import RedisSessionMiddleware + +USERNAME = "user_1" + + +def create_test_app() -> Starlette: + async def login(request: Request) -> JSONResponse: + request.session["iss"] = "romm:auth" + request.session["sub"] = USERNAME + return JSONResponse({"ok": True}) + + async def revoke(request: Request) -> JSONResponse: + """Revoke the caller's sessions while their own request is in flight.""" + await RedisSessionMiddleware.clear_user_sessions(USERNAME) + return JSONResponse({"ok": True}) + + async def whoami(request: Request) -> JSONResponse: + return JSONResponse({"sub": request.session.get("sub")}) + + return Starlette( + routes=[ + Route("/login", login, methods=["POST"]), + Route("/revoke", revoke, methods=["POST"]), + Route("/whoami", whoami, methods=["GET"]), + ], + middleware=[ + Middleware( + RedisSessionMiddleware, + session_cookie=SESSION_COOKIE_NAME, + same_site="strict", + https_only=False, + ) + ], + ) + + +class TestRedisSessionMiddleware: + def test_session_survives_across_requests(self) -> None: + client = TestClient(create_test_app()) + + assert client.post("/login").status_code == 200 + assert client.get("/whoami").json()["sub"] == USERNAME + + def test_revoked_session_is_not_restored_by_an_in_flight_request(self) -> None: + """A request holding a copy of a session revoked mid-flight must not + write it back, or a credential change could never lock anyone out.""" + client = TestClient(create_test_app()) + client.post("/login") + + client.post("/revoke") + + assert client.get("/whoami").json()["sub"] is None + + def test_a_cookie_for_an_unknown_session_gets_a_fresh_id(self) -> None: + client = TestClient(create_test_app()) + client.cookies.set(SESSION_COOKIE_NAME, "not-a-real-session") + + response = client.post("/login") + + assert response.cookies[SESSION_COOKIE_NAME] != "not-a-real-session" From b065fc7bc19c0e4c66e8b666df1a4df725bf08fb Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 20 Sep 2026 11:43:30 -0400 Subject: [PATCH 30/52] fix(frontend): encode the download path segment exactly once `getDownloadPath` encoded a selected file name but left `fs_name` raw, then `getDownloadLink` ran `encodeURI` over the whole result. Three things went wrong: - a selected file name came back double-encoded, so the browser saved `Game%20(USA).zip` instead of `Game (USA).zip` - `encodeURI` also hit the query string, so `file_ids=29%2C30` reached the backend as one value and `int()` raised on it: copying a link for a multi-file selection produced a 500 - a raw `#` in `fs_name` started the fragment, truncating the path before the request left the browser Encode the segment once in `getDownloadPath` for both branches and let `getDownloadLink` only prepend the origin. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/src/utils/downloadPath.test.ts | 51 ++++++++++++++++++++++++- frontend/src/utils/downloadPath.ts | 13 ++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/frontend/src/utils/downloadPath.test.ts b/frontend/src/utils/downloadPath.test.ts index 52cf8c015..4f1d112a1 100644 --- a/frontend/src/utils/downloadPath.test.ts +++ b/frontend/src/utils/downloadPath.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import type { SimpleRom } from "@/stores/roms"; -import { getDownloadPath } from "./downloadPath"; +import { getDownloadLink, getDownloadPath } from "./downloadPath"; import { makeRom } from "./rom.fixtures"; describe("getDownloadPath", () => { @@ -14,7 +14,7 @@ describe("getDownloadPath", () => { ] as SimpleRom["files"], }); expect(getDownloadPath({ rom })).toBe( - "/api/roms/14/content/Maniac Mansion (1989).adf", + "/api/roms/14/content/Maniac%20Mansion%20(1989).adf", ); }); @@ -83,3 +83,50 @@ describe("getDownloadPath", () => { ); }); }); + +describe("download URL encoding", () => { + const rom = makeRom({ + id: 24, + fs_name: "Game & (USA)", + has_nested_single_file: false, + files: [ + { id: 29, file_name: "Game & (USA) Disk1.adf" }, + { id: 30, file_name: "Disk2.adf" }, + ] as SimpleRom["files"], + }); + + it("encodes a name that would otherwise truncate the URL", () => { + // A bare `#` starts the fragment, so an unencoded fs_name loses + // everything after it before the request is even sent. + const hashRom = makeRom({ id: 7, fs_name: "Game #1 (100%)" }); + const url = new URL(getDownloadLink({ rom: hashRom })); + expect(url.hash).toBe(""); + expect(decodeURIComponent(url.pathname)).toBe( + "/api/roms/7/content/Game #1 (100%)", + ); + }); + + it("does not double-encode the selected file name", () => { + const url = new URL(getDownloadLink({ rom, fileIDs: [29] })); + expect(url.pathname).not.toContain("%25"); + expect(decodeURIComponent(url.pathname)).toBe( + "/api/roms/24/content/Game & (USA) Disk1.adf", + ); + }); + + it("leaves file_ids parseable for a multi-file zip link", () => { + // The backend splits this on "," and int()s each part, so a re-encoded + // comma reaches it as one unparseable value. + const url = new URL(getDownloadLink({ rom, fileIDs: [29, 30] })); + expect(url.searchParams.get("file_ids")).toBe("29,30"); + expect(decodeURIComponent(url.pathname)).toBe( + "/api/roms/24/content/Game & (USA)", + ); + }); + + it("prefixes the path with the origin and nothing else", () => { + expect(getDownloadLink({ rom })).toBe( + `${window.location.origin}${getDownloadPath({ rom })}`, + ); + }); +}); diff --git a/frontend/src/utils/downloadPath.ts b/frontend/src/utils/downloadPath.ts index 14f8cf180..3c00ef000 100644 --- a/frontend/src/utils/downloadPath.ts +++ b/frontend/src/utils/downloadPath.ts @@ -25,9 +25,12 @@ export function getDownloadPath({ ? rom.files[0] : undefined; const contentFile = selectedFile ?? nestedFile; - const contentName = contentFile - ? encodeURIComponent(contentFile.file_name) - : rom.fs_name; + // One path segment, so it is encoded here and never again: callers that + // prepend an origin must not re-encode. A bare `#` or `%` in a name would + // otherwise truncate the URL or survive as a literal in the zip's name. + const contentName = encodeURIComponent( + contentFile ? contentFile.file_name : rom.fs_name, + ); return `/api/roms/${rom.id}/content/${contentName}${ queryString ? `?${queryString}` : "" @@ -41,7 +44,5 @@ export function getDownloadLink({ rom: SimpleRom; fileIDs?: number[]; }) { - return `${window.location.origin}${encodeURI( - getDownloadPath({ rom, fileIDs }), - )}`; + return `${window.location.origin}${getDownloadPath({ rom, fileIDs })}`; } From 60ba29ca3e9202523dc5c1556774197de21c71b8 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 16:16:13 +0000 Subject: [PATCH 31/52] fix(security): revoke before the credential write commits Revoking after the write left the two able to disagree: an unreachable Redis raised once the new password was already committed, so the endpoint reported failure while the account's old sessions stayed valid, and session authentication checks only the username and enabled flag, never the password. Revoking first makes that failure abort the change instead. The login race documented on the PR is unchanged by the reordering: it turns on when a login read the old hash, not on when the revocation runs. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NouZquWDxNBqxYyu2E2GF8 --- backend/endpoints/user.py | 19 +++++++++--------- backend/tests/endpoints/test_identity.py | 25 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/backend/endpoints/user.py b/backend/endpoints/user.py index b414253da..4af58ff13 100644 --- a/backend/endpoints/user.py +++ b/backend/endpoints/user.py @@ -475,6 +475,14 @@ async def update_user( # Sessions are keyed by username, so the old one is what identifies # them once the update has renamed the account. previous_username = db_user.username + creds_updated = cleaned_data.get("username") or cleaned_data.get( + "hashed_password" + ) + + # Ahead of the write: an unreachable Redis then aborts the change + # rather than committing it with the account's sessions left live. + if creds_updated: + await RedisSessionMiddleware.clear_user_sessions(previous_username) db_user_handler.update_user(id, cleaned_data) @@ -482,15 +490,8 @@ async def update_user( if "role" in cleaned_data: await emit_permissions_changed(id) - # The target's sessions, not the caller's: an admin resetting a - # compromised account has to lock its attacker out. - creds_updated = cleaned_data.get("username") or cleaned_data.get( - "hashed_password" - ) - if creds_updated: - await RedisSessionMiddleware.clear_user_sessions(previous_username) - if request.user.id == id: - request.session.clear() + if creds_updated and request.user.id == id: + request.session.clear() db_user = db_user_handler.get_user(id) if not db_user: diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index e03bb7eb4..7ce724f9a 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -303,6 +303,31 @@ async def test_admin_password_reset_invalidates_the_target_user_sessions( assert response.status_code == HTTPStatus.OK +@pytest.mark.asyncio +async def test_a_failed_revocation_leaves_the_password_unchanged( + client, access_token: str, editor_user: User +): + """Revoking before the write keeps the two from disagreeing: a password + that changed while its sessions survived would outlive the reset.""" + original_hash = editor_user.hashed_password + + with mock.patch.object( + RedisSessionMiddleware, + "clear_user_sessions", + side_effect=ConnectionError("redis is down"), + ): + with pytest.raises(ConnectionError): + client.put( + f"/api/users/{editor_user.id}", + data={"password": "reset_while_redis_is_down"}, + headers={"Authorization": f"Bearer {access_token}"}, + ) + + db_user = DBUsersHandler().get_user(editor_user.id) + assert db_user is not None + assert db_user.hashed_password == original_hash + + @pytest.mark.asyncio async def test_password_change_invalidates_sessions(client, admin_user: User): # Get the user's session cookie From 0511e47fa644f4911ed2bb822dc63ec20b5d68ea Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 16:33:14 +0000 Subject: [PATCH 32/52] fix(security): revoke on both sides of the credential write Revoking only before the write left a wider hole than the one it closed: the old password stays good until the write commits, so a login starting in that window authenticates and writes a session unconditionally, having no existing id for the `XX` guard to refuse. Revoking only after the write cannot abort a change Redis was unreachable for. Doing both keeps each property. What remains is a login that read the old hash before the first pass and writes after the second, which needs the per-user revocation generation rather than an ordering change. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NouZquWDxNBqxYyu2E2GF8 --- backend/endpoints/user.py | 13 ++++--- backend/tests/endpoints/test_identity.py | 37 ++++++++++++++++++- .../auth/test_redis_session_middleware.py | 3 +- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/backend/endpoints/user.py b/backend/endpoints/user.py index 4af58ff13..25fb86583 100644 --- a/backend/endpoints/user.py +++ b/backend/endpoints/user.py @@ -479,20 +479,23 @@ async def update_user( "hashed_password" ) - # Ahead of the write: an unreachable Redis then aborts the change - # rather than committing it with the account's sessions left live. + # Once before the write, so an unreachable Redis aborts rather than + # commits, and once after, to catch a login the old password was still + # good for while the write was in progress. if creds_updated: await RedisSessionMiddleware.clear_user_sessions(previous_username) db_user_handler.update_user(id, cleaned_data) + if creds_updated: + await RedisSessionMiddleware.clear_user_sessions(previous_username) + if request.user.id == id: + request.session.clear() + # A role change alters the user's effective permissions; tell their UI. if "role" in cleaned_data: await emit_permissions_changed(id) - if creds_updated and request.user.id == id: - request.session.clear() - db_user = db_user_handler.get_user(id) if not db_user: msg = f"Username with id {id} not found" diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index 7ce724f9a..bb6ec633b 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -307,8 +307,7 @@ async def test_admin_password_reset_invalidates_the_target_user_sessions( async def test_a_failed_revocation_leaves_the_password_unchanged( client, access_token: str, editor_user: User ): - """Revoking before the write keeps the two from disagreeing: a password - that changed while its sessions survived would outlive the reset.""" + """An unreachable Redis aborts the change instead of committing it.""" original_hash = editor_user.hashed_password with mock.patch.object( @@ -328,6 +327,40 @@ async def test_a_failed_revocation_leaves_the_password_unchanged( assert db_user.hashed_password == original_hash +@pytest.mark.asyncio +async def test_sessions_are_revoked_on_both_sides_of_the_write( + client, access_token: str, editor_user: User +): + """The second pass catches a login the old password was still good for.""" + calls: list[str] = [] + real_update = DBUsersHandler.update_user + + def record_update(self, id, data, *args, **kwargs): + # `set_last_active` writes on every authenticated request; only the + # credential write is being ordered here. + if "hashed_password" in data: + calls.append("write") + return real_update(self, id, data, *args, **kwargs) + + async def record_revoke(user_id: str) -> None: + calls.append("revoke") + + with ( + mock.patch.object(DBUsersHandler, "update_user", record_update), + mock.patch.object( + RedisSessionMiddleware, "clear_user_sessions", side_effect=record_revoke + ), + ): + response = client.put( + f"/api/users/{editor_user.id}", + data={"password": "another_reset_password"}, + headers={"Authorization": f"Bearer {access_token}"}, + ) + + assert response.status_code == HTTPStatus.OK + assert calls == ["revoke", "write", "revoke"] + + @pytest.mark.asyncio async def test_password_change_invalidates_sessions(client, admin_user: User): # Get the user's session cookie diff --git a/backend/tests/handler/auth/test_redis_session_middleware.py b/backend/tests/handler/auth/test_redis_session_middleware.py index 49e318013..62e4f274c 100644 --- a/backend/tests/handler/auth/test_redis_session_middleware.py +++ b/backend/tests/handler/auth/test_redis_session_middleware.py @@ -52,8 +52,7 @@ class TestRedisSessionMiddleware: assert client.get("/whoami").json()["sub"] == USERNAME def test_revoked_session_is_not_restored_by_an_in_flight_request(self) -> None: - """A request holding a copy of a session revoked mid-flight must not - write it back, or a credential change could never lock anyone out.""" + """A session revoked mid-flight must not be written back.""" client = TestClient(create_test_app()) client.post("/login") From 2140d899cb0931730d1f2ec227ee3c8056f55c4a Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:11:00 +0000 Subject: [PATCH 33/52] fix(security): move session revocation behind the auth handler Addresses the two open review findings on the credential-change path. The endpoint was sequencing two Redis revocations around the database write itself, reaching past the handler layer into the session middleware. The whole sequence now lives in `auth_handler`, so the endpoint validates, calls a handler and serializes, as the rest of the backend does. The second revocation runs after the write has committed, so raising from it reported a failed change that had in fact succeeded, and an operator could not tell the two apart. It is now logged instead, naming the account and warning that a session created during the update may still be live. The first revocation still raises, because it has a write to abort. `set_user_new_password` (the forgot-password path) goes through the same helper, which gives it the pre-write pass it did not have: an unreachable Redis there used to change the password and leave the account's sessions live. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- backend/endpoints/user.py | 19 ++++------ backend/handler/auth/base_handler.py | 47 +++++++++++++++++++++--- backend/tests/endpoints/test_identity.py | 30 +++++++++++++++ 3 files changed, 79 insertions(+), 17 deletions(-) diff --git a/backend/endpoints/user.py b/backend/endpoints/user.py index 25fb86583..5da5ab38e 100644 --- a/backend/endpoints/user.py +++ b/backend/endpoints/user.py @@ -12,7 +12,6 @@ from endpoints.permissions import emit_permissions_changed from endpoints.responses.identity import InviteLinkSchema, UserSchema from handler.auth import auth_handler from handler.auth.constants import Scope -from handler.auth.middleware.redis_session_middleware import RedisSessionMiddleware from handler.database import db_user_handler from handler.filesystem import fs_asset_handler from handler.filesystem.assets_handler import ( @@ -479,18 +478,14 @@ async def update_user( "hashed_password" ) - # Once before the write, so an unreachable Redis aborts rather than - # commits, and once after, to catch a login the old password was still - # good for while the write was in progress. - if creds_updated: - await RedisSessionMiddleware.clear_user_sessions(previous_username) + await auth_handler.apply_user_update( + id, + cleaned_data, + revoke_sessions_for=previous_username if creds_updated else None, + ) - db_user_handler.update_user(id, cleaned_data) - - if creds_updated: - await RedisSessionMiddleware.clear_user_sessions(previous_username) - if request.user.id == id: - request.session.clear() + if creds_updated and request.user.id == id: + request.session.clear() # A role change alters the user's effective permissions; tell their UI. if "role" in cleaned_data: diff --git a/backend/handler/auth/base_handler.py b/backend/handler/auth/base_handler.py index 6f8f1cd94..50e83b9d3 100644 --- a/backend/handler/auth/base_handler.py +++ b/backend/handler/auth/base_handler.py @@ -9,6 +9,7 @@ from joserfc import jwt from joserfc.errors import BadSignatureError, DecodeError from joserfc.jwk import OctKey from passlib.context import CryptContext +from redis.exceptions import RedisError from starlette.requests import HTTPConnection from config import ( @@ -205,6 +206,43 @@ class AuthHandler: return user + async def apply_user_update( + self, + user_id: int, + data: dict[str, Any], + revoke_sessions_for: str | None = None, + ) -> None: + """ + Write an update to a user, revoking that account's sessions around it. + Args: + user_id (int): The user the update applies to. + data (dict[str, Any]): The fields to write. + revoke_sessions_for (str | None): Username the sessions are keyed by, + or None to write without revoking. + """ + from handler.database import db_user_handler + + if revoke_sessions_for: + # Ahead of the write: an unreachable Redis then aborts the change + # rather than committing it with the account's sessions left live. + await RedisSessionMiddleware.clear_user_sessions(revoke_sessions_for) + + db_user_handler.update_user(user_id, data) + + if revoke_sessions_for: + # After it, for a login the old password was still good for. The + # write has committed, so a failure here is logged, not raised. + try: + await RedisSessionMiddleware.clear_user_sessions(revoke_sessions_for) + except RedisError, OSError: + log.error( + "Credentials for '%s' changed, but revoking its sessions " + "afterwards failed; a session created during the update may " + "still be live", + hl(revoke_sessions_for, color=CYAN), + exc_info=True, + ) + async def set_user_new_password(self, user: Any, new_password: str) -> None: """ Set the new password for the user. @@ -212,12 +250,11 @@ class AuthHandler: user (Any): The user object. new_password (str): The new password to set. """ - from handler.database import db_user_handler - - db_user_handler.update_user( - user.id, {"hashed_password": self.get_password_hash(new_password)} + await self.apply_user_update( + user.id, + {"hashed_password": self.get_password_hash(new_password)}, + revoke_sessions_for=user.username, ) - await RedisSessionMiddleware.clear_user_sessions(user.username) def generate_invite_link_token( self, user: Any, role: str, expiration: int | None = None diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index bb6ec633b..7aba06a46 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -327,6 +327,36 @@ async def test_a_failed_revocation_leaves_the_password_unchanged( assert db_user.hashed_password == original_hash +@pytest.mark.asyncio +async def test_a_failed_post_write_revocation_does_not_fail_the_change( + client, access_token: str, editor_user: User +): + """The write has committed by the second pass, so its failure is logged.""" + original_hash = editor_user.hashed_password + calls: list[str] = [] + + async def revoke_then_fail(user_id: str) -> None: + calls.append(user_id) + if len(calls) == 2: + raise ConnectionError("redis went down mid-update") + + with mock.patch.object( + RedisSessionMiddleware, "clear_user_sessions", side_effect=revoke_then_fail + ): + response = client.put( + f"/api/users/{editor_user.id}", + data={"password": "reset_with_redis_failing_late"}, + headers={"Authorization": f"Bearer {access_token}"}, + ) + + assert response.status_code == HTTPStatus.OK + assert len(calls) == 2 + + db_user = DBUsersHandler().get_user(editor_user.id) + assert db_user is not None + assert db_user.hashed_password != original_hash + + @pytest.mark.asyncio async def test_sessions_are_revoked_on_both_sides_of_the_write( client, access_token: str, editor_user: User From 004c66e0a645fc525a143a1d9b2e62cac3455730 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:20:47 +0000 Subject: [PATCH 34/52] fix(tooling): make mypy's exclude a regex so it stops excluding everything `exclude` in an INI config is a regular expression, not a TOML list. The array that was there compiled to a single character class matching any of `" t e s , a l m b i c`, and since mypy matches with `re.search`, almost every path in the repo matched it. The effect was total: `mypy .` in `backend/` answered "There are no .py[i] files in directory '.'" and checked nothing. With the regex written properly it checks 533 files. `tests` is dropped rather than translated. `exclude` applies only to directory crawling, and Trunk passes changed files explicitly, so test files have always been typechecked in CI (as `.claude/skills/review-polish/SKILL.md` documents). Excluding them here only hid from a local run what CI would flag. `alembic` stays, matching the Trunk `ignore` block that covers the same paths for explicit runs. CI behaviour is unchanged: explicitly passed files bypass `exclude` entirely, verified by diffing per-file results under both configs. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- .trunk/configs/mypy.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.trunk/configs/mypy.ini b/.trunk/configs/mypy.ini index 7043064c6..c4b251465 100644 --- a/.trunk/configs/mypy.ini +++ b/.trunk/configs/mypy.ini @@ -1,4 +1,6 @@ [mypy] check_untyped_defs = True disable_error_code = import-untyped -exclude = ["tests", "alembic"] +# A regex, not a TOML list: an array here compiles to a character class that +# matches almost every path, excluding the whole backend. +exclude = (?x)(^|/)alembic/ From c26142d8450f5493d8c3e754236331dbfdfef6f7 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:23:04 +0000 Subject: [PATCH 35/52] test: annotate the record_update test double Every other inner helper in the file carries annotations (`revoke_then_fail`, `record_revoke`, `_cookie_header` twice); this one was the exception, and it was added by this PR. The signature mirrors `DBUsersHandler.update_user`, which it stands in for via `mock.patch.object`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- backend/tests/endpoints/test_identity.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index 7aba06a46..c404c577a 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -2,6 +2,7 @@ import base64 import json from datetime import timedelta from http import HTTPStatus +from typing import Any from unittest import mock import pytest @@ -365,7 +366,9 @@ async def test_sessions_are_revoked_on_both_sides_of_the_write( calls: list[str] = [] real_update = DBUsersHandler.update_user - def record_update(self, id, data, *args, **kwargs): + def record_update( + self: DBUsersHandler, id: int, data: dict, *args: Any, **kwargs: Any + ) -> User: # `set_last_active` writes on every authenticated request; only the # credential write is being ordered here. if "hashed_password" in data: From 65cee0f27a6f49c742339d867a0997c417b8a033 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 13:45:00 -0400 Subject: [PATCH 36/52] Update test_identity.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- backend/tests/endpoints/test_identity.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/backend/tests/endpoints/test_identity.py b/backend/tests/endpoints/test_identity.py index c404c577a..3f0684dc2 100644 --- a/backend/tests/endpoints/test_identity.py +++ b/backend/tests/endpoints/test_identity.py @@ -282,9 +282,6 @@ async def test_admin_password_reset_invalidates_the_target_user_sessions( HTTPStatus.OK ) - # The bearer has to be the only credential on the reset: HybridAuthBackend - # resolves a session cookie ahead of it, and the jar still holds the - # target's, which would make this a self-update. client.cookies.clear() response = client.put( From c0f290e9b8e9f8646ae1b3624e57e69b3182af96 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:45:18 +0000 Subject: [PATCH 37/52] build: align the mypy dev dependency with the version CI enforces `pyproject.toml` asked for `mypy ~= 1.19` (lock: 1.19.1) while `.trunk/trunk.yaml` runs `mypy@2.3.0`, so `uv run mypy` and the build were a major version apart and could disagree on the same file. Moving the dependency up rather than pinning Trunk down keeps CI enforcement exactly as it is today and changes only the local side. The two agree: over the whole backend, 2.3.1 and 2.3.0 produce byte-identical output (151 errors in 39 files). The lockfile moves mypy and its three transitives (ast-serialize, librt, pathspec). None is reachable from application code, so the runtime dependency set is unchanged. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- pyproject.toml | 4 +- uv.lock | 207 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 169 insertions(+), 42 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b89941203..a54b42cd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,9 @@ dev = [ "ipdb ~= 0.13", "ipykernel ~= 6.29", "memray ~= 1.15", - "mypy ~= 1.19", + # Keep in step with the mypy version in .trunk/trunk.yaml, which is what CI + # enforces; a skew means local runs disagree with the build. + "mypy ~= 2.3", "pyinstrument ~= 5.0", "types-colorama ~= 0.4", "types-passlib ~= 1.7", diff --git a/uv.lock b/uv.lock index 5f320c04d..3a8d69679 100644 --- a/uv.lock +++ b/uv.lock @@ -1,6 +1,10 @@ version = 1 revision = 3 requires-python = ">=3.14" +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version < '3.15'", +] [options] exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values. @@ -147,6 +151,70 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7c/3c/0464dcada90d5da0e71018c04a140ad6349558afb30b3051b4264cc5b965/asgiref-3.9.1-py3-none-any.whl", hash = "sha256:f3bba7092a48005b5f5bacd747d36ee4a5a61f4a269a6df590b43144355ebd2c", size = 23790, upload-time = "2025-07-08T09:07:41.548Z" }, ] +[[package]] +name = "ast-serialize" +version = "0.11.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/4e/a2/04a9383e7512c91c54b2f34b3ff86dc7d2610506f588c2bda36e952a68f7/ast_serialize-0.11.1.tar.gz", hash = "sha256:cc5db2983805f6be786488aac8c5998d5b71965488d1b18c44d435a2205a5cb4", size = 953785, upload-time = "2026-09-09T16:05:27.851Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e2/cb/3577c66278e4ea4ff6968aee04327447335ecfc58c76123f68cf7f76d75e/ast_serialize-0.11.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:f7ca1557553fdab313999ad69156de154ff87152cae963698be2e765164bb6c0", size = 897021, upload-time = "2026-09-09T16:03:59.316Z" }, + { url = "https://files.pythonhosted.org/packages/47/db/9b4eed53ab0bb63653f56ef71062fa91693c8c26b0b648c58d98365c990c/ast_serialize-0.11.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8b54e44763a851c336ca137c60a2434511f0d155e0b924ef374bfbc8d8db8927", size = 1235148, upload-time = "2026-09-09T16:04:01.201Z" }, + { url = "https://files.pythonhosted.org/packages/fd/97/1ebe323015c3cf530f08e88df9929bfd9f5cf8165842bd4b37a7c958565c/ast_serialize-0.11.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:753afabcc4abf295f515ea33185cf997a1990b88a29d3a3336a9acf62ea85950", size = 1216082, upload-time = "2026-09-09T16:04:02.87Z" }, + { url = "https://files.pythonhosted.org/packages/ac/72/0d3a368edc2d1e0e188c0d3f23821f4e20a6a2291b23d9df482a6b11277f/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:98b8aba6bb682b9e8859c628382b4881c0600b28056d63c3168c227c449f3284", size = 1282848, upload-time = "2026-09-09T16:04:04.316Z" }, + { url = "https://files.pythonhosted.org/packages/9c/fb/2a546a57d7caa708d739c1747bbdf45cc3aa9dac9407a11d9d67e8a0e255/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:651a7890558896c3e08089e51ab3b3a43710eab15b72ad861c400bc9a51923ba", size = 1285337, upload-time = "2026-09-09T16:04:05.899Z" }, + { url = "https://files.pythonhosted.org/packages/bf/16/4ff4179584f8b8bec348787bf721cb7ce3d4c707c7878778065249b59b9a/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ff8ddc1453bfe7934292409c7b8e9f68b0a6cff4e4c12535e4b4a66fd83aca0c", size = 1554906, upload-time = "2026-09-09T16:04:07.42Z" }, + { url = "https://files.pythonhosted.org/packages/df/e8/e54a54676ca8965e1ae3cfe065dc26c75158e0b3a3ce35af283da106fbf9/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:daec16b026c5741950a00c708acdf698c4f17babbe4829dd8232324822e9514f", size = 1301472, upload-time = "2026-09-09T16:04:08.782Z" }, + { url = "https://files.pythonhosted.org/packages/e0/ab/618835a2479868a0d4ac807dd04cf2f89d24afe22c4171538d9779c2772e/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9961abcb93bf03652ab09c00862a2396abacd57551c769ad34490a2ae508a61d", size = 1301293, upload-time = "2026-09-09T16:04:10.17Z" }, + { url = "https://files.pythonhosted.org/packages/61/cb/8acc29a1b279ccdfb30dcbdf099e1d8d34c4ee77be9be751c48061433129/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:8ca9e48edf246f09fd9bdb64fbd9cd8d18cd2a69ffc24d44891466e17595094f", size = 1307807, upload-time = "2026-09-09T16:04:11.989Z" }, + { url = "https://files.pythonhosted.org/packages/da/74/bada875132f452cb5c1179e3156df43cee6df6cb51f773220688be3d4bb4/ast_serialize-0.11.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6a57e0e025e9dcee48e466b3cf909178e298d238148664e796fc0f60ded5e52e", size = 1356265, upload-time = "2026-09-09T16:04:13.429Z" }, + { url = "https://files.pythonhosted.org/packages/4f/ae/720a8042fc8c1d170f4cc7ed46295ef078f8198ed3476f58210a1e675e0c/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:110386eebccf200446d5f4dcc215f80866a5d3d3d054d3ced6ec1bf386cd3f02", size = 1459957, upload-time = "2026-09-09T16:04:14.878Z" }, + { url = "https://files.pythonhosted.org/packages/7d/2c/ce2ff1ffd4d70376073393c154033728c8535c17211b7710fee7b0f04474/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:ef3950747f3a588f692cf4d6f2937eedd1a2d5e199f863af29e8ec7da78a4f36", size = 1562369, upload-time = "2026-09-09T16:04:16.563Z" }, + { url = "https://files.pythonhosted.org/packages/fd/3e/d7a5dd5f609bd0bac45617ce9425e4bd1e369b998c8678edfd70c985408c/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0bc94b81878a3f999fe4cdb606bf00ef7dff6b4f66d0e089b2cf7bfc00d59beb", size = 1556466, upload-time = "2026-09-09T16:04:18.396Z" }, + { url = "https://files.pythonhosted.org/packages/99/cd/a45179802a8637f2be252163ec4e4948534fa8d88798dd391c9cc54e096e/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:341dfc9e6b4e47e5c37e1b7257a77d39f407cf49a371ee90225ab624c2fe8b36", size = 1687190, upload-time = "2026-09-09T16:04:19.965Z" }, + { url = "https://files.pythonhosted.org/packages/01/eb/ef206d764ec0554368501b8b5268f5468819dc0588815acb0575465643df/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:7b524cb1b08e15db0f116075c39ab51674b6d3c8103ec1a59c8ca464be83e28a", size = 1481188, upload-time = "2026-09-09T16:04:21.368Z" }, + { url = "https://files.pythonhosted.org/packages/8b/37/9a724c523af7c8b97a659bf4dc28a8e60f97d0cf4d19be277db4067ca734/ast_serialize-0.11.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5c2358b341aca08bd2e1005713bc480bc06eee9f345b67fcb826829aa7b8d0d3", size = 1500731, upload-time = "2026-09-09T16:04:22.905Z" }, + { url = "https://files.pythonhosted.org/packages/48/10/890d5fcaf568088de7989e8cdb4ca525f485bd6cb25eea49d45f017500af/ast_serialize-0.11.1-cp314-cp314t-win32.whl", hash = "sha256:b9e61143a5904f46daa0cde74ba60d3b7c0e3e000752ee138e2bc68e126a5803", size = 1119009, upload-time = "2026-09-09T16:04:24.469Z" }, + { url = "https://files.pythonhosted.org/packages/9d/61/2bd32bd16b5e2ee07badc8c32a73c545dc5a9f087ed19c07eee1243d5a1b/ast_serialize-0.11.1-cp314-cp314t-win_amd64.whl", hash = "sha256:31df8649761d5cb6eb0de2209bd4a167c7477c0516147c70c0b2f5bddc7839bb", size = 1155665, upload-time = "2026-09-09T16:04:26.638Z" }, + { url = "https://files.pythonhosted.org/packages/5e/b6/84bb5e1dc418e660524b873c5bac9be2bf13d38676c96feef4cd4e7d03f3/ast_serialize-0.11.1-cp314-cp314t-win_arm64.whl", hash = "sha256:2f8f33e416a4c7aad12ad757e895c676e953b4027b80b90718dccea83d45111a", size = 1131854, upload-time = "2026-09-09T16:04:28.099Z" }, + { url = "https://files.pythonhosted.org/packages/8c/dd/16de2c0d23a6b298c735d4e4b56d86fa70476eef98e2c66ceaa65503b62f/ast_serialize-0.11.1-cp315-abi3.abi3t-macosx_10_12_x86_64.whl", hash = "sha256:a015ede631eeb098a23de8ec0cfe11a1dd02159ab7a26bdc7c6bde2befbbc7b4", size = 1235495, upload-time = "2026-09-09T16:04:29.654Z" }, + { url = "https://files.pythonhosted.org/packages/27/f7/302d2251e6298bbeabc8a1815c9147127031517b305001a02f34fd46b6b5/ast_serialize-0.11.1-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:57b7d52d1f5c92905cd648bda9efc83cac33097de1e5bb68de8feca9b5f7e87a", size = 1215642, upload-time = "2026-09-09T16:04:31.186Z" }, + { url = "https://files.pythonhosted.org/packages/93/06/93b6527646613502f364cebfb23783fa6701cdbe90761ee26144f1fa20b9/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e47b9b028efbc0486263a49f782ad0ae3e879855fe5a2897b59feefb78e1c40c", size = 1283526, upload-time = "2026-09-09T16:04:32.597Z" }, + { url = "https://files.pythonhosted.org/packages/2f/ac/ffb216262c9a582d039d846081b8c3017dc368cbed5a2520deca5cb7f8cb/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:00adb748034c7b1938ec56925f9f6230ffcd9c56d47355fe32485df29b90b977", size = 1287526, upload-time = "2026-09-09T16:04:34.214Z" }, + { url = "https://files.pythonhosted.org/packages/a2/06/19a4c4837c4d5e73b982938d6da3c9ae10513b61527575b3e1b8396f9298/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:82359d00ea808c260c327e43955c0190bb7baef152a01ae0b5c74d05387b9552", size = 1558354, upload-time = "2026-09-09T16:04:35.669Z" }, + { url = "https://files.pythonhosted.org/packages/e5/29/2373199907b2d97feed176115308dfb3dd0446566b047009828f266d2d66/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f35bb9ddeed4008c7d3e272dd1999885d712e1ce623b0a65ba8a8ed1d51c35cf", size = 1302731, upload-time = "2026-09-09T16:04:37.423Z" }, + { url = "https://files.pythonhosted.org/packages/33/55/ab6805a1457dbe565c84f8d36e2aa4207ef22408adfd01d225823cd07484/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74093ed682ba58456f0d4450da7fb62b826fddd97824d44fc4a81ca6e0bf9e23", size = 1301594, upload-time = "2026-09-09T16:04:38.861Z" }, + { url = "https://files.pythonhosted.org/packages/52/e2/4f54eab2201bb420d39bf61423abcb5d4daffd28e2270e1c5eee2bf3c0f1/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_31_riscv64.whl", hash = "sha256:4dd7218870c203eff4533cfc04a39f29077d6789b20f5b746e7648fe5762a548", size = 1309355, upload-time = "2026-09-09T16:04:40.543Z" }, + { url = "https://files.pythonhosted.org/packages/10/07/755dd98664e2374080b72ccb5fea63d9f11b4bec2409a05b2a4ebc97618d/ast_serialize-0.11.1-cp315-abi3.abi3t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1e8d20700766171a8a17f89cf53d7bd9712c509460d28a51f7f98340577b78aa", size = 1356645, upload-time = "2026-09-09T16:04:42.299Z" }, + { url = "https://files.pythonhosted.org/packages/34/a0/fadbde3e108064236e2679728ce6d8247aefc81bac5fd82505b59cf69172/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:20b3371c0403099cd55d59f4bcedb6d3994d9db3fa41711c648760a89ef2a575", size = 1459696, upload-time = "2026-09-09T16:04:44.069Z" }, + { url = "https://files.pythonhosted.org/packages/02/fd/b4f95249bd895368ea8290668e27d1f0a5c4ad888bd72a34c7beb2a500d6/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_armv7l.whl", hash = "sha256:cc1a78b913f8665dda145999b1b4805ad2ef442ecbe3b819512cf7f95e70498a", size = 1562517, upload-time = "2026-09-09T16:04:45.461Z" }, + { url = "https://files.pythonhosted.org/packages/68/98/6afac594380410710d9d863b9ef41e9c6ca89bd901bda1464ee9e99180a8/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_i686.whl", hash = "sha256:38f7141881e783bccc362d201d7fd7437934216b669b9fef39febc2f63fd2d9b", size = 1556951, upload-time = "2026-09-09T16:04:47.12Z" }, + { url = "https://files.pythonhosted.org/packages/ae/6f/5a81b5cbf1731f4722bc90adf4b4ace7dda69ca29837844147063aeafb22/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_ppc64le.whl", hash = "sha256:13903a3f212ab9e5d05a6c3f2337288f4f8f4c18e6ab3817417ae7a3d46dee14", size = 1691039, upload-time = "2026-09-09T16:04:48.691Z" }, + { url = "https://files.pythonhosted.org/packages/99/eb/d9b903206cbd6d5143838367d385fa88ec49eaae2cc12f284327c6e0af05/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_riscv64.whl", hash = "sha256:e5a9c53e64732118ae8235d0e57eb90e2333e90ff749a1a7dca6f8bfdfa5200e", size = 1483297, upload-time = "2026-09-09T16:04:50.136Z" }, + { url = "https://files.pythonhosted.org/packages/ed/48/ee13b4079ec67e9b333a87e5bb8eee643ab1b49f7173b3fca71158c6cdf6/ast_serialize-0.11.1-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:aecb606f67f21fd1c0ffba1826470d2ee400e41b23881ad9a1b2157306865b1a", size = 1501686, upload-time = "2026-09-09T16:04:51.734Z" }, + { url = "https://files.pythonhosted.org/packages/15/67/2175b79e1ee6b042e4bf8ed6871e60cafea7e9cf3fc69e87d7a9d520ae77/ast_serialize-0.11.1-cp315-abi3.abi3t-win32.whl", hash = "sha256:d1ef9c478d8c8ca83499704d13e5ac32c840ed7ca7884aaaf716166aca5a2806", size = 1119522, upload-time = "2026-09-09T16:04:53.248Z" }, + { url = "https://files.pythonhosted.org/packages/f6/c3/8c96aa5f121e9bdda0346b2df3919185eb1ec9a2cce2d20e311b4575ca0b/ast_serialize-0.11.1-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:27eef0739e0110f5db1ff5dfa38b3dadfcb6f0c31975a2b412f9f2bd72139cea", size = 1157260, upload-time = "2026-09-09T16:04:54.944Z" }, + { url = "https://files.pythonhosted.org/packages/10/bc/8aa663209e335eca73c9e1006197222b6b8dafa6665e513cdd975aa65496/ast_serialize-0.11.1-cp315-abi3.abi3t-win_arm64.whl", hash = "sha256:f9454960bbf185d33c669ccd5c9b76c96709a4542a95a65e27342c4d10dd8e20", size = 1132060, upload-time = "2026-09-09T16:04:56.501Z" }, + { url = "https://files.pythonhosted.org/packages/aa/52/185edf155ff422744acfb2869a8adff84b7dc308027852feb97287b8688b/ast_serialize-0.11.1-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:2db9df3bca1431da25946ee8f2c50df01212e34e6029532bc90b92d05fa8d7a0", size = 897219, upload-time = "2026-09-09T16:04:58.217Z" }, + { url = "https://files.pythonhosted.org/packages/7f/a7/e738887429de70350d9e25f84a95efbdd086b79579a811509dee8b02d7d5/ast_serialize-0.11.1-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:7b9a6089f1337838492b217707e9a55d0b9b407fe9169a960fa12282abf2234c", size = 1240585, upload-time = "2026-09-09T16:04:59.616Z" }, + { url = "https://files.pythonhosted.org/packages/a1/f9/46b64fa883f3c8b8cf51629978f16d8a2da3d5c5c02f64add40864907703/ast_serialize-0.11.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:68929da7fb1c7375f69641baac9519d5c41ee441cd09a591ea5dfc83107ffe6f", size = 1228038, upload-time = "2026-09-09T16:05:00.948Z" }, + { url = "https://files.pythonhosted.org/packages/ad/89/fe75c8d0f104a4be11cd0e23acecf129484c9ba06c7130033752d63a78c5/ast_serialize-0.11.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8945557ed3015173dbf8d44184da9621add9162720acbc0ac4832b5a091b4e8a", size = 1292388, upload-time = "2026-09-09T16:05:02.498Z" }, + { url = "https://files.pythonhosted.org/packages/cb/56/3f21c881900d8254a35195e1e962355b4d570ccd9cc193b0ba08abb81952/ast_serialize-0.11.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b9cbed53bb8992b72e587dd47d0ca71703f5f715420f48ed57587c06c2fcd213", size = 1294413, upload-time = "2026-09-09T16:05:04.212Z" }, + { url = "https://files.pythonhosted.org/packages/f3/b2/8d77be3dad1139158c59e370391f4990ea73f7f102983392272856bd3a63/ast_serialize-0.11.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:65c836d1ab7af65e64a1dd73de82572566e838dd27529b1124eac0ac86f35e76", size = 1565921, upload-time = "2026-09-09T16:05:05.753Z" }, + { url = "https://files.pythonhosted.org/packages/94/2e/0675b5796c897f957fbdac6af0ebeeaa9a63cee866c1c54f1e5136ef5bf6/ast_serialize-0.11.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4ab6df9898600ff45149b86c12bb5aa3359cc71843ad99ad0c924d11392469ab", size = 1312160, upload-time = "2026-09-09T16:05:07.269Z" }, + { url = "https://files.pythonhosted.org/packages/93/c2/1749fa4efae0dc98aad3c3d29f0178e2609208c3ba34700b4551082e40d5/ast_serialize-0.11.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3eebd3dd25a81839ac7d25b5f3fb3527f6141b35eca29f63d2613fe6254307fd", size = 1312405, upload-time = "2026-09-09T16:05:08.753Z" }, + { url = "https://files.pythonhosted.org/packages/00/14/2afc9f9d7db551f805b4d5e496946dc3dc2a703d27294ccc200b6ff07a7a/ast_serialize-0.11.1-cp39-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:311333c5f58f55fc04121be2c5adffa42a19e1038a43a2cef862fdf58c45bf4f", size = 1319458, upload-time = "2026-09-09T16:05:10.552Z" }, + { url = "https://files.pythonhosted.org/packages/c7/4a/8b2866d9d6d5d0b037d7bf2b74db6e75a66695c503248632116f24009a8d/ast_serialize-0.11.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:aa8d0a9f6d02e7626cdf540555bc2f5313eabe803dcca04854fc628ddf4b1058", size = 1365055, upload-time = "2026-09-09T16:05:12.069Z" }, + { url = "https://files.pythonhosted.org/packages/47/17/73119504574f9b46610ffb718501b254c8adb727d4e43c5babc3c62d4529/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:e209a797fdf8680d58d2e969a9ddb25058ea682f6cff59dbabc98d8aef4e0db1", size = 1467771, upload-time = "2026-09-09T16:05:13.458Z" }, + { url = "https://files.pythonhosted.org/packages/56/f5/776bfb7a856ba0bb9bd373b76a90230fb77b1a10c987810b621ed244d5ba/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:b391becd31e9889da438d388aac0362e3dfd222affbe45d920580c351486c787", size = 1571459, upload-time = "2026-09-09T16:05:15.15Z" }, + { url = "https://files.pythonhosted.org/packages/c7/43/86a655170ee36a8fdce65a922b7e34040bb319eb4ec251161032343c1fc3/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:021afb3482d27d1dace9c8999724a13083e96c7ece785e53e418bf5df3b50e0a", size = 1568959, upload-time = "2026-09-09T16:05:16.677Z" }, + { url = "https://files.pythonhosted.org/packages/ed/b1/015a3a156dc9bd46e9c4e4f24a939eb0b87179b1c53c9495ac6f088f13b4/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:c1dc60251d93beff32d4147ecd4ccc518b0f022a900093f6f3021c2012416f0f", size = 1698173, upload-time = "2026-09-09T16:05:18.248Z" }, + { url = "https://files.pythonhosted.org/packages/0e/ea/a988b70980aca3a8a3fb731901dc911fe73a456cebbc225b767bbe5490ff/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:b77d6a2267227d68d8221cfca177f8c6d9f68019f3250401d0355d2638db9fb9", size = 1493298, upload-time = "2026-09-09T16:05:19.806Z" }, + { url = "https://files.pythonhosted.org/packages/de/15/e049b2701ddab9087d7f62448f4c2c1b1463e676baa471345cf3e4a31e1b/ast_serialize-0.11.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:e68ac7d7fd1a5d42a3a6d726d7cc8a7e0c9987934f11c6a5162aa2cf68e81e24", size = 1510213, upload-time = "2026-09-09T16:05:21.402Z" }, + { url = "https://files.pythonhosted.org/packages/46/a2/23d555eb842d1397dce54fac31851e6f151e03a0ae74db389d9b39718c33/ast_serialize-0.11.1-cp39-abi3-win32.whl", hash = "sha256:ed449d786b9032a7b85fcd6c2f7f54c4cd0e1e1ad254d396805ff922096bf08d", size = 1125239, upload-time = "2026-09-09T16:05:22.796Z" }, + { url = "https://files.pythonhosted.org/packages/1f/4a/251f3fd1b8a5549edaedf8f3ba0b9fb5060e194d3c0ed208b593fccaeff1/ast_serialize-0.11.1-cp39-abi3-win_amd64.whl", hash = "sha256:6b43f5a9b9a8dd20ba3124914e63aa7d7427de761ac849081cda403c2112fda0", size = 1164260, upload-time = "2026-09-09T16:05:24.714Z" }, + { url = "https://files.pythonhosted.org/packages/5e/b5/08e2f643feb9e4d72d42a484949ad51238b18262a01c7036196c201cc330/ast_serialize-0.11.1-cp39-abi3-win_arm64.whl", hash = "sha256:a579ea6f473aab3958a64734194b22fbaec108ec45d994c28d3bd721e1e1da32", size = 1137533, upload-time = "2026-09-09T16:05:26.095Z" }, +] + [[package]] name = "asttokens" version = "3.0.0" @@ -984,36 +1052,72 @@ wheels = [ [[package]] name = "librt" -version = "0.8.1" +version = "0.15.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/56/9c/b4b0c54d84da4a94b37bd44151e46d5e583c9534c7e02250b961b1b6d8a8/librt-0.8.1.tar.gz", hash = "sha256:be46a14693955b3bd96014ccbdb8339ee8c9346fbe11c1b78901b55125f14c73", size = 177471, upload-time = "2026-02-17T16:13:06.101Z" } +sdist = { url = "https://files.pythonhosted.org/packages/36/9b/356320fbae2ac8467e21c5e73e1389c80468e4998c62cc7d3536cc51b614/librt-0.15.0.tar.gz", hash = "sha256:4e66cbe84437497d951b799d3e1551291b6fb3d643820a7014b3655d57a59162", size = 214338, upload-time = "2026-08-07T10:49:42.663Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/c9/6a/907ef6800f7bca71b525a05f1839b21f708c09043b1c6aa77b6b827b3996/librt-0.8.1-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:6cfa7fe54fd4d1f47130017351a959fe5804bda7a0bc7e07a2cdbc3fdd28d34f", size = 66081, upload-time = "2026-02-17T16:12:12.766Z" }, - { url = "https://files.pythonhosted.org/packages/1b/18/25e991cd5640c9fb0f8d91b18797b29066b792f17bf8493da183bf5caabe/librt-0.8.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:228c2409c079f8c11fb2e5d7b277077f694cb93443eb760e00b3b83cb8b3176c", size = 68309, upload-time = "2026-02-17T16:12:13.756Z" }, - { url = "https://files.pythonhosted.org/packages/a4/36/46820d03f058cfb5a9de5940640ba03165ed8aded69e0733c417bb04df34/librt-0.8.1-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7aae78ab5e3206181780e56912d1b9bb9f90a7249ce12f0e8bf531d0462dd0fc", size = 196804, upload-time = "2026-02-17T16:12:14.818Z" }, - { url = "https://files.pythonhosted.org/packages/59/18/5dd0d3b87b8ff9c061849fbdb347758d1f724b9a82241aa908e0ec54ccd0/librt-0.8.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:172d57ec04346b047ca6af181e1ea4858086c80bdf455f61994c4aa6fc3f866c", size = 206907, upload-time = "2026-02-17T16:12:16.513Z" }, - { url = "https://files.pythonhosted.org/packages/d1/96/ef04902aad1424fd7299b62d1890e803e6ab4018c3044dca5922319c4b97/librt-0.8.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6b1977c4ea97ce5eb7755a78fae68d87e4102e4aaf54985e8b56806849cc06a3", size = 221217, upload-time = "2026-02-17T16:12:17.906Z" }, - { url = "https://files.pythonhosted.org/packages/6d/ff/7e01f2dda84a8f5d280637a2e5827210a8acca9a567a54507ef1c75b342d/librt-0.8.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:10c42e1f6fd06733ef65ae7bebce2872bcafd8d6e6b0a08fe0a05a23b044fb14", size = 214622, upload-time = "2026-02-17T16:12:19.108Z" }, - { url = "https://files.pythonhosted.org/packages/1e/8c/5b093d08a13946034fed57619742f790faf77058558b14ca36a6e331161e/librt-0.8.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:4c8dfa264b9193c4ee19113c985c95f876fae5e51f731494fc4e0cf594990ba7", size = 221987, upload-time = "2026-02-17T16:12:20.331Z" }, - { url = "https://files.pythonhosted.org/packages/d3/cc/86b0b3b151d40920ad45a94ce0171dec1aebba8a9d72bb3fa00c73ab25dd/librt-0.8.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:01170b6729a438f0dedc4a26ed342e3dc4f02d1000b4b19f980e1877f0c297e6", size = 215132, upload-time = "2026-02-17T16:12:21.54Z" }, - { url = "https://files.pythonhosted.org/packages/fc/be/8588164a46edf1e69858d952654e216a9a91174688eeefb9efbb38a9c799/librt-0.8.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:7b02679a0d783bdae30d443025b94465d8c3dc512f32f5b5031f93f57ac32071", size = 215195, upload-time = "2026-02-17T16:12:23.073Z" }, - { url = "https://files.pythonhosted.org/packages/f5/f2/0b9279bea735c734d69344ecfe056c1ba211694a72df10f568745c899c76/librt-0.8.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:190b109bb69592a3401fe1ffdea41a2e73370ace2ffdc4a0e8e2b39cdea81b78", size = 237946, upload-time = "2026-02-17T16:12:24.275Z" }, - { url = "https://files.pythonhosted.org/packages/e9/cc/5f2a34fbc8aeb35314a3641f9956fa9051a947424652fad9882be7a97949/librt-0.8.1-cp314-cp314-win32.whl", hash = "sha256:e70a57ecf89a0f64c24e37f38d3fe217a58169d2fe6ed6d70554964042474023", size = 50689, upload-time = "2026-02-17T16:12:25.766Z" }, - { url = "https://files.pythonhosted.org/packages/a0/76/cd4d010ab2147339ca2b93e959c3686e964edc6de66ddacc935c325883d7/librt-0.8.1-cp314-cp314-win_amd64.whl", hash = "sha256:7e2f3edca35664499fbb36e4770650c4bd4a08abc1f4458eab9df4ec56389730", size = 57875, upload-time = "2026-02-17T16:12:27.465Z" }, - { url = "https://files.pythonhosted.org/packages/84/0f/2143cb3c3ca48bd3379dcd11817163ca50781927c4537345d608b5045998/librt-0.8.1-cp314-cp314-win_arm64.whl", hash = "sha256:0d2f82168e55ddefd27c01c654ce52379c0750ddc31ee86b4b266bcf4d65f2a3", size = 48058, upload-time = "2026-02-17T16:12:28.556Z" }, - { url = "https://files.pythonhosted.org/packages/d2/0e/9b23a87e37baf00311c3efe6b48d6b6c168c29902dfc3f04c338372fd7db/librt-0.8.1-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:2c74a2da57a094bd48d03fa5d196da83d2815678385d2978657499063709abe1", size = 68313, upload-time = "2026-02-17T16:12:29.659Z" }, - { url = "https://files.pythonhosted.org/packages/db/9a/859c41e5a4f1c84200a7d2b92f586aa27133c8243b6cac9926f6e54d01b9/librt-0.8.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a355d99c4c0d8e5b770313b8b247411ed40949ca44e33e46a4789b9293a907ee", size = 70994, upload-time = "2026-02-17T16:12:31.516Z" }, - { url = "https://files.pythonhosted.org/packages/4c/28/10605366ee599ed34223ac2bf66404c6fb59399f47108215d16d5ad751a8/librt-0.8.1-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:2eb345e8b33fb748227409c9f1233d4df354d6e54091f0e8fc53acdb2ffedeb7", size = 220770, upload-time = "2026-02-17T16:12:33.294Z" }, - { url = "https://files.pythonhosted.org/packages/af/8d/16ed8fd452dafae9c48d17a6bc1ee3e818fd40ef718d149a8eff2c9f4ea2/librt-0.8.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9be2f15e53ce4e83cc08adc29b26fb5978db62ef2a366fbdf716c8a6c8901040", size = 235409, upload-time = "2026-02-17T16:12:35.443Z" }, - { url = "https://files.pythonhosted.org/packages/89/1b/7bdf3e49349c134b25db816e4a3db6b94a47ac69d7d46b1e682c2c4949be/librt-0.8.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:785ae29c1f5c6e7c2cde2c7c0e148147f4503da3abc5d44d482068da5322fd9e", size = 246473, upload-time = "2026-02-17T16:12:36.656Z" }, - { url = "https://files.pythonhosted.org/packages/4e/8a/91fab8e4fd2a24930a17188c7af5380eb27b203d72101c9cc000dbdfd95a/librt-0.8.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1d3a7da44baf692f0c6aeb5b2a09c5e6fc7a703bca9ffa337ddd2e2da53f7732", size = 238866, upload-time = "2026-02-17T16:12:37.849Z" }, - { url = "https://files.pythonhosted.org/packages/b9/e0/c45a098843fc7c07e18a7f8a24ca8496aecbf7bdcd54980c6ca1aaa79a8e/librt-0.8.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5fc48998000cbc39ec0d5311312dda93ecf92b39aaf184c5e817d5d440b29624", size = 250248, upload-time = "2026-02-17T16:12:39.445Z" }, - { url = "https://files.pythonhosted.org/packages/82/30/07627de23036640c952cce0c1fe78972e77d7d2f8fd54fa5ef4554ff4a56/librt-0.8.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:e96baa6820280077a78244b2e06e416480ed859bbd8e5d641cf5742919d8beb4", size = 240629, upload-time = "2026-02-17T16:12:40.889Z" }, - { url = "https://files.pythonhosted.org/packages/fb/c1/55bfe1ee3542eba055616f9098eaf6eddb966efb0ca0f44eaa4aba327307/librt-0.8.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:31362dbfe297b23590530007062c32c6f6176f6099646bb2c95ab1b00a57c382", size = 239615, upload-time = "2026-02-17T16:12:42.446Z" }, - { url = "https://files.pythonhosted.org/packages/2b/39/191d3d28abc26c9099b19852e6c99f7f6d400b82fa5a4e80291bd3803e19/librt-0.8.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:cc3656283d11540ab0ea01978378e73e10002145117055e03722417aeab30994", size = 263001, upload-time = "2026-02-17T16:12:43.627Z" }, - { url = "https://files.pythonhosted.org/packages/b9/eb/7697f60fbe7042ab4e88f4ee6af496b7f222fffb0a4e3593ef1f29f81652/librt-0.8.1-cp314-cp314t-win32.whl", hash = "sha256:738f08021b3142c2918c03692608baed43bc51144c29e35807682f8070ee2a3a", size = 51328, upload-time = "2026-02-17T16:12:45.148Z" }, - { url = "https://files.pythonhosted.org/packages/7c/72/34bf2eb7a15414a23e5e70ecb9440c1d3179f393d9349338a91e2781c0fb/librt-0.8.1-cp314-cp314t-win_amd64.whl", hash = "sha256:89815a22daf9c51884fb5dbe4f1ef65ee6a146e0b6a8df05f753e2e4a9359bf4", size = 58722, upload-time = "2026-02-17T16:12:46.85Z" }, - { url = "https://files.pythonhosted.org/packages/b2/c8/d148e041732d631fc76036f8b30fae4e77b027a1e95b7a84bb522481a940/librt-0.8.1-cp314-cp314t-win_arm64.whl", hash = "sha256:bf512a71a23504ed08103a13c941f763db13fb11177beb3d9244c98c29fb4a61", size = 48755, upload-time = "2026-02-17T16:12:47.943Z" }, + { url = "https://files.pythonhosted.org/packages/a8/93/949053fb462eecc4a9a5ee770a81f4b40be7b79538b245545d4aebc6b58b/librt-0.15.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:f5de7feedc56337a088eb15cd9fafa9938367362221d8cc62c642b7f94821993", size = 149833, upload-time = "2026-08-07T10:47:39.86Z" }, + { url = "https://files.pythonhosted.org/packages/61/ca/8281aa6cd560a3420e4497729f6b704b53be3eeaaef82d5aeadddaf7441f/librt-0.15.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:6c0eb900c0e91f4aebe680845242e614f1864edfd44106380d0752ac29522bf8", size = 154088, upload-time = "2026-08-07T10:47:41.065Z" }, + { url = "https://files.pythonhosted.org/packages/dd/02/1a1662dceaba6a086360891448d5ce9a7d3555976cae59a31a39d744b9c7/librt-0.15.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8c9a650a188e38bac005048cbe6342e81407782944d01934540ab75e417df21", size = 494215, upload-time = "2026-08-07T10:47:42.388Z" }, + { url = "https://files.pythonhosted.org/packages/69/84/99211619dc656370a3740c33d2b0b6d5a3fb1e73689314f6ed477a397dc4/librt-0.15.0-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:92bfed8deec93df30286b9fe9e3b1dd17329cc076a192b4ee5ec223841d54953", size = 491173, upload-time = "2026-08-07T10:47:43.683Z" }, + { url = "https://files.pythonhosted.org/packages/d4/aa/5448d0b05f4579b635d3899176817ebf561af0e57bacd425b5b1887264c1/librt-0.15.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:ec4b19788f835711a2072f9dbe6b03b3bf32ed1f0fb30cf399bdd59d9f0c33fa", size = 505512, upload-time = "2026-08-07T10:47:45.314Z" }, + { url = "https://files.pythonhosted.org/packages/95/82/01940e40b83c43a546c4a3c896cf34ca272a9690899d55914e4827b3dcce/librt-0.15.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d4c7bacb70930f3d0a56f4ecf1be474a1f0d941b01dd73b756f3c256d42cb879", size = 523073, upload-time = "2026-08-07T10:47:46.66Z" }, + { url = "https://files.pythonhosted.org/packages/88/fa/759c0030f3ee371439eb26de34fc745807caf0abb878af7af4b8b7c3dd3d/librt-0.15.0-cp314-cp314-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:3e79f05e4a08b4d880342673312bbc895b56df7765605796f15902eb5367d3ae", size = 515080, upload-time = "2026-08-07T10:47:48.319Z" }, + { url = "https://files.pythonhosted.org/packages/0b/27/894e072228fcb159703c655da69f8cd10dbed489c36e3df7dd032a2483be/librt-0.15.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a417149c0cba4d50b61e992e5a15e69eaf96746609b461cc4ed168aeef6b79dd", size = 534164, upload-time = "2026-08-07T10:47:49.875Z" }, + { url = "https://files.pythonhosted.org/packages/98/a3/0078e91c1f36f8815db17827de15650b9a3fe56c55fbf998c854b34e40d3/librt-0.15.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:da7a94d6a3411f579d72aa3e3bc5fbca7ed4549f3dbd7e5de3aa567333374285", size = 540616, upload-time = "2026-08-07T10:47:51.408Z" }, + { url = "https://files.pythonhosted.org/packages/86/33/81a29b796dd52a45e9ef7974c7732926e8f10f15b8d2be505665979f896d/librt-0.15.0-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:856f743ae607f2c1380eccb566c0038a9fb3eabf0fc2be2704d76d9f73557239", size = 545890, upload-time = "2026-08-07T10:47:52.818Z" }, + { url = "https://files.pythonhosted.org/packages/05/82/8be1baa1350e5d30cfd70ae79d0a6f4dc5862ef47f7bb2808aabc9bb86e5/librt-0.15.0-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:779a6e7c894737e5983e7790a9c78c4000c30e23c9aada08081bdbea53b0fa60", size = 523287, upload-time = "2026-08-07T10:47:54.165Z" }, + { url = "https://files.pythonhosted.org/packages/c6/4f/d1be6a01a35c20ef734e0e44113f87d4af756a9354a89dcfbe3b4f8af5e1/librt-0.15.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:96bb17dbe8bab3c0954fbebfc69ed395599de75b6bbc35e3270a878e15d4dd65", size = 565868, upload-time = "2026-08-07T10:47:55.566Z" }, + { url = "https://files.pythonhosted.org/packages/67/88/649cfa33f5825927b160610f670bdab012a64d627eddb94fa795ea4292fd/librt-0.15.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:7220697efaa6e5348fc3d18ee7f8563d4bfecd9872b37ffb915bfc1d08840622", size = 81619, upload-time = "2026-08-07T10:47:56.886Z" }, + { url = "https://files.pythonhosted.org/packages/22/31/8e88a8d5e48fc8d1a817787fb6811dfff6499acd6c8683dd83934aa6ede0/librt-0.15.0-cp314-cp314-win32.whl", hash = "sha256:f54598964d357b1c5ab77cf5d92f21e598fe0e23cdbe9618480807f81b4eba15", size = 100138, upload-time = "2026-08-07T10:47:58.093Z" }, + { url = "https://files.pythonhosted.org/packages/80/92/20fd6c4b6a1b1a564b076d55cd3d427d8428217d7638dc25a654cc4791d4/librt-0.15.0-cp314-cp314-win_amd64.whl", hash = "sha256:3ff5893a2c23d886aa9ce786de5ac6ddc74aeeaf90743682b74d920e117d2e28", size = 121258, upload-time = "2026-08-07T10:47:59.564Z" }, + { url = "https://files.pythonhosted.org/packages/fc/28/6af430b44d9ebb897b865a3c363b6dcace51357be2347cc0f8f869656a86/librt-0.15.0-cp314-cp314-win_arm64.whl", hash = "sha256:3722a099730704c9a3d70c879fc0f51daec25fe5f1555672d97bc595abeafb95", size = 106467, upload-time = "2026-08-07T10:48:01.097Z" }, + { url = "https://files.pythonhosted.org/packages/7e/aa/b42bb798942ced219f6d63b27e07f91237887a8d0bd0921666db79a13790/librt-0.15.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:38c0c7d4b6fc06c3324b3f9162c8391bfc4fd9dde53afe1033ce7edb48d5a714", size = 159523, upload-time = "2026-08-07T10:48:02.442Z" }, + { url = "https://files.pythonhosted.org/packages/75/03/1b53cd4ef904e73b1d828a5f90143bf94a2967d7cfff0b9ccf93e12aa9b4/librt-0.15.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:8b2fdd7ead3c995c37940a790690660d0ca006c302db26cc51933f6766866fc3", size = 161638, upload-time = "2026-08-07T10:48:03.725Z" }, + { url = "https://files.pythonhosted.org/packages/ac/c4/9f9c9fba097d49e9e694c2b4dc331df31884645ecbc58a93b4b5fc69d2c5/librt-0.15.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2fde98cf1fc4bac144ce23c2c4c017b924ba714509ea9334977b0b27050c837d", size = 701795, upload-time = "2026-08-07T10:48:05.135Z" }, + { url = "https://files.pythonhosted.org/packages/4c/05/0966840bda0380c8ae167b9043c6230202941cc90ea29c48e096964c765e/librt-0.15.0-cp314-cp314t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:e3b461183c5fa7681b48560f91515f53a953122fb30c71e07abc67d7ddf58c38", size = 682147, upload-time = "2026-08-07T10:48:06.555Z" }, + { url = "https://files.pythonhosted.org/packages/18/af/1c47ca573c30ea47d195aec26133af522fea1104afaace028d7b32247ea8/librt-0.15.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4bbcc257e3babea20a91715c361b24554ec4e8f51aa578568afc230799fe1a19", size = 696397, upload-time = "2026-08-07T10:48:08.03Z" }, + { url = "https://files.pythonhosted.org/packages/2e/0f/1aed6223d4f9f9d1171a8596ff100ea4c3f7699fea7a4ba657c3e60daa6c/librt-0.15.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b845b8d48088fad0cadc84be4b8fda63203be7e9237b71015b3925443c1f35ab", size = 722542, upload-time = "2026-08-07T10:48:09.569Z" }, + { url = "https://files.pythonhosted.org/packages/c6/22/9e3a929aea456c97d69e6ef3884efea56d4807f97399471cc946baebd8af/librt-0.15.0-cp314-cp314t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b30e600e8f337b9bd7f39b86d9fdfedc73cc46e3d0f745931a23a234220bb7e2", size = 729709, upload-time = "2026-08-07T10:48:11.129Z" }, + { url = "https://files.pythonhosted.org/packages/e9/1b/c327ef6018e3a9ca0b8e7c5eddeeb331ba8f9b76c24e126d37d0f6d62faf/librt-0.15.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:64b0c8c35aa4c4ed79896359f3e0b285cbe4e610042106500da4811c322cc108", size = 752891, upload-time = "2026-08-07T10:48:12.558Z" }, + { url = "https://files.pythonhosted.org/packages/d7/d1/d5f1ea02c56930087009e39db9b70660a663e76c730b27b925d786718457/librt-0.15.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:0da0d94cb802f32a0524653e7201f2cef72d5f700a5407678f5290483d4fcd08", size = 745301, upload-time = "2026-08-07T10:48:14.55Z" }, + { url = "https://files.pythonhosted.org/packages/d9/3c/5f7c585d15ebb2250c73e7c0ee4e9e47be72c65d520c07ddbcdc62037674/librt-0.15.0-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:4a6369168d371207339b1e50d4532b06a7121586141f82599505a3f315751d47", size = 747921, upload-time = "2026-08-07T10:48:16.453Z" }, + { url = "https://files.pythonhosted.org/packages/7f/52/1443a446486eba966bcbca1696b472e4f210320ec42f490a47f48fbf0fdc/librt-0.15.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:c434e072557ade9cbc642d052c89d031efe47d5c9614523619d0d74a02378e81", size = 727561, upload-time = "2026-08-07T10:48:18.089Z" }, + { url = "https://files.pythonhosted.org/packages/79/91/2270a9380f11725cf83ce1925a5e32dd1dde2be9bba597f25c10a38644e7/librt-0.15.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:c7eec6a42018bc1d45763b1c162d3d2bf7c3b9a1b0ed30d3e91dcba390efefcc", size = 774417, upload-time = "2026-08-07T10:48:19.611Z" }, + { url = "https://files.pythonhosted.org/packages/9e/3b/f4b1548d4f5b99186737fe27aec238e9823e8d5d23bf4df007c030689dc5/librt-0.15.0-cp314-cp314t-win32.whl", hash = "sha256:6912fa5e635d74529ac7cdb1bdf6ca3af4453da8d1edbe0110ee1cb4ad407ebf", size = 104381, upload-time = "2026-08-07T10:48:21.048Z" }, + { url = "https://files.pythonhosted.org/packages/80/b6/134afad262def1de04c0843c376d02135f1168af43f22e09a52bd8394727/librt-0.15.0-cp314-cp314t-win_amd64.whl", hash = "sha256:8e11699ed745931c395acd3621b07062e0f840efa6935aad87a64ed0995f0915", size = 127034, upload-time = "2026-08-07T10:48:22.561Z" }, + { url = "https://files.pythonhosted.org/packages/99/5f/1b6846b20572bd699c9e9ec321a5f781845bee477df2aa2a43b28bc40119/librt-0.15.0-cp314-cp314t-win_arm64.whl", hash = "sha256:5d2a91724463bfed4f573cd7a9fdc856d2e230d0c0e5a61416a93481dccd8605", size = 110827, upload-time = "2026-08-07T10:48:23.804Z" }, + { url = "https://files.pythonhosted.org/packages/c6/44/4de9f4ddadb009a55c7758eb5736d62534a7daaf27bd71bc50e64b606b06/librt-0.15.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:8443e38dcfcfdbcf5add5118c623efd788d65ac2e25756d6251a54a06a4d0aca", size = 149843, upload-time = "2026-08-07T10:48:25.148Z" }, + { url = "https://files.pythonhosted.org/packages/1f/eb/5d9ab71e30119c44094e0275f38b47dd327aea0f843a080396677029d508/librt-0.15.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:6d15a29033c57490cfe2069097c6fc4049e4e65ffbb749be7dc453b7c4c68965", size = 154510, upload-time = "2026-08-07T10:48:26.485Z" }, + { url = "https://files.pythonhosted.org/packages/d0/9c/8505d1b8f5e8c19587bd03f7429993b3e9ce5c06819d856bfb11d919374c/librt-0.15.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d2c05c729b589e734c09578bf5964be48a911765484840d017bbc84f49d4c4ad", size = 497543, upload-time = "2026-08-07T10:48:28.045Z" }, + { url = "https://files.pythonhosted.org/packages/1d/9a/3a8390775cb095765aded027ac9c63e7c8ea74e731498607544c6505de0e/librt-0.15.0-cp315-cp315-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:fa60887537e1d0cd2d9982269d33a709bf54b195cd2b9364fc0a758022af5bd9", size = 480452, upload-time = "2026-08-07T10:48:29.531Z" }, + { url = "https://files.pythonhosted.org/packages/e7/40/258a4a7117ee915d66de5cd9b8ade65a440993161107ce3a686f1859955c/librt-0.15.0-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d8bc24219b24c0af375718942ab75e3544b2763085f40f965be4326734ae8328", size = 507768, upload-time = "2026-08-07T10:48:31.007Z" }, + { url = "https://files.pythonhosted.org/packages/6b/c6/2f4dd296c97a0b85b98894519b279408ec9dd602d4f692b1ea0e25dee670/librt-0.15.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:86a21a7bd3fe3a419512ef424cc1c020f6771d0b29cfddff36d1635a855e63f0", size = 525122, upload-time = "2026-08-07T10:48:32.7Z" }, + { url = "https://files.pythonhosted.org/packages/49/dd/29eab42be13b2bf0ea8cb227135a45d44693e30a7e8b92871981ff56b82b/librt-0.15.0-cp315-cp315-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:dbab647e88d90b3167b91efe7091e248653688ed4337e4f90907a722c7361bb9", size = 520371, upload-time = "2026-08-07T10:48:34.294Z" }, + { url = "https://files.pythonhosted.org/packages/91/ed/4bad71adeca8fe208b775c2a35417fa5a2584c8f4791daaf89a89450fea1/librt-0.15.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:d8edcf6f550e918dca779c069b9e156385c60b406f99fc7641f32c52f7193659", size = 537258, upload-time = "2026-08-07T10:48:35.88Z" }, + { url = "https://files.pythonhosted.org/packages/4c/63/59dba6143fdcc7240c54458b629f3250000a61b8945890fc9efd451b19c5/librt-0.15.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:8b62076030baa2d8b1501a46bf0e19c27a489aa90671c55665bff7887f7660b0", size = 527432, upload-time = "2026-08-07T10:48:37.466Z" }, + { url = "https://files.pythonhosted.org/packages/ec/21/21a24c6a2327d8362580efebe77286bf47b0f4062ec5ea41766e609d3c7d/librt-0.15.0-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:d00d20d1818e82a07a0ee0aa89a98b17ed7916b92441090b683719cb20a59b6d", size = 548108, upload-time = "2026-08-07T10:48:39.384Z" }, + { url = "https://files.pythonhosted.org/packages/5a/6d/fc68c89a7971418b41f9a873623ff935cb864097544c6a2f8ce491c8ef5d/librt-0.15.0-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:4e6ee93fc3cf848dcbf0cce2eca73d8e7dcd0cc2b6df3a529d57750b30a4c55c", size = 529681, upload-time = "2026-08-07T10:48:41.392Z" }, + { url = "https://files.pythonhosted.org/packages/65/7e/c2d98766124400d722063a630b0fde38a9fc768705d37eecca15c47dc192/librt-0.15.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:32896a0af72508ea979e0acb4e4c04cbeeae04938167950d535c83c45597167d", size = 567736, upload-time = "2026-08-07T10:48:43.124Z" }, + { url = "https://files.pythonhosted.org/packages/55/6c/f8c34a95e3a515c6e1c192b89511e7253c89a7760c6b500d57ffdb8d2dc8/librt-0.15.0-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:ec3ba415afaf951f6951b1dd16d3c8e4f540065fc382d7e70b823a79567ca374", size = 81673, upload-time = "2026-08-07T10:48:44.645Z" }, + { url = "https://files.pythonhosted.org/packages/c9/9e/e23fa8e78679ec45728188650b39e8ff476c83b691c96f749217df3b1b7c/librt-0.15.0-cp315-cp315-win32.whl", hash = "sha256:d2813ba2503764f0450680c533d13df7cff9b49df1411062eded5f67db4195b9", size = 100081, upload-time = "2026-08-07T10:48:46.171Z" }, + { url = "https://files.pythonhosted.org/packages/e1/dc/3eb4c5e297343f0620a55532cd7c8d764d3001fa2159212dadf480464827/librt-0.15.0-cp315-cp315-win_amd64.whl", hash = "sha256:b87d67e33afaf265262f2a66db578284b88ee2e6fcd224579cb5c15518677ad8", size = 121228, upload-time = "2026-08-07T10:48:47.631Z" }, + { url = "https://files.pythonhosted.org/packages/97/70/43abce19f04e49762f8ec834c8fafee13cc40fd6b94a72a24e534febfcd0/librt-0.15.0-cp315-cp315-win_arm64.whl", hash = "sha256:713bd7df21170b982e729e46870f31d6b437bd1a9b4648cffb529bd3c2ec5c4b", size = 106487, upload-time = "2026-08-07T10:48:49.095Z" }, + { url = "https://files.pythonhosted.org/packages/de/15/83f2deddb9368b8951ec8c9477269b5b9b8bd9bbf15e57402d0f38817dca/librt-0.15.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:3de789c82752730f94782a5ee518baf9c05edf85733aeaf73bb6e518755cdf54", size = 159448, upload-time = "2026-08-07T10:48:50.649Z" }, + { url = "https://files.pythonhosted.org/packages/06/bf/043097353f9b3c73b583d07f6b8e552795463f4bfc8caf85e42eee50c26a/librt-0.15.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:e0b5deec9a8664eb722c797241970fd4aa1894d25fda36a1ddac0f7407606bd6", size = 161686, upload-time = "2026-08-07T10:48:52.174Z" }, + { url = "https://files.pythonhosted.org/packages/f4/2a/8ae77f9719d42ce71cd708560a3557b38ac3c17a0383e57f87084de45bbe/librt-0.15.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5563302a8359bc2295bb7084d1a8ed1519df96afb30eb2aa4e0bff7b54228988", size = 710668, upload-time = "2026-08-07T10:48:53.782Z" }, + { url = "https://files.pythonhosted.org/packages/61/34/c0436ea134deb9a0d6da80a396a2739a81cb31e0418f7227239e23140898/librt-0.15.0-cp315-cp315t-manylinux2014_i686.manylinux_2_17_i686.manylinux_2_28_i686.whl", hash = "sha256:22d6263b9d39d7bbb286fa791945646e3218f1be2d693e36fb630f1d0e59cd13", size = 679396, upload-time = "2026-08-07T10:48:55.645Z" }, + { url = "https://files.pythonhosted.org/packages/4a/9f/001e0d99aa9250d5cd5715a9081291a20656083459f9019cda15255329e1/librt-0.15.0-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:39ffd14646190c454f0d86e0d256b33f00a87a26ab410e619773b841d0e41416", size = 704313, upload-time = "2026-08-07T10:48:57.46Z" }, + { url = "https://files.pythonhosted.org/packages/2d/53/b34fa9d0ff00f136f4d58ebb4c411ff634baed1eb412bb602a2bc8dcafcb/librt-0.15.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c47318cd3a61401452de11282242937e3e057c4fd3dbaf601e269d0928a06c0a", size = 729847, upload-time = "2026-08-07T10:48:59.231Z" }, + { url = "https://files.pythonhosted.org/packages/86/ac/fa4d7a424665040e95baf480a6d523446057684b6758624c85338e8a23b2/librt-0.15.0-cp315-cp315t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a56a1d4f859a82ca5b99fc4b82c9b027b15e3c455c5cd99e7d0719f27bb20b6c", size = 742736, upload-time = "2026-08-07T10:49:01.151Z" }, + { url = "https://files.pythonhosted.org/packages/8a/f1/e17a9bb5de6fb8c3186ed1a7d68d21618b027ac2d3633e03d3b6109c67ae/librt-0.15.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:077471b3182db4e17c36ae91555f36a4d2c00080b267f749bcad34a478a9a302", size = 763454, upload-time = "2026-08-07T10:49:03.039Z" }, + { url = "https://files.pythonhosted.org/packages/1d/ec/ecd02cd30935b931b9cdbfed6ab5a099c51b280b4e7baa274da80978ed27/librt-0.15.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:411ca4d1b905b860ceba7570dd6717a71dedaddcc4b0f77ece710aa41ee11f8d", size = 743296, upload-time = "2026-08-07T10:49:04.941Z" }, + { url = "https://files.pythonhosted.org/packages/e6/b5/b3c2b8353ce820a4854f78d19321344242f89fa71c975b71132ba9bf242a/librt-0.15.0-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1256589e0b0adb31751d685a68bce29d73407ddf4ef05d4188f49d5dcf9566d9", size = 756217, upload-time = "2026-08-07T10:49:06.825Z" }, + { url = "https://files.pythonhosted.org/packages/3c/52/6cc22542ba59146b05cca2a656f9ff8bb67e38e63d12c3b0cc183d837bf1/librt-0.15.0-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:f42b74a53e5f26a0ba0007411a7455b66c67ce4022a39cc1f56fc4efd65bcbab", size = 741934, upload-time = "2026-08-07T10:49:08.839Z" }, + { url = "https://files.pythonhosted.org/packages/40/32/a04b72b1aa86e3be23b2ecff8c1aad2dcc955bd3956d6d26e7e34267e57a/librt-0.15.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:291bf73caf78b9e88d6fae9bfd693207ff7d832e2fdbe2cf8e746bc13f5f892b", size = 783763, upload-time = "2026-08-07T10:49:10.661Z" }, + { url = "https://files.pythonhosted.org/packages/6c/f0/89eb11dffbe9279ff37144dec786927314502ae0b114f1449dc78c458aab/librt-0.15.0-cp315-cp315t-win32.whl", hash = "sha256:c16d15ee371643ab48dc8248a3e680ebbeca573a13af2c3dd0c985b142d77162", size = 104313, upload-time = "2026-08-07T10:49:12.305Z" }, + { url = "https://files.pythonhosted.org/packages/6d/4a/1f1978c200f563beda63c36adff2d65bbecb81e365e8e69e572f5f70fbc6/librt-0.15.0-cp315-cp315t-win_amd64.whl", hash = "sha256:dbd605739f228912dc49027cb764456b9757750bdc2b6b7773164db7096c6fd1", size = 126889, upload-time = "2026-08-07T10:49:13.881Z" }, + { url = "https://files.pythonhosted.org/packages/38/a6/800800bfed7b1fb10fc3f3d557785c3854e80d3f7a9800d784b176a1fc2d/librt-0.15.0-cp315-cp315t-win_arm64.whl", hash = "sha256:84d244b00604d17df3fc7736c327892d6bba66181254aa4087be807b6c342bdc", size = 110700, upload-time = "2026-08-07T10:49:15.499Z" }, ] [[package]] @@ -1213,23 +1317,44 @@ wheels = [ [[package]] name = "mypy" -version = "1.19.1" +version = "2.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ + { name = "ast-serialize" }, { name = "librt", marker = "platform_python_implementation != 'PyPy'" }, { name = "mypy-extensions" }, { name = "pathspec" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f5/db/4efed9504bc01309ab9c2da7e352cc223569f05478012b5d9ece38fd44d2/mypy-1.19.1.tar.gz", hash = "sha256:19d88bb05303fe63f71dd2c6270daca27cb9401c4ca8255fe50d1d920e0eb9ba", size = 3582404, upload-time = "2025-12-15T05:03:48.42Z" } +sdist = { url = "https://files.pythonhosted.org/packages/82/6a/878cc1097d4035f82bd516658d0c528d2a9955bc7b363afcbd0b07fea11b/mypy-2.3.1.tar.gz", hash = "sha256:47c1b1207258513a9d93495f69c8be9de73916186f0e52703e8c461b7a623419", size = 3992554, upload-time = "2026-08-15T03:03:38.549Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/de/eb/b83e75f4c820c4247a58580ef86fcd35165028f191e7e1ba57128c52782d/mypy-1.19.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:06e6170bd5836770e8104c8fdd58e5e725cfeb309f0a6c681a811f557e97eac1", size = 13199744, upload-time = "2025-12-15T05:03:30.823Z" }, - { url = "https://files.pythonhosted.org/packages/94/28/52785ab7bfa165f87fcbb61547a93f98bb20e7f82f90f165a1f69bce7b3d/mypy-1.19.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:804bd67b8054a85447c8954215a906d6eff9cabeabe493fb6334b24f4bfff718", size = 12215815, upload-time = "2025-12-15T05:02:42.323Z" }, - { url = "https://files.pythonhosted.org/packages/0a/c6/bdd60774a0dbfb05122e3e925f2e9e846c009e479dcec4821dad881f5b52/mypy-1.19.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:21761006a7f497cb0d4de3d8ef4ca70532256688b0523eee02baf9eec895e27b", size = 12740047, upload-time = "2025-12-15T05:03:33.168Z" }, - { url = "https://files.pythonhosted.org/packages/32/2a/66ba933fe6c76bd40d1fe916a83f04fed253152f451a877520b3c4a5e41e/mypy-1.19.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:28902ee51f12e0f19e1e16fbe2f8f06b6637f482c459dd393efddd0ec7f82045", size = 13601998, upload-time = "2025-12-15T05:03:13.056Z" }, - { url = "https://files.pythonhosted.org/packages/e3/da/5055c63e377c5c2418760411fd6a63ee2b96cf95397259038756c042574f/mypy-1.19.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:481daf36a4c443332e2ae9c137dfee878fcea781a2e3f895d54bd3002a900957", size = 13807476, upload-time = "2025-12-15T05:03:17.977Z" }, - { url = "https://files.pythonhosted.org/packages/cd/09/4ebd873390a063176f06b0dbf1f7783dd87bd120eae7727fa4ae4179b685/mypy-1.19.1-cp314-cp314-win_amd64.whl", hash = "sha256:8bb5c6f6d043655e055be9b542aa5f3bdd30e4f3589163e85f93f3640060509f", size = 10281872, upload-time = "2025-12-15T05:03:05.549Z" }, - { url = "https://files.pythonhosted.org/packages/8d/f4/4ce9a05ce5ded1de3ec1c1d96cf9f9504a04e54ce0ed55cfa38619a32b8d/mypy-1.19.1-py3-none-any.whl", hash = "sha256:f1235f5ea01b7db5468d53ece6aaddf1ad0b88d9e7462b86ef96fe04995d7247", size = 2471239, upload-time = "2025-12-15T05:03:07.248Z" }, + { url = "https://files.pythonhosted.org/packages/be/c4/42a49d44aeff804edf1b19acce0b49e8bd1a9c57dee9605dd8d980aa43d7/mypy-2.3.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:192abaedf75da1bc0b1cef104927e70ec49c1ef0031cc4825c7ee10a438ed24d", size = 13986778, upload-time = "2026-08-15T03:01:33.69Z" }, + { url = "https://files.pythonhosted.org/packages/45/13/9331fd2dfed7194d66c5304072894a8be3e51e9deda6863c1eceaa35a43d/mypy-2.3.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf678dffd16efcda2c15cbd30e9ecc0081388e29ea23687a88e686ed92638dc3", size = 14188467, upload-time = "2026-08-15T03:02:40.554Z" }, + { url = "https://files.pythonhosted.org/packages/78/f7/f4a34edab45667c5465855dc585a20e87978ffa8aee711445b7239d120c6/mypy-2.3.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8e036f06b41630f4c8a1d48f9ac6aa26acc65f8be089973f5519da643318f03f", size = 15225538, upload-time = "2026-08-15T03:03:09.761Z" }, + { url = "https://files.pythonhosted.org/packages/40/05/534b3590757bd05794f73e07f6666c2a77b8597ffed795c94ce570096aa0/mypy-2.3.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:71af9c8a894e862b58e92abb08e53b05a384a1e5e5d6dc7cda59126211a53d82", size = 15480805, upload-time = "2026-08-15T03:01:41.134Z" }, + { url = "https://files.pythonhosted.org/packages/55/da/bdfba852e2562f599624af5bb7d29e36b0b4f526f2b8bac85efe0dd1803d/mypy-2.3.1-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:3c80cd23d85368bdd9f37d5231dfd97d35bcbf5bf41af96ef3a9b078ad1957f9", size = 7761712, upload-time = "2026-08-15T03:02:36.008Z" }, + { url = "https://files.pythonhosted.org/packages/98/31/60fc64a74cdba4f2a5d642d32317993e479163e1ac7d91b695e5d15e2264/mypy-2.3.1-cp314-cp314-win_amd64.whl", hash = "sha256:4956f34d145e145562a0a0bf367f642bbc85c04ec2baf47ae015947c3169a85d", size = 11423968, upload-time = "2026-08-15T03:02:06.931Z" }, + { url = "https://files.pythonhosted.org/packages/a9/23/eb5950b24cd26ba3b78f87707a275568d633c77dae8e61c9661be6055ca6/mypy-2.3.1-cp314-cp314-win_arm64.whl", hash = "sha256:cfb12e360242d23d91f5e978d94f58ea66acf5804c4fb6f2f794a20d4cb1b595", size = 10399323, upload-time = "2026-08-15T03:02:33.671Z" }, + { url = "https://files.pythonhosted.org/packages/82/c7/f80f4e46c0b9a00eb5f78a79d49dda8bdf56a5230f7257fb33e76be04da7/mypy-2.3.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e5f1c50bb05b64e2026b52867e8d21106f01313c744a2c4ecc34c90d12e8d6e2", size = 15121308, upload-time = "2026-08-15T03:01:46.053Z" }, + { url = "https://files.pythonhosted.org/packages/5d/74/9b04f17c7074cc5188f02fb63a2ca1d43fedf479e84fe3091c39061a1d7f/mypy-2.3.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:667196b352f4cf304ded4c10f90cfc179263a1acfb3cdcfa984bdfd340d498bc", size = 15536590, upload-time = "2026-08-15T03:01:35.941Z" }, + { url = "https://files.pythonhosted.org/packages/26/04/c837ef6208e567774e2ed1f863f8ba6ec4817b1b6dd426315e5d559b6ec9/mypy-2.3.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b9c53e395c12cad2c6d4b67d5da7c6057638a132d85c08b73646b18f802a0045", size = 16791074, upload-time = "2026-08-15T03:01:31.073Z" }, + { url = "https://files.pythonhosted.org/packages/37/68/48730230afa45192d5bd429a6a2ff24a6f8dedda90fdf2b221792b54518f/mypy-2.3.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:18162b128c3f9c703cd35f5537446900b0d21a2549aa7a95d21380d2ef643fb0", size = 17069183, upload-time = "2026-08-15T03:02:28.566Z" }, + { url = "https://files.pythonhosted.org/packages/1c/ea/ca23fc9c20eeda09a15c9cbcf50015d0e73f409f6ead059e42aa69a608ff/mypy-2.3.1-cp314-cp314t-win_amd64.whl", hash = "sha256:30c0477d4aab7b7f39c8397dc877f2c96b9fe5588ec379f372c56eb63d599f63", size = 12154679, upload-time = "2026-08-15T03:02:04.809Z" }, + { url = "https://files.pythonhosted.org/packages/3b/67/8d982126034990869466f73b8db80dcb2234a7ac39b4dad093e047a79835/mypy-2.3.1-cp314-cp314t-win_arm64.whl", hash = "sha256:6941ab3619377bc3f32ca02876b07d27f216f5201604b664d3937ea0fdd23bb4", size = 10969159, upload-time = "2026-08-15T03:02:38.152Z" }, + { url = "https://files.pythonhosted.org/packages/ee/f7/41e7f2d8117fbc7a7587286162ffe2f688984b69c46ed63cf5f2e4fc3bae/mypy-2.3.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:6f041a6de52c9217ca125e78ba0a335cb7fd98a1c0580978e49ab2b126f70b57", size = 13990694, upload-time = "2026-08-15T03:03:21.919Z" }, + { url = "https://files.pythonhosted.org/packages/06/85/8f665811a0c8f3bf6fa1d9acd665ec2d97a2bcc453ae68dcd92340941cd6/mypy-2.3.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5159ae60f5dbc3a498af5ba8365505808ac8031bc63f9e00304ad545d40bdd9b", size = 14203518, upload-time = "2026-08-15T03:01:48.455Z" }, + { url = "https://files.pythonhosted.org/packages/2d/82/91b866c8546b120bff83b73a439d90d2d63ef3aff113599e6b8e4d566848/mypy-2.3.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:47a8a7a0a7f6f6e63995c0ac36fa0c07b127413fdc81f0439b7f3dccafd33561", size = 15220224, upload-time = "2026-08-15T03:01:23.577Z" }, + { url = "https://files.pythonhosted.org/packages/c8/78/c226c99208ee40de7c768369fa533f933afa003dfdc606ff021450724e91/mypy-2.3.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:2329c0501293d4e1f33bc15d04d6304d65a1cdda967ee93a05c1e681a3923133", size = 15501512, upload-time = "2026-08-15T03:02:09.453Z" }, + { url = "https://files.pythonhosted.org/packages/a9/e7/7cfb3f106c393979f4cc37ad6c0586044d50401e3c35b0c003e4f3ba6bc9/mypy-2.3.1-cp315-cp315-pyemscripten_2026_5_wasm32.whl", hash = "sha256:bb26deed807bdb0457cf3e3f1cd7c4a1cf9d66864eaf1b4a61e06805d4c6b1f9", size = 7761913, upload-time = "2026-08-15T03:01:55.65Z" }, + { url = "https://files.pythonhosted.org/packages/99/3c/52affefa273b97939a1f474ae4a349c8718635c15b941112dfab4291b0c1/mypy-2.3.1-cp315-cp315-win_amd64.whl", hash = "sha256:375d7013876a8233b2d05be185bfa09f689696cd999ce8b1cfe6acac5c80e8a3", size = 11422533, upload-time = "2026-08-15T03:03:24.101Z" }, + { url = "https://files.pythonhosted.org/packages/2a/b7/75643e70c72a5b346d8a9b1543c967ea8824df2ee3fb7ccba652c272b7bb/mypy-2.3.1-cp315-cp315-win_arm64.whl", hash = "sha256:586b3612214cceabb3c0f588c97e7d1e535393f06a60e912e994f6b3ace97523", size = 10397931, upload-time = "2026-08-15T03:02:55.265Z" }, + { url = "https://files.pythonhosted.org/packages/10/ce/53be21f2d4adfcd26f63f1184a13ed797015ab463853f117e2e11e4d726f/mypy-2.3.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:ef0c6335cda9d807f8193d8ff6204a72bc909fa9882aacbca14f43cdb7188306", size = 15118669, upload-time = "2026-08-15T03:02:51.479Z" }, + { url = "https://files.pythonhosted.org/packages/62/43/20de757cd42989d291a17fad607742c4c74e875ce5cea00e5a5225020ac1/mypy-2.3.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e598c8c66401d26b150872154a286e6d484cf2789c3bb28a7556806298423021", size = 15545627, upload-time = "2026-08-15T03:03:05.132Z" }, + { url = "https://files.pythonhosted.org/packages/7e/fc/092bdf77ad280eaf501422f0f3b966012b528076cc13e41a774861c907d1/mypy-2.3.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:eda22fd4efa9dcd39331d1dede9b5b8b8a7fd69af07592e778433da98610d29e", size = 16764157, upload-time = "2026-08-15T03:02:23.958Z" }, + { url = "https://files.pythonhosted.org/packages/94/5c/c94c4d62d909b07f552d0d9356d7acc943825558e602a64822ffa2231536/mypy-2.3.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:2a0ba2e57847849fb0d1fcdabb32786d223095ed8bc121dfe322bcdb3d9c46bc", size = 17073258, upload-time = "2026-08-15T03:02:14.573Z" }, + { url = "https://files.pythonhosted.org/packages/c0/f7/511a88b89e478053c02d22039bb8f3ce4183efe8fd7a4f0a5910a8bb0a32/mypy-2.3.1-cp315-cp315t-win_amd64.whl", hash = "sha256:3f7e865dd51f235f60a2dbcd8728a1c095f5ca28f095d48a725b84cd935735c4", size = 12135505, upload-time = "2026-08-15T03:02:16.714Z" }, + { url = "https://files.pythonhosted.org/packages/71/bf/02573b56964ecb0f7c644f915f53c325ae15c3faec521c5adf11599a32df/mypy-2.3.1-cp315-cp315t-win_arm64.whl", hash = "sha256:8ad80807dc3ab8ea978b1b2b6e4a657194ace1d4ef03e0e731aff1abd517da29", size = 10962647, upload-time = "2026-08-15T03:01:43.712Z" }, + { url = "https://files.pythonhosted.org/packages/8e/41/9675c7a1e78edecfba0b79e587a52594c56e189368261dc7b3a7fffb9527/mypy-2.3.1-py3-none-any.whl", hash = "sha256:6ed5c7e3419083268e5c9258bd1c1ef91af44a9e89374dbcaf37b775716e72eb", size = 2754338, upload-time = "2026-08-15T03:02:53.4Z" }, ] [[package]] @@ -1543,11 +1668,11 @@ bcrypt = [ [[package]] name = "pathspec" -version = "0.12.1" +version = "1.1.1" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ca/bc/f35b8446f4531a7cb215605d100cd88b7ac6f44ab3fc94870c120ab3adbf/pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712", size = 51043, upload-time = "2023-12-10T22:30:45Z" } +sdist = { url = "https://files.pythonhosted.org/packages/5a/82/42f767fc1c1143d6fd36efb827202a2d997a375e160a71eb2888a925aac1/pathspec-1.1.1.tar.gz", hash = "sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a", size = 135180, upload-time = "2026-04-27T01:46:08.907Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", size = 31191, upload-time = "2023-12-10T22:30:43.14Z" }, + { url = "https://files.pythonhosted.org/packages/f1/d9/7fb5aa316bc299258e68c73ba3bddbc499654a07f151cba08f6153988714/pathspec-1.1.1-py3-none-any.whl", hash = "sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189", size = 57328, upload-time = "2026-04-27T01:46:07.06Z" }, ] [[package]] @@ -2261,7 +2386,7 @@ requires-dist = [ { name = "joserfc", specifier = "~=1.6.8" }, { name = "memray", marker = "extra == 'dev'", specifier = "~=1.15" }, { name = "mutagen", specifier = "~=1.47" }, - { name = "mypy", marker = "extra == 'dev'", specifier = "~=1.19" }, + { name = "mypy", marker = "extra == 'dev'", specifier = "~=2.3" }, { name = "opentelemetry-distro", specifier = "~=0.56" }, { name = "opentelemetry-exporter-otlp", specifier = "~=1.36" }, { name = "opentelemetry-instrumentation-aiohttp-client", specifier = "~=0.56" }, From 7f5b7bc9d5162c293c882943ed501faf918f499e Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:47:27 +0000 Subject: [PATCH 38/52] build: drop the comment on the mypy pin Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a54b42cd5..bd2aececb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,8 +66,6 @@ dev = [ "ipdb ~= 0.13", "ipykernel ~= 6.29", "memray ~= 1.15", - # Keep in step with the mypy version in .trunk/trunk.yaml, which is what CI - # enforces; a skew means local runs disagree with the build. "mypy ~= 2.3", "pyinstrument ~= 5.0", "types-colorama ~= 0.4", From 0b37017dcd9329f0013bdebdf6a4c8e6f841e0ba Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Sun, 20 Sep 2026 17:53:22 +0000 Subject: [PATCH 39/52] build: pin mypy to the 2.3 patch line and trim the exclude comment `~= 2.3` allowed any release below 3.0, so a later `uv lock` could pick 2.4 while Trunk stayed on 2.3.0 and quietly reintroduce the skew this change exists to remove. `~= 2.3.0` holds the same minor line as Trunk. The resolved version is unchanged at 2.3.1; only the recorded specifier moves in the lockfile. The config comment now states what the current value is rather than what the previous one did. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01SPpv6W2ygP9tQ61fTQxdYp --- .trunk/configs/mypy.ini | 3 +-- pyproject.toml | 2 +- uv.lock | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.trunk/configs/mypy.ini b/.trunk/configs/mypy.ini index c4b251465..7ff97cd03 100644 --- a/.trunk/configs/mypy.ini +++ b/.trunk/configs/mypy.ini @@ -1,6 +1,5 @@ [mypy] check_untyped_defs = True disable_error_code = import-untyped -# A regex, not a TOML list: an array here compiles to a character class that -# matches almost every path, excluding the whole backend. +# INI configs take a regex here, not a TOML-style list. exclude = (?x)(^|/)alembic/ diff --git a/pyproject.toml b/pyproject.toml index bd2aececb..d08a390f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ dev = [ "ipdb ~= 0.13", "ipykernel ~= 6.29", "memray ~= 1.15", - "mypy ~= 2.3", + "mypy ~= 2.3.0", "pyinstrument ~= 5.0", "types-colorama ~= 0.4", "types-passlib ~= 1.7", diff --git a/uv.lock b/uv.lock index 3a8d69679..2d4366dd1 100644 --- a/uv.lock +++ b/uv.lock @@ -2386,7 +2386,7 @@ requires-dist = [ { name = "joserfc", specifier = "~=1.6.8" }, { name = "memray", marker = "extra == 'dev'", specifier = "~=1.15" }, { name = "mutagen", specifier = "~=1.47" }, - { name = "mypy", marker = "extra == 'dev'", specifier = "~=2.3" }, + { name = "mypy", marker = "extra == 'dev'", specifier = "~=2.3.0" }, { name = "opentelemetry-distro", specifier = "~=0.56" }, { name = "opentelemetry-exporter-otlp", specifier = "~=1.36" }, { name = "opentelemetry-instrumentation-aiohttp-client", specifier = "~=0.56" }, From 44962cd0466c933975e0aef22b6bc2e2005fc533 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 21 Sep 2026 07:05:42 -0400 Subject: [PATCH 40/52] docs: drop the Aikido badge from the readme Co-Authored-By: Claude Opus 5 (1M context) --- .github/resources/aikido-badge.svg | 16 ---------------- README.md | 1 - 2 files changed, 17 deletions(-) delete mode 100644 .github/resources/aikido-badge.svg diff --git a/.github/resources/aikido-badge.svg b/.github/resources/aikido-badge.svg deleted file mode 100644 index 343c746d7..000000000 --- a/.github/resources/aikido-badge.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - Secured with Aikido - - - OPEN SOURCE SECURITY - - - diff --git a/README.md b/README.md index a3718343e..b38827e9b 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,6 @@ These companies support us by providing their tools for free:
Greptile - Aikido
From 76fd21d9a645234736199bc60e2d16a1ad3b076d Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 21 Sep 2026 07:30:56 -0400 Subject: [PATCH 41/52] ci: enable zizmor and fix its findings Adds zizmor to Trunk, which audits GitHub Actions workflows, and clears the 19 findings it reports: - Every actions/checkout now sets persist-credentials: false, so the token stops being written into .git/config where any later step (or an uploaded artifact) could read it. - Service ports and the release version move from run-block template expansions into env vars, keeping expansion out of the shell. - Frontend Checks drops read-all for the contents: read it actually needs. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/build.yml | 6 +++++- .github/workflows/copilot-setup-steps.yml | 2 ++ .github/workflows/e2e.yml | 9 +++++++-- .github/workflows/frontend-v1-frozen.yml | 1 + .github/workflows/frontend.yml | 7 ++++++- .github/workflows/i18n.yml | 2 ++ .github/workflows/migrations.yml | 4 ++++ .github/workflows/pytest.yml | 6 +++++- .github/workflows/test-build.yml | 1 + .github/workflows/trunk-check.yml | 2 ++ .github/workflows/typecheck.yml | 2 ++ .github/workflows/update-hltb-api-url.yml | 2 ++ .trunk/trunk.yaml | 1 + 13 files changed, 40 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2341a4b81..f2131f1ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 @@ -112,8 +114,10 @@ jobs: org.opencontainers.image.licenses="AGPLv3" - name: Set version + env: + VERSION: ${{ steps.meta.outputs.version }} run: | - sed -i 's//${{ steps.meta.outputs.version }}/' backend/__version__.py + sed -i "s//$VERSION/" backend/__version__.py - name: Build and push slim image by digest id: build-slim diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 8636222a2..934cf9031 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -25,6 +25,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 82f4f7785..52234b33d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -61,6 +61,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install mariadb connectors run: | @@ -96,6 +98,9 @@ jobs: # assets/ under it), so copy the fixture library out of the repo rather # than scanning it in place. - name: Stage the library fixture + env: + MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }} + VALKEY_PORT: ${{ job.services.valkey.ports['6379'] }} run: | mkdir -p "$RUNNER_TEMP/romm/resources" "$RUNNER_TEMP/romm/assets" cp -R backend/romm_test/library "$RUNNER_TEMP/romm/library" @@ -103,8 +108,8 @@ jobs: # config.yml declares. cp -R backend/romm_test/config "$RUNNER_TEMP/romm/config" echo "ROMM_BASE_PATH=$RUNNER_TEMP/romm" >> "$GITHUB_ENV" - echo "DB_PORT=${{ job.services.mariadb.ports['3306'] }}" >> "$GITHUB_ENV" - echo "REDIS_PORT=${{ job.services.valkey.ports['6379'] }}" >> "$GITHUB_ENV" + echo "DB_PORT=$MARIADB_PORT" >> "$GITHUB_ENV" + echo "REDIS_PORT=$VALKEY_PORT" >> "$GITHUB_ENV" # A migration failure is its own red step rather than a confusing server-start failure. - name: Apply migrations diff --git a/.github/workflows/frontend-v1-frozen.yml b/.github/workflows/frontend-v1-frozen.yml index 9a7fb3593..29cf54ecd 100644 --- a/.github/workflows/frontend-v1-frozen.yml +++ b/.github/workflows/frontend-v1-frozen.yml @@ -26,6 +26,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 + persist-credentials: false - name: Fail if v1 UI files changed env: diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 30cb2af0e..bafb31752 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -10,7 +10,8 @@ on: paths: - "frontend/**" -permissions: read-all +permissions: + contents: read jobs: test: @@ -18,6 +19,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 @@ -39,6 +42,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 6d3323820..fed327de4 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 1d603225a..e67297576 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -34,6 +34,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install mariadb connectors run: | @@ -91,6 +93,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install mariadb connectors run: | diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c127fc30f..2107a770e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -63,6 +63,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install mariadb connectors run: | @@ -82,12 +84,14 @@ jobs: - name: Initiate MariaDB database if: matrix.db == 'mariadb' + env: + MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }} run: | # Grant on the `romm_test%` namespace so the test user can create the # per-worker databases (romm_test_gw0, ...) used under pytest-xdist, # without granting it global privileges. The backticks are escaped so # the shell doesn't treat them as command substitution. - mysql --host 127.0.0.1 --port ${{ job.services.mariadb.ports['3306'] }} -uroot -ppasswd -e "GRANT ALL PRIVILEGES ON \`romm\_test%\`.* TO 'romm_test'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;" + mysql --host 127.0.0.1 --port "$MARIADB_PORT" -uroot -ppasswd -e "GRANT ALL PRIVILEGES ON \`romm\_test%\`.* TO 'romm_test'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;" - name: Run python tests env: diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 1640e87a8..7be278d57 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -76,6 +76,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }} + persist-credentials: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 diff --git a/.github/workflows/trunk-check.yml b/.github/workflows/trunk-check.yml index 7f21098cb..387ed3cfc 100644 --- a/.github/workflows/trunk-check.yml +++ b/.github/workflows/trunk-check.yml @@ -21,5 +21,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Trunk Check uses: trunk-io/trunk-action@e1234e67a86010d61ddac8d8ebf4b783e2ffd2fa # v2.0.0 diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index aa505a17f..f44f8ee98 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -21,6 +21,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 diff --git a/.github/workflows/update-hltb-api-url.yml b/.github/workflows/update-hltb-api-url.yml index 9b45293c3..1f193a27d 100644 --- a/.github/workflows/update-hltb-api-url.yml +++ b/.github/workflows/update-hltb-api-url.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install uv uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 0d04ba83c..9f68fdb1a 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -22,6 +22,7 @@ lint: - oxipng - pyright enabled: + - zizmor@1.30.1 - grype@0.110.0 - pinact@4.0.0 - dotenv-linter@4.0.0 From 95c3aa5df33c2b11c99c4993f63752b18826f30b Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 21 Sep 2026 07:40:02 -0400 Subject: [PATCH 42/52] ci: hold Renovate updates for 7 days A release compromised at publish time is usually yanked within days, so waiting a week before proposing it keeps the window where a malicious version can land in a PR here closed. Co-Authored-By: Claude Opus 5 (1M context) --- renovate.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/renovate.json b/renovate.json index beed93a37..34e71e8fc 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,8 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:recommended", ":semanticCommitTypeAll(chore)"], + "description": "Updates wait out a week before Renovate proposes them, so a compromised release has time to be pulled before it reaches a PR here.", + "minimumReleaseAge": "7 days", "enabledManagers": ["github-actions", "docker-compose", "custom.regex"], "ignorePaths": ["examples/**"], "packageRules": [ From f4e1ab3846bfc0e835cd99a6ad439cbcac5423d7 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 21 Sep 2026 07:44:26 -0400 Subject: [PATCH 43/52] docs: add a Socket badge to the readme Socket has been scanning this repo's pull requests for supply chain risk, under their free open source plan, so it belongs in Supported By. Co-Authored-By: Claude Opus 5 (1M context) --- .github/resources/socket-badge.svg | 22 ++++++++++++++++++++++ README.md | 1 + 2 files changed, 23 insertions(+) create mode 100644 .github/resources/socket-badge.svg diff --git a/.github/resources/socket-badge.svg b/.github/resources/socket-badge.svg new file mode 100644 index 000000000..41952a2bd --- /dev/null +++ b/.github/resources/socket-badge.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + Secured by Socket + + + SUPPLY CHAIN SECURITY + + + diff --git a/README.md b/README.md index b38827e9b..38b5591f5 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ These companies support us by providing their tools for free:
Greptile + Socket
From 24bf1cc25dace775d15f50fbde4411256d54977a Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 21 Sep 2026 15:26:33 -0400 Subject: [PATCH 44/52] docs: add a draft-announcement skill Codifies the house format of the Discord release announcements from the last three years: the timely hook, the upgrade warning, two to five features in prose with the tail as bullets, community news, and the pointer to the release notes. The community news is the half of an announcement no diff contains, so the skill interviews the maintainer for it one step at a time, and refuses to invent a contributor, an app, a milestone or a handle. Co-Authored-By: Claude Opus 5 (1M context) --- .claude/skills/draft-announcement/SKILL.md | 155 ++++++++++++++++++ .claude/skills/draft-announcement/template.md | 69 ++++++++ CLAUDE.md | 1 + 3 files changed, 225 insertions(+) create mode 100644 .claude/skills/draft-announcement/SKILL.md create mode 100644 .claude/skills/draft-announcement/template.md diff --git a/.claude/skills/draft-announcement/SKILL.md b/.claude/skills/draft-announcement/SKILL.md new file mode 100644 index 000000000..a4e1546bf --- /dev/null +++ b/.claude/skills/draft-announcement/SKILL.md @@ -0,0 +1,155 @@ +--- +name: draft-announcement +description: Draft the Discord release announcement for a RomM release, from the release notes plus an interview about community news. Use when asked to "write the Discord announcement for 5.3.0", "draft the announcement post", "announce the beta in Discord", or to refresh an announcement draft. Interviews the user for the things no diff contains (new team members, third-party apps to spotlight, milestones, events, Discord housekeeping), writes in the house voice, and never posts to Discord. +argument-hint: "[version to announce, e.g. 5.3.0 | nothing to infer it]" +--- + +# Drafting a Discord announcement + +The release notes say what shipped. The announcement says why anyone should care, +in RomM's voice, in one Discord message. It is a short, warm, slightly unhinged +post: a hook, the few features worth naming, the community news, a pointer to the +notes, a sign-off. + +Half the content is not in the repository. **Interview the user for it.** Never +invent a contributor, an app, a milestone, a link or a handle. + +Write the draft to the session scratchpad and print it. **Never** post to Discord, +and never write into the maintainer's announcement archive (see section 1). + +--- + +## 1. Read before you write + +`$ARGUMENTS` is the version. If empty, take the newest tag and confirm it. + +The release notes are the feature source. + +```bash +TAG=5.3.0 +gh release view "$TAG" --json body --jq .body # the notes for this release +# for a release not yet published, use the draft in the scratchpad +``` + +Past announcements are the voice source, and a Discord post is not in the repo, so +they exist only wherever the maintainer archives them. Ask where that is if you do +not already know, and treat it as **read only**: drafts go to the scratchpad. + +Read the **two most recent** before drafting. They set the current voice, and they +tell you which third-party apps were already spotlighted. An app highlighted in +either one does not get spotlighted again. + +From the notes, pull: + +- the Highlights, as candidate features to name, +- every `> [!WARNING]`, which **must** survive into the announcement (`4.1.0` led + with the mandatory `config.yml`, `4.0.0` led with the RCE advisory), +- a rough PR count and whether the release is mostly fixes, which decides the hook. + +## 2. Interview the user, one step at a time + +The community news is names, URLs and handles that only the user has, so it gets +**typed, not picked**. Ask **one question per message** and wait for the answer +before asking the next. Never send the whole questionnaire as a numbered list, and +never collect the content answers as checkbox options. + +Number every step and say how many there are ("Step 2 of 6"), so the user can see +where the interview ends. Each step states exactly which fields you need, and how +to skip it. Take "skip", "none" or "n/a" as an answer, move on without arguing, and +drop that item from the draft. + +| # | Step | Ask for | +| --- | ------------------ | --------------------------------------------------------------------------------------------------------------- | +| 1 | Features | print the Highlights you found as a numbered list, ask which get named prose; the rest become bullets | +| 2 | App spotlight | name, repo URL, author's handle, one line on what it does. List the apps already spotlighted so nothing repeats | +| 3 | Team or role news | handle, what they built or do, what changes now (joined the team, project gone official, new Experts) | +| 4 | Milestone or event | what it is, the number or date, and the link | +| 5 | Anything else | housekeeping, a call to action, a beta bug-report ask; the exact wording they want | +| 6 | Pings and shape | the only genuinely multiple-choice step, so one `AskUserQuestion` call: who gets pinged, and one message or two | + +Ask for a handle as it is written in Discord, since `@Covin` and `@Covin90` are not +interchangeable. Never offer a sample answer that could be mistaken for a real one: +no invented app names, no placeholder URLs, no guessed star counts. + +If steps 2 through 5 all come back empty, drop the Community news section. Several +releases (`4.3.0`, `4.4.0`) have none, and a padded one reads worse than none. + +Skip a step only when the answer is already on the table, and say so rather than +silently dropping it: a user who opened with "announce 5.3.0, spotlight ``" has +answered step 2 already. + +## 3. The shape + +Always, in this order: + +1. **Hook.** One or two sentences, opening on something _timely_. Check today's + date first and use it: the season, a holiday, the month, or a self-aware nod to + the last release. `3.6.0` served Thanksgiving turkey, `3.10.0` opened on the + summer heat, `3.7.0` on the new year, `4.9.0` on being the last `4.x`, `5.1.0` + on arriving sooner than anyone expected. Then `@everyone` (if pinging), the + version in backticks, and what the release is _about_. Never open cold with + "version X is out". Keep the reference light and skip a holiday that is not + widely shared, and do not assert a date you have not checked ("the equinox is + today") when "the days are getting shorter" carries the same warmth. +2. **Any upgrade warning**, immediately after the hook. Imperative, and what to do, + not why. +3. **The features**, in one of two shapes: + - **Bullet list** for a release carried by a long tail (`5.1.0`, `4.3.0`): one + sentence of setup, then five to nine bullets of three to six words each. + - **`###` section per feature** for a release with two to five real headliners + (`3.10.0`, `4.4.0`, `3.5.0`): a heading and two or three sentences, saying what + it does and the one thing needed to use it. Close with an `Other notable +features:` bullet list when there is a tail. +4. **`## Community news`** (`### Community updates` also appears; match the last + one). Team additions first, then app spotlights, then milestones and events, then + housekeeping and calls to action. +5. **The pointer.** "More details on each of these features, and a complete list of + changes, can be found in the [release notes](url)." Link the tag URL. +6. **Sign-off.** "See you soon!", optionally with `:mario_here_we_go:`. + +## 4. Voice + +- Second person, present tense, contractions. Talking to friends, not users. +- One idea per sentence, and short paragraphs. Nothing here is a manual. +- Enthusiasm is earned by specifics, not adjectives. Name the feature, don't call + it revolutionary. No claim the release notes do not support. +- Emphasis is _italics_ on a single word, sparingly. Bold is for the thing that + will break someone's install. +- Backticks for versions, env vars, config keys, filenames. +- Credit by name every time: the contributor for a feature, the author for an app. +- No em-dashes. No AI throat-clearing, no "we're excited to announce" twice in one + post, no bullet list of benefits. + +## 5. Discord mechanics + +- **2000 characters**, hard. Past announcements run 1300 to 2100; treat 1800 as the + target and count before handing over (`wc -m`). +- Over the limit, pick one: split at a section boundary into message 1 (hook plus + features) and message 2 (community news plus sign-off), marking the split in the + draft; or do what `3.7.0` did and post a three-line teaser pointing at the GitHub + notes. Say which you did and why. +- `##`, `###`, `**bold**`, `*italics*`, `` `code` ``, `> quote`, `-`/`*` bullets and + `[text](url)` all render. Tables, images and HTML do not. +- `@everyone` goes in the first sentence or not at all. +- Custom emoji only from ones this server is known to have: + `:mario_here_we_go:` (the usual sign-off), `:linkEz:`, `:linkLove:`, `:peepoAlert:`, + `:snakeSalute:`, `:excuseme:`, `:okay:`, `:linuxNootNoot:`. Anything else renders as + literal text, so use plain unicode (🎊 👉 ⚠️ 🔥) instead of guessing a shortcode. +- Role pings (`@Expert`, `@Alpha Tester`, `@Beta Tester`) only when the user asked + for them, spelled as they gave them. + +## 6. Before handing it over + +- Every feature named appears in the release notes. +- The hook opens on something timely, and the reference matches today's date. +- Every warning in the notes appears in the announcement. +- Every handle, repo URL and number came from the user or from the notes, never + from you, and every URL is one you have actually seen. +- No app spotlighted in either of the last two announcements. +- The release notes link ends in the tag being announced. +- Under 2000 characters, or split deliberately. +- No em-dashes, no invented emoji shortcodes. + +Write to `/-announcement.md`, print it, and say what still needs a +human: a screenshot or GIF to attach, a link the user has not given you, a name you +could not confirm. diff --git a/.claude/skills/draft-announcement/template.md b/.claude/skills/draft-announcement/template.md new file mode 100644 index 000000000..f424a0942 --- /dev/null +++ b/.claude/skills/draft-announcement/template.md @@ -0,0 +1,69 @@ + + + + + +## Bullet shape (a long tail of changes) + +@everyone + + + +⚠️ + + + +- +- +- +- +- + +## Community news + + + + + + + +More details on each of these features, and a complete list of changes, can be +found in the [release notes](https://github.com/rommapp/romm/releases/tag/X.Y.Z). + +See you soon! :mario_here_we_go: + +--- + +## Section shape (two to five real headliners) + +@everyone + +### + + + +### + + + +Other notable features: + +- +- + +## Community news + + + +More details on each of these features, and a complete list of changes, can be +found in the [release notes](https://github.com/rommapp/romm/releases/tag/X.Y.Z). + +See you soon! :mario_here_we_go: diff --git a/CLAUDE.md b/CLAUDE.md index d59075454..941ca04e7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,7 @@ These live in `.claude/skills/` and carry the detailed rules. Invoke the one tha | `pr-ready` | Before opening a PR - the four passes in order: `security-audit`, `code-review xhigh --fix`, `simplify`, `review-polish`. Not auto-invoked. | | `address-bot-reviews` | After Greptile and Copilot review a PR - triage each finding, fix what holds up, reply with the fix or the reason, and resolve the threads. Not auto-invoked. | | `draft-release-notes` | Drafting the GitHub release notes for a release, stable or alpha/beta, from the diff since the previous stable tag. | +| `draft-announcement` | Drafting the Discord announcement for a release, from the release notes plus an interview about community news. Not auto-invoked. | --- From 80b83351398b0c3cf94b2df542139b601b3071fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:06:09 +0000 Subject: [PATCH 45/52] chore(deps): update astral-sh/setup-uv action to v10.2.0 --- .github/workflows/copilot-setup-steps.yml | 2 +- .github/workflows/e2e.yml | 2 +- .github/workflows/i18n.yml | 2 +- .github/workflows/migrations.yml | 4 ++-- .github/workflows/pytest.yml | 2 +- .github/workflows/update-hltb-api-url.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 8636222a2..9ff713112 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install Python run: uv python install diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 82f4f7785..85045b95e 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -68,7 +68,7 @@ jobs: sudo apt-get install -y libmariadb3 libmariadb-dev - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: uv python install diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 6d3323820..f7b569136 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: uv python install diff --git a/.github/workflows/migrations.yml b/.github/workflows/migrations.yml index 1d603225a..17fa7bda8 100644 --- a/.github/workflows/migrations.yml +++ b/.github/workflows/migrations.yml @@ -41,7 +41,7 @@ jobs: sudo apt-get install -y libmariadb3 libmariadb-dev - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: uv python install @@ -98,7 +98,7 @@ jobs: sudo apt-get install -y libmariadb3 libmariadb-dev - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: uv python install diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c127fc30f..80d3b74a1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -70,7 +70,7 @@ jobs: sudo apt-get install -y libmariadb3 libmariadb-dev 7zip - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: | diff --git a/.github/workflows/update-hltb-api-url.yml b/.github/workflows/update-hltb-api-url.yml index 9b45293c3..c8e6b864b 100644 --- a/.github/workflows/update-hltb-api-url.yml +++ b/.github/workflows/update-hltb-api-url.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Install uv - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - name: Install python run: | From 552cf7c213303eb6ea9ccb2be425a5a9c1192164 Mon Sep 17 00:00:00 2001 From: Sam Dornan Date: Mon, 21 Sep 2026 19:52:40 -0400 Subject: [PATCH 46/52] fix(config): show folder mappings whose folder name is not lowercase (#4676) --- backend/config/config_manager.py | 24 ++- backend/endpoints/configs.py | 16 ++ backend/handler/database/platforms_handler.py | 12 +- .../handler/filesystem/platforms_handler.py | 19 +++ backend/handler/scan_handler.py | 12 +- backend/tests/config/test_config_loader.py | 79 +++++++-- backend/tests/endpoints/test_config.py | 42 ++++- .../database/test_platforms_handler.py | 26 +++ .../filesystem/test_platforms_handler.py | 18 ++ backend/tests/utils/test_platform_aliases.py | 18 ++ backend/utils/platform_aliases.py | 21 +++ .../Config/Dialog/CreateFolderMapping.vue | 9 +- .../Config/FolderMappings.vue | 36 ++-- frontend/src/services/api/config.ts | 8 +- frontend/src/stores/config.ts | 20 ++- .../Settings/FolderMappingsSection.test.ts | 160 ++++++++++++++++++ .../Settings/FolderMappingsSection.vue | 25 ++- 17 files changed, 480 insertions(+), 65 deletions(-) create mode 100644 frontend/src/v2/components/Settings/FolderMappingsSection.test.ts diff --git a/backend/config/config_manager.py b/backend/config/config_manager.py index 043f07b37..b32ff1b4f 100644 --- a/backend/config/config_manager.py +++ b/backend/config/config_manager.py @@ -919,7 +919,17 @@ class ConfigManager: f"Invalid config.yml: {config_key}.{key} must be a non-empty string" ) sys.exit(3) - normalized[str(key).lower()] = value + folded = str(key).lower() + # One key covers `PSX` and `psx` alike, so a second spelling of the + # same folder silently replaces the first. + if folded in normalized and normalized[folded] != value: + log.warning( + f"{config_key}.{key} replaces a case variant of the same " + f"folder name: {hl(normalized[folded])} is dropped for " + f"{hl(value)}, since folder names are matched " + "case-insensitively" + ) + normalized[folded] = value return normalized @@ -1401,9 +1411,11 @@ class ConfigManager: def add_platform_binding(self, fs_slug: str, slug: str) -> None: fs_slug = fs_slug.lower() platform_bindings = self.config.PLATFORMS_BINDING - if fs_slug in platform_bindings: - log.warning(f"Binding for {hl(fs_slug)} already exists") + bound = platform_bindings.get(fs_slug) + if bound == slug: return None + if bound: + log.info(f"Rebinding {hl(fs_slug)} from {hl(bound)} to {hl(slug)}") platform_bindings[fs_slug] = slug self.config.PLATFORMS_BINDING = platform_bindings @@ -1423,9 +1435,11 @@ class ConfigManager: def add_platform_version(self, fs_slug: str, slug: str) -> None: fs_slug = fs_slug.lower() platform_versions = self.config.PLATFORMS_VERSIONS - if fs_slug in platform_versions: - log.warning(f"Version for {hl(fs_slug)} already exists") + parent = platform_versions.get(fs_slug) + if parent == slug: return None + if parent: + log.info(f"Reparenting {hl(fs_slug)} from {hl(parent)} to {hl(slug)}") platform_versions[fs_slug] = slug self.config.PLATFORMS_VERSIONS = platform_versions diff --git a/backend/endpoints/configs.py b/backend/endpoints/configs.py index bd081063c..418125b17 100644 --- a/backend/endpoints/configs.py +++ b/backend/endpoints/configs.py @@ -18,6 +18,7 @@ from endpoints.responses.config import ConfigResponse from exceptions.config_exceptions import ConfigNotWritableException from handler.auth.constants import Scope from handler.database import db_rom_handler +from handler.filesystem import fs_platform_handler from logger.logger import log from utils.router import APIRouter @@ -169,6 +170,19 @@ def get_config(request: Request) -> ConfigResponse: ) +async def _reject_ambiguous_folder(fs_slug: str) -> None: + """Refuse a mapping that several folders on disk would share.""" + ambiguous = await fs_platform_handler.find_ambiguous_folders(fs_slug) + if ambiguous: + raise HTTPException( + status_code=status.HTTP_409_CONFLICT, + detail=( + f"Folders {', '.join(ambiguous)} differ only by case and share a " + "single mapping. Rename one to map them to different platforms." + ), + ) + + @protected_route(router.post, "/system/platforms", [Scope.PLATFORMS_WRITE]) async def add_platform_binding( request: Request, payload: PlatformBindingPayload @@ -177,6 +191,7 @@ async def add_platform_binding( fs_slug = payload.fs_slug slug = payload.slug + await _reject_ambiguous_folder(fs_slug) try: cm.add_platform_binding(fs_slug, slug) @@ -208,6 +223,7 @@ async def add_platform_version( fs_slug = payload.fs_slug slug = payload.slug + await _reject_ambiguous_folder(fs_slug) try: cm.add_platform_version(fs_slug, slug) diff --git a/backend/handler/database/platforms_handler.py b/backend/handler/database/platforms_handler.py index d19e383a6..d61da9ad7 100644 --- a/backend/handler/database/platforms_handler.py +++ b/backend/handler/database/platforms_handler.py @@ -2,7 +2,7 @@ import functools from collections.abc import Sequence from datetime import datetime -from sqlalchemy import delete, or_, select, update +from sqlalchemy import delete, func, or_, select, update from sqlalchemy.orm import Query, Session, selectinload from decorators.database import begin_session @@ -103,7 +103,15 @@ class DBPlatformsHandler(DBBaseHandler): query: Query = None, # type: ignore session: Session = None, # type: ignore ) -> Platform | None: - return session.scalar(query.filter_by(fs_slug=fs_slug).limit(1)) + platform = session.scalar(query.filter_by(fs_slug=fs_slug).limit(1)) + if platform: + return platform + + # Folder names are matched case-insensitively everywhere else, so a + # folder renamed only in case is the same platform, not a new one. + return session.scalar( + query.filter(func.lower(Platform.fs_slug) == fs_slug.lower()).limit(1) + ) @begin_session @with_firmware diff --git a/backend/handler/filesystem/platforms_handler.py b/backend/handler/filesystem/platforms_handler.py index 38ed64814..a138a32a5 100644 --- a/backend/handler/filesystem/platforms_handler.py +++ b/backend/handler/filesystem/platforms_handler.py @@ -77,3 +77,22 @@ class FSPlatformsHandler(FSHandler): platforms = self._exclude_platforms(platforms) return platforms + + async def find_ambiguous_folders(self, fs_slug: str) -> list[str]: + """The folders a single config mapping would cover, when it covers several. + + Folder names key the config case-insensitively, so siblings differing + only by case (which only a case-sensitive filesystem allows) share one + entry and cannot be mapped apart. + + Args: + fs_slug: The folder name a mapping is being written for. + + Returns: + The matching folders, sorted, or empty when the name is unambiguous. + """ + folded = fs_slug.lower() + matches = sorted( + folder for folder in await self.get_platforms() if folder.lower() == folded + ) + return matches if len(matches) > 1 else [] diff --git a/backend/handler/scan_handler.py b/backend/handler/scan_handler.py index 410e13b12..4e8f958a1 100644 --- a/backend/handler/scan_handler.py +++ b/backend/handler/scan_handler.py @@ -80,7 +80,11 @@ from models.user import User from utils import emoji from utils.audio_tags import persist_embedded_cover, remove_persisted_cover from utils.filesystem import sanitize_filename -from utils.platform_aliases import resolve_fs_slug, resolve_platform_slug +from utils.platform_aliases import ( + resolve_fs_folder, + resolve_fs_slug, + resolve_platform_slug, +) LOGGER_MODULE_NAME = {"module_name": "scan"} @@ -292,7 +296,11 @@ async def scan_platform( if platform: known_fs_slug = resolve_fs_slug(platform.slug, cnfg) if known_fs_slug: - platform_attrs["fs_slug"] = known_fs_slug + # `resolve_fs_slug` answers with a lowercased config key, but + # every path is built from the folder's own casing. + platform_attrs["fs_slug"] = ( + resolve_fs_folder(known_fs_slug, fs_platforms) or known_fs_slug + ) platform_attrs["slug"] = resolve_platform_slug(fs_slug, cnfg) diff --git a/backend/tests/config/test_config_loader.py b/backend/tests/config/test_config_loader.py index 325741c33..4e93b35f9 100644 --- a/backend/tests/config/test_config_loader.py +++ b/backend/tests/config/test_config_loader.py @@ -1,5 +1,6 @@ import logging import os +from contextlib import contextmanager from pathlib import Path import pytest @@ -16,6 +17,22 @@ from config.config_manager import ( ) +@contextmanager +def capture_romm_logs(caplog, level=logging.WARNING): + """Capture the `romm` logger, whose records never reach caplog on their own. + + It sets `propagate = False`, so caplog's handler has to be attached to it + directly rather than to the root logger. + """ + romm_logger = logging.getLogger("romm") + romm_logger.addHandler(caplog.handler) + try: + with caplog.at_level(level, logger="romm"): + yield caplog + finally: + romm_logger.removeHandler(caplog.handler) + + def test_config_loader(): loader = ConfigManager( os.path.join(Path(__file__).resolve().parent, "fixtures", "config/config.yml") @@ -524,15 +541,8 @@ def test_legacy_streaming_container_logs_deprecation_warning(caplog, tmp_path): " broker_host: http://192.168.1.51:8000\n" " label: PCSX2\n" ) - # The "romm" logger has propagate=False, so caplog's handler must be - # added directly to it rather than relying on root-logger propagation. - romm_logger = logging.getLogger("romm") - romm_logger.addHandler(caplog.handler) - try: - with caplog.at_level(logging.WARNING, logger="romm"): - loader = ConfigManager(str(config_file)) - finally: - romm_logger.removeHandler(caplog.handler) + with capture_romm_logs(caplog): + loader = ConfigManager(str(config_file)) assert loader.config.STREAMING_CONTAINERS assert "deprecated" in caplog.text @@ -552,13 +562,8 @@ def test_webstation_streaming_container_does_not_warn(caplog, tmp_path): " platforms:\n" " ps2: pcsx2\n" ) - romm_logger = logging.getLogger("romm") - romm_logger.addHandler(caplog.handler) - try: - with caplog.at_level(logging.WARNING, logger="romm"): - ConfigManager(str(config_file)) - finally: - romm_logger.removeHandler(caplog.handler) + with capture_romm_logs(caplog): + ConfigManager(str(config_file)) assert "deprecated" not in caplog.text @@ -630,6 +635,48 @@ def test_platform_binding_lookup_ignores_case(tmp_path): assert loader.config.PLATFORMS_BINDING == {} +def test_case_variant_folder_keys_collapse_with_a_warning(caplog, tmp_path): + """One key covers both, so the dropped mapping must not vanish silently.""" + with capture_romm_logs(caplog): + loader = _write_config( + tmp_path, ' platforms:\n PSX: "ps2"\n psx: "psx"\n' + ) + + assert loader.config.PLATFORMS_BINDING == {"psx": "psx"} + assert "case variant" in caplog.text + assert "ps2" in caplog.text + + +def test_identical_case_variant_mappings_do_not_warn(caplog, tmp_path): + with capture_romm_logs(caplog): + loader = _write_config( + tmp_path, ' platforms:\n PSX: "psx"\n psx: "psx"\n' + ) + + assert loader.config.PLATFORMS_BINDING == {"psx": "psx"} + assert "case variant" not in caplog.text + + +def test_rebinding_a_folder_replaces_the_existing_platform(tmp_path): + loader = _write_config(tmp_path, ' platforms:\n GameCube: "ngc"\n') + + loader.add_platform_binding("GameCube", "wii") + + assert loader.config.PLATFORMS_BINDING == {"gamecube": "wii"} + reloaded = ConfigManager(loader.config_file) + assert reloaded.config.PLATFORMS_BINDING == {"gamecube": "wii"} + + +def test_reparenting_a_folder_replaces_the_existing_version(tmp_path): + loader = _write_config(tmp_path, ' versions:\n NAOMI: "arcade"\n') + + loader.add_platform_version("naomi", "dc") + + assert loader.config.PLATFORMS_VERSIONS == {"naomi": "dc"} + reloaded = ConfigManager(loader.config_file) + assert reloaded.config.PLATFORMS_VERSIONS == {"naomi": "dc"} + + def _write_emulatorjs_config(tmp_path: Path, emulatorjs_block: str) -> ConfigManager: config_file = tmp_path / "config.yml" config_file.write_text(f"emulatorjs:\n{emulatorjs_block}") diff --git a/backend/tests/endpoints/test_config.py b/backend/tests/endpoints/test_config.py index 4222c3aa6..8ea1ddf27 100644 --- a/backend/tests/endpoints/test_config.py +++ b/backend/tests/endpoints/test_config.py @@ -1,4 +1,4 @@ -from unittest.mock import patch +from unittest.mock import AsyncMock, patch from fastapi import status @@ -87,6 +87,46 @@ def test_add_platform_version_payload_shape(client, access_token: str): add_platform_version.assert_called_once_with("n64", "1.0") +def test_mapping_a_folder_with_a_case_variant_sibling_is_rejected( + client, access_token: str +): + """One config key covers both, so the write would remap the sibling too.""" + with ( + patch( + "endpoints.configs.fs_platform_handler.find_ambiguous_folders", + AsyncMock(return_value=["PSX", "psx"]), + ), + patch.object(cm, "add_platform_binding") as add_platform_binding, + ): + response = client.post( + "/api/config/system/platforms", + headers={"Authorization": f"Bearer {access_token}"}, + json={"fs_slug": "PSX", "slug": "ps2"}, + ) + + assert response.status_code == status.HTTP_409_CONFLICT + assert "differ only by case" in response.json()["detail"] + add_platform_binding.assert_not_called() + + +def test_mapping_a_folder_whose_name_is_unique_is_allowed(client, access_token: str): + with ( + patch( + "endpoints.configs.fs_platform_handler.find_ambiguous_folders", + AsyncMock(return_value=[]), + ), + patch.object(cm, "add_platform_binding") as add_platform_binding, + ): + response = client.post( + "/api/config/system/platforms", + headers={"Authorization": f"Bearer {access_token}"}, + json={"fs_slug": "Nintendo 64", "slug": "n64"}, + ) + + assert response.status_code == status.HTTP_200_OK + add_platform_binding.assert_called_once_with("Nintendo 64", "n64") + + def test_add_exclusion_payload_shape(client, access_token: str): with patch.object(cm, "add_exclusion") as add_exclusion: response = client.post( diff --git a/backend/tests/handler/database/test_platforms_handler.py b/backend/tests/handler/database/test_platforms_handler.py index 195264373..6ede30241 100644 --- a/backend/tests/handler/database/test_platforms_handler.py +++ b/backend/tests/handler/database/test_platforms_handler.py @@ -2,6 +2,32 @@ from handler.database import db_platform_handler from models.platform import Platform +def test_lookup_finds_a_folder_renamed_only_in_case(): + """A rescan must reuse the row, not add a second platform beside it.""" + stored = db_platform_handler.add_platform( + Platform(name="N64", slug="n64", fs_slug="nintendo 64") + ) + + found = db_platform_handler.get_platform_by_fs_slug("Nintendo 64") + + assert found is not None + assert found.id == stored.id + + +def test_lookup_returns_the_exactly_named_folder_when_one_exists(): + """The exact spelling is tried first, for backends that can tell them apart. + + MariaDB and MySQL match case-insensitively by collation, so only the + exactly-named row is asserted here; PostgreSQL additionally distinguishes + the sibling. + """ + exact = db_platform_handler.add_platform( + Platform(name="PlayStation", slug="psx", fs_slug="psx") + ) + + assert db_platform_handler.get_platform_by_fs_slug("psx").id == exact.id + + def test_rescan_preserves_user_authored_fields(platform): """A rescan merges a freshly built Platform over the existing row. diff --git a/backend/tests/handler/filesystem/test_platforms_handler.py b/backend/tests/handler/filesystem/test_platforms_handler.py index 58448f70d..dffef35ad 100644 --- a/backend/tests/handler/filesystem/test_platforms_handler.py +++ b/backend/tests/handler/filesystem/test_platforms_handler.py @@ -205,6 +205,24 @@ class TestFSPlatformsHandler: assert "n64" in result assert "psx" not in result + async def test_find_ambiguous_folders_reports_case_variant_siblings( + self, handler: FSPlatformsHandler + ): + """One config key covers both, so they cannot be mapped apart.""" + with patch.object(handler, "get_platforms", return_value=["PSX", "n64", "psx"]): + assert await handler.find_ambiguous_folders("psx") == ["PSX", "psx"] + assert await handler.find_ambiguous_folders("PSX") == ["PSX", "psx"] + + async def test_find_ambiguous_folders_ignores_an_unshared_name( + self, handler: FSPlatformsHandler + ): + with patch.object( + handler, "get_platforms", return_value=["Nintendo 64", "psx"] + ): + assert await handler.find_ambiguous_folders("Nintendo 64") == [] + assert await handler.find_ambiguous_folders("nintendo 64") == [] + assert await handler.find_ambiguous_folders("absent") == [] + async def test_get_platforms_calls_list_directories_with_correct_path( self, handler: FSPlatformsHandler, config ): diff --git a/backend/tests/utils/test_platform_aliases.py b/backend/tests/utils/test_platform_aliases.py index 7d2c25c82..d1b0924e8 100644 --- a/backend/tests/utils/test_platform_aliases.py +++ b/backend/tests/utils/test_platform_aliases.py @@ -7,6 +7,7 @@ from config.config_manager import Config from utils.platform_aliases import ( PLATFORM_FS_ALIASES, PLATFORM_SLUG_FOLDERS, + resolve_fs_folder, resolve_fs_slug, resolve_platform_slug, ) @@ -85,6 +86,23 @@ def test_slug_reached_by_several_folders_has_no_reverse(): assert resolve_fs_slug("my-custom-slug", _config()) is None +def test_resolves_a_config_key_to_the_folder_on_disk(): + """Config keys are lowercased; paths need the folder's own casing.""" + assert resolve_fs_folder("nintendo 64", ["Nintendo 64", "psx"]) == "Nintendo 64" + + +def test_resolves_a_folder_that_is_not_on_disk_to_nothing(): + assert resolve_fs_folder("nintendo 64", ["psx"]) is None + + +def test_two_folders_differing_only_by_case_each_resolve_to_themselves(): + """A case-sensitive filesystem allows both; neither may claim the other.""" + folders = ["PSX", "psx"] + + assert resolve_fs_folder("psx", folders) == "psx" + assert resolve_fs_folder("PSX", folders) == "PSX" + + def test_reverse_map_agrees_with_alias_table(): for slug, fs_slug in PLATFORM_SLUG_FOLDERS.items(): assert PLATFORM_FS_ALIASES[fs_slug].value == slug diff --git a/backend/utils/platform_aliases.py b/backend/utils/platform_aliases.py index 4833a44ae..1f030c425 100644 --- a/backend/utils/platform_aliases.py +++ b/backend/utils/platform_aliases.py @@ -1,5 +1,6 @@ from __future__ import annotations +from collections.abc import Iterable from typing import TYPE_CHECKING, Final from utils.platform_slugs import UniversalPlatformSlug as UPS @@ -190,3 +191,23 @@ def resolve_fs_slug(slug: str, config: Config) -> str | None: if bound == slug: return fs_slug return PLATFORM_SLUG_FOLDERS.get(slug) + + +def resolve_fs_folder(fs_slug: str, fs_platforms: Iterable[str]) -> str | None: + """Resolve a folder name to the one on disk it names, ignoring case. + + Config keys are lowercased, but paths are built from the folder's own + casing. An exact match wins, so on a case-sensitive filesystem two folders + differing only by case each still resolve to themselves. + + Returns: + The folder as it is spelled on disk, or None when none matches. + """ + folded = fs_slug.lower() + fallback: str | None = None + for folder in fs_platforms: + if folder == fs_slug: + return folder + if fallback is None and folder.lower() == folded: + fallback = folder + return fallback diff --git a/frontend/src/components/Settings/LibraryManagement/Config/Dialog/CreateFolderMapping.vue b/frontend/src/components/Settings/LibraryManagement/Config/Dialog/CreateFolderMapping.vue index d17d97a75..0dad195f2 100644 --- a/frontend/src/components/Settings/LibraryManagement/Config/Dialog/CreateFolderMapping.vue +++ b/frontend/src/components/Settings/LibraryManagement/Config/Dialog/CreateFolderMapping.vue @@ -36,13 +36,10 @@ const availableFolders = computed(() => { } // Exclude folders that are already mapped as either an alias or a variant. - const isBound = Object.keys(configStore.config.PLATFORMS_BINDING).includes( - folder, + return ( + !configStore.getPlatformBinding(folder) && + !configStore.getPlatformVersion(folder) ); - const isVersion = Object.keys( - configStore.config.PLATFORMS_VERSIONS, - ).includes(folder); - return !isBound && !isVersion; }); }); diff --git a/frontend/src/components/Settings/LibraryManagement/Config/FolderMappings.vue b/frontend/src/components/Settings/LibraryManagement/Config/FolderMappings.vue index 47bde87a6..4a2bcb27c 100644 --- a/frontend/src/components/Settings/LibraryManagement/Config/FolderMappings.vue +++ b/frontend/src/components/Settings/LibraryManagement/Config/FolderMappings.vue @@ -1,4 +1,5 @@