Skip to content

fix(presentation): a map page title's layer statistic with no figure is said (#2999) - #3064

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/2999-presentation-title-statistics
Nov 27, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/2999-presentation-title-statistics

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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 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

UI evidence

presentation.mapPage with the title {count:Nowhere} sites in {count:Countries} countries, Messages pane before and after.

2999-title-warning.png

Related issue

Closes #2999

Summary by CodeRabbit

  • New Features
    • 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.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Changes: Map-page title notices

Layer / File(s) Summary
Shared statistic notice generation
crates/render/src/layout.rs
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.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

Possibly related PRs

  • 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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

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.

@github-actions

Copy link
Copy Markdown
Contributor

Code 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).

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 4.36 MB
Size after 4.37 MB
Total size change +6.6 KB
File Before After Change
crates/engine/src/tests.rs 3.62 MB 3.62 MB +3.6 KB
crates/engine/src/cmd/presentation.rs 33.4 KB 35.3 KB +1.9 KB
crates/render/src/layout.rs 655.2 KB 656.1 KB +922 B
docs/user-guide/layouts.md 73.8 KB 74.0 KB +159 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3064/
Web app https://preview.rustgis.app/pr-3064/app/
Commit 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).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit 25d0786 Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/2999-presentation-title-statistics branch November 27, 2026 02:41
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 layer statistic in a presentation map page's title with no figure is not said

1 participant