Skip to content

fix(engine): removing a layer says which map series and presentation titles name it (#3075) - #3101

Merged
jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:fix/3075-removed-layer-series-titles
Nov 27, 2026
Merged

jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:fix/3075-removed-layer-series-titles

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removing a layer said nothing of a layout's map series that uses it as the index layer, or of a presentation map page whose title holds one of its statistics ({count:Countries}). Exporting such a series to PDF then wrote only the current page, again without a word.

  • Removing the layer (layer.remove, group.remove and the other paths through follow_removal) now gives one notice: how many map series and presentation titles name the removed layer. Both keep the name, so a layer of that name brings them back. Only the series and map pages of the active map count, as for layer.rename; nothing is said while another layer of that name remains.
  • Exporting a PDF with every series page (the default, and the app's Export and Print), when the index layer isn't in the series frame's map, now warns that the PDF holds the current page only. allPages: false, PNG and SVG write one page anyway and say nothing. This also covers a project opened with the layer already gone.

The element notice added by #3020 is unchanged; a project with both gets both notices. The two share the "which removed names does this item read" helper.

These strings wait for the release translation pass.

Surfaces

The change is in rustgis-engine, so the desktop app, the browser, the command line, Python and the assistant get both messages. No command or parameter changes, nothing new is saved, and undo brings the layer and the series back.

Testing

  • New tests in crates/engine/src/tests/layout_removed_layer.rs, written first and seen failing for the missing messages: a series' index layer, titles counted per page, a series and titles of several layers removed with their group said once, and the export warning. Others pin the silent cases: another layer, another map, a name another layer still bears, one-page exports, and a full export once undo brings the layer back.
  • fmt, clippy -D warnings, nextest (the local DuckDB test left out), doctests, cargo xtask layers and schema --check passed on the branch; after the last small fixes, the series, statistic and removal tests of rustgis-engine, fmt and clippy passed again.
  • ui_shot before and after (below), and the issue's steps on the command line: before, nothing at removal and a one-page PDF without a word; after, both messages.

UI evidence

The Messages pane after removing Countries and exporting the series (before left, after right):

Messages pane before and after

Not in this PR

Related issue

Closes #3075

Summary by CodeRabbit

  • New Features
    • Layer-removal notices now include references from map-series index layers and presentation map-page titles, so you can see which layouts may be affected.
    • When a map series’ index layer is missing from its frame’s map, an all-pages PDF export reports that it contains only the current page.
  • Documentation
    • Updated the layouts guide with details on these notices and the PDF export fallback.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Layer removal now reports affected layout elements, map series, and presentation titles. When an all-pages PDF export has a series whose index layer is unavailable, it reports that the PDF contains only the current page.

Changes: Layer reference reporting

Layer / File(s) Summary
Removal reference notices
crates/engine/src/cmd/layer.rs, crates/engine/src/tests/layout_removed_layer.rs, docs/user-guide/layouts.md
Layer removal reports references from map-series index layers and presentation-title tokens. Shared logic counts affected items and removed layer names. Tests cover grouped removals, duplicate references, same-name layers, and references on other maps. The guide documents these notices.

PDF series fallback

Layer / File(s) Summary
Missing series index layer during PDF export
crates/engine/src/cmd/layout/export.rs, crates/engine/src/tests/layout_removed_layer.rs, docs/user-guide/layouts.md
All-pages PDF export reports when a series index layer is unavailable and the export contains only the current page. Tests cover cases that emit or suppress the warning. The guide documents the fallback.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

Possibly related PRs

  • opengeos/RustGIS#3076 — It adds the layout-element notice on the layer-removal path that this PR extends.
  • opengeos/RustGIS#2980 — It defines the statistic tokens that this PR checks in presentation titles.

Suggested reviewers: giswqs, mavrick-f

Merge Risk: Minimal · up to 7734f

This change adds informational notices on layer removal and a warning when a PDF series export falls back to the current page. No rendering or data behavior changes, and no actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: removing a layer now reports which map series and presentation titles reference it. It matches the changeset's removal notice. The export warning is not mentioned, but…
Description check Passed The description follows the template. It has a Summary that explains the change and why. It has a Testing section that lists new tests, the validation commands run, and the before/after reproduction. …
Linked Issues check Passed Issue #3075 asks for two coding behaviours: (1) a one-time notice at layer removal when a map series index layer or a presentation map-page title statistic names the removed layer, and (2) a PDF expor…
Out of Scope Changes check Passed All changed areas tie to #3075. Layer removal notices and the shared removed-name helper in crates/engine/src/cmd/layer.rs serve the removal objective. The export warning in crates/engine/src/cmd/layo…
Full details: Title check

Explanation

The title names the main change: removing a layer now reports which map series and presentation titles reference it. It matches the changeset's removal notice. The export warning is not mentioned, but the title is specific and accurate, and the '(#3075)' issue reference is harmless.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the change and why. It has a Testing section that lists new tests, the validation commands run, and the before/after reproduction. It has a UI evidence section with a before/after screenshot of the Messages pane, which fits the template's requirement for a visible UI change. It has a Related issue section that closes #3075. The description does not state the 'No visible UI change' line from the template, but it gives UI evidence instead, which is the correct choice for this change.

Full details: Linked Issues check

Explanation

Issue #3075 asks for two coding behaviours: (1) a one-time notice at layer removal when a map series index layer or a presentation map-page title statistic names the removed layer, and (2) a PDF export notice when an all-pages series export cannot find its index layer. Export (verified in crates/engine/src/cmd/layout/export.rs, layout_bytes_inner): when all && pdf, series_info is None, and the layout has a series, the code emits 'The map series' index layer '<layer>' isn't in its frame's map: the PDF holds the current page only'. This covers the default PDF export and the projects opened with the layer already gone, and it stays silent for allPages false, PNG and SVG. Removal (crates/engine/src/cmd/layer.rs): the whole-PR summary states that layer removal now counts map series and presentation titles naming the removed layer, deduplicates names, suppresses the notice when a same-named layer remains, and applies through layer.remove, group.remove and follow_removal. I could not read the layer.rs diff (changed blobs unavailable), so this removal behaviour rests on the summary and the PR's reported tests in crates/engine/src/tests/layout_removed_layer.rs, not on a direct code read. Test coverage named in the summary includes the index layer, per-page title counts, grouped removal, the same-name case, and the export silent cases. The #3020 element notice is reported unchanged.

Full details: Out of Scope Changes check

Explanation

All changed areas tie to #3075. Layer removal notices and the shared removed-name helper in crates/engine/src/cmd/layer.rs serve the removal objective. The export warning in crates/engine/src/cmd/layout/export.rs serves the export objective. The new tests in crates/engine/src/tests/layout_removed_layer.rs support both objectives. The user guide change in docs/user-guide/layouts.md documents the new behaviour and is supporting documentation. The refactor that replaces the inline layout-notice construction with the shared helper is needed to keep one notice format for the layout, series and title cases. No unrelated change was identified in the reviewed evidence. The summary does not indicate any change to commands, parameters or saved data, which matches the 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 layer name,
Map series and titles join the frame.
A missing index? The PDF says,
“Only this page” along the way.
Then carrots mark the changes 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: 67999cb8-d910-4cba-8665-e17ac59f2bf7
Commits

Reviewing files that changed from the base of the PR and between 656a9bc and 7734f17.

Files selected for processing: 4

  • crates/engine/src/cmd/layer.rs
  • crates/engine/src/cmd/layout/export.rs
  • crates/engine/src/tests/layout_removed_layer.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; 5 remain after this review.

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

Copy link
Copy Markdown
Contributor

Code review

No blocking findings. The change does what the PR describes, and I found no crash, silent-loss or data-corruption paths. One quality nit is posted inline.

Bugs

  • None found.

Security

  • None found.

Performance

  • None found. The new work is a few iterations over layouts and presentation pages per layer removal.

Quality

  • Duplicated "which removed layers does this item read" logic (crates/engine/src/cmd/layer.rs:7582, inline comment posted). gone is recomputed in pages_follow_removal and layouts_follow_removal. Confidence: high. Category: quality. Can wait for the release quality pass.

AGENTS.md

  • None found. Checked against the repo rules:
    • Engine diagnostics stay English through s.warn(format!(…)), which is the engine's existing convention (about 189 call sites). The deferred-template path, NoticeText, is used for the removal notices, so the translation rule is met.
    • No new command, parameter or saved field, so the schema, fixture and command-surface snapshot rules don't apply.
    • No desktop-only code was added to a shared path, so the wasm rule isn't triggered.

Twins checked

  • Layout series and presentation titles vs. the existing element notice: the removal count uses the same active-map gate as layer.rename (layer.rs ~7374–7392), so rename and removal agree on what a series or title "reads".
  • Removal paths: remove and drop_layers both call follow_removal, so layer.remove and group.remove are covered. The other layers.retain sites are rollbacks, template clears, field-package copies or plugin discards, not user removals.
  • Export surfaces: the PDF warning applies to layout_bytes_inner, which the app's Export, Print and layout.export all use with all && pdf. PNG and SVG write the current page, so they correctly stay silent. layout_png doesn't need the warning.
  • Tests: the test cases cover the positive path, the silent cases, and undo.

Change size

Compared with main (merge base 1a80975 to PR head 7734f17). Sizes are in KB using 1024 bytes per KB.

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 549.7 KB (562,896 B)
Size after 558.5 KB (571,889 B)
Total size change +8.8 KB (+8,993 B)
File Before After Change
crates/engine/src/tests/layout_removed_layer.rs 5.3 KB 11.1 KB +5.8 KB
crates/engine/src/cmd/layer.rs 449.6 KB 452.1 KB +2.5 KB
crates/engine/src/cmd/layout/export.rs 20.7 KB 21.0 KB +325 B
docs/user-guide/layouts.md 74.1 KB 74.4 KB +264 B

Earlier concerns left alone: 0 (there were no prior review threads).

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3101/
Web app https://preview.rustgis.app/pr-3101/app/
Commit 7734f17

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 0235f78 Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3075-removed-layer-series-titles branch November 27, 2026 10:19
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]: deleting a layer says nothing of the map series or presentation titles that name it

1 participant