fix: correct misleading lint hint for crypto.getRandomValues#1729
Open
AGRO-CODEX wants to merge 1 commit into
Open
fix: correct misleading lint hint for crypto.getRandomValues#1729AGRO-CODEX wants to merge 1 commit into
AGRO-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
approved these changes
Jun 26, 2026
jrusso1020
left a comment
Collaborator
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
Collaborator
|
@AGRO-CODEX can you sign your commit please? it's not mergable without that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.