This commit is contained in:
2026-05-08 11:44:42 +08:00
parent b08127031c
commit abf1f1ebea
249 changed files with 39411 additions and 887 deletions

View File

@@ -1,29 +0,0 @@
import type { SimulationRunResult } from '../../types';
export interface NarrativeReplaySeed {
id: string;
seed: string;
label: string;
}
export function recordReplaySeed(params: {
seed: string;
label: string;
}) {
return {
id: `replay-seed:${params.seed}`,
seed: params.seed,
label: params.label,
} satisfies NarrativeReplaySeed;
}
export function replayNarrativeRun(params: {
recordedSeed: NarrativeReplaySeed;
result: SimulationRunResult;
}) {
return {
replayId: `replay:${params.recordedSeed.id}`,
seed: params.recordedSeed.seed,
summary: `${params.recordedSeed.label} 回放结果:${params.result.summary}`,
};
}

View File

@@ -1,14 +1,14 @@
import { describe, expect, it } from 'vitest';
import { recordReplaySeed, replayNarrativeRun } from './narrativeRegressionReplay';
import { recordRerunSeed, rerunNarrativeSimulation } from './narrativeRegressionRerun';
describe('narrativeRegressionReplay', () => {
it('records and replays a narrative seed summary', () => {
const seed = recordReplaySeed({
describe('narrativeRegressionRerun', () => {
it('records and reruns a narrative seed summary', () => {
const seed = recordRerunSeed({
seed: 'baseline',
label: 'Baseline',
});
const replay = replayNarrativeRun({
const rerun = rerunNarrativeSimulation({
recordedSeed: seed,
result: {
id: 'simulation-1',
@@ -23,6 +23,6 @@ describe('narrativeRegressionReplay', () => {
},
});
expect(replay.summary).toContain('Baseline');
expect(rerun.summary).toContain('Baseline');
});
});

View File

@@ -0,0 +1,29 @@
import type { SimulationRunResult } from '../../types';
export interface NarrativeRerunSeed {
id: string;
seed: string;
label: string;
}
export function recordRerunSeed(params: {
seed: string;
label: string;
}) {
return {
id: `rerun-seed:${params.seed}`,
seed: params.seed,
label: params.label,
} satisfies NarrativeRerunSeed;
}
export function rerunNarrativeSimulation(params: {
recordedSeed: NarrativeRerunSeed;
result: SimulationRunResult;
}) {
return {
rerunId: `rerun:${params.recordedSeed.id}`,
seed: params.recordedSeed.seed,
summary: `${params.recordedSeed.label} 复测结果:${params.result.summary}`,
};
}