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
{{ message }}
Repository navigation
Use crate::test_rng::Rng in every randomized test: three more xorshift64* copies sit beside the module that claims to be the only one #1868
[agent] Filed by the scheduled architecture audit (audit-core). Register: register.
Kind: refactor (test-only). Register ID: A29.
Problem
test_rng.rs calls itself "the one deterministic RNG the randomized tests share". There are three more copies of the same xorshift64* generator:
crawlers/oracle_support.rs L10-L38:`` pub(crate) struct Rng, with the same `new`/`next`/`below`/`pick` and a `chance(pct: usize)` spelled `below(100) < pct`. `test_rng` spells it `next() % 100 < percent` with a `u64` argument.
crawlers/npm_crawler/oracle.rs L1056-L1068:``` next/`below` inlined into a fixture builder.
All four produce the same stream for the same state (the same shifts and multiplier), so a single type serves every caller.
Proposed change
Delete the three copies. Use crate::test_rng::Rng in the crawler oracle tests, copy_tree's randomized test and the npm oracle builder.
Keep test_rng's chance(u64) and change the crawler callers' argument type.
Seeds stay the same, so every generated case is unchanged.
Size
4 files, about −50 lines, all #[cfg(test)].
Acceptance criteria
No production change.
Every randomized test in crawlers/* (the *_matches_the_async_oracle tests), patch::copy_tree and npm_crawler passes with the same seeds and the same case counts.
grep -rn "0x2545_F491_4F6C_DD1D" crates/socket-patch-core/src returns one hit, in test_rng.rs.
Not in scope (noted in the register)
The eight crawlers/**/oracle.rs files, 2,978 lines with oracle_support.rs, keep the pre-blocking-pool crawlers as equivalence oracles. cargo_crawler/oracle.rs already differs from production: it reads with tokio::fs::read_to_string, which follows FIFOs and links, while production uses read_regular_to_string_sync. Whether to delete these oracles is a separate question.
[agent] Claiming this issue (CI / test-harness lane; root cause: randomized tests re-implement xorshift64* instead of using crate::test_rng::Rng). Branch: agent/fix-ci-test-rng-dedup. Claim-ID: 2026-10-30T03:51:12Z-ec26d9
Note: on 5ca5623 there are two more copies in core beyond the three listed, as inline closures in vendor/go_sum_edit.rs and vendor/go_mod_edit.rs. I'll fold those in too.
Activity
mikolalysenko commentedon Oct 30, 2026
[agent] Claiming this issue (CI / test-harness lane; root cause: randomized tests re-implement xorshift64* instead of using
crate::test_rng::Rng). Branch: agent/fix-ci-test-rng-dedup. Claim-ID: 2026-10-30T03:51:12Z-ec26d9Note: on 5ca5623 there are two more copies in core beyond the three listed, as inline closures in
vendor/go_sum_edit.rsandvendor/go_mod_edit.rs. I'll fold those in too.Generated by Claude Code
mikolalysenko commentedon Oct 30, 2026
[agent] Draft PR: #1882
Generated by Claude Code
Import test_rng::Rng directly in oracle tests