fix: correct misleading lint hint for crypto.getRandomValues - #1729
fix: correct misleading lint hint for crypto.getRandomValues#1729AGRO-CODEX wants to merge 1 commit into
Conversation
The hint for the crypto.getRandomValues() non-determinism rule incorrectly said 'Remove time-dependent code', but crypto.getRandomValues() is a source of randomness, not time-dependence. Replaced with the same pattern used by the Math.random() hint, which correctly points to a seeded PRNG.
jrusso1020
left a comment
There was a problem hiding this comment.
Approving per James — tiny correctness fix on the non_deterministic_code lint rule.
crypto.getRandomValues() was getting the "Remove time-dependent code" hint, which is the right text for Date.now() / new Date() / performance.now() but wrong for a randomness source. The new hint mirrors the Math.random() entry ("Replace with a seeded PRNG …"), which is the structurally identical case. No logic change, no rule-behavior change, no severity change. Free quality.
— Jerrai
|
@AGRO-CODEX can you sign your commit please? it's not mergable without that |
|
Closing in the backlog value sweep. This is documentation, test-only, dependency upkeep, refactoring, or narrow diagnostic/ergonomic polish without enough current user impact or an active merge path to justify carrying it open. Please reopen or resubmit against current main if the need is still concrete. |
Builds on #1729 in the extracted lint package. Co-authored-by: AGRO-CODEX <brstopo@gmail.com>
|
Closing now that the refreshed, attributed successor #3659 has merged. It preserves this contribution and was checked against the current implementation and reviewed before landing. Thanks for the original work. |
What
Corrects the
fixHintmessage for thecrypto.getRandomValues()pattern in thenon_deterministic_codelint rule (packages/core/src/lint/rules/core.ts).Why
The previous hint said "Remove time-dependent code. Use a seeded PRNG for deterministic renders." but
crypto.getRandomValues()is not time-dependent — it is a source of randomness. The "time-dependent" label is accurate forDate.now(),new Date(), andperformance.now(), but is factually wrong for the crypto case.Change
The new hint follows the same pattern as the
Math.random()entry:No logic changes — lint behaviour, severity, and error codes are untouched.