Skip to content

fix(engine): say which presentation pages lack their map when a project opens - #3230

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3191-open-pages-without-map
Nov 28, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3191-open-pages-without-map

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A presentation map page whose map the project doesn't have is drawn over the active map. Deleting the
map and importing the presentation say so since #3047, but opening a project that already holds such a
page (saved after the map was deleted, or edited by hand) said nothing. It now gives the same notice,
once, for every presentation of the project.

The notice comes from Project::normalize_opened, so every way of opening a project gives it: a
project file, project text, a template or package opened as a project, a session started on a project
and a peer's project text. Importing maps from such a project says nothing about its pages, which it
doesn't take. The pages keep the name and are drawn as before.

Testing

  • New tests in crates/engine/src/tests/layout_removed_map.rs: opening from text, from a saved file
    after deleting the map, a session started on such a project, a peer's text, two presentations, and
    no notice for pages whose maps are there (also spelled in another case), for a project with no
    presentation and for a map import. The five that expect a notice failed before the change.
  • Local: cargo fmt --check, clippy, nextest (10449 passed), doctests, the layers check and the
    schema check. After the last commit (a doc comment and an unused derive): fmt, the engine's clippy
    and the touched tests again. cargo xtask ci is left to CI.

UI evidence

Messages after opening a project with a page whose map is missing, before (left) and after (right):

3191-messages-before-after.png

Related issue

Closes #3191.

Surfaces

Engine notices, so the desktop, browser, phone, command line, Python, the Assistant and MCP get them.
No command, parameter, saved-format or interface string change.

Summary by CodeRabbit

  • Bug Fixes
    • Opening a project now reports presentation pages that reference missing maps. The affected pages are identified, and those pages continue to fall back to the active map.
  • Documentation
    • Updated the Presentations guide to describe missing-map notices and the active-map fallback.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Project opening now reports presentation pages that reference maps missing from the project. The scan returns a notice for matching pages, and project normalization collects it with item read notices.

Changes: Project-open missing-map notices

Layer / File(s) Summary
Scan presentation pages for missing maps
crates/engine/src/cmd/presentation.rs
The scan accepts a project and returns an optional notice for selected pages that reference absent maps. PagesOf::All selects every map page.
Collect and verify notices on project open
crates/engine/src/project.rs, crates/engine/src/tests/layout_removed_map.rs, docs/user-guide/layouts.md
Project normalization adds notices for all presentation pages as item read notices. Tests cover project-opening paths and cases where no notice is expected. The guide documents the opening notice.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • opengeos/RustGIS#3047 — This change reports missing-map pages on project opening; the import behavior described in the issue remains unaddressed.

Possibly related PRs

  • opengeos/RustGIS#3190 — It implements missing-map notices for map removal and import paths, which are related to this PR’s project-opening notice behavior.

Suggested reviewers: giswqs, mavrick-f

Merge Risk: Minimal · up to 786d6

Opening a project now reports presentation pages that refer to maps the project does not have. The notice is informational and does not change project data. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: opening a project now reports which presentation pages lack their map. It follows the conventional commit form and is specific to the changeset.
Description check Passed The description follows the template. Summary, Testing, and Related issue are complete. The UI evidence section has a before/after screenshot of the new notice, which fits the template's requirement f…
Linked Issues check Passed Directly linked issue #3191 requires that opening a project report how many presentation map pages name a map the project lacks, as deleting a map or importing a presentation already does (#3047). The…
Out of Scope Changes check Passed The changes stay within the scope of #3191. The notice logic in crates/engine/src/project.rs implements the requirement. In crates/engine/src/cmd/presentation.rs, pages_without_their_map is refactored…
Full details: Description check

Explanation

The description follows the template. Summary, Testing, and Related issue are complete. The UI evidence section has a before/after screenshot of the new notice, which fits the template's requirement for visible UI changes. The Summary explains the cause, the scope of the change, and the expected behavior.

Full details: Linked Issues check

Explanation

Directly linked issue #3191 requires that opening a project report how many presentation map pages name a map the project lacks, as deleting a map or importing a presentation already does (#3047). The PR adds this notice to Project::normalize_opened in crates/engine/src/project.rs, per the AI-generated summary and PR description. The notice is emitted once per presentation, so it covers project files, project text, templates or packages opened as projects, sessions, and peer project text. The new tests in crates/engine/src/tests/layout_removed_map.rs cover these opening paths, multiple presentations, pages whose maps exist, projects without presentations, and map imports. The author reports that the five notice-expecting tests failed before the change. The PR description reports the same notice text in the UI screenshot. Pages keep their names and draw as before, which matches the issue's expected behavior. Limitation: repository diff reads were unavailable (changed blobs missing from the checkout), so this verdict relies on the PR summary, AI-generated summary, and test descriptions, not on direct code reading.

Full details: Out of Scope Changes check

Explanation

The changes stay within the scope of #3191. The notice logic in crates/engine/src/project.rs implements the requirement. In crates/engine/src/cmd/presentation.rs, pages_without_their_map is refactored to take a Project and return an optional NoticeText, with a PagesOf::All variant and a say_pages_without_their_map wrapper. This refactor lets the new opening path and the existing delete and import paths share one message, so it supports the objective. The tests in layout_removed_map.rs verify the new behavior. The docs/user-guide/layouts.md change adds the new opening case to the documented list of cases that report affected pages, which matches the new behavior. The PR reports no command, parameter, saved-format, or interface-string changes. Limitation: direct diff inspection was unavailable, so this verdict relies on the summaries and PR description.

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 page at dawn,
And spots the maps that are gone.
A notice names each wayward view,
While present maps pass inspection, too.
Then hops away, its work all done.

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: 0509d588-a81e-437f-a7ea-fa8bdbd460aa
Commits

Reviewing files that changed from the base of the PR and between d364137 and 786d6fe.

Files selected for processing: 4

  • crates/engine/src/cmd/presentation.rs
  • crates/engine/src/project.rs
  • crates/engine/src/tests/layout_removed_map.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; 3 remain after this review.

Comment thread crates/engine/src/cmd/presentation.rs Resolved
Comment thread crates/engine/src/project.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Overall the change is sound. I found no bugs, crash paths, or silent-data-loss issues. The new notice runs on every open path that calls normalize_opened, and the tests cover both the expected and clean cases.

Bugs

  • None found.

Security

  • None found.

Performance

  • crates/engine/src/cmd/presentation.rs:683: On open, project.maps.iter().any(...) runs once per map page. Pages are capped at 500 per presentation and presentations at 1000, so a hostile file could cause a few hundred thousand case-insensitive comparisons on the UI-thread open path. This is a slowdown, not a crash. A HashSet of lowercased map names built once would fix it. Confidence: medium on the bound, low on whether it matters in practice.

Quality

  • crates/engine/src/project.rs:1546: The data model (project.rs) now imports from cmd::presentation. The check only reads presentations and maps, so PagesOf and pages_without_their_map could move to a shared module. This is a refactor and can wait for the release quality pass. Confidence: high.
  • Nits, left for the release quality pass:
    • The use inside normalize_opened could move to the top of the file.
    • The doc comment "One notice of which of the map pages…" reads awkwardly.
    • pages_without_their_map is a long signature; it fits the 140-column rustfmt limit, so this is cosmetic.

AGENTS.md

  • None found. The notice goes through notify_text, and the tests cover lossy and clean input. Not applicable: command-surface.txt and schema, since nothing new is saved or registered.

Twins checked

  • layer/project.open*/project.import*: project.open, project.openText and package import all go through read_json with normalize=true, so they get the notice. map.import uses normalize=false with a map limit and is excluded on purpose, as the tests assert. check_import_json and from_peer_raw produce no notice of their own, and the peer path calls normalize_opened directly.
  • Existing say_pages_without_their_map(Map(gone)) callers in navigate.rs and workspace.rs are unchanged and still correct.
  • No wasm32 branches are touched.

I did not raise any earlier concerns, because the PR has no prior review threads.

Change size

Compared with the base branch (merge base 30fcf3c to PR head 786d6fe).

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 288.0 KB
Size after 292.6 KB
Total size change +4.5 KB
Path Before After Change
crates/engine/src/tests/layout_removed_map.rs 8.3 KB 12.1 KB +3.8 KB
crates/engine/src/project.rs 154.3 KB 154.7 KB +396 B
crates/engine/src/cmd/presentation.rs 39.7 KB 40.0 KB +327 B
docs/user-guide/layouts.md 85.8 KB 85.8 KB +35 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3230/
Web app https://preview.rustgis.app/pr-3230/app/
Commit 786d6fe

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 78f3412 Nov 28, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3191-open-pages-without-map branch November 28, 2026 15:21
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]: opening a project says nothing about presentation map pages whose map it doesn't have

1 participant