Fix regression & Improve test coverage related to 'DijkstraMap'#100
Conversation
📝 WalkthroughWalkthroughThe PR updates Dijkstra pathfinding initialization to explicitly set start tile distances before propagation and adds comprehensive unit test coverage. Unweighted and weighted builds now initialize distances with ChangesStart tile initialization and test coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e39fbd4 to
e6756de
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bracket-pathfinding/src/dijkstra.rs`:
- Around line 355-407: Add a threaded-only unit test that exercises
DijkstraMap::build_parallel by supplying at least THREADED_REQUIRED_STARTS (>=4)
start positions; create a new #[test] function annotated with #[cfg(feature =
"threaded")] (e.g., fn test_new_threaded()) in the same tests module, construct
a MiniMap, call DijkstraMap::new (or new_weighted) with 4+ start indices, and
assert the resulting map contents or properties match expected values so the
parallel code path (DijkstraMap::build_parallel) is exercised and validated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c27ed64-bd1b-4929-bbce-be1b39669f0b
📒 Files selected for processing (1)
bracket-pathfinding/src/dijkstra.rs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Format all Rust code usingcargo fmt --all
Fix allcargo clippywarnings — the CI enforces-D warnings
Add tests for new functionality in the relevant module; for split domains, prefer colocatedtests.rs
Files:
bracket-pathfinding/src/dijkstra.rs
🔇 Additional comments (1)
bracket-pathfinding/src/dijkstra.rs (1)
151-153: LGTM!Also applies to: 183-185, 230-232
utilForever
left a comment
There was a problem hiding this comment.
LGTM. Thanks for your work! 🧪
What
Restore Dijkstra start tiles as seeded distance values and add regression coverage for the restored behavior.
Why
DijkstraMap.mapis public distance data, but the current build paths only write neighboring tiles during expansion. That leaves start tiles with a return-path cost instead of the expected seed distance, which can affect directmapreads and helper-based path selection.This PR restores the intended seed behavior for
build,build_weighted, and threadedbuild_parallel, then locks the behavior with tests for constructor output, weighted starts, empty maps, clearing, and lowest-exit selection.Closes #26
Checklist
Required
cargo check --allpassescargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warnings -A clippy::multiple-crate-versionspassescargo test --allpassesThreaded Dijkstra path was verified separately with
cargo test -p bracket-pathfinding --features threaded dijkstra::test -- --nocaptureFunctional Validation
Configuration & Docs
README.md,ARCHITECTURE.md, or relevant manual pages, if applicable)If Applicable
cargo auditlocally if needed)Summary by CodeRabbit