refactor(data): 收口关系表运行时数据源
Some checks failed
Deploy Production / Build, push, deploy, verify (push) Has been cancelled

- 移除已迁移业务 AppData 运行时 fallback,改走领域 API 和关系表快读
- 补齐需求产品负责人、版本计划任务 JSON 和成员 username 回填迁移
- 统一治理字典入口,并补充 AI provider、数据源契约和领域服务测试

Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
2026-07-09 14:59:49 +08:00
parent 1e6fb0c7aa
commit 2e595c7e72
98 changed files with 2938 additions and 1441 deletions

View File

@@ -170,8 +170,8 @@ test('buildVersionDataScopeMap indexes many versions in one pass', () => {
assert.deepEqual(Object.keys(scopeMap).sort(), ['version-1', 'version-2', 'version-empty']);
});
test('selectVersionDataScope prefers non-empty V2.2 scope but keeps AppData overtime records', () => {
const appDataScope = buildVersionDataScope({
test('selectVersionDataScope prefers non-empty V2.2 scope but keeps store overtime records', () => {
const storeScope = buildVersionDataScope({
versionId: 'version-1',
requirements: [requirement('req-app', 'version-1')],
plans: [plan('plan-app', 'version-1', 'research')],
@@ -190,15 +190,61 @@ test('selectVersionDataScope prefers non-empty V2.2 scope but keeps AppData over
overtimeRecords: [],
});
const selected = selectVersionDataScope({ appDataScope, v22Scope });
const selected = selectVersionDataScope({ storeScope, v22Scope });
assert.equal(selected?.requirements[0].id, 'req-v22');
assert.equal(selected?.plans[0].id, 'plan-v22');
assert.deepEqual(selected?.overtimeRecords.map((item) => item.id), ['ot-app']);
});
test('selectVersionDataScope falls back to AppData when V2.2 scope is empty', () => {
const appDataScope = buildVersionDataScope({
test('selectVersionDataScope overlays local store changes onto V2.2 rows by id', () => {
const storeScope = buildVersionDataScope({
versionId: 'version-1',
requirements: [
{ ...requirement('req-v22', 'version-1'), title: '本地标题' },
{ ...requirement('req-local', 'version-1'), title: '本地新增' },
],
plans: [
{
...plan('plan-v22', 'version-1', 'product'),
status: 'in_progress',
requirementCoverage: [
{
requirementId: 'req-v22',
status: 'not_started',
currentWorkStartedAt: '2026-07-09T09:30:00.000Z',
updatedAt: '2026-07-09T09:30:00.000Z',
updatedBy: 'PM',
},
],
},
],
devTasks: [devTask('dev-v22', { versionId: 'version-1', status: 'in_progress' })],
testCases: [testCase('tc-v22', 'version-1')],
bugs: [bug('bug-v22', 'version-1')],
overtimeRecords: [],
});
const v22Scope = buildVersionDataScope({
versionId: 'version-1',
requirements: [requirement('req-v22', 'version-1')],
plans: [plan('plan-v22', 'version-1', 'product')],
devTasks: [devTask('dev-v22', { versionId: 'version-1', status: 'todo' })],
testCases: [testCase('tc-v22', 'version-1')],
bugs: [bug('bug-v22', 'version-1')],
overtimeRecords: [],
});
const selected = selectVersionDataScope({ storeScope, v22Scope });
assert.equal(selected?.requirements.find((item) => item.id === 'req-v22')?.title, '本地标题');
assert.equal(selected?.requirements.some((item) => item.id === 'req-local'), true);
assert.equal(selected?.plans[0].status, 'in_progress');
assert.equal(selected?.plans[0].requirementCoverage?.[0]?.currentWorkStartedAt, '2026-07-09T09:30:00.000Z');
assert.equal(selected?.devTasks[0].status, 'in_progress');
});
test('selectVersionDataScope falls back to store scope when V2.2 scope is empty', () => {
const storeScope = buildVersionDataScope({
versionId: 'version-1',
requirements: [requirement('req-app', 'version-1')],
plans: [],
@@ -215,7 +261,7 @@ test('selectVersionDataScope falls back to AppData when V2.2 scope is empty', ()
bugs: [],
});
const selected = selectVersionDataScope({ appDataScope, v22Scope: emptyV22Scope });
const selected = selectVersionDataScope({ storeScope, v22Scope: emptyV22Scope });
assert.equal(selected?.requirements[0].id, 'req-app');
});