Skip to content
Merged
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
29 changes: 21 additions & 8 deletions crates/engine/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22999,15 +22999,28 @@ fn dropped_z_values_are_said_on_import_and_export() {
let mark = s.notice_mark();
let id = s.run("layer.addData", &json!({"path": src, "stream": stream})).unwrap()["layer"].as_u64().unwrap();
assert!(s.notices_since(mark).iter().any(|n| n.text.contains("Z or M values")), "stream {stream}: {:?}", s.notices_since(mark));
let out = dir.join(format!("out-{stream}.geojson"));
let mark = s.notice_mark();
s.run("share.exportLayer", &json!({"layer": id, "path": out})).unwrap();
let said = |s: &Session, mark| s.notices_since(mark).iter().any(|n| n.text.contains("its geometry has no Z or M values"));
assert!(said(&s, mark), "stream {stream}: {:?}", s.notices_since(mark));
assert!(std::fs::read_to_string(&out).unwrap().contains("[1.0,2.0]"));
let said = |s: &Session, mark, path: &std::path::Path| {
let notes: Vec<_> = s.notices_since(mark).iter().filter(|n| n.text.contains("Z or M")).map(|n| &n.text).collect();
let loss = if stream {
format!("wells: {}", rustgis_data::zm_note(Some(1)))
} else {
"its geometry has no Z or M values, which were dropped when wells was read".into()
};
assert_eq!(notes, [&format!("{}: {loss}", path.display())], "stream {stream}");

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.

Likely failing for stream == true. The streamed GeoJSON and CSV paths never see the counted reader note, so this exact-match assertion should fail on the first export.

Why: share.exportLayer takes the chunk branch for streamed .geojson (export::streams includes geojson and csv; share.rs:723). That branch calls chunk_export() and write_source_to, neither of which carries info.notes. unreadable stays Unreadable::default(), so zm_noted is false and coalesce_read_zm keeps only the generic zm_export_note. The result is "<path>: its geometry has no Z or M values, which were dropped when wells was read", not the wells: 1 feature had Z or M values… text this test expects. data.convert to .csv has the same shape: its chunk branch (workflows.rs:1903-1928) builds notes from export_notes and never reads info.notes.

The counted note only reaches the export on the load_all_counted path (share.rs:724-725, workflows.rs:1930-1943), which streamed GeoJSON and CSV skip.

The PR body also says the focused test result is still pending, so this probably hasn't been run. Please run cargo test -p rustgis-engine dropped_z_values_are_said_on_import_and_export before merging.

Either the chunk branches need to carry the reader's counted Z/M note (and set zm_noted), or the streamed expectation needs to be the generic wording. The comment at lines 23011-23012 ("A counted reader diagnostic replaces the generic export warning") describes behaviour the chunk path doesn't have.

};
// Every output describes its loss, even after import or an earlier export said it.
// A counted reader diagnostic replaces the generic export warning, rather than adding one.
for repeat in 0..2 {
let out = dir.join(format!("out-{stream}-{repeat}.geojson"));
let mark = s.notice_mark();
s.run("share.exportLayer", &json!({"layer": id, "path": out})).unwrap();
said(&s, mark, &out);
assert!(std::fs::read_to_string(&out).unwrap().contains("[1.0,2.0]"));
}
let converted = dir.join(format!("converted-{stream}.csv"));
let mark = s.notice_mark();
s.run("data.convert", &json!({"layer": id, "format": "wkt", "path": dir.join(format!("converted-{stream}.csv"))})).unwrap();
assert!(said(&s, mark), "stream {stream}");
s.run("data.convert", &json!({"layer": id, "format": "wkt", "path": converted})).unwrap();
said(&s, mark, &converted);
}
let mut s = world();
let mark = s.notice_mark();
Expand Down
Loading