Repository navigation
fix(engine): report unreadable route definition queries - #2442
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| rustgis_map::rows::Rows::All => (0..l.dataset.features.len()).collect(), | ||
| rustgis_map::rows::Rows::Subset(rows) => rows, | ||
| }; | ||
| let r = network::shortest_route( |
There was a problem hiding this comment.
Bug (moderate confidence, about 55%): the unreadable-query notice is lost when the route fails. The notice is only emitted after shortest_route(...)? succeeds, so an Err returns before notify_text runs. With a broken definition query the network silently widens to every feature, and if the route then fails, the user sees only "no route" with no hint that their query was ignored. The AGENTS.md "Never silent" rule asks that the fallback be reported. The new test covers only successful routes, so this path is untested.
Suggested fix: emit the notice before returning the error. query_notice is only moved on one path at a time, and l is not used on the Err path, so this should borrow-check, but I have not compiled it.
| let r = network::shortest_route( | |
| let r = match network::shortest_route( | |
| &l.dataset, | |
| &rows, | |
| point(p, "from")?, | |
| point(p, "to")?, | |
| cost, | |
| f(p, "snapDistance").unwrap_or(1000.0).clamp(0.0, 1e6), | |
| ) { | |
| Ok(r) => r, | |
| Err(error) => { | |
| if let Some(notice) = query_notice { | |
| s.notify_text(notice, false); | |
| } | |
| return Err(error); | |
| } | |
| }; |
A regression case would be a broken query on a network where the endpoints can't connect: assert the error and one query notice.
There was a problem hiding this comment.
The notice describes a successful route made without its unreadable query. When shortest_route fails, no output dataset or route layer is added. This follows the same successful-result notice policy as Simulation. Also, Session::guarded withdraws ordinary non-error notices on failure (lib.rs, the (Err(_), Some(snap)) branch), so moving notify_text(..., false) onto the error path would not retain it. The route failure remains the reported outcome.
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Verified correct
Prior reviews: none existed on this PR, so no concerns were skipped as already raised. Outside this diff (not raised): Change sizeCompared with main (merge base fde9aea to PR head 13dac4e), the whole PR.
|
|
The failed-route notice point is answered inline: no route is committed, and the session guard withdraws ordinary informational notices on failure. Successful fallback routes report the parser error once. The fixed-count wording is accurate for this single-input command; a wording/template refactor is left for the release quality pass. Neighborhood is already recorded as the next separate consumer slice. |
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
analysis.routesilently used every resident line when a saved definition query could no longer be read. Use the shared row resolver withPolicy::Queryand report that fallback once through a typed, translatable notice. Valid queries still restrict the network; selection remains irrelevant to connectivity. Empty query results remain an empty network.This changes the shared engine command used by desktop, browser, CLI, Python, touch, Assistant/MCP and plugins. Existing ribbon/search dispatch and route-layer undo remain unchanged; no command options or descriptions change. The resident dataset is borrowed and source row positions, network caching and cancellation are preserved. No external project code was followed.
Testing
route_reports_unreadable_query_and_keeps_query_only_network: two connected source features, one selected, queries keeping both/one/neither, and an unreadable field query. Checks route segment count and one typed fallback notice with literal layer data.UI evidence
No UI layout or rendering change. The new fallback notice is covered through the actual engine command and its translation payload.
Related issue
Part of #2402 (remaining consumer adoption).
Summary by CodeRabbit