diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:39:38 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:39:38 +0200 |
| commit | 9e7b75bb0f6f6649fb00f2dc97059e90b7d52875 (patch) | |
| tree | 94463bba19b424fdce6db0d4dacbc1901af8ea95 /packages/meshbay-hub | |
| parent | 86188385cbdae1ee90c1dca7a7b9db2edef1ecd4 (diff) | |
| download | meshbay-9e7b75bb0f6f6649fb00f2dc97059e90b7d52875.tar.gz | |
style: the 98 ruff could not fix, so the linter is a signal again
The pass before this applied ruff's own fixes. These are the ones needing a
decision, and the point of doing them is that `ruff check .` now passes: a
linter reporting 98 known-acceptable findings reports nothing, because the next
real one arrives invisible.
**Lines over 100 (70).** Mostly wrapped where they stood. Two exceptions: the
aligned trailing comments in `protocol.py`'s message table were shortened rather
than wrapped, because wrapping one row of a table breaks the table; and in
`models.py` the column comments moved above their columns for the same reason.
**Imports below the first statement (14).** `csam.py` kept its FastAPI imports
under a section header halfway down the file; two node tests had a constant and
a `pytestmark` wedged between two import blocks. Moved, not suppressed.
**Bindings nothing reads (4).** Three in tests, where the call stays and only the
name goes — `_user(client, "listener")` is there to create the user, not to
return one. The fourth was in `revocation.py` and was not a lint finding at all:
`_connect_and_listen` opened an httpx stream to the WebSocket URL, did `pass`,
and then opened the real connection through the `websockets` library. One
pointless request per connect, left over from before that library was used
directly. Removed, and `httpx` with it.
**`l` as a name (4)**, **semicolons (6)** in the POC spikes, and the rest.
2893 passed, the same count as the two commits before it.
`meshbay_node/revocation.py` is worth a decision separately: 154 lines that
nothing imports, superseded by `hub_client.maintain_ws`'s `on_revocation`. This
commit only stopped it failing the linter.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub')
21 files changed, 89 insertions, 45 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/admin.py b/packages/meshbay-hub/src/meshbay_hub/api/admin.py index d8e13e9..b4b2f4f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/admin.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/admin.py @@ -317,7 +317,8 @@ async def admin_patch_user( if body.role not in ("user", "moderator", "admin"): raise HTTPException(status_code=422, detail="role must be user, moderator, or admin") user.role = body.role - log.info("User %s role changed to %s by %s", user.username, body.role, current_user.username) + log.info("User %s role changed to %s by %s", + user.username, body.role, current_user.username) await create_notification( db, user.id, "role_change", f"Your role has been changed to {body.role}", @@ -325,7 +326,9 @@ async def admin_patch_user( if body.status is not None: if body.status not in ("active", "suspended", "revoked"): - raise HTTPException(status_code=422, detail="status must be active, suspended, or revoked") + raise HTTPException( + status_code=422, + detail="status must be active, suspended, or revoked") user.status = body.status log.info("User %s status changed to %s by %s", user.username, body.status, current_user.username) @@ -483,7 +486,9 @@ async def admin_patch_group( if body.status is not None: if body.status not in ("active", "suspended", "revoked"): - raise HTTPException(status_code=422, detail="status must be active, suspended, or revoked") + raise HTTPException( + status_code=422, + detail="status must be active, suspended, or revoked") group.status = body.status log.info("Group %s status changed to %s by %s", group.name, body.status, current_user.username) diff --git a/packages/meshbay-hub/src/meshbay_hub/api/relay.py b/packages/meshbay-hub/src/meshbay_hub/api/relay.py index 08d935b..7bb3f66 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/relay.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/relay.py @@ -102,7 +102,8 @@ async def relay_register( approved = _relays.get(body.relay_id) if not approved or approved.get("pk") != body.pk_relay: raise HTTPException(status_code=403, - detail="Relay not approved — ask hub admin to run POST /v1/relays/approve") + detail="Relay not approved — ask the hub admin to " + "run POST /v1/relays/approve") if body.timestamp is None or not body.signature: raise HTTPException( diff --git a/packages/meshbay-hub/src/meshbay_hub/api/users.py b/packages/meshbay-hub/src/meshbay_hub/api/users.py index ee8aabc..2666e86 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/users.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/users.py @@ -1312,7 +1312,9 @@ async def register_node_key( if len(raw) != 32: raise ValueError except Exception: - raise HTTPException(status_code=400, detail="Invalid Ed25519 public key (need 32 bytes base64)") + raise HTTPException( + status_code=400, + detail="Invalid Ed25519 public key (need 32 bytes base64)") current_user.pk_node_ed25519 = body.pk_node_ed25519 await db.commit() diff --git a/packages/meshbay-hub/src/meshbay_hub/api/webapp.py b/packages/meshbay-hub/src/meshbay_hub/api/webapp.py index 3e23961..054d04a 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/webapp.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/webapp.py @@ -168,7 +168,8 @@ _HTML = """\ though it had scrolled away. This asks for the keyboard to resize the layout viewport instead, so what is pinned stays where it is looked at. Ignored by browsers that do not know it. --> - <meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-content"> + <meta name="viewport" + content="width=device-width, initial-scale=1, interactive-widget=resizes-content"> <title>MeshBay</title> <link rel="stylesheet" href="/a/{v}/style.css"> </head> diff --git a/packages/meshbay-hub/src/meshbay_hub/csam.py b/packages/meshbay-hub/src/meshbay_hub/csam.py index e540068..b8e8d04 100644 --- a/packages/meshbay-hub/src/meshbay_hub/csam.py +++ b/packages/meshbay-hub/src/meshbay_hub/csam.py @@ -22,6 +22,11 @@ must be reported to NCMEC (US law) or relevant authority immediately. import logging from pathlib import Path +from fastapi import APIRouter, Depends, HTTPException + +from meshbay_hub.api.deps import require_admin +from meshbay_hub.db.models import User + log = logging.getLogger(__name__) # Default path for the CSAM hash database (blake3 hex hashes, one per line) @@ -121,11 +126,6 @@ def check_content_hash(blake3_hex: str) -> bool: # ── Hub API integration ─────────────────────────────────────────────────────── -from fastapi import APIRouter, Depends, HTTPException - -from meshbay_hub.api.deps import require_admin -from meshbay_hub.db.models import User - csam_router = APIRouter(prefix="/v1/admin/csam", tags=["csam"]) diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py index 38c4723..ac1828f 100644 --- a/packages/meshbay-hub/src/meshbay_hub/db/models.py +++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py @@ -53,10 +53,12 @@ class User(Base): # the node does the wrapping, nothing reads a key from this directory. Keys # are generated per node and pinned there (meshbay_node/roster.py). email_hash: Mapped[str | None] = mapped_column(String(64), nullable=True) # HMAC blind index - pk_node_ed25519: Mapped[str | None] = mapped_column(String(64), nullable=True) # node daemon key + pk_node_ed25519: Mapped[str | None] = mapped_column(String(64), nullable=True) hub_id: Mapped[str] = mapped_column(String(128), nullable=False) - role: Mapped[str] = mapped_column(String(16), default="user") # user|moderator|admin - status: Mapped[str] = mapped_column(String(16), default="active") # active|suspended|revoked + # user|moderator|admin + role: Mapped[str] = mapped_column(String(16), default="user") + # active|suspended|revoked + status: Mapped[str] = mapped_column(String(16), default="active") created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) nodes: Mapped[list["Node"]] = relationship(back_populates="user") @@ -105,7 +107,8 @@ class Group(Base): visibility: Mapped[str] = mapped_column(String(16), default="private") # public|private join_policy: Mapped[str] = mapped_column(String(16), default="invite") # open|request|invite description: Mapped[str | None] = mapped_column(String(512)) - status: Mapped[str] = mapped_column(String(16), default="active") # active|suspended|revoked + # active|suspended|revoked + status: Mapped[str] = mapped_column(String(16), default="active") created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) # First time a node registered on /v1/nodes/ws announcing that it hosts this # group. Until then the group has no files, no key and nobody to serve it, so @@ -382,7 +385,8 @@ class IPLog(Base): __tablename__ = "ip_logs" id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) - user_id: Mapped[str | None] = mapped_column(ForeignKey("users.id")) # null for failed logins + # null for failed logins + user_id: Mapped[str | None] = mapped_column(ForeignKey("users.id")) # The name this account had, written when it is deleted. The username is # released on deletion and the row itself is tombstoned, so the join that # normally supplies the name would answer "deleted-3f9a1c" for exactly the @@ -390,7 +394,8 @@ class IPLog(Base): username: Mapped[str | None] = mapped_column(String(64)) event: Mapped[str] = mapped_column(String(32), nullable=False) ip_address: Mapped[str] = mapped_column(String(45), nullable=False) # IPv4 or IPv6 - detail: Mapped[str | None] = mapped_column(String(256)) # e.g. username on fail + # e.g. username on fail + detail: Mapped[str | None] = mapped_column(String(256)) timestamp: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now) user: Mapped["User | None"] = relationship(back_populates="ip_logs") diff --git a/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py b/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py index 429575f..1ef7796 100644 --- a/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py +++ b/packages/meshbay-hub/src/meshbay_hub/tasks/cleanup.py @@ -50,7 +50,8 @@ async def cleanup_loop(get_session): async with get_session() as db: deleted = await purge_old_ip_logs(db) if deleted: - log.info("Purged %d IP log entries older than %d days", deleted, RETENTION_DAYS) + log.info("Purged %d IP log entries older than %d days", + deleted, RETENTION_DAYS) expired = await purge_expired_verifications(db) if expired: log.info("Purged %d expired email verifications", expired) diff --git a/packages/meshbay-hub/tests/harness/boot_guard_probe.py b/packages/meshbay-hub/tests/harness/boot_guard_probe.py index 01751ba..b4a5e7c 100644 --- a/packages/meshbay-hub/tests/harness/boot_guard_probe.py +++ b/packages/meshbay-hub/tests/harness/boot_guard_probe.py @@ -83,7 +83,8 @@ const cases = []; const post = (o) => fetch('/log', { method: 'POST', body: JSON.stringify(o) }); addEventListener('error', (e) => post({ error: 'page error: ' + (e.message || e) })); addEventListener('unhandledrejection', - (e) => post({ error: 'rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason) })); + (e) => post({ error: 'rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason) })); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const add = (src) => { const f = document.createElement('iframe'); diff --git a/packages/meshbay-hub/tests/harness/menu_scroll_probe.py b/packages/meshbay-hub/tests/harness/menu_scroll_probe.py index 5fb9579..c4d3b87 100755 --- a/packages/meshbay-hub/tests/harness/menu_scroll_probe.py +++ b/packages/meshbay-hub/tests/harness/menu_scroll_probe.py @@ -48,7 +48,8 @@ import { Menu } from '/menu.js'; const LOGS = []; addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e))); addEventListener('unhandledrejection', - (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); + (e) => LOGS.push('rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const frame = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))); diff --git a/packages/meshbay-hub/tests/harness/music_grid_probe.py b/packages/meshbay-hub/tests/harness/music_grid_probe.py index 365e028..0cf65bc 100644 --- a/packages/meshbay-hub/tests/harness/music_grid_probe.py +++ b/packages/meshbay-hub/tests/harness/music_grid_probe.py @@ -100,7 +100,8 @@ import { MusicPlayerBar } from '/music-player.js'; const LOGS = []; addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e))); addEventListener('unhandledrejection', - (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); + (e) => LOGS.push('rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const waitFor = async (sel, tries = 60) => { @@ -209,7 +210,8 @@ const clickMenu = async (i) => { const last = rows[rows.length - 1]; const entry = { artist: label, top, heading: heading ? heading.textContent : null, - headingH: heading ? Math.round(heading.getBoundingClientRect().height) : null }; + headingH: heading + ? Math.round(heading.getBoundingClientRect().height) : null }; if (last && Math.abs(last.top - top) < 8) last.cells.push(entry); else rows.push({ top, cells: [entry] }); } diff --git a/packages/meshbay-hub/tests/harness/music_queue_probe.py b/packages/meshbay-hub/tests/harness/music_queue_probe.py index a9146ce..9138db9 100755 --- a/packages/meshbay-hub/tests/harness/music_queue_probe.py +++ b/packages/meshbay-hub/tests/harness/music_queue_probe.py @@ -99,7 +99,8 @@ import { MusicPlayerBar } from '/music-player.js'; const LOGS = []; addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e))); addEventListener('unhandledrejection', - (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); + (e) => LOGS.push('rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const waitFor = async (sel, tries = 60) => { diff --git a/packages/meshbay-hub/tests/harness/playlist_store_probe.py b/packages/meshbay-hub/tests/harness/playlist_store_probe.py index 6421426..9a54a0d 100755 --- a/packages/meshbay-hub/tests/harness/playlist_store_probe.py +++ b/packages/meshbay-hub/tests/harness/playlist_store_probe.py @@ -38,7 +38,8 @@ import { MANIFEST_KIND, bodyKind } from '/playlist-merge.js'; const LOGS = []; addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e))); addEventListener('unhandledrejection', - (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); + (e) => LOGS.push('rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); const USER = 'user-1'; const steps = []; @@ -95,7 +96,8 @@ function fakeNode() { await P.addTracks(USER, P.FAVORITES_ID, [track(9)], 'g1', 'Favoris'); steps.push({ step: 'after editing', - list: (await P.listPlaylists(USER)).map((p) => ({ id: p.id, name: p.name, count: p.count })) }); + list: (await P.listPlaylists(USER)) + .map((p) => ({ id: p.id, name: p.name, count: p.count })) }); steps.push({ step: 'tracks read back', tracks: (await P.getPlaylistTracks(USER, eveningId)).map((t) => ({ diff --git a/packages/meshbay-hub/tests/harness/playlist_ui_probe.py b/packages/meshbay-hub/tests/harness/playlist_ui_probe.py index f0fc9c3..b60baf6 100644 --- a/packages/meshbay-hub/tests/harness/playlist_ui_probe.py +++ b/packages/meshbay-hub/tests/harness/playlist_ui_probe.py @@ -98,7 +98,8 @@ import * as P from '/playlists.js'; const LOGS = []; addEventListener('error', (e) => LOGS.push('error: ' + (e.message || e))); addEventListener('unhandledrejection', - (e) => LOGS.push('rejection: ' + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); + (e) => LOGS.push('rejection: ' + + ((e.reason && (e.reason.stack || e.reason.message)) || e.reason))); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const waitFor = async (sel, tries = 60) => { @@ -253,7 +254,8 @@ const clickMenu = async (i) => { open.click(); await waitFor('.music-detail .music-tracklist'); steps.push({ step: 'loaded into the queue', - play: [...document.querySelectorAll('.music-detail .music-tracklist .music-track-title')] + play: [...document.querySelectorAll( + '.music-detail .music-tracklist .music-track-title')] .map((e) => e.textContent) }); document.querySelector('.music-detail .video-close').click(); await sleep(150); @@ -267,8 +269,10 @@ const clickMenu = async (i) => { await clickLabel('A2-t2'); await sleep(300); steps.push({ step: 'track removed', - lists: (await P.listPlaylists('u1')).map((p) => ({ name: p.name, count: p.count })), - tracks: (await P.getPlaylistTracks('u1', lists.find((p) => p.name === 'Soirée').id)) + lists: (await P.listPlaylists('u1')) + .map((p) => ({ name: p.name, count: p.count })), + tracks: (await P.getPlaylistTracks('u1', + lists.find((p) => p.name === 'Soirée').id)) .map((tr) => tr.display_title) }); // 6. Delete it. diff --git a/packages/meshbay-hub/tests/test_files_drop_upload.py b/packages/meshbay-hub/tests/test_files_drop_upload.py index 5dfaf23..fc15c47 100644 --- a/packages/meshbay-hub/tests/test_files_drop_upload.py +++ b/packages/meshbay-hub/tests/test_files_drop_upload.py @@ -66,7 +66,8 @@ def test_names_in_a_folder_count_files_folders_and_empty_folders(tmp_path, sourc {"path": "music/Album", "name": "t.flac"}, {"path": "musicals", "name": "not-here.txt"}] got = _run(tmp_path, source, - f"namesIn({json.dumps(entries)}, ['music/Empty', 'music/Album/cd1'], 'music').sort()") + f"namesIn({json.dumps(entries)}, " + f"['music/Empty', 'music/Album/cd1'], 'music').sort()") assert got == ["Album", "Empty", "a.mp3"] diff --git a/packages/meshbay-hub/tests/test_hook_ordering.py b/packages/meshbay-hub/tests/test_hook_ordering.py index 3c82bb0..d03cdf5 100644 --- a/packages/meshbay-hub/tests/test_hook_ordering.py +++ b/packages/meshbay-hub/tests/test_hook_ordering.py @@ -123,7 +123,8 @@ def test_the_check_would_notice(): # Inject a dependency on `last` into the first declaration's dep array. end = broken.index("\n }, [", decls[0].start()) close = broken.index("]", end) - broken = broken[:close] + (", " if broken[end + 7:close].strip() else "") + last + broken[close:] + broken = (broken[:close] + (", " if broken[end + 7:close].strip() else "") + + last + broken[close:]) declared_at = {m.group(1): m.start() for m in DECL.finditer(broken)} caught = False diff --git a/packages/meshbay-hub/tests/test_hub_api.py b/packages/meshbay-hub/tests/test_hub_api.py index 9b73701..2afd27b 100644 --- a/packages/meshbay-hub/tests/test_hub_api.py +++ b/packages/meshbay-hub/tests/test_hub_api.py @@ -260,7 +260,9 @@ async def test_group_member_add(client): "pk_user_ed25519": pk_ed, "pk_user_x25519": pk_x}) alice_token = (await client.post("/v1/users/login", - json={"username": "alice2_test", "password": "alicepass99"})).json()["access_token"] + json={"username": "alice2_test", + "password": "alicepass99"}) + ).json()["access_token"] a_hdrs = {"Authorization": f"Bearer {alice_token}"} @@ -298,9 +300,13 @@ async def test_non_admin_cannot_add_member(client): "pk_user_ed25519": pk_ed, "pk_user_x25519": pk_x}) charlie_token = (await client.post("/v1/users/login", - json={"username": "charlie_test", "password": "charliepass"})).json()["access_token"] + json={"username": "charlie_test", + "password": "charliepass"}) + ).json()["access_token"] dan_token = (await client.post("/v1/users/login", - json={"username": "dan_test", "password": "danpass1234"})).json()["access_token"] + json={"username": "dan_test", + "password": "danpass1234"}) + ).json()["access_token"] r = await client.post("/v1/groups", json={"name": "charlies-group"}, headers={"Authorization": f"Bearer {charlie_token}"}) @@ -338,7 +344,9 @@ async def test_jwt_contains_groups_claim(client): # Alice creates a group and adds Bob alice_token = (await client.post("/v1/users/login", - json={"username": "grp_alice", "password": "alicepass99"})).json()["access_token"] + json={"username": "grp_alice", + "password": "alicepass99"}) + ).json()["access_token"] r = await client.post("/v1/groups", json={"name": "testgroup"}, headers={"Authorization": f"Bearer {alice_token}"}) group_id = r.json()["group_id"] diff --git a/packages/meshbay-hub/tests/test_layout_measured.py b/packages/meshbay-hub/tests/test_layout_measured.py index a71b6b9..9bf1bde 100644 --- a/packages/meshbay-hub/tests/test_layout_measured.py +++ b/packages/meshbay-hub/tests/test_layout_measured.py @@ -178,7 +178,8 @@ GROUPED = textwrap.dedent(""" <button class="transfer-cancel">✕</button> </div> <div class="dl-progress"><div class="dl-fill" style="width:42%"></div></div> - <div class="transfer-meta"><span>210 MB / 493 MB</span><span>3.1 MB/s · 4 min left</span></div> + <div class="transfer-meta"><span>210 MB / 493 MB</span> + <span>3.1 MB/s · 4 min left</span></div> </div> </div> <div class="transfer-group"> @@ -190,7 +191,8 @@ GROUPED = textwrap.dedent(""" <button class="transfer-cancel">✕</button> </div> <div class="dl-progress dl-waiting"></div> - <div class="transfer-meta"><span>Waiting — your slots are busy</span><span>1.2 GB</span></div> + <div class="transfer-meta"><span>Waiting — your slots are busy</span> + <span>1.2 GB</span></div> </div> </div> </div> diff --git a/packages/meshbay-hub/tests/test_locales.py b/packages/meshbay-hub/tests/test_locales.py index 59ea2bf..602d161 100644 --- a/packages/meshbay-hub/tests/test_locales.py +++ b/packages/meshbay-hub/tests/test_locales.py @@ -158,7 +158,8 @@ def test_locale_resolution_is_region_aware(tmp_path): const out = {}; for (const tags of [['pt-BR'], ['pt'], ['zh-CN'], ['zh'], ['fr-CA'], ['de-AT'], ['ru', 'it'], ['ko']]) { - Object.defineProperty(globalThis, 'navigator', { value: { languages: tags, language: tags[0] }, configurable: true }); + Object.defineProperty(globalThis, 'navigator', + { value: { languages: tags, language: tags[0] }, configurable: true }); delete store.mb_lang; out[tags.join(',')] = await i18n.initLocale(); } @@ -186,7 +187,8 @@ def test_counted_string_picks_the_right_polish_form(tmp_path): setItem: (k, v) => { store[k] = v; }, }; globalThis.document = { documentElement: {} }; - Object.defineProperty(globalThis, 'navigator', { value: { languages: ['pl'], language: 'pl' }, configurable: true }); + Object.defineProperty(globalThis, 'navigator', + { value: { languages: ['pl'], language: 'pl' }, configurable: true }); const i18n = await import('./i18n.js'); await i18n.initLocale(); console.log(JSON.stringify( @@ -205,7 +207,8 @@ def test_interpolated_value_is_not_read_as_a_replacement_pattern(tmp_path): setItem: (k, v) => { store[k] = v; }, }; globalThis.document = { documentElement: {} }; - Object.defineProperty(globalThis, 'navigator', { value: { languages: ['en'], language: 'en' }, configurable: true }); + Object.defineProperty(globalThis, 'navigator', + { value: { languages: ['en'], language: 'en' }, configurable: true }); const i18n = await import('./i18n.js'); await i18n.initLocale(); console.log(JSON.stringify( diff --git a/packages/meshbay-hub/tests/test_memory_ceiling.py b/packages/meshbay-hub/tests/test_memory_ceiling.py index 1654825..5984292 100644 --- a/packages/meshbay-hub/tests/test_memory_ceiling.py +++ b/packages/meshbay-hub/tests/test_memory_ceiling.py @@ -246,11 +246,11 @@ def test_no_unguarded_memory_floor(target_fn): # definition out before looking. Comments go too — the branch that used to # be the bug is now described in one, and a test that reads prose is the # mistake already recorded in CLAUDE.md for the packaged systemd unit. - start = next(n for n, l in enumerate(lines) if "const _memoryFloor" in l) + start = next(n for n, ln in enumerate(lines) if "const _memoryFloor" in ln) end = next(n for n in range(start, len(lines)) if lines[n].strip() == "};") rest = lines[:start] + lines[end + 1:] - code = [re.sub(r"//.*$", "", l) for l in rest] - bare = [l.strip() for l in code if re.search(r"\breturn null\b", l)] + code = [re.sub(r"//.*$", "", ln) for ln in rest] + bare = [ln.strip() for ln in code if re.search(r"\breturn null\b", ln)] assert bare == [], ( "an unguarded in-memory fallback was added to _openDownloadTarget; " "return _memoryFloor() instead: " + "; ".join(bare)) diff --git a/packages/meshbay-hub/tests/test_notifications_behaviour.py b/packages/meshbay-hub/tests/test_notifications_behaviour.py index 67fd99e..4684d3f 100644 --- a/packages/meshbay-hub/tests/test_notifications_behaviour.py +++ b/packages/meshbay-hub/tests/test_notifications_behaviour.py @@ -35,7 +35,7 @@ async def test_chat_keeps_one_notification_per_group(client, db_session): """Forty messages are one line saying when the conversation last spoke.""" from meshbay_hub.api.notifications import create_notification - token = await _user(client, "listener") + await _user(client, "listener") owner = await _user(client, "talker_test") g = await client.post("/v1/groups", json={"name": "busy"}, headers={"Authorization": f"Bearer {owner}"}) diff --git a/packages/meshbay-hub/tests/test_transfers.py b/packages/meshbay-hub/tests/test_transfers.py index a776b50..9b65ca5 100644 --- a/packages/meshbay-hub/tests/test_transfers.py +++ b/packages/meshbay-hub/tests/test_transfers.py @@ -243,7 +243,10 @@ class L { acquire() { return this._wait; } release(reason) { if (!this.closed) { this.closed = true; this.released.push(reason); } } grant() { this.state = 'granted'; if (this._onState) this._onState(this); this._go(); } - push(state, ahead) { this.state = state; this.ahead = ahead; if (this._onState) this._onState(this); } + push(state, ahead) { + this.state = state; this.ahead = ahead; + if (this._onState) this._onState(this); + } } """ |