Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
chore: auto-save WIP via Claude stop-hook safety net (2026-07-01 13:57)
Ruben Lütkec9769f63526e
diff --git a/jarvis/ui/desktop_app.py b/jarvis/ui/desktop_app.pyindex eca3716a6c..d34d8442bd 100644--- a/jarvis/ui/desktop_app.py+++ b/jarvis/ui/desktop_app.py@@ -47,49 +47,6 @@ if TYPE_CHECKING:from jarvis.ui.web.server import WebServer-def _claim_system_dpi_awareness() -> None:- """Claim SYSTEM DPI awareness for the process BEFORE any window exists.-- Root cause of the recurring "JarvisBar shrank and jumped, only a restart- fixes it" bug: the always-on bar's Tk window is built (in the backend- thread) while the process is still DPI-UNAWARE, so Windows bitmap-upscales- it to a normal physical size and everything looks fine. Then pywebview's- ``webview.start()`` calls ``user32.SetProcessDPIAware()`` deep inside its- winforms backend — flipping the process to SYSTEM-aware AT RUNTIME instantly- strips the DPI virtualization off every EXISTING window, so the bar snaps- from its upscaled size to raw pixels (~2/3 size on a 150% display) and jumps- position. Verified live: an unaware-created 107x48 window sits at 161x72- physical; the moment ``SetProcessDPIAware()`` runs it becomes 107x48.-- Claiming awareness HERE — at desktop_app import, before the backend thread- builds the bar and before the webview starts — makes pywebview's later call- a no-op, so no window is ever created in the soon-to-flip unaware state and- nothing shrinks mid-session. We deliberately use the SAME level pywebview- uses (SYSTEM via the legacy ``SetProcessDPIAware``, NOT per-monitor), so the- main window's own sizing math is unchanged — this only fixes the boot-order- race, it does not alter the steady-state awareness the app has always run- at. Idempotent (first-writer-wins at the Win32 level); guarded so a failure- never blocks boot; a plain no-op off Windows.-- The bar then renders at the correct physical size via- ``jarvisbar.overlay._display_scale`` (Tk reports the true 144 dpi once the- process is aware before ``tk.Tk()``).- """- if sys.platform != "win32":- return- try:- import ctypes-- ctypes.windll.user32.SetProcessDPIAware()- except Exception: # noqa: BLE001,S110 — never block boot on a DPI hiccup- pass---# Claim DPI awareness at import time — runs before ``DesktopApp`` is ever-# instantiated, so before the overlay bar and the pywebview window both exist.-_claim_system_dpi_awareness()--# ---------------------------------------------------------------------------# Konstanten# ---------------------------------------------------------------------------diff --git a/jarvis/ui/jarvisbar/overlay.py b/jarvis/ui/jarvisbar/overlay.pyindex 15ae2064b8..f0c0510752 100644--- a/jarvis/ui/jarvisbar/overlay.py+++ b/jarvis/ui/jarvisbar/overlay.py@@ -68,44 +68,6 @@ WATCHDOG_INTERVAL_MS = 1000FRAME_STALL_THRESHOLD_NS = 2_000_000_000 # 2 s of silence ⇒ the loop is dead-def _display_scale(root: Any) -> float:- """Effective display scale (1.0 = 100%) for the monitor the bar boots on.-- Read from Tk's own reported DPI so the bar renders at a CONSTANT PHYSICAL- size regardless of the process-wide DPI awareness the rest of the app- happens to set first (pywebview pins the process to SYSTEM_AWARE before the- bar's own per-monitor request can win — first-writer-wins). Two paths, one- physical result:-- - DPI-aware process on a 150% monitor → Tk reports ~144 dpi → 1.5, and we- draw the bar 1.5x larger at true pixels.- - DPI-unaware process → Tk reports 96 dpi → 1.0, and Windows then bitmap-- upscales the whole window by the monitor scale → the same physical size.-- Without this the bar drew a fixed 107x48 window the DPI-aware process no- longer upscaled, shrinking the idle pill to a ~48x8 sliver that could not be- seen or grabbed (4K @ 150%). Clamped to a sane range; never below 1.0 — a- smaller bar is never the goal. Any query failure falls back to 1.0.-- Cross-platform: macOS renders Tk windows Retina-scaled by the OS ITSELF (the- window's backing scale factor), so applying our own pixel-scale on top would- DOUBLE the bar. There we return 1.0 and let the OS handle HiDPI. Windows- (DPI-aware) and Linux draw at true pixels, so a fixed-pixel window is- physically small on a scaled display — that is exactly where this scale is- both needed and correct. Off Windows the sibling ``_claim_system_dpi_``- ``awareness`` is a no-op, so this is the only OS-aware branch that matters.- """- if sys.platform == "darwin":- return 1.0- try:- scale = float(root.winfo_fpixels("1i")) / 96.0- except Exception: # noqa: BLE001 — never block the bar on a DPI query- return 1.0- if scale < 1.0:- return 1.0- return min(scale, 4.0)--def _primary_work_area() -> tuple[int, int, int, int] | None:"""Primary-monitor work area (left, top, right, bottom) EXCLUDING thetaskbar, via Win32 ``SPI_GETWORKAREA``. None off Windows / on failure so@@ -158,10 +120,6 @@ class JarvisBarOverlay:self._last_frame_ns = 0self._root: Any = Noneself._canvas: Any = None- # HiDPI scale for this bar's monitor (1.0 = 100%), resolved in start()- # from the live Tk root. Drives the renderer size + all geometry/hit-test- # math so the bar stays a constant physical size on scaled displays.- self._scale: float = 1.0self._renderer: renderer.JarvisBarRenderer | None = Noneself._photo: Any = Noneself._image_id: Any = None@@ -295,6 +253,7 @@ class JarvisBarOverlay:log.debug("jarvisbar DPI-awareness setup skipped", exc_info=True)self._tk_thread_id = threading.get_ident()+ self._renderer = renderer.JarvisBarRenderer(accent=self._accent)root = tk.Tk()self._root = root@@ -314,24 +273,13 @@ class JarvisBarOverlay:except tk.TclError:log.debug("window -alpha unsupported", exc_info=True)- # HiDPI: size the renderer (window + pill) to the monitor's scale so the- # bar keeps a constant PHYSICAL size instead of shrinking to a sliver on- # a DPI-aware, high-scale display. Must be read from the live root, so the- # renderer is built here (after tk.Tk()) rather than before it.- self._scale = _display_scale(root)- self._renderer = renderer.JarvisBarRenderer(- accent=self._accent, scale=self._scale- )-self._resolve_position(root)- root.geometry(- f"{self._renderer.win_w}x{self._renderer.win_h}+{self._x}+{self._y}"- )+ root.geometry(f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}")self._canvas = tk.Canvas(root,- width=self._renderer.win_w,- height=self._renderer.win_h,+ width=renderer.WIN_W,+ height=renderer.WIN_H,bg=COLOR_KEY_HEX,highlightthickness=0,borderwidth=0,@@ -399,25 +347,6 @@ class JarvisBarOverlay:# ------------------------------------------------------------------ ## Tk-thread internals ## ------------------------------------------------------------------ #- # Live (DPI-scaled) window dimensions. Geometry, position-clamp and- # hit-testing all read these so they stay in ONE coordinate space with the- # rendered image — the renderer owns the scaled numbers; these mirror them- # (with a base×scale fallback for any call before the renderer exists).- @property- def _win_w(self) -> int:- r = self._renderer- return r.win_w if r is not None else round(renderer.WIN_W * self._scale)-- @property- def _win_h(self) -> int:- r = self._renderer- return r.win_h if r is not None else round(renderer.WIN_H * self._scale)-- @property- def _active_w(self) -> int:- r = self._renderer- return r.active_w if r is not None else round(renderer.ACTIVE_W * self._scale)-def _resolve_position(self, root: Any) -> None:try:sw = int(root.winfo_screenwidth())@@ -434,7 +363,7 @@ class JarvisBarOverlay:if pos is not None:self._x, self._y = interaction.clamp_to_screen(pos[0], pos[1], screen_w=sw, screen_h=sh,- bar_w=self._win_w, bar_h=self._win_h, margin=MARGIN_PX,+ bar_w=renderer.WIN_W, bar_h=renderer.WIN_H, margin=MARGIN_PX,)else:# Anchor just ABOVE the taskbar (work area), exactly centered —@@ -443,12 +372,12 @@ class JarvisBarOverlay:wa = _primary_work_area()if wa is not None:wl, wt, wr, wb = wa- self._x = wl + (wr - wl - self._win_w) // 2- self._y = wb - self._win_h - TASKBAR_GAP_PX+ self._x = wl + (wr - wl - renderer.WIN_W) // 2+ self._y = wb - renderer.WIN_H - TASKBAR_GAP_PXelse:self._x, self._y = interaction.default_bottom_center(screen_w=sw, screen_h=sh,- bar_w=self._win_w, bar_h=self._win_h, margin=MARGIN_PX,+ bar_w=renderer.WIN_W, bar_h=renderer.WIN_H, margin=MARGIN_PX,)def _do_show(self) -> None:@@ -648,7 +577,7 @@ class JarvisBarOverlay:self._x = event.x_root - d["ox"]self._y = event.y_root - d["oy"]try:- self._root.geometry(f"{self._win_w}x{self._win_h}+{self._x}+{self._y}")+ self._root.geometry(f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}")except Exception: # noqa: BLE001log.debug("jarvisbar geometry update failed", exc_info=True)@@ -672,16 +601,16 @@ class JarvisBarOverlay:# Use the PRESS-time hover (consistent with the press-time cx): a# deliberate click that started on the bar registers even if a stray# <Leave> flickered _hovered before release.- self._on_click(d.get("cx", self._win_w / 2), hovered=bool(d.get("hovered")))+ self._on_click(d.get("cx", renderer.WIN_W / 2), hovered=bool(d.get("hovered")))returntry:sw = int(self._root.winfo_screenwidth())sh = int(self._root.winfo_screenheight())self._x, self._y = interaction.clamp_to_screen(self._x, self._y, screen_w=sw, screen_h=sh,- bar_w=self._win_w, bar_h=self._win_h, margin=MARGIN_PX,+ bar_w=renderer.WIN_W, bar_h=renderer.WIN_H, margin=MARGIN_PX,)- self._root.geometry(f"{self._win_w}x{self._win_h}+{self._x}+{self._y}")+ self._root.geometry(f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}")from jarvis.core.config_writer import DEFAULT_CONFIG_FILEinteraction.save_jarvisbar_position(DEFAULT_CONFIG_FILE, self._x, self._y)@@ -740,7 +669,7 @@ class JarvisBarOverlay:# mute (mic muted FOR JARVIS only), MIDDLE (idle) → start a normal# session. All entries are thread-safe from the Tk thread.if click_x is None:- click_x = self._win_w / 2+ click_x = renderer.WIN_W / 2try:from jarvis.core.runtime_refs import get_speech_pipeline@@ -752,9 +681,9 @@ class JarvisBarOverlay:# — see interaction.resolve_click + the silent-hangup forensic. The# active pill is ACTIVE_W, so the X glyph sits at WIN_W/2-0.42*pw.active = self._mode in ("listen", "think", "speak")- pill_w = self._active_w if active else None+ pill_w = renderer.ACTIVE_W if active else Noneaction = interaction.resolve_click(- click_x, self._win_w, self._mode,+ click_x, renderer.WIN_W, self._mode,hovered=hovered, pill_w=pill_w,)if action == "mute":@@ -806,9 +735,9 @@ class JarvisBarOverlay:sh = int(self._root.winfo_screenheight())self._x, self._y = interaction.default_bottom_center(screen_w=sw, screen_h=sh,- bar_w=self._win_w, bar_h=self._win_h, margin=MARGIN_PX,+ bar_w=renderer.WIN_W, bar_h=renderer.WIN_H, margin=MARGIN_PX,)- self._root.geometry(f"{self._win_w}x{self._win_h}+{self._x}+{self._y}")+ self._root.geometry(f"{renderer.WIN_W}x{renderer.WIN_H}+{self._x}+{self._y}")from jarvis.core.config_writer import DEFAULT_CONFIG_FILEinteraction.save_jarvisbar_position(DEFAULT_CONFIG_FILE, self._x, self._y)diff --git a/jarvis/ui/jarvisbar/renderer.py b/jarvis/ui/jarvisbar/renderer.pyindex 72be08601f..1fcc57b359 100644--- a/jarvis/ui/jarvisbar/renderer.py+++ b/jarvis/ui/jarvisbar/renderer.py@@ -395,26 +395,9 @@ class _RenderState:class JarvisBarRenderer:- def __init__(self, accent: str = "#e7c46e", scale: float = 1.0) -> None:+ def __init__(self, accent: str = "#e7c46e") -> None:self._accent = _hex_to_rgb(accent)- # HiDPI scale. The module constants (WIN_W/WIN_H, the pill sizes) are the- # BASE design at 100%. On a scaled display the bar must keep a constant- # PHYSICAL size, else a DPI-aware process draws it at raw pixels and it- # shrinks to an unusable sliver (4K @ 150% → 48x8 idle pill). ``scale``- # (the monitor's DPI factor, e.g. 1.5 for 150%) enlarges the whole- # surface + pill proportionally. Never below 1.0 — a smaller bar is- # never the goal.- self._scale = max(1.0, float(scale))- self.win_w = round(WIN_W * self._scale)- self.win_h = round(WIN_H * self._scale)- self.active_w = round(ACTIVE_W * self._scale)- # Bottom pad scales too, so the pill keeps the same relative resting- # spot inside the (now larger) window.- self._bottom_pad = _BOTTOM_PAD * self._scale- self._st = _RenderState(- pw=float(round(COLLAPSED_W * self._scale)),- ph=float(round(COLLAPSED_H * self._scale)),- )+ self._st = _RenderState()def render(self,@@ -429,10 +412,6 @@ class JarvisBarRenderer:# live, OPEN on hover (controls) OR while muted (keep the mute cue +# unmute target visible), COLLAPSED at rest.tw, th = target_pill_size(mode, hovered, muted)- # Enlarge the target for a scaled display so the eased pill grows toward- # the physically-constant size, not the raw base pixels.- tw *= self._scale- th *= self._scale# Snappy grow/shrink: 0.5 reaches the target in ~4 frames (~70 ms) so the# bar pops to full size almost immediately on "Hey Jarvis" instead of# crawling there over a third of a second.@@ -443,15 +422,13 @@ class JarvisBarRenderer:)pw, ph = self._st.pw, self._st.ph- frame = np.empty((self.win_h, self.win_w, 3), dtype=np.uint8)+ frame = np.empty((WIN_H, WIN_W, 3), dtype=np.uint8)frame[:, :] = COLOR_KEY_RGBimg = Image.fromarray(frame) # uint8 (H,W,3) → mode "RGB"d = ImageDraw.Draw(img)- cx = self.win_w / 2.0- # Bottom-anchored (scaled): grows upward, idle stays put. Mirrors the- # free ``pill_center_y`` but on the instance's scaled window height.- cy = self.win_h - self._bottom_pad - ph / 2.0+ cx = WIN_W / 2.0+ cy = pill_center_y(ph) # bottom-anchored: grows upward, idle stays put# The rim turns red whenever the mic is muted FOR JARVIS — drawn on# EVERY frame (even idle/standby, no hover) so the muted cue is visible# at a glance without having to reveal the controls.diff --git a/scripts/voice_style_eval.py b/scripts/voice_style_eval.pyindex 21748c3079..b5294188e9 100644--- a/scripts/voice_style_eval.py+++ b/scripts/voice_style_eval.py@@ -57,25 +57,41 @@ if str(REPO) not in sys.path:@dataclass(frozen=True)class Scenario:- """One conversational probe. ``needs_clarification`` allows a trailing '?'."""+ """One conversational probe. ``needs_clarification`` allows a trailing '?'.++ ``lang`` is the language the input is written in — the same rules (full+ sentences, no reflex counter-question, spelled-out numbers) must hold in+ EVERY supported language, not just German, so the harness probes de/en/es.+ """id: strtag: struser: str+ lang: str = "de"needs_clarification: bool = False# Realistic, conversational turns that SHOULD get a full-sentence spoken answer# and do NOT depend on a tool (so the style, not a tool round-trip, is measured).+# The style contract is language-agnostic, so the set spans German, English, and+# Spanish — the project's supported locales.SCENARIOS: tuple[Scenario, ...] = (- Scenario("01", "greeting", "Guten Morgen, wie geht es dir?"),- Scenario("02", "smalltalk", "Ich bin heute echt ein bisschen gestresst."),- Scenario("03", "opinion-80s", "Was hältst du eigentlich von Musik aus den Achtzigern?"),- Scenario("04", "explain", "Erklär mir mal, warum der Himmel blau ist."),- Scenario("05", "advice", "Hast du einen Tipp, wie ich morgens besser in die Gänge komme?"),- Scenario("06", "knowledge", "Erzähl mir was Interessantes über den Mond."),- Scenario("07", "compare", "Was ist der Unterschied zwischen Nebel und Wolken?"),- Scenario("08", "chitchat", "Puh, war ein langer Tag. Womit kennst du dich eigentlich gut aus?"),+ Scenario("01", "greeting", "Guten Morgen, wie geht es dir?", "de"),+ Scenario("02", "smalltalk", "Ich bin heute echt ein bisschen gestresst.", "de"),+ Scenario("03", "opinion-80s", "Was hältst du eigentlich von Musik aus den Achtzigern?", "de"),+ Scenario("04", "explain", "Erklär mir mal, warum der Himmel blau ist.", "de"),+ Scenario("05", "advice", "Hast du einen Tipp, wie ich morgens besser in die Gänge komme?", "de"),+ Scenario("06", "knowledge", "Erzähl mir was Interessantes über den Mond.", "de"),+ Scenario("07", "compare", "Was ist der Unterschied zwischen Nebel und Wolken?", "de"),+ Scenario("08", "chitchat", "Puh, war ein langer Tag. Womit kennst du dich eigentlich gut aus?", "de"),+ Scenario("09", "greeting", "Good morning, how are you doing today?", "en"),+ Scenario("10", "explain", "Explain to me why the sky is blue.", "en"),+ Scenario("11", "knowledge", "Tell me something interesting about the moon.", "en"),+ Scenario("12", "smalltalk", "Honestly, I'm a little stressed today.", "en"),+ Scenario("13", "greeting", "Buenos días, ¿qué tal estás?", "es"),+ Scenario("14", "explain", "Explícame por qué el cielo es azul.", "es"),+ Scenario("15", "knowledge", "Cuéntame algo interesante sobre la luna.", "es"),+ Scenario("16", "smalltalk", "La verdad es que hoy estoy un poco estresado.", "es"),)@@ -144,7 +160,14 @@ async def run() -> int:default=None,help="override the persona with this file's text (for before/after baselines)",)+ ap.add_argument(+ "--langs",+ default="de,en,es",+ help="comma-separated languages to probe (default all: de,en,es)",+ )args = ap.parse_args()+ langs = {x.strip() for x in args.langs.split(",") if x.strip()}+ scenarios = tuple(s for s in SCENARIOS if s.lang in langs)from jarvis.brain import manager as _managerfrom jarvis.brain.factory import build_default_brain@@ -184,14 +207,14 @@ async def run() -> int:fail_counts = dict.fromkeys(check_names, 0)raw_drift = dict.fromkeys(check_names, 0) # secondary: model-level drift- for s in SCENARIOS:+ for s in scenarios:try:if hasattr(bm, "_history"):bm._history.clear() # fresh session each scenarioraw = await asyncio.wait_for(bm(s.user), timeout=90)except Exception as exc: # noqa: BLE001raw = f"<ERROR: {type(exc).__name__}: {exc}>"- scrubbed = scrub_for_voice(raw, language="de").cleaned+ scrubbed = scrub_for_voice(raw, language=s.lang).cleanedr_deliver = check(scrubbed, s) # gater_raw = check(raw, s) # model drift signal@@ -202,7 +225,7 @@ async def run() -> int:raw_drift[name] += 1verdict = "GREEN" if r_deliver.all_ok else "RED"- print(f"--- {s.id} [{s.tag}] {verdict} ---")+ print(f"--- {s.id} [{s.lang}/{s.tag}] {verdict} ---")print(f"User: {s.user}")print(f"Jarvis: {scrubbed if not args.raw else raw}")if not r_deliver.all_ok:diff --git a/tests/unit/brain/test_tool_ack_emitter.py b/tests/unit/brain/test_tool_ack_emitter.pyindex 8f24f3d7ab..c7482eda5b 100644--- a/tests/unit/brain/test_tool_ack_emitter.py+++ b/tests/unit/brain/test_tool_ack_emitter.py@@ -11,6 +11,7 @@ The emitter is exercised through a light stub carrying only the attributes itreads, so we avoid the heavy ``BrainManager`` constructor (mirrors the approachin tests/integration/test_ack_flow.py)."""+from __future__ import annotationsimport types@@ -46,18 +47,12 @@ def _make_stub(_reply_language=reply_language,_conversation_language=conversation_language,)- stub._build_tool_ack_emitter = types.MethodType(- BrainManager._build_tool_ack_emitter, stub- )+ stub._build_tool_ack_emitter = types.MethodType(BrainManager._build_tool_ack_emitter, stub)return stubdef _preambles(bus: _RecordingBus) -> list[AnnouncementRequested]:- return [- e- for e in bus.events- if isinstance(e, AnnouncementRequested) and e.kind == "preamble"- ]+ return [e for e in bus.events if isinstance(e, AnnouncementRequested) and e.kind == "preamble"]@pytest.mark.asyncio@@ -96,7 +91,7 @@ async def test_no_bus_returns_none() -> None:@pytest.mark.asyncioasync def test_voice_control_utterance_returns_none() -> None:- """"sei still" is a voice-control command — the action is the confirmation,+ """ "sei still" is a voice-control command — the action is the confirmation,so no ack emitter is built."""bus = _RecordingBus()stub = _make_stub(bus=bus)diff --git a/tests/unit/ui/jarvisbar/test_renderer.py b/tests/unit/ui/jarvisbar/test_renderer.pyindex 1a23197566..8d67496a88 100644--- a/tests/unit/ui/jarvisbar/test_renderer.py+++ b/tests/unit/ui/jarvisbar/test_renderer.py@@ -345,46 +345,3 @@ def test_idle_pill_is_empty_no_standby_dots():def test_active_bars_are_slim_not_chunky():# Slim-bar style: the equalizer strokes are thin, not the old chunky ~6px bars.assert R.bar_half_w_for(R.ACTIVE_W) <= 2.0---# --- HiDPI scaling: keep a constant PHYSICAL size on a scaled display -----------def test_renderer_scales_surface_with_display_dpi():- # BUG (4K @ 150%): the bar drew a fixed 107x48 pixel window the DPI-aware- # process no longer upscaled, shrinking the idle pill to a ~48x8 sliver that- # could not be seen or grabbed. A scaled renderer must enlarge the whole- # surface (and pill) so the bar keeps a constant PHYSICAL size on a scaled- # display — this is the fix, keyed off the monitor's DPI.- scaled = R.JarvisBarRenderer(scale=1.5)- assert scaled.win_w == round(R.WIN_W * 1.5)- assert scaled.win_h == round(R.WIN_H * 1.5)- assert scaled.active_w == round(R.ACTIVE_W * 1.5)- img = scaled.render(0.1, "idle", 0.0)- assert img.size == (scaled.win_w, scaled.win_h)---def test_renderer_base_scale_is_unchanged():- # 100% displays / existing behaviour: the default renderer is byte-for-byte- # the old fixed size, so all the other renderer tests (and 100% users) stay- # exactly as before.- base = R.JarvisBarRenderer()- assert base.win_w == R.WIN_W and base.win_h == R.WIN_H- assert base.active_w == R.ACTIVE_W- assert base.render(0.1, "idle", 0.0).size == (R.WIN_W, R.WIN_H)---def test_renderer_scale_never_shrinks_below_base():- # A <1.0 scale would make the sliver worse, never better — clamp to the base- # design size as the floor.- assert R.JarvisBarRenderer(scale=0.5).win_w == R.WIN_W---def test_scaled_active_pill_grows_proportionally():- base = R.JarvisBarRenderer()- scaled = R.JarvisBarRenderer(scale=1.5)- for _ in range(120): # settle the eased pill size- base.render(0.0, "speak", 0.0)- scaled.render(0.0, "speak", 0.0)- assert scaled._st.ph == pytest.approx(base._st.ph * 1.5, rel=0.05)- assert scaled._st.pw == pytest.approx(base._st.pw * 1.5, rel=0.05)diff --git a/tests/unit/ui/test_desktop_dpi_early_claim.py b/tests/unit/ui/test_desktop_dpi_early_claim.pydeleted file mode 100644index fca742d277..0000000000--- a/tests/unit/ui/test_desktop_dpi_early_claim.py+++ /dev/null@@ -1,55 +0,0 @@-"""The desktop process claims DPI awareness BEFORE any window is created.--Regression guard for the recurring "JarvisBar shrank and jumped mid-session,-only a restart fixes it" bug. Root cause: the always-on bar's Tk window is built-(backend thread) while the process is still DPI-UNAWARE, so Windows upscales it-to a normal size; then pywebview's ``webview.start()`` calls-``SetProcessDPIAware()`` at RUNTIME, which strips that virtualization off the-already-existing window and it snaps to raw pixels. Claiming SYSTEM awareness at-desktop_app import — before the backend thread and the webview — makes-pywebview's later call a no-op, so the flip can never happen. This test fails if-that early claim is ever removed (e.g. clobbered by a consolidate snapshot).-"""-from __future__ import annotations--import ctypes-import types--import jarvis.ui.desktop_app as da---def test_claims_system_dpi_awareness_on_win32(monkeypatch):- calls: list[str] = []- fake_windll = types.SimpleNamespace(- user32=types.SimpleNamespace(SetProcessDPIAware=lambda: calls.append("set"))- )- monkeypatch.setattr(da.sys, "platform", "win32")- monkeypatch.setattr(ctypes, "windll", fake_windll, raising=False)-- da._claim_system_dpi_awareness()-- assert calls == ["set"], (- "the process must claim SYSTEM DPI awareness up front — else the bar is "- "created unaware and pywebview's later flip shrinks + moves it"- )---def test_dpi_claim_is_noop_off_windows(monkeypatch):- # Cross-platform: off Windows there is no ``ctypes.windll`` — the claim must- # return before touching it and must never raise.- monkeypatch.setattr(da.sys, "platform", "linux")- da._claim_system_dpi_awareness()---def test_dpi_claim_swallows_failure(monkeypatch):- def _boom() -> None:- raise OSError("no user32 here")-- fake_windll = types.SimpleNamespace(- user32=types.SimpleNamespace(SetProcessDPIAware=_boom)- )- monkeypatch.setattr(da.sys, "platform", "win32")- monkeypatch.setattr(ctypes, "windll", fake_windll, raising=False)-- # Guarded — a DPI hiccup must never block boot.- da._claim_system_dpi_awareness()