Repository navigation
fix(router): key obstacle cache by effective exclusions - #5105
cangen185-sudo wants to merge 3 commits into
Conversation
Co-authored-by: 福晋 <liufu.lf@antgroup.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5105 +/- ##
==========================================
+ Coverage 83.78% 83.81% +0.03%
==========================================
Files 338 338
Lines 39416 39407 -9
Branches 8164 8179 +15
==========================================
+ Hits 33023 33028 +5
+ Misses 6369 6355 -14
Partials 24 24
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Follow-up to the coverage report: commit This covers the three missing identity-selection lines. The remaining changed uncovered line is the defensive missing- Local validation on this head: 160 router/Cell/Edge tests passed, including the production Manhattan routing case; targeted V8 coverage, TypeScript, Biome on the changed test, and diff checks passed. Production code is unchanged in this follow-up. Hosted CI for this new head is tracked separately from these local results. |
📝 Description
Keep Manhattan obstacle-map reuse consistent with the actual cells excluded for each edge. Two edges can have identical router options but different excluded terminals or terminal ancestors. Previously the second edge reused the first edge's map, allowing a route through a node that should be an obstacle, or treating its own enclosing group as an obstacle.
Compute the terminal/ancestor exclusion set with the same helper used by
ObstacleMap.build, include its sorted IDs in a structured cache key, and retain reuse when exclusions are equivalent. Serialize option arrays as JSON to distinguish IDs such asa|bfrom the two IDsaandb. Invalidate cached geometry when node visibility or shape changes.🖼️ Screenshot
The regression calls the production Manhattan router with real
Model,Node, andEdgeinstances and a geometry-onlyEdgeViewfixture. After warming the cache with an edge that excludes its source, another edge must take an orthogonal detour around that node. Every resulting segment is checked against the padded obstacle; fallback routing throws in this test.💡 Motivation and Context
ObstacleMap.build(model, edge)depends on the current edge's terminals and ancestors, while the previous cache key included only router option values. Visibility and shape also affect obstacle membership but did not invalidate the cache.The cache retains one entry per model. Switching between different exclusion sets rebuilds it; equivalent exclusions still share the map. This is a correctness fix and does not claim a performance improvement on grouped or terminal-excluding graphs.
🧩 Types of changes
🔍 Self Check before Merge
Validation on Windows, against
masterat306eddb03fd5313d75d9a3ce084722f44475da01:tsc --noEmit, Biome on both changed files, andgit diff --checkpassed.AI assistance: implementation and test drafting assisted by OpenAI Codex; the patch was reviewed and locally tested.