fix(replay): share one seeded generator and present builtins with real identity (#539)

This commit is contained in:
morluto
2026-10-05 16:47:20 +08:00
committed by GitHub
parent 333d118c0f
commit 5b51fa01e2
5 changed files with 176 additions and 19 deletions
+7 -7
View File
@@ -2,6 +2,10 @@ import canonicalize from "canonicalize";
import { createHash } from "node:crypto";
import type { JsonValue } from "../domain/jsonValue.js";
import {
createSeededRandomUint,
NON_DEGENERATE_XORSHIFT32_SEED,
} from "../replay/seededRandom.js";
import type {
ControlledReplayInput,
ReplayExecutionResult,
@@ -252,13 +256,9 @@ const replayCases = (
arguments: item.arguments,
}));
if (input.generator === undefined) return uniqueCases(explicit);
let state = input.generator.seed || 0x9e37_79b9;
const next = (): number => {
state ^= state << 13;
state ^= state >>> 17;
state ^= state << 5;
return state >>> 0;
};
const next = createSeededRandomUint(
input.generator.seed || NON_DEGENERATE_XORSHIFT32_SEED,
);
const corpus = boundaryCorpus(input.generator.preset);
const generated: {
readonly case_id: string;