Skip to content

Show build-log and provider text in tooltips without printf formatting - #353

Merged
matt-edmondson merged 3 commits into
mainfrom
fix/348-tooltip-format
Oct 7, 2026
Merged

matt-edmondson merged 3 commits into
mainfrom
fix/348-tooltip-format

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #348

Before: the Errors cell tooltip and the provider status-bar tooltip passed their text to ImGui.SetTooltip(string). Hexa forwards that string to native igSetTooltip as a printf format with no arguments. Build-log errors often contain %s (GCC -Werror=format) or %VAR% (batch errors). Hovering one made vsnprintf read arguments that were never passed: at best garbage text, at worst a native access violation that kills the app.

After: both call sites go through a new Tooltip.Show(string), which draws the text with BeginTooltip / TextUnformatted / EndTooltip. The rest of the app already draws text this way. No ImGui.SetTooltip call is left in the repository.

RenderErrorsColumn and RenderProviderStatusBar are now internal instead of private, so tests can render them.

Tests

TooltipTests render in a headless ImGui context and compare vertex counts. Each visible glyph is one quad, so two strings of the same length with no spaces draw the same vertex count only when every character of both is drawn. A format pass collapses %% to % and drops a glyph.

  • Tooltip.Show: ab%% draws as many vertices as abcd, and '%%SIGNTOOL%%' as many as 'xxSIGNTOOLxx'.
  • Errors cell: with the mouse over the cell, the tooltip opens, and an error of ab%% draws as many vertices as abcd.
  • Provider status bar: the test registers a provider on AppData and puts the mouse over its status text. The tooltip opens, and a status message containing ab%% draws as many vertices as one containing abcd.

The tests don't use a bare %s. On the old code path it reads a missing argument and can crash the test host, which is the crash being fixed, and it can't be asserted on deterministically.

Each fix was checked by reverting it:

  • With Tooltip.Show calling ImGui.SetTooltip, the two Tooltip.Show tests fail.
  • With either call site calling ImGui.SetTooltip directly, its hover test fails.

Full suite: 94/94 passing locally on Linux.

Not in this PR: the triage comment suggests checking the org's other ImGui apps for the same pattern. That is left for separate issues in those repositories.

🤖 Generated with Claude Code

https://claude.ai/code/session_0118yDY82foMMXSZ6XaQmc4c

claude added 3 commits October 7, 2026 09:32
…atting [patch]

ImGui.SetTooltip(string) passes its argument to native igSetTooltip as a
printf format with no arguments, so an error line containing %s or a
%VAR% batch reference made vsnprintf read missing arguments: garbage
text, or a native access violation that kills the process on hover.

Both call sites that pass untrusted text (the Errors cell and the
provider status bar) now go through Tooltip.Show, which draws the text
with BeginTooltip/TextUnformatted/EndTooltip.

Fixes #348

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118yDY82foMMXSZ6XaQmc4c
The quality gate failed on coverage of new code: the two changed call
sites in BuildMonitor.cs were never executed by a test. The errors cell
renderer is now internal, and the per-provider part of the status bar is
extracted into RenderProviderStatus, so the tests can render each in a
headless ImGui frame with the mouse over it. Each test checks that the
tooltip opens and that a "%%" message draws every character.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118yDY82foMMXSZ6XaQmc4c
Moving the loop body into RenderProviderStatus re-indented lines the
diff then counted as new, and the remaining loop in
RenderProviderStatusBar was never run by a test, so coverage on new code
fell. The extraction is undone; RenderProviderStatusBar is internal, and
the test registers a provider on AppData and renders the bar itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118yDY82foMMXSZ6XaQmc4c
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit cefe325 into main Oct 7, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/348-tooltip-format branch October 7, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hovering an Errors cell passes build-log text to ImGui.SetTooltip as a printf format, so an error containing "%s" crashes the app

2 participants