oxc-project
oxc
BlogDocsChangelog

fix(linter): fix flaky import/no_cycle test

#14328Merged
Comparing
fix-no-cycle-flaky
(
f1bc608
) with
main
(
588acd5
)
CodSpeed Performance Gauge
0%
Untouched
4
Skipped
33

Benchmarks

Skipped (33)

Passed

linter[react.development.js]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
33 ms33 ms
linter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
1.6 ms1.6 ms
linter[cal.com.tsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
729.6 ms729.6 ms
linter[binder.ts]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
88.7 ms88.7 ms

Commits

Click on a commit to change the comparison range
Base
main
588acd5
+0.03%
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)
f1bc608
5 days ago
by Boshen
© 2025 CodSpeed Technology
Home Terms Privacy Docs