Files
Genarrative/src/services/storyEngine/releaseGateReport.ts
高物 ddcb5d5c8c
Some checks failed
CI / verify (push) Has been cancelled
Rework story engine flow and reorganize project docs
2026-04-06 23:19:00 +08:00

37 lines
1.2 KiB
TypeScript

import type {
NarrativeQaReport,
ReleaseGateReport,
SimulationRunResult,
} from '../../types';
export function buildReleaseGateReport(params: {
qaReport: NarrativeQaReport | null | undefined;
simulationResults: SimulationRunResult[];
unresolvedThreadCount: number;
}) {
const issueCount = params.qaReport?.issues.length ?? 0;
const blockingIssues = [
...(params.qaReport?.issues.filter((issue) => issue.severity === 'high').map((issue) => issue.summary) ?? []),
...(params.unresolvedThreadCount > 5 ? ['活跃线程过多,可能会导致结局收束不稳。'] : []),
];
const status =
blockingIssues.length > 0
? 'block'
: issueCount > 0
? 'warn'
: 'pass';
return {
generatedAt: new Date().toISOString(),
status,
summary:
status === 'pass'
? '当前版本通过 narrative release gate。'
: status === 'warn'
? '当前版本可继续观察,但仍有若干 narrative 风险。'
: '当前版本存在 narrative 阻断问题,不建议发布。',
blockingIssues,
simulationCoverage: params.simulationResults.length,
} satisfies ReleaseGateReport;
}