L2考核落地:人才测评整合为L2考核track,新增查重初筛与e2e验证

- 新增 L2考核 track(7维标准/100分):选题难度赋分cap、功能完整性地板线、合格判定
- 人才测评整合进 L2考核:移除 L2/L3 两级认定与 question_id 机制
- 新增 l2-topics 选题元数据服务与 config/l2-topics.json(11命题题+自选题)
- 新增查重初筛 plagiarism-detect(MD5精确比对+归一化相似度+提交行为,仅告警)
- 修复 L2 维度 DIM_FILE_FILTERS 缺失导致 AI 协作记录证据漏喂
- e2e:修复 Windows spawn、DB 隔离,L2 用例 27 项全绿
This commit is contained in:
hangshuo652
2026-08-23 20:58:56 +08:00
parent 4da7044c4b
commit 6a2419d4a4
26 changed files with 1306 additions and 662 deletions
+32 -30
View File
@@ -5,9 +5,9 @@ import { test, expect, type Page, type APIRequestContext } from '@playwright/tes
// 覆盖对象:
// 1. 模板维度可声明「文件关键词」→ DIM_FILE_FILTERS 硬编码仅兑底
// 2. 模板 content 成为评审指南第一来源(评审要点完整保留并透传)
// 3. 人才测评 L2「功能完整性」盲区修复isBuildRelatedDim
// 3. L2考核「功能完整性」构建封顶维度识别isBuildRelatedDim
// 4. 阈值收拢命名常量后 pass_line / 及格线行为回归
// 5. question_id 分组过滤(快照只含 common + 所选 Qn
// 5. L2考核 选题(selected_topic)与难度赋分 cap
// ══════════════════════════════════════════════════════════════════
const PASSWORD = 'test123';
@@ -107,20 +107,21 @@ test.describe('项目创建与赛道自动标准', () => {
await request.fetch(`${BASE}/projects/${pid}?force=true`, { method: 'DELETE', headers: { Authorization: `Bearer ${token}` } });
});
test('1.3 人才测评自动生成含「功能完整性」标准', async ({ request }) => {
test('1.3 L2考核自动生成 7 维标准(功能完整性 30', async ({ request }) => {
const token = await apiLogin(request);
const pid = await apiCreateProject(request, token, `人才-${UNIQUE}`, '人才测评');
const pid = await apiCreateProject(request, token, `L2-${UNIQUE}`, 'L2考核');
const r = await request.fetch(`${BASE}/projects/${pid}/standards`, {
headers: { Authorization: `Bearer ${token}` },
});
const standards = await r.json();
expect(standards).toHaveLength(1);
const dims = standards[0].dimensions;
expect(dims.some((d: any) => d.name === '功能完整性' && d.maxScore === 40)).toBe(true);
expect(dims.some((d: any) => d.name === '功能完整性' && d.maxScore === 30)).toBe(true);
// 共通维度合计 100L2 格线 = 60
const commonTotal = dims.filter((d: any) => (d.group || 'common') === 'common').reduce((s: number, d: any) => s + d.maxScore, 0);
expect(commonTotal).toBe(100);
// 7 维合计 100L2 格线 = 60
const total = dims.reduce((s: number, d: any) => s + d.maxScore, 0);
expect(total).toBe(100);
expect(dims).toHaveLength(7);
await request.fetch(`${BASE}/projects/${pid}?force=true`, { method: 'DELETE', headers: { Authorization: `Bearer ${token}` } });
});
});
@@ -273,50 +274,51 @@ test.describe('条目快照透传', () => {
});
// ══════════════════════════════════════
// 4. 人才测评:question_id 分组过滤 + 功能完整性
// 4. L2考核:选题(selected_topic+ 难度赋分 cap
// ══════════════════════════════════════
test.describe('人才测评 question_id 分组', () => {
test.describe('L2考核 选题与 cap', () => {
let pid = '';
let token = '';
test.beforeAll(async ({ request }) => {
token = await apiLogin(request);
pid = await apiCreateProject(request, token, `人才Q-${UNIQUE}`, '人才测评');
pid = await apiCreateProject(request, token, `L2Q-${UNIQUE}`, 'L2考核');
});
test.afterAll(async ({ request }) => {
await request.fetch(`${BASE}/projects/${pid}?force=true`, { method: 'DELETE', headers: { Authorization: `Bearer ${token}` } });
});
test('4.1 建条目未选题被拒绝(400', async ({ request }) => {
test('4.1 无效选题被拒绝(400', async ({ request }) => {
const r = await request.fetch(`${BASE}/projects/${pid}/entries`, {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
data: { title: '无题', repo_url: `https://noq-${UNIQUE}.git` },
data: { title: '无效选题', repo_url: `https://noid-${UNIQUE}.git`, selected_topic: '99' },
});
expect(r.status()).toBe(400);
});
test('4.2 Q2 条目快照包含 common 与 [Q2] 维度(完整标准,评审时按题目过滤)', async ({ request }) => {
const entry = await apiCreateEntry(request, token, pid, 'Q2选手', { question_id: 'Q2' });
const dims = JSON.parse(entry.standard_snapshot);
const groups = new Set(dims.map((d: any) => d.group || 'common'));
expect(groups.has('common')).toBe(true);
expect(groups.has('Q2')).toBe(true);
// 快照保留完整标准(含其他题目维度),评审时按 question_id 过滤
expect(groups.has('Q3')).toBe(true);
// 功能完整性在 common 组且是构建封顶维度
const fnDim = dims.find((d: any) => d.name === '功能完整性');
expect(fnDim).toBeDefined();
expect(fnDim.maxScore).toBe(40);
test('4.2 命题 11(★★)→ cap=100;自选题 → cap=100', async ({ request }) => {
const e1 = await apiCreateEntry(request, token, pid, '题11选手', { selected_topic: '11' });
expect(e1.selected_topic).toBe('11');
expect(e1.max_score_cap).toBe(100);
const e2 = await apiCreateEntry(request, token, pid, '自选选手', { selected_topic: 'self' });
expect(e2.max_score_cap).toBe(100);
});
test('4.3 pass_line = 共通维度 60% = 60', async ({ request }) => {
const entry = await apiCreateEntry(request, token, pid, 'Q1选手', { question_id: 'Q1' });
expect(entry.pass_line).toBe(60);
test('4.3 命题 03(★★★★)→ cap=110(难度赋分封顶)', async ({ request }) => {
const entry = await apiCreateEntry(request, token, pid, '题03选手', { selected_topic: '03' });
expect(entry.max_score_cap).toBe(110);
});
test('4.4 快照为 7 维标准(全 common,功能完整性 30', async ({ request }) => {
const entry = await apiCreateEntry(request, token, pid, '快照选手', { selected_topic: '01' });
const dims = JSON.parse(entry.standard_snapshot);
expect(dims).toHaveLength(7);
expect(dims.every((d: any) => (d.group || 'common') === 'common')).toBe(true);
const fnDim = dims.find((d: any) => d.name === '功能完整性');
expect(fnDim.maxScore).toBe(30);
});
});