Repository navigation
fix(engine): stac.addCube adds its tile layers from a plugin command in the app - #2422
Conversation
…in the app (opengeos#2418) A plugin's command in the desktop app runs with leave_downloads set, and layer.addUrl left every remote address to the app, the data cube's GeoTIFFs too: no tile layer came, and stac.addCube said the file was "not a cloud-optimised GeoTIFF read in place". A "cube": true GeoTIFF is now added as a tile layer at once (its tiles are read in place on later frames, nothing waits), as the command line and the browser do. stac.addCube also tells a file left to the app to download apart from one that isn't cloud-optimised. Closes opengeos#2418 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action performed
|
Code reviewI read the diff, the surrounding code in Bugs
Security
Performance
Quality
AGENTS.md
Earlier concerns: there were no prior review threads, so nothing was left out as already raised. Change sizeCompared: the whole PR against main (merge base 0e9e6cd to PR head a02d2a9).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
…pengeos#2418) - Test the other side: a cube file that is a plain (stripped) GeoTIFF is added unprobed from a plugin command, its header read fails with "not a cloud-optimised GeoTIFF", and a GeoTIFF export of the view says so, as the desktop map view does for any tile layer's error. - Say in the comment why the branch needs no web check (web_address refuses other addresses above it), and use `b` throughout. - add_cube keeps the file's address as a &str instead of an Option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI found no crash, silent-loss or wasm-build problems in the changed lines. Two inline comments are posted: an address leak in the new error (low confidence) and a limit on unnamed-address COGs in the app path (medium). I could not run the build or tests here, so the PR's own claim that the test passes is unverified by me. Bugs
Security
Performance
Quality
AGENTS.md
Earlier concerns left alone: 2
Change sizeCompared with
|
Code reviewNo new findings. I read the three changed files, the surrounding code, and the earlier review threads, and checked the following against the code:
I did not run the test suite or clippy; this review was read-only. Earlier threads (4 total, all left alone):
Change sizeCompared: the whole PR against main (merge base 0e9e6cd to PR head be845c2).
|
Problem
A plugin command that runs
stac.addCubein the desktop app fails for every collection, even when the files are valid cloud-optimised GeoTIFFs:The same call works in
rustgis-cli(for files whose addresses name a GeoTIFF, as STAC APIs' do).cube.openwith a STAC entry ofcube.cataloggoes throughstac.addCubeand fails the same way.Cause
A plugin's command in the app runs with
leave_downloadsset. In that modelayer::add_urlreturnss.request_url(…)for any remote address before it reaches the cloud-optimised GeoTIFF branch, so the"cube": truefilestac::add_cubeasks for comes back as a download left to the app ("pending": true), not a tile layer.add_cubethen finds no tile layer at the returned index and reports the file as not cloud-optimised.Fix
crates/engine/src/cmd/layer.rs: underleave_downloads, a remote GeoTIFF with"cube": true(named.tif/.tiff, or"cog"; not"as": "scan"or"whole") is added withadd_cogdirectly, its header unread, as the browser build already does. A tile layer reads its tiles in place on later frames, so nothing waits on the command's frame (add_cogalready skips the header probe underleave_downloads). Every other remote address is still left to the app exactly as before.crates/engine/src/cmd/stac.rs:add_cubetells a pending answer apart (a cube file whose address names no GeoTIFF, left to the app) and says so, instead of "not a cloud-optimised GeoTIFF". What it added is taken back as for any other failure, and the queued request goes with the failed command.Surfaces
Only plugin commands run by the desktop app change: they run through
Session::run_leaving_downloads, the one placeleave_downloadsis set. The command line, scripts and the Assistant/MCP tools run commands that wait and already took theadd_cogpath; the browser build takes it too (wasm32branch, untouched). No command description, parameter or i18n text changes. The cube's tile layers are one undo step, as from the command line.A cube file that turns out not to be cloud-optimised is added unprobed (a plugin command can't wait for its header on the frame, as in the browser). Its header's error is then said as the map draws it: the desktop map view notifies tile-layer errors (
mapview.rs,session.notify(error, true)), and a GeoTIFF export lists it among the tile layers that failed. The test covers that side too.Limit, unchanged by this PR: a cube file whose address names no GeoTIFF (no
.tif/.tiff, no"cog") is still left to the app in a plugin command, andstac.addCuberefuses it with the new message. The command line reads such a file by probing its header (is_unnamed_url), which a plugin command can't wait for on the frame; reading it would need that probe off the frame, a separate change. Real STAC sources name their files (the Brazil Data Cube's…_NDVI.tif, Earth Search's….tif).Test
a_stac_data_cube_from_a_plugin_command_in_the_app: a session withleave_downloadsset runsstac.addCubeagainst a STAC API served locally (items on two grid tiles, COGs served by range). It checks that two tile layers are added with their per-date files and range, that nothing is left to the app, and that the time slider gets the two dates and steps through them.cube.open(open_entrywith a STAC entry pointed at the same API) adds the same layers. A cube file whose address names no GeoTIFF gets the new message, with nothing kept. A cube file that is a plain (stripped) GeoTIFF is added, its header read fails with "not a cloud-optimised GeoTIFF", and a GeoTIFF export of the view says so.On
mainthe test fails with the error from the issue (…/a1.tif: not a cloud-optimised GeoTIFF read in place; a data cube needs those); with the fix it passes.cargo test -p rustgis-engine --lib: 1802 passed.cargo clippy -p rustgis-engine --all-targets -- -D warningsandcargo fmt --checkare clean.Closes #2418
🤖 Generated with Claude Code
Summary by CodeRabbit
Summary