You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(presentation): a map page title's layer statistic with no figure is said (#2999) - #3064
A presentation map page's title fills in a layer's figures ({count:Layer}, {sum:Layer:field}, …) from the page's map, but a token with no figure was drawn as written with nothing said, unlike a layout text.
presentation.mapPage, presentation.updatePage (when it sets title) and presentation.import now warn with what each such token misses, naming "the page's map". Over a layer read in place they also say the figure covers only the loaded features.
An import says each warning once, followed by "(in N map pages)" when several pages share it.
Layout texts and map page titles share one function for these warnings (statistic_notices and the new map_statistic_notices); the wording for layout texts is unchanged.
Blank, image and video pages say nothing: no figure is ever filled in there.
Surfaces: the warnings come from the engine commands, so they reach the desktop app, the browser, the phone (touch interface), the command line, Python (take_notices), scripts and saved steps, and the Assistant and MCP; the presentation.mapPage description says so (updatePage refers to it). No ribbon, shortcut, plugin API or project format change, and nothing new to undo.
Not in this PR: a map page whose map is no longer in the project is drawn, and now checked, against the active map. That fallback predates this change and goes to its own issue.
The check runs on the command's thread, as a layout text's does: one pass over each layer a title names, so an import makes one per map page that holds a figure (at most 500 pages).
Testing
New test a_map_page_title_statistic_without_a_figure_is_said (failed before the change); a raster case added to the render test of these warnings.
fmt, clippy with -D warnings, doctests, layer check and schema check pass.
Presentation map-page titles are now checked for statistics that reference missing layers or fields when a page is added, its title is changed, or a presentation is imported.
Repeated warnings are grouped and show how many map pages are affected. Warnings are limited to the relevant page when adding or editing titles.
Documentation
Updated the dynamic-text guide to explain when presentation map-page titles are checked.
No actionable comments were generated in the recent review.
Walkthrough
Presentation commands now report unresolved statistic tokens in map-page titles when pages are added, retitled, or imported. Shared notice generation checks tokens against the page map. Import warnings with identical text are grouped and include the number of affected pages.
Layout notices distinguish a missing frame from an unavailable map. The new map_statistic_notices function generates notices for a supplied map and description. Tests cover notices from a supplied map.
Presentation page title checks crates/engine/src/cmd/presentation.rs, crates/engine/src/tests.rs, docs/user-guide/layouts.md
Adding or retitling a map page emits notices for its title. Import checks each page and groups identical notices, with a page count when repeated. Tests cover page-specific maps, unrelated updates, undo, blank pages, and import. Documentation describes when title checks occur.
opengeos/RustGIS#2980 — Introduces the statistic tokens and warning behavior extended here to presentation map-page titles.
Suggested reviewers:giswqs, deniial00
Merge Risk: Minimal · up to c8eea
This change adds warnings for unresolved statistic tokens in map-page titles when pages are added, retitled, or imported. The behavior is additive, and no actionable merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix for a presentation map page title whose layer statistic token has no figure. The changeset adds warnings for that case in presentation.mapPage, updatePage and import, so the ti…
Description check
The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The summary explains the problem and the change. Testing lists the new test, the render test case, and …
Linked Issues check
Issue #2999 requires a notice when a presentation map-page title, set through presentation.mapPage or presentation.updatePage, holds a layer-statistic token with no figure. At head, presentation.mapPa…
Out of Scope Changes check
The changes stay within #2999. Map-page title warnings for mapPage and updatePage are the core. The presentation.import warning is an extension, but it applies the same token check to the same map-pag…
Full details: Title check
Explanation
The title names the fix for a presentation map page title whose layer statistic token has no figure. The changeset adds warnings for that case in presentation.mapPage, updatePage and import, so the title matches the main change. It is specific and uses the issue number. The wording is slightly awkward ('is said'), but the meaning is clear.
Full details: Description check
Explanation
The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The summary explains the problem and the change. Testing lists the new test, the render test case, and the CI checks. The UI evidence section includes a before and after screenshot for a visible warning change. It links the related issue with 'Closes #2999'. The template's UI evidence instructions ask for before and after images, and the author provided them. The description is thorough and complete.
Full details: Linked Issues check
Explanation
Issue #2999 requires a notice when a presentation map-page title, set through presentation.mapPage or presentation.updatePage, holds a layer-statistic token with no figure. At head, presentation.mapPage calls say_title_statistics(s, i, k) after add_page (crates/engine/src/cmd/presentation.rs). The updatePage registration and the mapPage parameter text state that a title with no figure is drawn as written, with a warning. The raw summary says updatePage warns when it sets title and does not warn for other updates. The new test a_map_page_title_statistic_without_a_figure_is_said covers creation and updates, per the test summary. The shared map_statistic_notices function in crates/render/src/layout.rs supplies the wording. Limits: the helper bodies (say_title_statistics, title_statistic_notices, update_page) were cut off by the 16000-byte read limit, and the test body was not read. The result relies on the summary and the visible call sites. Blank, image and video pages are not shown to warn, which matches the issue's scope.
Full details: Out of Scope Changes check
Explanation
The changes stay within #2999. Map-page title warnings for mapPage and updatePage are the core. The presentation.import warning is an extension, but it applies the same token check to the same map-page titles, and the PR objectives list it as included work. It is related, not unrelated. The import code shown groups identical warnings with an '(in N map pages)' count and makes no change to other behavior. The layout.rs refactor (statistic_notices and map_statistic_notices) shares the logic between layout texts and map titles, which supports the feature. The docs/user-guide/layouts.md note and the raster test case also support it. The PR states that no ribbon, shortcut, plugin API, project format, or undo behavior changes. The raw summary also reports no changed declarations beyond the new pub function map_statistic_notices. Unverified: that the layout-text wording is unchanged, since the layout.rs hunk was not read.
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.
A rabbit checks each title line, For fields and layers, token by sign. If figures hide, a warning hops, Repeated notes join into groups. The page map guides each check along. Now every title gets its song.
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: 8c4c74d9-4744-4312-b88c-d3239ff501c4
Commits
Reviewing files that changed from the base of the PR and between 09f7541 and c8eeab4.
Files selected for processing: 4
crates/engine/src/cmd/presentation.rs
crates/engine/src/tests.rs
crates/render/src/layout.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; 7 remain after this review.
I read the full diff, the base AGENTS.md, the metadata, and the prior-review file (empty, so no earlier concerns to skip). I also checked the callers of statistic_notices and the layout-text statistics path, the presentation import, add, and update paths, and the docs in docs/maintaining.md. Two inline comments are posted.
Bugs
None found. The updatePage move case (at after moveTo), the mapPage at index, the Blank, Image and Video page exclusion, and the import dedupe all check out against the code and tests.
Security
None found. The change only adds warnings and reads the project; no input is parsed in a new way.
Performance
Import makes one layer pass per map page, not per distinct title (medium confidence on the cost).presentation.import runs title_statistic_notices for every page (up to 500) with no reuse. Pages that share a map and title repeat the same pass. The PR's comparison with layout texts does not hold, because layout texts make one pass per text. This is an AGENTS.md "Never hold the window" issue as well, so it is filed under AGENTS.md below. Inline comment at crates/engine/src/cmd/presentation.rs:73.
Quality
crates/render/src/layout.rs:1290: map.err().unwrap_or_default() depends on an unstated invariant. Correct as written. Inline comment posted.
docs/user-guide/layouts.md: "when it is changed" should say "when its title is changed", since updatePage warns only when title is set. Low-impact wording.
presentation.rs:73: s.project.presentations[i] is indexing. i was just pushed, so it cannot panic, but get(i) matches the crate rule. Included in the inline comment.
AGENTS.md
Import work grows with input and has no background path or Cancel. This is the point in the first Performance item, and it is the more serious framing under the rule "a command whose work grows with its input runs off the UI thread with progress and Cancel". Confidence: medium. Inline comment posted at crates/engine/src/cmd/presentation.rs:73.
Checked and not a break: the surface and command-surface.txt file is unaffected, since only help text changed. maintaining.md needs no capability change, because the save format is unchanged. The wasm build is unaffected, because the change is in shared, non-cfg code.
Twins checked
Read routes: the import's path, data and text routes all go through presentation.import's read_text, so they warn alike.
Project open: layout texts do not warn on project open either (their callers are add, update, import, and frame-map changes), so the presentation case matches the precedent and is not a gap.
The overlay tools and wasm branches are not touched by this diff.
Other notes
The warning names "the page's map" even when page_map falls back to the active map for a missing map. The PR says this fallback is tracked separately, so I did not raise it as a finding.
Change size
Compared: the whole PR against main (merge base 5d49160 to PR head c8eeab4).
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A presentation map page's title fills in a layer's figures (
{count:Layer},{sum:Layer:field}, …) from the page's map, but a token with no figure was drawn as written with nothing said, unlike a layout text.presentation.mapPage,presentation.updatePage(when it setstitle) andpresentation.importnow warn with what each such token misses, naming "the page's map". Over a layer read in place they also say the figure covers only the loaded features.statistic_noticesand the newmap_statistic_notices); the wording for layout texts is unchanged.Surfaces: the warnings come from the engine commands, so they reach the desktop app, the browser, the phone (touch interface), the command line, Python (
take_notices), scripts and saved steps, and the Assistant and MCP; thepresentation.mapPagedescription says so (updatePagerefers to it). No ribbon, shortcut, plugin API or project format change, and nothing new to undo.Not in this PR: a map page whose map is no longer in the project is drawn, and now checked, against the active map. That fallback predates this change and goes to its own issue.
The check runs on the command's thread, as a layout text's does: one pass over each layer a title names, so an import makes one per map page that holds a figure (at most 500 pages).
Testing
a_map_page_title_statistic_without_a_figure_is_said(failed before the change); a raster case added to the render test of these warnings.-D warnings, doctests, layer check and schema check pass.layout_title::a_wrapped_map_title_is_sized_for_its_drawn_lines, is the font-dependent test onmaintracked in [Bug]: a layout title test fails on Windows, macOS and some Linux: its map names fit the title box in other fonts #3043; this change does not touch it.ui_shotreplay before and after.UI evidence
presentation.mapPagewith the title{count:Nowhere} sites in {count:Countries} countries, Messages pane before and after.Related issue
Closes #2999
Summary by CodeRabbit