Repository navigation
fix(tests): make dotnet TRX tests deterministic via explicit mtimes - #4040
AngelVRodC wants to merge 1 commit into
Conversation
Replace thread::sleep-based wall-clock separation in the three flaky dotnet TRX tests with explicit file mtimes set via File::set_modified (stable since Rust 1.75). Sleep margins of 5-10ms fall inside the 1-2s mtime granularity of HFS+/FAT/CI mounts, causing nondeterministic failures. Timestamps are now pinned (old = base - 1 day, new = base + 1 hour) and since-cutoffs derive from the same base value, so outcomes never depend on elapsed real time. Fixes rtk-ai#4037
📊 Automated PR Analysis
SummaryFixes flaky dotnet TRX tests by replacing wall-clock-dependent mtimes and thread::sleep synchronization with explicit File::set_modified timestamps derived from a shared base time. A new #[cfg(test)] helper write_trx_with_mtime is added to pin fixture mtimes precisely, eliminating filesystem mtime granularity issues. Review Checklist
Linked issues: #4037 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Thanks for the fix and for finding the two sibling flakes. Issue #4037 was closed by #4048 (merged 2026-09-17), which covers the same three tests: old fixtures are pinned ten seconds before the cutoff and new ones ten seconds after through an explicit set_modified, and the sleeps are gone, so the dotnet TRX suites no longer depend on filesystem mtime granularity. The shared write_trx_with_mtime helper here is the one thing develop does not have, and with a per module set_mtime helper already in place that did not look like a reason to keep this open. Please comment or reopen if you think a part of this was missed. |
Fixes #4037
Summary
File::set_modifiedtimestamps (old = base − 1 day, new = base + 1 hour), deriving everysincecutoff from the samebaseso results are independent of filesystem mtime granularity (HFS+/FAT 1–2s flooring).thread::sleepsynchronization from these tests; add a tiny#[cfg(test)]write_trx_with_mtimehelper insrc/cmds/dotnet/mod.rs(inline module —automod::dir!would declare a new file as a production module).test_parse_trx_files_in_dir_since_ignores_older_filesplus two sibling latent flakes found during investigation (test_find_recent_trx_in_dir_picks_newest_trx,test_merge_test_summary_from_trx_ignores_stale_fallback_file).Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test— 0 warnings, 3781 passed / 0 failedsrc/cmds/dotnet/, +37/−16; no production code, no new dependencies