From ca37a690cacba4453ee23fd1e4e31857abf1eb02 Mon Sep 17 00:00:00 2001 From: Bryce Zuccaro Date: Fri, 14 Aug 2026 12:09:57 -0600 Subject: [PATCH] fix: render in-flight count as static white (remove blink pulse) --- src/actions/inflight-monitor.ts | 21 +-------------------- src/lib/render.ts | 4 +--- tests/render.test.ts | 27 +++++++++++++-------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/actions/inflight-monitor.ts b/src/actions/inflight-monitor.ts index f9cd128..0e6628f 100644 --- a/src/actions/inflight-monitor.ts +++ b/src/actions/inflight-monitor.ts @@ -19,8 +19,6 @@ type InflightState = { settings: InflightSettings; action?: KeyAction; unsubscribe?: () => void; - pulseTimer?: ReturnType; - pulse: boolean; history: number[]; sampler?: ReturnType; }; @@ -34,7 +32,7 @@ export class InflightMonitor extends SingletonAction { private stateFor(action: KeyAction): InflightState { let state = this.states.get(action.id); if (!state) { - state = { settings: {}, pulse: false, history: [] }; + state = { settings: {}, history: [] }; this.states.set(action.id, state); } return state; @@ -57,7 +55,6 @@ export class InflightMonitor extends SingletonAction { state.unsubscribe?.(); if (state.sampler) clearInterval(state.sampler); state.sampler = undefined; - this.clearPulse(state); this.states.delete(ev.action.id); } @@ -89,26 +86,10 @@ export class InflightMonitor extends SingletonAction { state: trackerState, count, offline, - pulse: state.pulse, history: state.history, }), ), ); - - if (trackerState === "ready" && count > 0 && !state.pulseTimer) { - state.pulseTimer = setInterval(() => { - state.pulse = !state.pulse; - this.render(state); - }, 500); - } else if (!(trackerState === "ready" && count > 0) && state.pulseTimer) { - this.clearPulse(state); - } - } - - private clearPulse(state: InflightState): void { - if (state.pulseTimer) clearInterval(state.pulseTimer); - state.pulseTimer = undefined; - state.pulse = false; } private sample(state: InflightState): void { diff --git a/src/lib/render.ts b/src/lib/render.ts index 675a853..6724a8a 100644 --- a/src/lib/render.ts +++ b/src/lib/render.ts @@ -19,7 +19,6 @@ export interface InflightRenderOptions { state?: ModelRuntimeState; count: number; offline: boolean; - pulse: boolean; history?: number[]; } @@ -49,11 +48,10 @@ export function renderInflight(opts: InflightRenderOptions): string { const bg = opts.state === "ready" ? (isActive ? "#8b2626" : "#1e6b34") : opts.state === "loading" ? "#8a6d1d" : "#3a3a3a"; const center = isActive ? `${opts.count}` : opts.state === "ready" ? "IDLE" : opts.state === "loading" ? "LOADING" : "OFF"; const centerSize = isActive ? 24 : 16; - const opacity = isActive && opts.pulse ? 0.55 : 1; const parts: string[] = [ centerText(name, 12, 7, "normal", "#ffffff"), - centerText(center, 40, centerSize, "bold", "#ffffff", opacity), + centerText(center, 40, centerSize, "bold", "#ffffff"), ]; if (opts.state === "ready") { diff --git a/tests/render.test.ts b/tests/render.test.ts index 2a013c5..0e2685f 100644 --- a/tests/render.test.ts +++ b/tests/render.test.ts @@ -8,14 +8,14 @@ test("svgDataUrl wraps an SVG as a base64 data URL", () => { }); test("renderInflight: ready + count renders IDLE in green", () => { - const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 0, offline: false, pulse: false }); + const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 0, offline: false }); assert.match(svg, /IDLE/); assert.match(svg, /#1e6b34/); assert.doesNotMatch(svg, /ACTIVE/); }); test("renderInflight: ready + count>0 renders the count number on red", () => { - const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 2, offline: false, pulse: false }); + const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 2, offline: false }); assert.match(svg, /2/); assert.match(svg, /#8b2626/); assert.doesNotMatch(svg, /ACTIVE/); @@ -23,40 +23,39 @@ test("renderInflight: ready + count>0 renders the count number on red", () => { }); test("renderInflight: idle state does not show a count number", () => { - const svg = renderInflight({ modelName: "A", state: "ready", count: 0, offline: false, pulse: false }); + const svg = renderInflight({ modelName: "A", state: "ready", count: 0, offline: false }); assert.match(svg, /IDLE/); assert.doesNotMatch(svg, /font-size="24"/); }); test("renderInflight: draws a count-trend spark when history has 2+ samples", () => { - const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [0, 1, 2, 1] }); + const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, history: [0, 1, 2, 1] }); assert.match(svg, / { - const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [1] }); + const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, history: [1] }); assert.doesNotMatch(svg, / { - const a = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false }); - const b = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: true }); - assert.notEqual(a, b); - assert.match(b, /opacity="0.55"/); +test("renderInflight: active count is static white (no blink opacity)", () => { + const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false }); + assert.match(svg, />1 { - const offline = renderInflight({ modelName: "A", state: "ready", count: 0, offline: true, pulse: false }); + const offline = renderInflight({ modelName: "A", state: "ready", count: 0, offline: true }); assert.match(offline, /OFFLINE/); - const noModel = renderInflight({ modelName: "unset", state: undefined, count: 0, offline: false, pulse: false }); + const noModel = renderInflight({ modelName: "unset", state: undefined, count: 0, offline: false }); assert.match(noModel, /NO MODEL/); }); test("renderInflight: loading renders LOADING in amber", () => { - const svg = renderInflight({ modelName: "A", state: "loading", count: 0, offline: false, pulse: false }); + const svg = renderInflight({ modelName: "A", state: "loading", count: 0, offline: false }); assert.match(svg, /LOADING/); assert.match(svg, /#8a6d1d/); });