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
[Feature]: Layout files (.rgislayout): a checked format header, so an older RustGIS refuses what it can't keep #2277
I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
A layout saved as a file (.rgislayout, from Save Layout File or layout.save) is the bare Layout JSON: no format, no requires. layout.import (also used by report.addLayout) reads it with serde_json::from_str::<Layout>, which ignores keys it doesn't know. So a layout file written by a newer RustGIS opens in an older one with every newer setting dropped and no notice: element backgrounds (#2257, #2271), and earlier locked, dash and rotation. Saving it again loses them for good.
Projects are already protected: a format-2 project lists what it needs in requires and an older reader refuses it by name (layout-element-background since #2271). Map, layer and style files got a checked header in #1405 item 1. Layout files were left out.
A header written today can't protect releases already out, because their reader ignores it. That is why the reader has to come first.
Proposed solution
Follow the order in docs/maintaining.md ("Saved files and settings") and #1405:
Reader first: layout.import runs project::check_format on the text and refuses a requires entry it doesn't know, naming it. A file without a header keeps opening as a legacy layout.
Writer a release later: layout.save and the browser download in ui.saveLayout write {format, requires, ...layout} the way map_file_bytes does, with requires computed from the layout (layout-element-background when an element has one).
Tests both ways: an unknown capability is refused with its name, a legacy file and a clean file open, and a saved file round-trips.
Estimated scope
Small: a minor tweak, small UI change, or text adjustment
Alternatives considered
A notice from layout.save that the file needs this release: it reaches the person saving, not the one importing into the older release, where the loss happens.
Rejecting unknown keys (deny_unknown_fields) on import: it would refuse files from newer releases even when what they added is harmless, and it's still a reader-side change that has to ship first.
Activity