feat(版本): 优化概览与只读状态

关键改动:

- 增加需求排序和版本只读状态规则及测试

- 完善版本概览阶段耗时、项目页和工作台展示

- 优化小宝预警请求节流、建议状态和风险过滤

Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
Script Generator
2026-06-30 18:18:18 +08:00
parent 3d3d56697a
commit eef3c8f000
32 changed files with 1072 additions and 289 deletions

View File

@@ -9,6 +9,7 @@ import {
findPreviousRiskSnapshot,
getReusableInsight,
shouldRequestRiskInsight,
shouldRequestRiskInsightWithRequestGate,
shouldRequestRiskInsightWithCacheGate,
shouldRequestRiskInsightWithCooldown,
} from './xiaobao-risk-ai';
@@ -283,6 +284,22 @@ test('shouldRequestRiskInsightWithCacheGate allows changed risk facts after cach
);
});
test('shouldRequestRiskInsightWithRequestGate skips repeat requests during request cooldown without cache', () => {
const current = risk({ riskLevel: 'at_risk', riskScore: 82 });
assert.equal(
shouldRequestRiskInsightWithRequestGate({
riskCacheLoaded: true,
cache: [],
current,
previous: snapshot({ riskScore: 45 }),
lastRequestedAt: '2026-06-29T10:30:00.000Z',
now: new Date('2026-06-29T11:00:00.000Z'),
}),
false,
);
});
test('buildRiskInsightSignature uses all open bugs, not only critical bugs', () => {
const base = buildRiskInsightSignature(risk({
signals: { ...risk().signals, openBugCount: 1, criticalBugCount: 0 },