Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): report a bundled font face the renderer refuses without throwing

marcoteb6dfd4f752fed
diff --git a/mcp-host/src/workflow/__tests__/fonts.ready.test.ts b/mcp-host/src/workflow/__tests__/fonts.ready.test.ts
index aa31b07fb..ff37de708 100644
--- a/mcp-host/src/workflow/__tests__/fonts.ready.test.ts
+++ b/mcp-host/src/workflow/__tests__/fonts.ready.test.ts
@@ -32,4 +32,20 @@ describe('ensureFontsReady', () => {
fonts.ensureFontsReady()
expect(error).toHaveBeenCalledTimes(1)
})
+
+ it('reports a bundled face the renderer refuses without throwing', async () => {
+ vi.resetModules()
+ const { logger } = await import('../../logger')
+ const error = vi.spyOn(logger, 'error').mockImplementation(() => undefined)
+ // register answers null, not an error, for a face it cannot use.
+ vi.spyOn(GlobalFonts, 'register').mockImplementationOnce(() => null)
+ const fonts = await import('../fonts')
+
+ fonts.ensureFontsReady()
+ expect(error).toHaveBeenCalledTimes(1)
+ expect(error).toHaveBeenCalledWith(
+ expect.objectContaining({ err: expect.stringContaining('regular') }),
+ 'Bundled Roboto faces could not be loaded'
+ )
+ })
})
diff --git a/mcp-host/src/workflow/fonts.ts b/mcp-host/src/workflow/fonts.ts
index e95db94be..3d7293cf3 100644
--- a/mcp-host/src/workflow/fonts.ts
+++ b/mcp-host/src/workflow/fonts.ts
@@ -134,8 +134,13 @@ export function ensureFontsReady(): void {
ready = true
try {
const f = loadRobotoFaces()
- GlobalFonts.register(f.normal, CHART_FONT_FAMILY)
- GlobalFonts.register(f.bold, `${CHART_FONT_FAMILY} Bold`)
+ // register answers null, without throwing, for a face it cannot use.
+ if (!GlobalFonts.register(f.normal, CHART_FONT_FAMILY)) {
+ throw new Error('the renderer refused the regular face')
+ }
+ if (!GlobalFonts.register(f.bold, `${CHART_FONT_FAMILY} Bold`)) {
+ throw new Error('the renderer refused the bold face')
+ }
} catch (err) {
// The system faces still register, so charts draw in them rather than in nothing.
logger.error({ err: errorText(err) }, 'Bundled Roboto faces could not be loaded')