You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(linter): fix flaky import/no_cycle test (#14328)
## Summary
Fixes the flaky `import/no_cycle` test that was failing 2/10 times on Linux CI.
## Root Cause
The module graph is populated via parallel insertion (`par_drain` in `runtime.rs`), which causes non-deterministic insertion order into `FxHashMap`. Since hashmap iteration order depends on insertion order, this leads to:
1. Different iteration orders across test runs
2. Different graph traversal paths in the cycle detector
3. The `traversed` set preventing revisiting nodes means cycles can be found or missed depending on which path is explored first
## Solution
Sort the hashmap entries by key before iterating in `module_graph_visitor.rs` to ensure deterministic traversal order regardless of parallel insertion timing.
## Test Plan
- [x] `cargo test -p oxc_linter no_cycle` passes
- [x] Code formatted with `just fmt`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
0 commit comments