From 8f0a8795ff656f902e0afbf8cd58d313e858b267 Mon Sep 17 00:00:00 2001 From: choupeanut Date: Wed, 25 Nov 2026 11:15:00 +0800 Subject: [PATCH 1/5] fix(engine): overture.add from a plugin command in the app answers pending, not an empty list (#2677) Co-Authored-By: Claude Sonnet 5.5 --- crates/engine/src/cmd/catalogs.rs | 19 +++++++-- crates/engine/src/tests.rs | 64 +++++++++++++++++++++++++++++++ docs/plugins.md | 7 ++++ 3 files changed, 86 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/catalogs.rs b/crates/engine/src/cmd/catalogs.rs index 18b4cc1104..ef19eb7c24 100644 --- a/crates/engine/src/cmd/catalogs.rs +++ b/crates/engine/src/cmd/catalogs.rs @@ -11,7 +11,7 @@ use crate::{CmdResult, CommandSpec as C, Session}; pub fn commands() -> Vec { vec![ C::new("overture.add", "Add Overture Maps Data", "Home › Add › Web Data", overture_add).roles(&[]).effects(crate::policy::Effects::NONE.with(crate::policy::Effect::Network)).params( - r#"{"theme": "buildings"|"places"|"transportation"|"divisions"|"base"|"addresses", "type"?: "the theme's type (building, building_part; place; segment, connector; division_area, division, division_boundary; land_use, land, land_cover, water, infrastructure, bathymetry; address)", "release"?: "such as 2026-09-23.1 (default: the latest)", "bbox"?: [west, south, east, north] | "view" (the map's extent, the default), "tiles"?: bool (the whole world as map tiles, from the theme's PMTiles archive, instead of the features in view), "files"?: [the files' GeoParquet addresses, when already found and opened (the app's background requests)]}"#, + r#"{"theme": "buildings"|"places"|"transportation"|"divisions"|"base"|"addresses", "type"?: "the theme's type (building, building_part; place; segment, connector; division_area, division, division_boundary; land_use, land, land_cover, water, infrastructure, bathymetry; address)", "release"?: "such as 2026-09-23.1 (default: the latest)", "bbox"?: [west, south, east, north] | "view" (the map's extent, the default), "tiles"?: bool (the whole world as map tiles, from the theme's PMTiles archive, instead of the features in view), "files"?: [the files' GeoParquet addresses, when already found and opened (the app's background requests)]} (in a plugin's command in the app the files are left to download: it answers pending, with the layers already in, and the command runs again once they are added; see docs/plugins.md)"#, ), C::new("sourcecoop.products", "List Source Cooperative Products", "Home › Add › Web Data", sourcecoop_products).roles(&[]).effects(crate::policy::Effects::NONE.with(crate::policy::Effect::Network)) .view() @@ -110,15 +110,22 @@ fn overture_add(s: &mut Session, p: &Value) -> CmdResult { /// Adds a theme type's files (read in place, the map's view kept), all or none: when one can't be /// added, the ones added before it are taken out again, so trying again doesn't add them twice. +/// Files left to the app (a plugin's command in the app) make the answer `"pending": true`. pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult { // What a failure puts back: the map's layers in their order and its layer ids (not a copy of // their data), and the active layer. let (n, active, before) = (urls.len(), s.active_layer, s.map().layer_mark()); let mut layers: Vec = Vec::new(); + let mut pending = false; for (i, url) in urls.iter().enumerate() { match super::layer::add_url(s, &json!({"url": url, "name": overture::layer_name(ty, i, n), "zoom": false})) { - Ok(r) => layers - .extend(r["layers"].as_array().into_iter().flatten().filter_map(Value::as_u64).filter_map(|id| u32::try_from(id).ok())), + Ok(r) => { + // A plugin's command in the app leaves the file to the app (`layer.addUrl`'s pending + // answer): the layer comes when it lands, and the command runs again (#2677). + pending |= r.get("pending").and_then(Value::as_bool) == Some(true); + layers + .extend(r["layers"].as_array().into_iter().flatten().filter_map(Value::as_u64).filter_map(|id| u32::try_from(id).ok())); + } Err(e) => { s.map_mut().restore_layers(&before); s.active_layer = active; @@ -126,7 +133,11 @@ pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult } } } - Ok(json!({"layers": layers, "files": n})) + let mut out = json!({"layers": layers, "files": n}); + if pending { + out["pending"] = json!(true); + } + Ok(out) } fn sourcecoop_products(_s: &mut Session, p: &Value) -> CmdResult { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index d1ffa103c7..3feb45248f 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -37495,6 +37495,70 @@ fn overture_files_are_added_all_or_none() { assert_eq!(r["files"], 2); let names: Vec<&str> = s.map().layers.iter().map(|l| l.name.as_str()).collect(); assert!(names.contains(&"Overture building (1/2)") && names.contains(&"Overture building (2/2)"), "{names:?}"); + assert!(r.get("pending").is_none(), "files added here are not pending: {r}"); +} + +/// A plugin's command in the app leaves each Overture file to the app (`layer.addUrl`'s pending +/// answer): `overture.add` says so, instead of answering an empty list of layers (#2677). +#[test] +fn overture_files_a_plugin_command_leaves_to_the_app_answer_pending() { + let home = "https://overturemaps-us-west-2.s3.amazonaws.com/release/2026-11-18.0/theme=buildings/type=building"; + let urls = [format!("{home}/part-0.parquet"), format!("{home}/part-1.parquet")]; + let mut s = Session::new(Project::default()); + let r = s.run_leaving_downloads("overture.add", &json!({"theme": "buildings", "files": urls})).unwrap(); + assert_eq!(r["pending"], true, "{r}"); + assert_eq!((&r["files"], &r["layers"]), (&json!(2), &json!([])), "{r}"); + assert!(s.map().layers.is_empty()); + // Both files are asked for, named as the synchronous add names them; nothing was fetched. + let asked = s.take_url_requests(); + let named: Vec<(&str, &str)> = + asked.iter().map(|q| (q.params()["url"].as_str().unwrap_or_default(), q.params()["name"].as_str().unwrap_or_default())).collect(); + assert_eq!(named, [(urls[0].as_str(), "Overture building (1/2)"), (urls[1].as_str(), "Overture building (2/2)")]); +} + +/// A plugin command that adds an area's Overture files in the app waits for them, and runs again +/// once the app has added them: its `overture.add` then answers both layers, added once (#2677). +#[test] +fn a_plugin_command_adding_overture_files_runs_again_when_they_are_added() { + use rustgis_data::{Dataset, Feature, Field, FieldType, Geometry, GeometryType, Value}; + let mut ds = Dataset::new("b", GeometryType::Point, vec![Field::new("n", FieldType::Integer)]); + for i in 0..5u32 { + let c = rustgis_geom::Coord::new(7.0 + 0.01 * f64::from(i), 46.0); + ds.features.push(Feature { id: u64::from(i) + 1, geometry: Some(Geometry::Point(c)), attrs: vec![Value::Int(i64::from(i))] }); + } + let bytes = rustgis_data::source::parquet::write(&ds).unwrap(); + let mut s = world(); + plugin("eng-overture", &["edit", "network"]); + let layers = s.map().layers.len(); + let home = "https://overturemaps-us-west-2.s3.amazonaws.com/release/2026-11-18.0/theme=buildings/type=building"; + let urls = [format!("{home}/part-0.parquet"), format!("{home}/part-1.parquet")]; + let p = json!({"op": "overture.add", "params": {"theme": "buildings", "files": urls}}); + let first = s.run_leaving_downloads("plugin:eng-overture/f", &p).unwrap(); + assert_eq!(first["pending"], true, "{first}"); + assert_eq!(s.map().layers.len(), layers, "the call's own run is undone"); + let asked = s.take_url_requests(); + assert_eq!(asked.len(), 2); + assert!(s.poll_plugin_retries().is_empty(), "nothing landed yet"); + // The app downloads and adds both, each with its request's number. + for q in &asked { + let id = s.download_started_for(q).unwrap(); + assert!(s.download_landed(id, bytes.clone())); + let mut add = q.params().clone(); + add["id"] = json!(id); + s.complete_download(id, &add).unwrap(); + } + assert_eq!(s.map().layers.len(), layers + 2); + let undo = s.undo.len(); + let ran = s.poll_plugin_retries(); + assert_eq!(ran.len(), 1, "{ran:?}"); + let answer = ran[0].1.as_ref().unwrap(); + assert_eq!(answer["layers"].as_array().map(Vec::len), Some(2), "{answer}"); + assert!(answer.get("pending").is_none(), "{answer}"); + let names: Vec<&str> = s.map().layers.iter().map(|l| l.name.as_str()).collect(); + assert!(names.contains(&"Overture building (1/2)") && names.contains(&"Overture building (2/2)"), "{names:?}"); + assert_eq!((s.map().layers.len(), s.undo.len()), (layers + 2, undo), "added once"); + assert!(s.take_url_requests().is_empty() && !s.plugin_retries_waiting()); + rustgis_plugins::unload("eng-overture"); } /// A multi-file add that fails puts the map back exactly: the same layers in the same order, and diff --git a/docs/plugins.md b/docs/plugins.md index 7f196bfc78..fe3315f1c5 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -699,6 +699,13 @@ the way, once for each document at most, and a map layer is added by the run tha 16 documents are read at a time, and asking for more fails. In the web app `service.add` still refuses to download. +`overture.add` does the same on the desktop when it adds an area's files: each GeoParquet file is +left to download as `layer.addUrl` does, and while any is under way it answers `{"pending": true, +"files": n, "layers": [...]}` (the layers already in; none on the first run), so the command can +return and runs again once they are added, when `overture.add` answers the ids of the layers it +added. It adds all of an area's files or none: a file that fails stops the command with an error. +It also fetches the catalog on each run, which waits with the window held. + While a command waits the window answers, so the user can work and the project can change. The status bar says the command is running, and asking for it again with the same parameters does nothing. A run again sees the view the command first ran with, and the window's size then, unless From e8ffd361a5e0628fbaa7d42558b8c2a6d385b849 Mon Sep 17 00:00:00 2001 From: choupeanut Date: Thu, 26 Nov 2026 11:34:05 +0800 Subject: [PATCH 2/5] overture.add: say which files a failed pending add leaves (#2677) --- crates/engine/src/cmd/catalogs.rs | 12 ++++++++-- crates/engine/src/tests.rs | 39 +++++++++++++++++++++++++++++++ docs/plugins.md | 2 +- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/catalogs.rs b/crates/engine/src/cmd/catalogs.rs index ef19eb7c24..7fd2fb66fe 100644 --- a/crates/engine/src/cmd/catalogs.rs +++ b/crates/engine/src/cmd/catalogs.rs @@ -110,7 +110,8 @@ fn overture_add(s: &mut Session, p: &Value) -> CmdResult { /// Adds a theme type's files (read in place, the map's view kept), all or none: when one can't be /// added, the ones added before it are taken out again, so trying again doesn't add them twice. -/// Files left to the app (a plugin's command in the app) make the answer `"pending": true`. +/// Files left to the app (a plugin's command in the app) make the answer `"pending": true`; the +/// ones that landed before a later file failed stay (each its own undo step), and the error says so. pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult { // What a failure puts back: the map's layers in their order and its layer ids (not a copy of // their data), and the active layer. @@ -129,7 +130,14 @@ pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult Err(e) => { s.map_mut().restore_layers(&before); s.active_layer = active; - return Err(if n > 1 { format!("{e} (none of the {n} files was added)") } else { e }); + // Layers a plugin's earlier run left to the app have landed before this run: they + // stay, each its own undo step, so say so rather than that none was added. + let kept = layers.iter().filter(|id| s.map().layer(**id).is_some()).count(); + return Err(match (n > 1, kept) { + (false, _) => e, + (true, 0) => format!("{e} (none of the {n} files was added)"), + (true, k) => format!("{e} ({k} of the {n} files was added earlier and stays; undo removes it)"), + }); } } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 3feb45248f..8e6c67616a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -37561,6 +37561,45 @@ fn a_plugin_command_adding_overture_files_runs_again_when_they_are_added() { rustgis_plugins::unload("eng-overture"); } +/// When the second of a plugin command's Overture files fails after the first landed, the command's +/// error says the first stays (it is its own undo step), not that none was added. +#[test] +fn a_failed_pending_overture_add_says_which_files_stay() { + use rustgis_data::{Dataset, Feature, Field, FieldType, Geometry, GeometryType, Value}; + let mut ds = Dataset::new("b", GeometryType::Point, vec![Field::new("n", FieldType::Integer)]); + for i in 0..5u32 { + let c = rustgis_geom::Coord::new(7.0 + 0.01 * f64::from(i), 46.0); + ds.features.push(Feature { id: u64::from(i) + 1, geometry: Some(Geometry::Point(c)), attrs: vec![Value::Int(i64::from(i))] }); + } + let good = rustgis_data::source::parquet::write(&ds).unwrap(); + let mut s = world(); + plugin("eng-overture-fail", &["edit", "network"]); + let layers = s.map().layers.len(); + let home = "https://overturemaps-us-west-2.s3.amazonaws.com/release/2026-11-18.0/theme=buildings/type=building"; + let urls = [format!("{home}/part-0.parquet"), format!("{home}/part-1.parquet")]; + let p = json!({"op": "overture.add", "params": {"theme": "buildings", "files": urls}}); + s.run_leaving_downloads("plugin:eng-overture-fail/f", &p).unwrap(); + let asked = s.take_url_requests(); + assert_eq!(asked.len(), 2); + // The first lands and is added; the second's download fails. + let id = s.download_started_for(&asked[0]).unwrap(); + assert!(s.download_landed(id, good)); + let mut add = asked[0].params().clone(); + add["id"] = json!(id); + s.complete_download(id, &add).unwrap(); + let id = s.download_started_for(&asked[1]).unwrap(); + assert!(s.download_landed(id, b"not a parquet file".to_vec())); + let mut add = asked[1].params().clone(); + add["id"] = json!(id); + let _ = s.complete_download(id, &add); + let ran = s.poll_plugin_retries(); + let e = ran.first().and_then(|r| r.1.as_ref().err()).cloned().unwrap_or_default(); + assert_eq!(s.map().layers.len(), layers + 1, "the first file's layer stays: {ran:?}"); + assert!(e.contains("1 of the 2 files was added earlier and stays"), "{e}"); + assert!(!e.contains("none of the"), "{e}"); + rustgis_plugins::unload("eng-overture-fail"); +} + /// A multi-file add that fails puts the map back exactly: the same layers in the same order, and /// the same active layer. #[test] diff --git a/docs/plugins.md b/docs/plugins.md index fe3315f1c5..2c6021f6bb 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -703,7 +703,7 @@ the way, once for each document at most, and a map layer is added by the run tha left to download as `layer.addUrl` does, and while any is under way it answers `{"pending": true, "files": n, "layers": [...]}` (the layers already in; none on the first run), so the command can return and runs again once they are added, when `overture.add` answers the ids of the layers it -added. It adds all of an area's files or none: a file that fails stops the command with an error. +added. It adds all of an area's files or none when it adds them itself; when they are left to download, a file that fails stops the command with an error that says how many were added before it. Those stay, each its own undo step. It also fetches the catalog on each run, which waits with the window held. While a command waits the window answers, so the user can work and the project can change. The From d8029643d1e33dc5cc789010575dc250518adb07 Mon Sep 17 00:00:00 2001 From: choupeanut Date: Thu, 26 Nov 2026 12:26:01 +0800 Subject: [PATCH 3/5] overture.add: word the kept-files error and docs for any count (#2677) --- crates/engine/src/cmd/catalogs.rs | 2 +- crates/engine/src/tests.rs | 2 +- docs/plugins.md | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/catalogs.rs b/crates/engine/src/cmd/catalogs.rs index 7fd2fb66fe..9e9bb78995 100644 --- a/crates/engine/src/cmd/catalogs.rs +++ b/crates/engine/src/cmd/catalogs.rs @@ -136,7 +136,7 @@ pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult return Err(match (n > 1, kept) { (false, _) => e, (true, 0) => format!("{e} (none of the {n} files was added)"), - (true, k) => format!("{e} ({k} of the {n} files was added earlier and stays; undo removes it)"), + (true, k) => format!("{e} ({k} of the {n} files landed earlier and stay, each its own undo step)"), }); } } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 8e6c67616a..b97affe08e 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -37595,7 +37595,7 @@ fn a_failed_pending_overture_add_says_which_files_stay() { let ran = s.poll_plugin_retries(); let e = ran.first().and_then(|r| r.1.as_ref().err()).cloned().unwrap_or_default(); assert_eq!(s.map().layers.len(), layers + 1, "the first file's layer stays: {ran:?}"); - assert!(e.contains("1 of the 2 files was added earlier and stays"), "{e}"); + assert!(e.contains("1 of the 2 files landed earlier and stay"), "{e}"); assert!(!e.contains("none of the"), "{e}"); rustgis_plugins::unload("eng-overture-fail"); } diff --git a/docs/plugins.md b/docs/plugins.md index 2c6021f6bb..5b72cdb4c4 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -703,7 +703,9 @@ the way, once for each document at most, and a map layer is added by the run tha left to download as `layer.addUrl` does, and while any is under way it answers `{"pending": true, "files": n, "layers": [...]}` (the layers already in; none on the first run), so the command can return and runs again once they are added, when `overture.add` answers the ids of the layers it -added. It adds all of an area's files or none when it adds them itself; when they are left to download, a file that fails stops the command with an error that says how many were added before it. Those stay, each its own undo step. +added. Where it adds the files in the same run (the command line, the assistant) it adds all of an +area's files or none. When they are left to download, a file that fails stops the command with an +error that says how many landed before it. Those stay, each its own undo step. It also fetches the catalog on each run, which waits with the window held. While a command waits the window answers, so the user can work and the project can change. The From a5494a137e8e12b1fd87c95c7b35e98ac9df4d31 Mon Sep 17 00:00:00 2001 From: choupeanut Date: Thu, 26 Nov 2026 20:32:10 +0800 Subject: [PATCH 4/5] overture.add: count the files that landed from the downloads, not the loop (#2677) --- crates/engine/src/cmd/catalogs.rs | 12 +++++++++++- crates/engine/src/tests.rs | 32 +++++++++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/catalogs.rs b/crates/engine/src/cmd/catalogs.rs index 9e9bb78995..2ea856d91c 100644 --- a/crates/engine/src/cmd/catalogs.rs +++ b/crates/engine/src/cmd/catalogs.rs @@ -132,7 +132,17 @@ pub(crate) fn add_files(s: &mut Session, ty: &str, urls: &[String]) -> CmdResult s.active_layer = active; // Layers a plugin's earlier run left to the app have landed before this run: they // stay, each its own undo step, so say so rather than that none was added. - let kept = layers.iter().filter(|id| s.map().layer(**id).is_some()).count(); + // Counted from the downloads that landed, whichever of the files they were: a file + // after the failed one may have landed too, and this loop never reached it. + let kept = s + .rerun_landed + .iter() + .filter(|(asked, _, added)| { + added.added_any() + && !added.gone(s.map()) + && asked.get("url").and_then(Value::as_str).is_some_and(|u| urls.iter().any(|x| x == u)) + }) + .count(); return Err(match (n > 1, kept) { (false, _) => e, (true, 0) => format!("{e} (none of the {n} files was added)"), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index b97affe08e..d30977ceba 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -37565,6 +37565,14 @@ fn a_plugin_command_adding_overture_files_runs_again_when_they_are_added() { /// error says the first stays (it is its own undo step), not that none was added. #[test] fn a_failed_pending_overture_add_says_which_files_stay() { + // The failed file comes second (the loop has added the first) or first (it never reaches the + // one that landed after it). + for bad_first in [false, true] { + a_failed_pending_overture_add_says_which_files_stay_in(bad_first); + } +} + +fn a_failed_pending_overture_add_says_which_files_stay_in(bad_first: bool) { use rustgis_data::{Dataset, Feature, Field, FieldType, Geometry, GeometryType, Value}; let mut ds = Dataset::new("b", GeometryType::Point, vec![Field::new("n", FieldType::Integer)]); for i in 0..5u32 { @@ -37572,6 +37580,9 @@ fn a_failed_pending_overture_add_says_which_files_stay() { ds.features.push(Feature { id: u64::from(i) + 1, geometry: Some(Geometry::Point(c)), attrs: vec![Value::Int(i64::from(i))] }); } let good = rustgis_data::source::parquet::write(&ds).unwrap(); + fn bad_bytes() -> Vec { + b"not a parquet file".to_vec() + } let mut s = world(); plugin("eng-overture-fail", &["edit", "network"]); let layers = s.map().layers.len(); @@ -37581,20 +37592,17 @@ fn a_failed_pending_overture_add_says_which_files_stay() { s.run_leaving_downloads("plugin:eng-overture-fail/f", &p).unwrap(); let asked = s.take_url_requests(); assert_eq!(asked.len(), 2); - // The first lands and is added; the second's download fails. - let id = s.download_started_for(&asked[0]).unwrap(); - assert!(s.download_landed(id, good)); - let mut add = asked[0].params().clone(); - add["id"] = json!(id); - s.complete_download(id, &add).unwrap(); - let id = s.download_started_for(&asked[1]).unwrap(); - assert!(s.download_landed(id, b"not a parquet file".to_vec())); - let mut add = asked[1].params().clone(); - add["id"] = json!(id); - let _ = s.complete_download(id, &add); + // One lands and is added; the other's download fails. + for (q, bytes) in asked.iter().zip(if bad_first { [bad_bytes(), good.clone()] } else { [good.clone(), bad_bytes()] }) { + let id = s.download_started_for(q).unwrap(); + assert!(s.download_landed(id, bytes)); + let mut add = q.params().clone(); + add["id"] = json!(id); + let _ = s.complete_download(id, &add); + } let ran = s.poll_plugin_retries(); let e = ran.first().and_then(|r| r.1.as_ref().err()).cloned().unwrap_or_default(); - assert_eq!(s.map().layers.len(), layers + 1, "the first file's layer stays: {ran:?}"); + assert_eq!(s.map().layers.len(), layers + 1, "the file that landed stays: {ran:?}"); assert!(e.contains("1 of the 2 files landed earlier and stay"), "{e}"); assert!(!e.contains("none of the"), "{e}"); rustgis_plugins::unload("eng-overture-fail"); From 73f523c9b5a8346a03bb61434f807f559531635d Mon Sep 17 00:00:00 2001 From: choupeanut Date: Thu, 26 Nov 2026 21:39:16 +0800 Subject: [PATCH 5/5] overture.add: test both orders of a failed pending file more tightly (#2677) --- crates/engine/src/tests.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index d30977ceba..0939df8603 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -37561,8 +37561,8 @@ fn a_plugin_command_adding_overture_files_runs_again_when_they_are_added() { rustgis_plugins::unload("eng-overture"); } -/// When the second of a plugin command's Overture files fails after the first landed, the command's -/// error says the first stays (it is its own undo step), not that none was added. +/// When one of a plugin command's Overture files fails and the other landed (before or after it), +/// the command's error says that one stays (its own undo step), not that none was added. #[test] fn a_failed_pending_overture_add_says_which_files_stay() { // The failed file comes second (the loop has added the first) or first (it never reaches the @@ -37592,6 +37592,7 @@ fn a_failed_pending_overture_add_says_which_files_stay_in(bad_first: bool) { s.run_leaving_downloads("plugin:eng-overture-fail/f", &p).unwrap(); let asked = s.take_url_requests(); assert_eq!(asked.len(), 2); + assert_eq!(asked[0].params()["url"], json!(urls[0]), "asked in the files' order"); // One lands and is added; the other's download fails. for (q, bytes) in asked.iter().zip(if bad_first { [bad_bytes(), good.clone()] } else { [good.clone(), bad_bytes()] }) { let id = s.download_started_for(q).unwrap(); @@ -37604,6 +37605,7 @@ fn a_failed_pending_overture_add_says_which_files_stay_in(bad_first: bool) { let e = ran.first().and_then(|r| r.1.as_ref().err()).cloned().unwrap_or_default(); assert_eq!(s.map().layers.len(), layers + 1, "the file that landed stays: {ran:?}"); assert!(e.contains("1 of the 2 files landed earlier and stay"), "{e}"); + assert!(e.contains(if bad_first { "part-0.parquet" } else { "part-1.parquet" }), "the failed file's own error: {e}"); assert!(!e.contains("none of the"), "{e}"); rustgis_plugins::unload("eng-overture-fail"); }