Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for hard/soft barrier layers across the Python orchestration and Rust routing core, avoiding “dummy high cost” barrier encodings and enabling retry-by-dropping ranked soft barriers while tracking which barriers were relaxed per solution.
Changes:
- Extend routing payloads + CLI APIs to accept
barrier_layers, normalizebarrier_values, and persist hard barriers into the Python-built routing raster. - Refactor Rust dataset handling to materialize derived cost + barrier masks in a swap store, and add retry-aware successor generation + per-solution dropped-barrier metadata.
- Update Rust/Python bindings and tests to return/validate
(path, cost, dropped_barrier_layers)results, plus docs describing barrier configuration.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python/unit/test_skimage_validate.py | Adjusts assertions for new 3-tuple route result shape. |
| tests/python/unit/test_rust_bindings.py | Adds unit coverage for hard/soft barriers and dropped-barrier metadata. |
| tests/python/unit/routing/test_routing_base.py | Adds Python-side normalization + routing-layer barrier behavior tests (includes a callable-vs-property issue). |
| tests/python/unit/routing/cli/test_routing_cli_point_to_feature.py | Updates CLI converter batch tuple to include barrier layers. |
| tests/python/unit/routing/cli/test_routing_cli_build_costs.py | Adds CLI test ensuring explicit barriers become NaN in final routing raster output. |
| tests/python/integration/test_rust_bindings_integration.py | Adds layered-file integration coverage for hard/soft barriers and retries. |
| revrt/routing/cli/utilities.py | Includes barrier layers in routing-layer output hashing/persistence. |
| revrt/routing/cli/point_to_point.py | Adds barrier_layers parameter + documentation to point-to-point CLI entry. |
| revrt/routing/cli/point_to_feature.py | Adds barrier_layers parameter + documentation to point-to-feature CLI entry. |
| revrt/routing/cli/build_costs.py | Plumbs barrier_layers from config into routing-layer build. |
| revrt/routing/cli/base.py | Threads barrier layers through batch generation and routing execution. |
| revrt/routing/base.py | Normalizes barrier layers for Rust, applies hard barriers to Python routing raster, and records dropped-barrier metadata in outputs. |
| revrt/models/cost_layers.py | Introduces BarrierLayer model + barrier_values parsing/validation. |
| docs/source/guides/routing_layers.md | Documents barrier operators including != and usage guidance. |
| crates/revrt/src/solution.rs | Extends Solution to store dropped barrier layer names. |
| crates/revrt/src/routing/scenario.rs | Adds retry-aware successor filtering and dropped-barrier reporting helpers. |
| crates/revrt/src/routing/mod.rs | Implements per-start retry loop dropping soft barrier groups and recording metadata. |
| crates/revrt/src/network/long_range/mod.rs | Tweaks frontier update criteria to use estimated cost (aligning with PQ ordering). |
| crates/revrt/src/lib.rs | Adds a core test ensuring explicit barriers block routing. |
| crates/revrt/src/ffi/mod.rs | Updates Python return tuple type to include dropped barrier layers (docs currently overstate contents). |
| crates/revrt/src/dataset/swap.rs | New swap initialization/layout inspection module for derived routing arrays. |
| crates/revrt/src/dataset/reader.rs | New cached neighborhood reader for costs + hard/soft barrier masks. |
| crates/revrt/src/dataset/mod.rs | Major dataset refactor to use swap+reader+derived writer and expose soft barrier grouping. |
| crates/revrt/src/dataset/lazy_subset.rs | Expands documentation/comments and supports new derived workflow. |
| crates/revrt/src/dataset/derived.rs | New derived-data writer to materialize costs + barrier masks chunk-wise. |
| crates/revrt/src/cost.rs | Adds barrier layer types, grouping by importance, and barrier mask construction. |
| crates/revrt/Cargo.toml | Adds test-integration feature gating for Rust integration tests. |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (71.73%) is below the target coverage (93.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #256 +/- ##
==========================================
- Coverage 97.26% 96.86% -0.41%
==========================================
Files 26 26
Lines 2927 2967 +40
Branches 340 351 +11
==========================================
+ Hits 2847 2874 +27
- Misses 59 66 +7
- Partials 21 27 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
castelao
left a comment
There was a problem hiding this comment.
This is a lot of code. Thanks for addressing the barriers requirements! I think we might be able to resolve the barriers in a simpler way, but we should move this PR forward to support barriers now, and try to improve it later when we have a chance. Thanks!
| workspace = true | ||
|
|
||
| [features] | ||
| test-integration = [] |
There was a problem hiding this comment.
Great idea! With that we can easily choose when we can afford a heavier tests.
This PR adds support for both hard and soft barriers without the need to specify a high dummy cost multiplier value like 99999. Instead the algorithm simply does not show barriered cells as successors. Soft barriers have an intrinsic rank, and can be dropped iteratively until a valid routing solution is found. All of this is described in the routing layer guide that was put together a while ago.
The requirements for this PR led to a sizable refactor of dataset.rs, but hopefully that module has better separation of responsibilities now.