Skip to content

Use the visible raster layer name for workflow outputs - #3542

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
robmarkcole:fix/3488-raster-output-names
Dec 1, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
robmarkcole:fix/3488-raster-output-names

Conversation

@robmarkcole

@robmarkcole robmarkcole commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Use the input layer’s name in Contents when generating output names for Visibility Analysis, raster functions, and raster function chains. For example, a DEM downloaded as exportImage.tif and named MDT Bogotá 2025 now produces MDT Bogotá 2025_viewshed. An explicit output name still takes precedence.

The shared engine captures the visible layer name when resolving the input, so callers get the same behavior and function chains use the same name whether they process the raster in memory or in blocks. Codex assisted with implementation, testing, and this description.

Testing

Tested on Apple Silicon with macOS 26.6.2.

  • cargo test --locked -p rustgis-engine --lib raster_workflow_outputs_use_the_visible_layer_name passed. It checks the generated and explicit names for each of the three commands on a renamed DEM, including a case-insensitive layer lookup.
  • The engine unit suite passed with 3,193 tests passing and 9 ignored. Workspace formatting and Clippy passed.
  • cargo xtask ci stopped at the renderer test polygon_labels_tests::with_both_places_inside_taken_it_goes_round_its_polygon_corners_first. Rerunning that test on the unmodified base commit def6c67f produced the identical assertion failure at 0° rotation and 30° tilt.

UI evidence

The same named DEM and observer position are used in both runs. The output layer appears in Contents.

Before

Contents showing exportImage_viewshed

After

Contents showing MDT Bogotá 2025_viewshed

Related issue

Closes #3488

Summary by CodeRabbit

  • Bug Fixes
    • Raster function, function-chain, and viewshed outputs now use the visible layer name by default, rather than the name of the underlying raster.
    • Custom output names continue to be used when provided.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Raster inputs now keep the visible layer name separately from the tiled-file path. Raster function, function-chain, and viewshed outputs use the visible layer name by default. A supplied custom name overrides the default. Function chains use whole-raster processing when a chain halo or block plan is unavailable.

Changes: Raster output naming

Layer / File(s) Summary
Separate layer names from file paths
crates/engine/src/cmd/workflows.rs
Input stores the raster layer name separately from its optional file path. File lookup, raster reads, reuse, and part reads use these values.
Name raster workflow outputs
crates/engine/src/cmd/workflows.rs, crates/engine/src/tests.rs
Raster function, function-chain, and viewshed outputs default to names based on the source layer. Function-chain output naming is resolved before processing. Block processing requires both a chain halo and a block plan. Tests cover default and custom names.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: mavrick-f, giswqs

Merge Risk: Minimal · up to 9e52e

Default output names for Visibility Analysis, raster functions and function chains now use the layer name shown in Contents instead of the downloaded filename, and a custom name still overrides it. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: workflow outputs (Visibility Analysis, raster functions, raster function chains) now use the visible layer name from Contents. The raw summary and objectives both con…
Description check Passed The description follows the template. It has Summary, Testing, UI evidence (before and after screenshots, which the template requires for visible UI changes), and Related issue (Closes #3488). The Tes…
Linked Issues check Passed [#3488] The issue requires that default output names for Visibility Analysis, raster functions, and raster function chains use the user-visible layer name (for example MDT Bogotá 2025_viewshed) inst…
Out of Scope Changes check Passed The changes fall in crates/engine/src/cmd/workflows.rs and crates/engine/src/tests.rs. Per the raw summary, the Input struct gains a layer_name field, the raster-reading accessors use it, and …
Full details: Title check

Explanation

The title states the main change: workflow outputs (Visibility Analysis, raster functions, raster function chains) now use the visible layer name from Contents. The raw summary and objectives both confirm this change, so the title is directly related to the changeset.

Full details: Description check

Explanation

The description follows the template. It has Summary, Testing, UI evidence (before and after screenshots, which the template requires for visible UI changes), and Related issue (Closes #3488). The Testing section lists the targeted test, the wider engine suite, and the pre-existing renderer test failure with its base-commit comparison. The Summary explains the behavior change and gives an example.

Full details: Linked Issues check

Explanation

[#3488] The issue requires that default output names for Visibility Analysis, raster functions, and raster function chains use the user-visible layer name (for example MDT Bogotá 2025_viewshed) instead of the downloaded file name (exportImage_viewshed). The PR's raw change summary states that Input now stores layer_name from the map layer, and that viewshed, raster-function, and function-chain default names use this layer name instead of the held raster's name. The Input::of code at the reviewed head confirms that layer_name is set from l.name (the layer name) and kept separate from the file path. The added test raster_workflow_outputs_use_the_visible_layer_name (per the PR description and summary) checks default and explicit names for all three commands on a renamed DEM, including case-insensitive lookup. The PR description and UI screenshots show the expected MDT Bogotá 2025_viewshed name in Contents. Limitation: the text diff could not be read (changed blobs unavailable), and the head file read was truncated before the viewshed naming lines, so the naming lines were not read directly. The verdict rests on the summary, the head Input code, and the test description. No unmet coding requirement was found.

Full details: Out of Scope Changes check

Explanation

The changes fall in crates/engine/src/cmd/workflows.rs and crates/engine/src/tests.rs. Per the raw summary, the Input struct gains a layer_name field, the raster-reading accessors use it, and the default output-name logic for viewshed, raster functions, and function chains is changed. These directly implement #3488. The test addition supports the same objective. The summary also reports that function-chain output naming is resolved before work starts, and that block processing requires both a chain halo and a block plan. This reordering is described as supporting consistent naming between in-memory and block processing, which the PR description states. It is not a separate feature. No unrelated change was identified. The block-processing condition was not verified line by line because the diff was unavailable, so this assessment relies on the summary.

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 sees a layer name bright,
And names each output just right.
The viewshed follows suit,
Slope and aspect join the route.
A custom name can take the lead,
Then off through raster fields we speed.

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: d9556400-88d7-4f75-bdb5-e62368bccca2
Commits

Reviewing files that changed from the base of the PR and between 5799813 and 9e52e7d.

Files selected for processing: 2

  • crates/engine/src/cmd/workflows.rs
  • crates/engine/src/tests.rs

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

let src = raster_of(s, ps(p, "layer").ok_or("layer is required")?)?;
let target = resample_target(s, p)?;
let name = out_name(p, format!("{}_{}", src.held().name, ps(p, "function").unwrap_or("")))?;
let name = out_name(p, format!("{}_{}", src.layer_name, ps(p, "function").unwrap_or("")))?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output name now comes from the visible layer name here, but the same default is still built from the raster's internal name in other raster commands. After a rename, a DEM loaded from exportImage.tif still yields exportImage_… in them. Examples I checked by grep: index_work (imagery.rs:1667, format!("{}_{idx}", r.held().name)), and imagery.rs:197, 1311, 1551, 1731, 1854, 1886 and deeplearning.rs:307, 348. All read their input through Input::of, so the layer_name field would be available to them.

The PR body limits the fix to Visibility Analysis, raster functions and chains, but the title says "workflow outputs". Either extend the change to these, or say in the PR body why they stay as they are. The new test covers only the three commands in this diff.

Category: quality

};
let name = out_name(p, format!("{}_viewshed", dem.held().name))?;
let dem_name = dem.held().name.clone();
let name = out_name(p, format!("{}_viewshed", dem.layer_name))?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default name is built with format! and is not checked against the 200-character limit that out_name applies to a name the user gives (#1888). A layer name at that limit gives a default up to 209 characters long, since _viewshed adds 9. function_work and function_chain_work have the same pattern. This is probably harmless, because in_blocks shortens file stems, but it is inconsistent with the cap. I did not confirm whether renaming a layer enforces the same 200-character cap, so my confidence is low.

Category: quality

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or performance problems. Two quality points are posted inline. I checked the diff against the surrounding code in workflows.rs, imagery.rs, deeplearning.rs, in_blocks.rs and layer_by_name in map/src/lib.rs. The earlier-concern count is 0, since prior-reviews.json has no threads.

Bugs

  • None found. The Input::file() and read() paths return the same values as before. The name is now computed once and shared with the block path, so the in-memory and block chains use the same output name. Confidence: high.

Security

  • None found.

Performance

  • None found. The change only alters a name string.

Quality

  • Missed twins (inline on workflows.rs:1793). The same default name is still built from held().name in imagery.rs (index_work at line 1667, and lines 197, 1311, 1551, 1731, 1854, 1886) and in deeplearning.rs (lines 307, 348). A renamed DEM still produces exportImage_… in those commands. The PR body scopes the fix to three commands, but the title says "workflow outputs". Confidence: high that they are unchanged; medium on whether they are meant to be in scope.
  • Default name length (inline on workflows.rs:2155). Defaults built with format! skip the 200-character cap that out_name applies to given names. A layer name at the cap can produce a 209-character default. Confidence: low.
  • Test coverage. The new test exercises only the in-memory path. The block path for chains (in_blocks::plan with out) is not covered by a test. Confidence: medium.

AGENTS.md

  • The PR description does not say which surfaces the change reaches (CLI, Python, the Assistant and MCP tool descriptions, the browser), or why the others don't apply. The repository's "Reach every surface" rule asks for that. The default output names change for existing users, so this matters. Confidence: high.

Change size

Compared: the whole PR against main (merge base def6c67 to PR head 9e52e7d).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 3.99 MB
Size after 3.99 MB
Total size change +681 B
Path Before After Change
crates/engine/src/tests.rs 3.84 MB 3.84 MB +1.1 KB
crates/engine/src/cmd/workflows.rs 152.0 KB 151.6 KB -422 B

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Commit 9e52e7d from a fork built, but isn't published until a maintainer adds the preview label (once per commit).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 1, 2026
Merged via the queue into opengeos:main with commit 2b14978 Dec 1, 2026
28 checks passed
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]: Raster tool outputs are named after the downloaded file, not the layer's name

2 participants