feat(版本): 优化概览与只读状态
关键改动: - 增加需求排序和版本只读状态规则及测试 - 完善版本概览阶段耗时、项目页和工作台展示 - 优化小宝预警请求节流、建议状态和风险过滤 Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import test from 'node:test';
|
||||
import { buildRiskInsightSignature } from './xiaobao-risk-ai';
|
||||
import type { XiaobaoRiskInsightCacheItem } from './xiaobao-risk-cache';
|
||||
import type { XiaobaoVersionRisk } from './xiaobao-risk';
|
||||
import { attachXiaobaoRiskSuggestion } from './xiaobao-risk-suggestion';
|
||||
import { attachXiaobaoRiskSuggestion, buildXiaobaoRiskInsightPendingKey } from './xiaobao-risk-suggestion';
|
||||
|
||||
function risk(patch: Partial<XiaobaoVersionRisk> = {}): XiaobaoVersionRisk {
|
||||
return {
|
||||
@@ -91,7 +91,7 @@ test('attachXiaobaoRiskSuggestion provides a rule suggestion when AI cache is em
|
||||
test('attachXiaobaoRiskSuggestion keeps previous AI suggestion while a new one is updating', () => {
|
||||
const previous = risk({ riskScore: 52, riskLevel: 'attention' });
|
||||
const current = risk({ riskScore: 82, riskLevel: 'at_risk', delayDays: 1 });
|
||||
const pendingKey = `${current.versionId}:${buildRiskInsightSignature(current)}`;
|
||||
const pendingKey = buildXiaobaoRiskInsightPendingKey(current);
|
||||
|
||||
const result = attachXiaobaoRiskSuggestion(current, {
|
||||
insights: [insight(previous)],
|
||||
@@ -125,3 +125,50 @@ test('attachXiaobaoRiskSuggestion uses the current AI suggestion when the signat
|
||||
assert.equal(result.aiInsightUpdating, false);
|
||||
assert.equal(result.aiInsight?.summary, '新的小宝建议');
|
||||
});
|
||||
|
||||
test('buildXiaobaoRiskInsightPendingKey stays stable for refresh-only risk drift', () => {
|
||||
const before = risk({
|
||||
riskLevel: 'likely_delayed',
|
||||
riskScore: 100,
|
||||
confidence: 65,
|
||||
forecastReleaseDate: '2026-07-14T03:37:15.903Z',
|
||||
signals: { ...risk().signals, failedTestCount: 14, silentRiskCount: 58, daysToExpectedRelease: 1 },
|
||||
dailyEvidence: {
|
||||
todayDeliveries: [],
|
||||
todayProgress: [
|
||||
{ id: 'ev-2', title: 'Progress', summary: 'Fixed login issue.', occurredAt: '2026-06-29T03:37:15.903Z' },
|
||||
],
|
||||
todayCreations: [],
|
||||
todayRisks: [],
|
||||
progressNotes: [],
|
||||
needsProgressItems: [],
|
||||
recentActivityCount: 12,
|
||||
totalActivityCount: 6,
|
||||
todayActualHours: 1.5,
|
||||
lastActivityAt: '2026-06-29T03:37:15.903Z',
|
||||
},
|
||||
});
|
||||
const after = risk({
|
||||
riskLevel: 'likely_delayed',
|
||||
riskScore: 100,
|
||||
confidence: 65,
|
||||
forecastReleaseDate: '2026-07-15T06:21:38.597Z',
|
||||
signals: { ...risk().signals, failedTestCount: 14, silentRiskCount: 58, daysToExpectedRelease: 0 },
|
||||
dailyEvidence: {
|
||||
todayDeliveries: [],
|
||||
todayProgress: [
|
||||
{ id: 'ev-2', title: 'Progress', summary: 'Fixed login issue.', occurredAt: '2026-06-29T06:21:38.597Z' },
|
||||
],
|
||||
todayCreations: [],
|
||||
todayRisks: [],
|
||||
progressNotes: [],
|
||||
needsProgressItems: [],
|
||||
recentActivityCount: 13,
|
||||
totalActivityCount: 6,
|
||||
todayActualHours: 3,
|
||||
lastActivityAt: '2026-06-29T06:21:38.597Z',
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(buildXiaobaoRiskInsightPendingKey(before), buildXiaobaoRiskInsightPendingKey(after));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user