Skip to content

fix(report): say what the charts of a report's layout pages leave out - #3192

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3166-report-chart-notices
Nov 28, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3166-report-chart-notices

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Since #3156, exporting a layout says what each of its charts leaves out. A report that draws that layout as a page said nothing, so the exported report went out with the losses unsaid.

  • A report says its pages' charts. Exporting a report (PDF, or PNG, which draws the first page alone), and downloading it in the browser, warn of the charts its layout pages drew: bars past the limit, features with no number, the other losses a layout's export says, and a box too small for the chart.
  • Named with their layout, as a report's cut legends are: Chart "Chart Frame" (7) in "Charts": …. Element ids are a layout's own, so two layouts' charts sharing one are two. Charts with the same notice are named together, the first ten and how many more; a layout on several pages is said once.
  • One path. chart_notice_lines now words its notices through chart_notice_lines_in, which a report calls with each chart's layout. A layout's own export says what it said before.

The report keeps nothing in the session or project: for the length of one export it opens the renderer's drawn_charts beside unfitted_legends, and keep_unfitted became keep_drawn, used for both.

Testing

New tests in crates/engine/src/tests/layout_chart_notices.rs: a PDF with the same layout on two pages, a reopened project, the layout's own export naming no layout, a PNG whose first page is or isn't the layout, two layouts whose charts share an id and a notice, a box too small for its chart, and nothing said with no layout page, no loss or a hidden chart. Those that expect a notice failed before the change. The full local checks (fmt, clippy, nextest, doctests, layers, schema) pass. A page too large for vectors and drawn again as a picture has no test of its own; its repeat is dropped by the same keep_drawn as a repeated layout.

UI evidence

The Messages pane after exporting a report that draws a layout with two charts (one cut to 3 bars, one too short for its columns), before (left) and after (right). The exported PDF is byte-identical.

Messages pane before and after

Related issue

Closes #3166

Summary by CodeRabbit

  • New Features
    • Report exports now show notices when charts omit bars or are too small to display fully, alongside notices for layout legends.
    • Notices identify charts by name and element number, and include the layout name when available. Repeated notices are grouped while charts from separate layouts remain distinct.
    • PNG reports display chart notices only for the first page.
  • Documentation
    • Updated the layouts guide to explain chart notices in report exports.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Report exports now collect chart notices from drawn layout pages. The notices identify charts by layout and element, and include chart omissions and undersized-box notices.

Changes: Report chart notices

Layer / File(s) Summary
Layout-aware chart notice formatting
crates/engine/src/cmd/layout.rs, crates/engine/src/cmd/layout/export.rs
The notice helper accepts charts from multiple layouts. It adds layout names when supplied and treats matching element IDs in different layouts as distinct charts.
Report chart capture and notice emission
crates/engine/src/cmd/report.rs, crates/engine/src/tests/layout_chart_notices.rs, docs/user-guide/layouts.md
Report rendering captures drawn charts and cut legends, deduplicates repeated entries, and emits chart notices. Tests cover report export scenarios, and the guide documents the notices.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

Possibly related PRs

Suggested reviewers: m-hollis-1, elpidioassinaturas, giswqs

Merge Risk: Minimal · up to 71de0

Report exports that include a layout page now name each chart and explain what it leaves out, as layout exports already do. The change only adds notices and has no visible rollback or data risk. Nothing blocks merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(report): say what the charts of a report's layout pages leave out" matches the main change: report exports (PDF/PNG/browser downloads) now emit chart notices for charts drawn by report …
Description check Passed The description follows the template. It has a Summary that explains the change and why (Since #3156, report exports omit chart-loss notices that layout exports give). It has a Testing section listing…
Linked Issues check Passed [#3166] Requires that a report export naming a layout page report each chart on that page and what it leaves out, as layout export does after #3156. The PR covers each named case: bars left out past t…
Out of Scope Changes check Passed All changes connect to the chart-notice objective. chart_notice_lines_in is the shared wording path for report and layout exports, and the layout export keeps its wording. The keep_unfitted to keep_dr…
Full details: Title check

Explanation

The title "fix(report): say what the charts of a report's layout pages leave out" matches the main change: report exports (PDF/PNG/browser downloads) now emit chart notices for charts drawn by report layout pages, naming what they omit. It is specific, uses a conventional prefix, and is a single sentence of 12 words. It does not mention the layout-index labeling or the keep_drawn refactor, which is acceptable because it need not cover every detail.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the change and why (Since #3156, report exports omit chart-loss notices that layout exports give). It has a Testing section listing new tests in layout_chart_notices.rs and the local checks run. It has a UI evidence section with a before/after screenshot of the Messages pane, which fits the template's requirement for visible UI changes. Its Related issue section closes #3166. The template's 'No visible UI change' line is not used, but the author supplied screenshots, which is what the template asks for when a message panel changes. The description is complete and specific.

Full details: Linked Issues check

Explanation

[#3166] Requires that a report export naming a layout page report each chart on that page and what it leaves out, as layout export does after #3156. The PR covers each named case: bars left out past the limit, features with no number, bars past the fixed maximum of 100, and a box too small for its chart. The report path collects charts drawn by report pages through the renderer's drawn_charts (report.rs, per the summary). chart_notice_lines_in names each chart with its layout (export.rs). The new tests in crates/engine/src/tests/layout_chart_notices.rs assert these notices for PDF, PNG first-page, reopened-project, two-layout, and undersized-box cases, and assert silence for no-layout, no-loss, and hidden-chart cases. The report.rs and export.rs diffs could not be read (changed blobs unavailable in the checkout). This verdict relies on the PR summary and the test source, and on the author's report that the tests pass. Non-coding items (manual UI evidence) are not assessed.

Full details: Out of Scope Changes check

Explanation

All changes connect to the chart-notice objective. chart_notice_lines_in is the shared wording path for report and layout exports, and the layout export keeps its wording. The keep_unfitted to keep_drawn rename supports the report dedup of both legends and charts. The layout.rs re-export supports the shared function. The docs/user-guide/layouts.md update describes the new report notices. The tests cover the new behavior. No unrelated change was found in the summary or the test source. The report.rs and export.rs diffs could not be read directly, so this verdict rests on the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the charts at night
Each layout’s name is printed right
Lost bars leave a note behind
Small boxes speak their limits kind
The pages hop to export light

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e1b15a48-029c-4151-bca2-069e1103e0da
Commits

Reviewing files that changed from the base of the PR and between 9b0f0f9 and 71de019.

Files selected for processing: 5

  • crates/engine/src/cmd/layout.rs
  • crates/engine/src/cmd/layout/export.rs
  • crates/engine/src/cmd/report.rs
  • crates/engine/src/tests/layout_chart_notices.rs
  • docs/user-guide/layouts.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread crates/engine/src/cmd/report.rs Resolved
Comment thread docs/user-guide/layouts.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I reviewed the full diff against the AGENTS.md copy from the base branch. pr-context/prior-reviews.json has no threads, so nothing was carried over. I checked the report and layout chart paths and their twins, and the tests. I did not compile or run the tests, since I have no shell.

Bugs

  • None found. The keying by layout index plus element id, the dedup in chart_notice_lines_in, and the drawn_charts and unfitted_legends nesting all look correct. The overflow path that draws a page twice is deduplicated by keep_drawn.

Security

  • None found.

Performance

  • Retains every chart's data, not only lossy ones (crates/engine/src/cmd/report.rs:1196, confidence medium). drawn_chart lists each chart with its full ChartData, and keep_drawn drops only exact repeats. A long map-series report keeps all of that data and scans the list on each insert, which is quadratic in pages times charts. Filtering to charts with a notice before keeping would fix it. Posted inline.

Quality

  • Docs wording (docs/user-guide/layouts.md:787, confidence high). The sentence does not say that a PNG report draws only its first page. Posted inline.
  • Silent drop in say_report_charts (report.rs:1278, confidence low). filter_map with s.project.layouts.get(*li)? drops a chart with no notice if the index is missing. That cannot happen within one export, so this is only a note.
  • format! in a push (export.rs:114). named.push_str(&format!(…)) could be write! or a single format!. Left for the release quality pass.
  • Weak test filter (layout_chart_notices.rs, reported). retain(|t| t.contains("chart")) would also keep an unrelated notice that mentions a chart. The exact-equality asserts still catch most regressions. Left for the release quality pass.

AGENTS.md

  • No rule breaks found. Layouts, .view(), Session::warn for notices, the chart_notices visibility, and the test structure follow the guide. No schema, command-surface, or limit file changed, so none needed regenerating.

Twins checked

  • Layout PNG, PDF, and SVG exports all list charts through drawn_charts and say them (export.rs:70, :267, :511). The report now does the same.
  • Report PDF, report PNG, and browser download all go through report_pages_bytes, the one call site.
  • Not in this PR: the report still does not warn about clipped text, which the layout export does (clipped_text_notice). This is an existing gap the PR does not claim to cover, so I did not raise it inline.

Change size

Compared: the whole PR against main (merge base 3ef1d13 to PR head 71de019).

Measure Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 245.4 KB
Size after 251.3 KB
Total size change +5.9 KB
Path Before After Change
crates/engine/src/tests/layout_chart_notices.rs 8.4 KB 12.5 KB +4.1 KB
crates/engine/src/cmd/report.rs 74.4 KB 75.4 KB +1.0 KB
crates/engine/src/cmd/layout/export.rs 24.6 KB 25.3 KB +0.7 KB
docs/user-guide/layouts.md 83.8 KB 83.9 KB +0.1 KB
crates/engine/src/cmd/layout.rs 54.1 KB 54.2 KB +0.1 KB

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3192/
Web app https://preview.rustgis.app/pr-3192/app/
Commit 71de019

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 28, 2026
Merged via the queue into opengeos:main with commit 755083c Nov 28, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3166-report-chart-notices branch November 28, 2026 09:55
m-hollis-1 added a commit to m-hollis-1/rustgis that referenced this pull request Nov 28, 2026
A report says its pictures drawn as a grey box beside the charts' notices (opengeos#3192).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

[Bug]: a report that draws a layout page says nothing of its charts

1 participant