Skip to content

fix(chartgen): grow the canvas for a caption a few lines over budget - #176

Merged
zannis merged 1 commit into
mainfrom
zannis/fix/chartgen-six-backend-caption
Sep 8, 2026
Merged

fix(chartgen): grow the canvas for a caption a few lines over budget#176
zannis merged 1 commit into
mainfrom
zannis/fix/chartgen-six-backend-caption

Conversation

@zannis

@zannis zannis commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

The six-backend results document (in-process, Kafka, NATS, RabbitMQ, Redis, SQS) does not render: the parallel-vs-sequenced family's caption carries 23 lines against the base canvas's budget of 21, and chartgen refuses the chart. #164 and #165 bought caption lines back by grouping and trimming notes; a sixth backend and its deviation notes spend them again, and the next one would too.

Change

  • frame reads the canvas height from the drawing area instead of the HEIGHT constant.
  • When the caption overruns the base height by at most MAX_CAPTION_GROWTH_LINES (8), frame returns ChartError::CaptionOverflow { extra_lines } and render_validated renders again on a canvas grown by exactly those lines. The variant never reaches callers of the public entry points.
  • The plot body keeps MIN_PLOT_PX. A runaway caption is still refused with the chart's name and the budget it went over, as before.

Effect on the published charts

Every committed chart still renders at the base height byte-for-byte (the byte-compare test passes unchanged). Rendering the six-backend document, all 22 charts succeed and only parallel-vs-sequenced-64kib and its dark variant grow, by two lines to 672 px.

Tests

a_caption_a_few_lines_over_budget_grows_the_canvas_instead_of_refusing: a document a few caption lines over budget renders, the SVG root is taller than HEIGHT, every text baseline sits inside the grown canvas, and the plot body spans at least its minimum. Failed first with the "leaves no room" refusal. The existing pathological-caption test still asserts the refusal for a 44-line caption; 127 chartgen tests pass. cargo fmt -- --check and both clippy gates pass.

Unblocks #175 (the SQS results), which stays a draft until this merges and its charts are regenerated.

Six backends' worth of qualifiers is a real document, not a pathology: the
six-backend results document's ordering chart carried 23 caption lines
against the base canvas's budget of 21 and was refused, so the SQS results
could not be published. #164 and #165 bought lines back by grouping and
trimming notes; the next backend or deviation spends them again.

Let the frame read the canvas height from the drawing area instead of the
constant, and when the caption overruns the base height by at most
MAX_CAPTION_GROWTH_LINES (8), have the renderer render again on a canvas
grown by exactly the missing lines. The plot body keeps MIN_PLOT_PX, every
committed chart still renders at the base height byte-for-byte, and a
runaway caption is still refused with the budget it went over. The
six-backend document renders every family; only the parallel-vs-sequenced
64 KiB pair grows, by two lines to 672 px.
@zannis
zannis merged commit 52e27b1 into main Sep 8, 2026
18 checks passed
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant