Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/engine/src/policy/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,10 @@ impl Session {
// command of an extension that is off, as `Session::run` does: the one asked for, and
// the one a completion finishes.
if let Some(why) = self.extensions().blocks(id) {
// A completion's raster is let go, as `finish_raster` does.
if let Some(run) = params.get("ran").and_then(Value::as_u64) {
self.raster_results.retain(|(n, _)| *n != run);
}
Comment on lines +696 to +699

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.

Bug (medium confidence): a blocked command drops another caller's pending raster before any owner check.

authorize runs for every ingress, including scoped ones (assistant, MCP, plugin, via with_scope), with the caller's raw params. This new retain removes the raster whose id is in params["ran"] without checking continuation_owner. finish_raster and authorize_unchecked both check ownership before touching that raster, so this line is the only path that doesn't. A scoped caller can send any command of an extension that is off with "ran": N and delete a pending raster it doesn't own. Run ids come from a sequential counter, so they are easy to guess. The effect is limited (the owner gets "no longer kept: run it again"), but it is a cross-caller state change on a path that used to have none.

Also, the removal is not mentioned in the returned error, so the drop is not reported.

Suggested fix: drop the raster only when its owner is the caller.

Suggested change
// A completion's raster is let go, as `finish_raster` does.
if let Some(run) = params.get("ran").and_then(Value::as_u64) {
self.raster_results.retain(|(n, _)| *n != run);
}
// A completion's raster is let go, as `finish_raster` does, once its owner asks.
if let Some(run) = params.get("ran").and_then(Value::as_u64)
&& let Some(c) = self.raster_results.iter().find(|(n, _)| *n == run).and_then(|(_, m)| m.continuation.clone())
&& self.continuation_owner(&c).is_ok()
{
self.raster_results.retain(|(n, _)| *n != run);
}

No regression test covers either this path or the new analysispane clearing. Please add one for each, since the PR changes behavior.

return Err(why);
}
let op = self.authorize_unchecked(id, params)?;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Expand Down
4 changes: 4 additions & 0 deletions crates/ui-egui/src/analysispane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ fn picked(app: &mut RustGisApp, purpose: &str) -> Option<Vec<rustgis_engine::geo
pub fn workflows(app: &mut RustGisApp, ui: &mut Ui, t: &Tokens) {
// A section whose extension was turned off while it was open: back to the first.
if app.workflow.section.is_empty() || !section_shown(&app.session, app.workflow.section) {
// Its map pick ends with it (a pick started elsewhere, with no section open, stays).
if !app.workflow.section.is_empty() {
app.workflow.pick = None;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
app.workflow.section = "rasterFunctions";
}
egui::ComboBox::from_id_salt("wf_section")
Expand Down
Loading