Skip to content

fix(engine): a saved relief step requires its capability only when the command would draw it - #3291

Merged
elpidioassinaturas merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:fix/relief-capabilities-type
Nov 29, 2026
Merged

elpidioassinaturas merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:fix/relief-capabilities-type

Conversation

@elpidioassinaturas

@elpidioassinaturas elpidioassinaturas commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3260 (aerial perspective, #3141) and #3200 (shadow softness, #3144), as promised in #3260's review threads: the type check and reading the value as the command does, where the reply noted that the softness predicate had the same gap.

What it does

A saved step (task, model, history, script) whose raster.symbology sets a relief key requires the project capability shaded-relief-aerial or shaded-relief-shadow-softness, so an older RustGIS refuses the file instead of running the step without the key. The two predicates now read the step as the command reads it. Before, they read it more broadly, so some files were refused that an older reader draws the same:

  • Only a Shaded Relief reads the keys. raster.symbology reads aerial and shadowSoftness only when it draws a Shaded Relief. type is matched as the command matches it: case and spaces, _ and - don't count, hillshade is the same renderer, and a left-out type is a stretch. A step with another type stored nothing, yet required the capability.
  • The value is the command's number. shadowSoftness was any non-null value, so the default 5 (or "5"), which the command keeps as none, required the capability. It is now read with cmd::f, the command's parser, like aerial since feat(map): a Shaded Relief's aerial perspective hazes and flattens its low ground (#3141, part 1) #3260, and the default requires nothing, like null.

The type matching moves out of symbology into cmd::raster::symbology_kind, so the command and the predicates share it; symbology_is_relief names the relief arm.

A layer that stores either setting still requires its capability, as before. Nothing about saving, drawing or the schema changes.

Tests

Written first; they failed on main's predicates:

  • The saved-command capability table (an_inline_graph_node_is_checked_as_a_saved_step_is) gains stretch and left-out types with both keys (nothing required), hillshade and "Shaded Relief" (required), and softness 5, "5" (nothing) and "1.5" (required). Each sample is also checked as a node in an inline model graph.
  • A script.run loop checks both keys, at a default and a set value, under shadedRelief and stretch.

Local runs (Windows): rustgis-engine 2792 passed, with two failures that this change does not touch: layout_report_text::a_report_measures_each_layout_page_with_its_own_page_number (text measurement from #3215; it fails the same way in this machine's runs of other branches) and cloud_optimised_geotiffs_are_read_in_place (it counts the bytes a local server sends; it failed in a run on a loaded machine and passes on its own). The capability tests (55) pass. cargo fmt and cargo clippy -D warnings (engine, all targets) pass.

Size: 51 changed lines (+41 −10).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Raster symbology now recognizes type names consistently, including variations in capitalization, spacing, underscores, and hyphens.
    • Shaded relief options are recognized only when a shaded relief renderer is selected and the option has a non-default value. Numeric strings are interpreted as numbers.

…e command would draw it

`command_sets_aerial` and `command_sets_shadow_softness` now read a saved
`raster.symbology` as the command does: only a Shaded Relief (its type
matched as the command matches it, a stretch when left out) reads either key,
and a numeric string is its number. The default softness, 5 or "5", which the
command keeps as none, requires nothing, like `null`. Follow-up promised
on opengeos#3260.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Raster symbology types are now normalized before renderer matching. Aerial and shadow-softness capabilities are required only for nondefault values on Shaded Relief renderers. Tests cover renderer types, default values, and numeric-string values.

Changes: Shaded Relief capabilities

Layer / File(s) Summary
Normalize raster symbology types
crates/engine/src/cmd/raster.rs
A shared helper defaults and normalizes symbology types. Renderer matching uses the normalized type.
Gate capabilities on Shaded Relief settings
crates/engine/src/project_capabilities.rs
Aerial and shadow-softness settings require capabilities only when the renderer is Shaded Relief and the parsed value is nondefault. Model-node and script tests cover renderer types and defaults.

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

Change: Bug fix

Possibly related issues

Possibly related PRs

  • opengeos/RustGIS#3200: This PR changes the capability predicate for the shadowSoftness setting introduced there.
  • opengeos/RustGIS#3260: This PR changes the capability predicate for the aerial setting introduced there.

Suggested reviewers: jgregoriorincon, giswqs

Merge Risk: Minimal · up to 04b68

The change makes saved-step capability checks match how the raster symbology command already reads its settings. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names a real change in the changeset: the saved-step capability predicates for shaded relief now require the capability only when the command would draw a relief step. It is specific and con…
Description check Passed The description follows the template's Summary, Testing, and Related issue sections. The UI evidence section is handled correctly: the author states 'No visible UI change,' which the template allows w…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names a real change in the changeset: the saved-step capability predicates for shaded relief now require the capability only when the command would draw a relief step. It is specific and concise, though it uses the term 'relief step' where the code uses 'Shaded Relief' renderer and 'shadow softness' and 'aerial' keys. It is clearly related to the main change.

Full details: Description check

Explanation

The description follows the template's Summary, Testing, and Related issue sections. The UI evidence section is handled correctly: the author states 'No visible UI change,' which the template allows when there is no visible change. The Summary explains the change, the reason for it, and the scope. The Testing section lists the tests written, local results, and the two unrelated failures. The Related issue section is left as the template placeholder, so it does not link an issue, though the description references follow-up PRs #3260 and #3200 in prose.

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 the shaded light,
And sorts each renderer type just right.
When softness rests at five,
No extra flag need come alive.
Aerial defaults stay in place,
The tests hop through each case.

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: e91450c5-83f3-459a-8dbe-f3d919e1371b
Commits

Reviewing files that changed from the base of the PR and between 36a1dd0 and 04b6830.

Files selected for processing: 2

  • crates/engine/src/cmd/raster.rs
  • crates/engine/src/project_capabilities.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: 2 files, crates/engine/src/cmd/raster.rs and crates/engine/src/project_capabilities.rs. I found no bugs introduced by this PR. I posted no inline comments, because the points below are either confirmations or notes outside the changed lines. I did not run the tests, since I have no shell here.

I checked that the narrowed predicates agree with the command for each case: non-relief types (stretch, left out, and unknown types), hillshade and Shaded Relief spellings, null, 0, "0", and the default 5/"5". Both agree. symbology_kind is shared, and the only use of kind in symbology is the match, so the unknown-type error text is unchanged. The new cmd::raster call is compiled for wasm (pub mod raster, no cfg gate), and the new helpers use get/f/ps, so they cannot panic on hostile input. The layer-level predicates (sets_aerial, sets_shadow_softness) already read the stored renderer, so they stay consistent. Prior review threads: none, so no earlier concerns were left alone.

Bugs

  • None in the diff. Confidence: high.
  • Pre-existing, not introduced here: raster.symbology silently ignores aerial and shadowSoftness when the type is not a Shaded Relief. Under "Never silent" that is a silent drop, and this PR's correctness argument relies on it. Confidence: medium-high that it breaks the rule; out of scope for this change.
  • Pre-existing twin gap, outside the diff: shadow, sky, fill, rock, ambient and balanced on a saved raster.symbology have no command-level check. shaded-relief-effects and shaded-relief-light apply only to layers already in the project, so a saved step that has not yet been applied to a layer does not require them. Confidence: medium-low (I read the capability table but did not trace every saving path).

Security

  • None found.

Performance

  • None found. The predicates do a constant amount of work, and symbology_kind allocates once per call, the same as before.

Quality

  • The PR body says "Nothing about saving … changes", but the requires list written for saved steps does change for the cases it names. The schema file lists only capability names, which this PR does not change, so cargo xtask schema should produce no diff. The PR should say that. Confidence: medium-low.

AGENTS.md

  • Possible rule trigger, not a confirmed break: "a change to what a project saves runs cargo xtask schema". I could not run it. Its output should be empty, since no capability names change. Confidence: medium-low.

Change size

Compared: the whole PR against main (merge base 0286882 to PR head 04b6830).

Item Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 291.8 KB
Size after 293.9 KB
Total size change +2.1 KB
Path Before After Change
crates/engine/src/project_capabilities.rs 207.8 KB 209.5 KB +1.7 KB
crates/engine/src/cmd/raster.rs 84.0 KB 84.4 KB +422 B

@elpidioassinaturas
elpidioassinaturas added this pull request to the merge queue Nov 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3291/
Web app https://preview.rustgis.app/pr-3291/app/
Commit 04b6830

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

Merged via the queue into opengeos:main with commit de6e59f Nov 29, 2026
28 checks passed
@elpidioassinaturas
elpidioassinaturas deleted the fix/relief-capabilities-type branch November 29, 2026 00:50
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.

2 participants