test(infra): gate protected acceptance tests and ratchet test quality (TDD 2.0 Phase 1)
docs/tdd-red/07-revamp-plan.md Phase 1 — v1.1이 문서로만 선언한 것을 게이트로 옮긴다. 보호 수용 경로 게이트 (check-protected-tests.mjs): - 06 §5 의 보호 6경로를 base revision 과 비교한다. - 실패 조건: 테스트/스텝 블록 감소, expect 감소, .only 추가, skip/todo 추가, 보호 파일 삭제. - 정당한 스펙 변경은 커밋 본문 `allow-protected-change: <사유>` 또는 --reason 으로만 통과한다(사람 리뷰 대체 아님). CI quality 잡이 --base HEAD^ 로 실행하며 체크아웃이 depth 2 로 바뀐다. 얕은 클론에서는 SKIP 사유를 출력한다. 품질 래칫 (check-test-quality.mjs + test-quality-baseline.json): - 파일별 weak-assertion(toBeDefined/toBeTruthy/toBeFalsy/toBeNull)과 ambient-time(Date.now/Math.random/performance.now) 수치를 동결하고 증가만 막는다. - 128 / 203 건을 한 번에 고치지 않고 회귀만 차단한다. --update 는 리뷰 후 실행. 배선: verify:all 에 두 게이트 편입, CI quality 잡 단계 추가, map/02 §10 · tdd-red/06 §5·§6 · 07 Phase 0-1 상태 갱신. 검증: - self-test: check-protected-tests 6케이스, check-test-quality 6케이스 통과 - 실제 약화 주입 시 두 게이트가 exit 1 (smoke.spec.ts .only, 약한 단정 추가) 후 원복 - npm run test:hygiene / check:design GREEN, npm test GREEN (2800+605+31+24)
This commit is contained in:
parent
42583cc96b
commit
d3d6f34bfa
9 changed files with 658 additions and 22 deletions
271
scripts/ci/check-protected-tests.mjs
Normal file
271
scripts/ci/check-protected-tests.mjs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
#!/usr/bin/env node
|
||||
// scripts/ci/check-protected-tests.mjs
|
||||
// TDD 2.0 Phase 1 — 보호 수용 경로(protected acceptance) 무결성 게이트.
|
||||
//
|
||||
// 정책 정본: docs/tdd-red/06-repo-application.md §5 · docs/tdd-red/07-revamp-plan.md §3-1
|
||||
// 목적: "읽지 못하게"가 아니라 "고치지 못하게"(05 §2). 보호 여정의 테스트가
|
||||
// 조용히 약화·삭제·skip 되는 것을 커밋 단계에서 막는다.
|
||||
//
|
||||
// 규칙 (protected 파일이 변경된 경우):
|
||||
// protected-deleted 보호 파일이 사라졌다
|
||||
// cases-decreased it/test/expectNoRuntimeErrors 기반 여정 블록이 줄었다
|
||||
// assertions-decreased expect(...) 가 줄었다
|
||||
// focused-only-added .only 가 새로 생겼다 (다른 여정을 건너뛴다)
|
||||
// unmarked-skip-added 이유 없는 .skip()/.todo() 가 새로 생겼다
|
||||
//
|
||||
// 정당한 변경(제품 행위 변경): 커밋 본문에 `allow-protected-change: <사유>` 를 남기거나
|
||||
// PROTECTED_CHANGE_REASON="<사유>" 로 실행한다. 사람 리뷰를 대체하지 않는다.
|
||||
//
|
||||
// 사용:
|
||||
// node scripts/ci/check-protected-tests.mjs # HEAD 대비 작업 트리
|
||||
// node scripts/ci/check-protected-tests.mjs --base origin/main
|
||||
// node scripts/ci/check-protected-tests.mjs --reason "..." # 정당한 스펙 변경
|
||||
// node scripts/ci/check-protected-tests.mjs --self-test
|
||||
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const CWD = process.cwd()
|
||||
|
||||
/** 보호 경로 — docs/tdd-red/06-repo-application.md §5 와 반드시 같아야 한다. */
|
||||
export const PROTECTED_FILES = [
|
||||
'apps/desktop/tests/e2e/navigation.spec.ts',
|
||||
'apps/desktop/tests/e2e/settings.spec.ts',
|
||||
'apps/desktop/tests/e2e/onboarding.spec.ts',
|
||||
'apps/desktop/tests/e2e/customer-support.spec.ts',
|
||||
'apps/desktop/tests/e2e/records.spec.ts',
|
||||
'apps/web/e2e/smoke.spec.ts',
|
||||
]
|
||||
|
||||
const TEST_BLOCK = /(?:^|\n)\s*test(?:\.(?:only|skip|todo|concurrent|each(?:\([^\n]*?\))?))?\s*\(/g
|
||||
const STEP_BLOCK = /test\.step\s*\(/g
|
||||
const ASSERTION = /\bexpect(?:NoRuntimeErrors)?\s*\(/g
|
||||
const ONLY = /\.only\s*\(/g
|
||||
// 보호 경로에서는 skip/todo 자체가 계약 변경이다 — 사유는 커밋 마커로 남긴다.
|
||||
const SKIP_ANY = /\.(?:skip|todo)\s*\(/g
|
||||
|
||||
function count(text, re) {
|
||||
re.lastIndex = 0
|
||||
let n = 0
|
||||
while (re.exec(text)) n += 1
|
||||
return n
|
||||
}
|
||||
|
||||
/** 보호 파일 본문 비교 — 순수 함수(테스트 가능). */
|
||||
export function detectWeakening(before, after) {
|
||||
const violations = []
|
||||
const beforeCases = count(before, TEST_BLOCK) + count(before, STEP_BLOCK)
|
||||
const afterCases = count(after, TEST_BLOCK) + count(after, STEP_BLOCK)
|
||||
if (afterCases < beforeCases) {
|
||||
violations.push({
|
||||
rule: 'cases-decreased',
|
||||
detail: `여정/스텝 블록 ${beforeCases} → ${afterCases}`,
|
||||
})
|
||||
}
|
||||
const beforeAssertions = count(before, ASSERTION)
|
||||
const afterAssertions = count(after, ASSERTION)
|
||||
if (afterAssertions < beforeAssertions) {
|
||||
violations.push({
|
||||
rule: 'assertions-decreased',
|
||||
detail: `단정 ${beforeAssertions} → ${afterAssertions}`,
|
||||
})
|
||||
}
|
||||
const onlyDelta = count(after, ONLY) - count(before, ONLY)
|
||||
if (onlyDelta > 0) {
|
||||
violations.push({ rule: 'focused-only-added', detail: `.only +${onlyDelta}` })
|
||||
}
|
||||
const skipDelta = count(after, SKIP_ANY) - count(before, SKIP_ANY)
|
||||
if (skipDelta > 0) {
|
||||
violations.push({ rule: 'unmarked-skip-added', detail: `skip/todo +${skipDelta}` })
|
||||
}
|
||||
return violations
|
||||
}
|
||||
|
||||
function git(args, options = {}) {
|
||||
return execFileSync('git', args, {
|
||||
cwd: CWD,
|
||||
encoding: 'utf8',
|
||||
maxBuffer: 1 << 26,
|
||||
// stderr 는 호출부가 처리한다(얕은 클론 등) — 콘솔을 더럽히지 않는다.
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
function changedFiles(base) {
|
||||
const tracked = git(['diff', '--name-only', base]).split('\n')
|
||||
const staged = git(['diff', '--name-only', '--cached', base]).split('\n')
|
||||
const untracked = git(['ls-files', '--others', '--exclude-standard']).split('\n')
|
||||
return [...new Set([...tracked, ...staged, ...untracked].map((l) => l.trim().replaceAll('\\', '/')).filter(Boolean))]
|
||||
}
|
||||
|
||||
function headBlob(base, path) {
|
||||
try {
|
||||
return git(['show', `${base}:${path}`])
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function readWorking(path) {
|
||||
const full = join(CWD, path)
|
||||
return existsSync(full) ? readFileSync(full, 'utf8') : null
|
||||
}
|
||||
|
||||
function commitReason() {
|
||||
try {
|
||||
const body = git(['log', '-1', '--format=%B'])
|
||||
const match = /allow-protected-change:\s*(\S.*)/.exec(body)
|
||||
return match ? match[1].trim() : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function evaluate({ base, protectedFiles = PROTECTED_FILES, changed, beforeOf, afterOf }) {
|
||||
const violations = []
|
||||
for (const path of protectedFiles) {
|
||||
if (!changed.includes(path)) continue
|
||||
const before = beforeOf(path)
|
||||
const after = afterOf(path)
|
||||
if (after === null) {
|
||||
violations.push({ path, rule: 'protected-deleted', detail: '보호 파일이 삭제됐다' })
|
||||
continue
|
||||
}
|
||||
if (before === null) continue // 새 보호 여정 추가 — 약화가 아니다
|
||||
for (const v of detectWeakening(before, after)) violations.push({ path, ...v })
|
||||
}
|
||||
return { base, violations }
|
||||
}
|
||||
|
||||
function runSelfTest() {
|
||||
const cases = [
|
||||
{
|
||||
name: '테스트 하나 삭제 → cases-decreased',
|
||||
before: "test('a', async () => { expect(1).toBe(1) })\ntest('b', async () => { expect(2).toBe(2) })",
|
||||
after: "test('a', async () => { expect(1).toBe(1) })",
|
||||
expectRules: ['cases-decreased', 'assertions-decreased'],
|
||||
},
|
||||
{
|
||||
name: '단정 하나 약화/삭제 → assertions-decreased',
|
||||
before: "test('a', async () => { await expect(x).toBeVisible(); expect(y).toBe(1) })",
|
||||
after: "test('a', async () => { await expect(x).toBeVisible() })",
|
||||
expectRules: ['assertions-decreased'],
|
||||
},
|
||||
{
|
||||
name: '.only 추가 → focused-only-added',
|
||||
before: "test('a', async () => { expect(1).toBe(1) })",
|
||||
after: "test.only('a', async () => { expect(1).toBe(1) })",
|
||||
expectRules: ['focused-only-added'],
|
||||
},
|
||||
{
|
||||
name: '이유 없는 skip 추가 → unmarked-skip-added',
|
||||
before: "test('a', async () => { expect(1).toBe(1) })",
|
||||
after: "test.skip('a', async () => { expect(1).toBe(1) })",
|
||||
expectRules: ['unmarked-skip-added'],
|
||||
},
|
||||
{
|
||||
name: '여정·스텝·단정 추가 → 위반 없음',
|
||||
before: "test('a', async () => { expect(1).toBe(1) })",
|
||||
after:
|
||||
"test('a', async () => { await test.step('s', async () => { await expect(nav).toHaveCount(1) })\n expect(2).toBe(2) })",
|
||||
expectRules: [],
|
||||
},
|
||||
]
|
||||
|
||||
let failures = 0
|
||||
for (const c of cases) {
|
||||
const rules = detectWeakening(c.before, c.after).map((v) => v.rule).sort()
|
||||
const ok = JSON.stringify(rules) === JSON.stringify([...c.expectRules].sort())
|
||||
if (!ok) {
|
||||
failures += 1
|
||||
process.stdout.write(`FAIL ${c.name} — got ${JSON.stringify(rules)}\n`)
|
||||
} else {
|
||||
process.stdout.write(`ok ${c.name}\n`)
|
||||
}
|
||||
}
|
||||
|
||||
// evaluate() 자체 경로도 확인한다 (파일 삭제 + 변경 없음).
|
||||
const deleted = evaluate({
|
||||
base: 'test',
|
||||
protectedFiles: PROTECTED_FILES.slice(0, 1),
|
||||
changed: [PROTECTED_FILES[0]],
|
||||
beforeOf: () => "test('a', async () => { expect(1).toBe(1) })",
|
||||
afterOf: () => null,
|
||||
})
|
||||
if (deleted.violations[0]?.rule !== 'protected-deleted') {
|
||||
failures += 1
|
||||
process.stdout.write('FAIL 보호 파일 삭제 감지\n')
|
||||
} else {
|
||||
process.stdout.write('ok 보호 파일 삭제 감지\n')
|
||||
}
|
||||
|
||||
if (failures > 0) {
|
||||
process.stdout.write(`\ncheck-protected-tests self-test 실패 ${failures}건\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
process.stdout.write('\ncheck-protected-tests self-test 통과\n')
|
||||
}
|
||||
|
||||
function main() {
|
||||
const argv = process.argv.slice(2)
|
||||
if (argv.includes('--self-test')) {
|
||||
runSelfTest()
|
||||
return
|
||||
}
|
||||
|
||||
const baseIndex = argv.indexOf('--base')
|
||||
const base = baseIndex >= 0 ? argv[baseIndex + 1] : 'HEAD'
|
||||
const reasonIndex = argv.indexOf('--reason')
|
||||
const reason = reasonIndex >= 0 ? argv[reasonIndex + 1] : process.env.PROTECTED_CHANGE_REASON || commitReason()
|
||||
|
||||
const missing = PROTECTED_FILES.filter((path) => !existsSync(join(CWD, path)))
|
||||
let changed
|
||||
try {
|
||||
changed = changedFiles(base)
|
||||
} catch {
|
||||
// CI 얕은 클론(depth 1)에서는 비교 기준 revision 이 없다. 게이트를 통과시키고 사실을 알린다.
|
||||
process.stdout.write(
|
||||
`[protected-tests] SKIP — 기준 revision \`${base}\` 을 찾을 수 없습니다(얕은 클론). ` +
|
||||
'로컬/전체 클론에서 검사하세요.\n',
|
||||
)
|
||||
return
|
||||
}
|
||||
const { violations } = evaluate({
|
||||
base,
|
||||
changed,
|
||||
beforeOf: (path) => headBlob(base, path),
|
||||
afterOf: (path) => readWorking(path),
|
||||
})
|
||||
|
||||
if (missing.length > 0) {
|
||||
for (const path of missing) {
|
||||
violations.push({ path, rule: 'protected-deleted', detail: '보호 파일이 저장소에 없다' })
|
||||
}
|
||||
}
|
||||
|
||||
if (violations.length === 0) {
|
||||
process.stdout.write(`[protected-tests] GREEN (base ${base}, 변경된 보호 파일 ${changed.filter((f) => PROTECTED_FILES.includes(f)).length}개)\n`)
|
||||
return
|
||||
}
|
||||
|
||||
if (reason) {
|
||||
process.stdout.write(`[protected-tests] 사유가 기록된 변경 — 통과: ${reason}\n`)
|
||||
for (const v of violations) process.stdout.write(` · ${v.path} ${v.rule} (${v.detail})\n`)
|
||||
return
|
||||
}
|
||||
|
||||
process.stdout.write('[protected-tests] 보호 수용 테스트가 약화되었습니다.\n')
|
||||
for (const v of violations) process.stdout.write(` ✗ ${v.path} · ${v.rule} — ${v.detail}\n`)
|
||||
process.stdout.write(
|
||||
'\n제품 행위가 정말 바뀌었다면 커밋 본문에 다음을 남기세요:\n' +
|
||||
' allow-protected-change: <왜 사용자가 하는 일이 바뀌었는가>\n' +
|
||||
'정책: docs/tdd-red/06-repo-application.md §5\n',
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (process.argv[1] && process.argv[1].replaceAll('\\', '/').endsWith('check-protected-tests.mjs')) {
|
||||
main()
|
||||
}
|
||||
181
scripts/ci/check-test-quality.mjs
Normal file
181
scripts/ci/check-test-quality.mjs
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
#!/usr/bin/env node
|
||||
// scripts/ci/check-test-quality.mjs
|
||||
// TDD 2.0 Phase 1 — 테스트 품질 래칫(ratchet) 게이트.
|
||||
//
|
||||
// 정책 정본: docs/tdd-red/02-meaningful-vs-meaningless-red.md (의미 없는 RED)
|
||||
// docs/tdd-red/07-revamp-plan.md §3-1 (약한 단정 · 결정성)
|
||||
//
|
||||
// 왜 래칫인가: 오늘 128건의 약한 단정과 203건의 ambient 시계/난수를 한 번에 고치면
|
||||
// 회귀 위험이 크다. 그래서 "현재 수치를 동결"하고 **증가만** 막는다.
|
||||
// (파일별 기준선 = scripts/ci/test-quality-baseline.json, --update 로만 갱신)
|
||||
//
|
||||
// 규칙:
|
||||
// weak-assertion expect(...).toBeDefined/toBeTruthy/toBeFalsy/toBeNull 만으로 끝나는 단정
|
||||
// → 관찰 가능한 값(문자열·개수·상태)을 단정하라
|
||||
// ambient-time 테스트 안에서 Date.now()/Math.random()/performance.now() 직접 호출
|
||||
// → 주입된 clock/rand 또는 vi.setSystemTime/vi.useFakeTimers 를 쓰라
|
||||
//
|
||||
// 사용:
|
||||
// node scripts/ci/check-test-quality.mjs # 기준선 대비 증가 시 실패
|
||||
// node scripts/ci/check-test-quality.mjs --update # 기준선 재생성(리뷰 필수)
|
||||
// node scripts/ci/check-test-quality.mjs --self-test
|
||||
|
||||
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { scanQuality } from './lib/test-files.mjs'
|
||||
|
||||
const CWD = process.cwd()
|
||||
const BASELINE_PATH = 'scripts/ci/test-quality-baseline.json'
|
||||
|
||||
const RULES = [
|
||||
{
|
||||
key: 'weak-assertion',
|
||||
field: 'weak',
|
||||
hint: 'toBeDefined/toBeTruthy/toBeNull 대신 관찰 결과(값·개수·상태)를 단정하세요.',
|
||||
},
|
||||
{
|
||||
key: 'ambient-time',
|
||||
field: 'ambient',
|
||||
hint: '시간·난수는 주입하세요 (clock/rand 포트, vi.setSystemTime, vi.useFakeTimers).',
|
||||
},
|
||||
]
|
||||
|
||||
export function compareToBaseline(rows, baseline) {
|
||||
const violations = []
|
||||
for (const rule of RULES) {
|
||||
const frozen = baseline.rules?.[rule.key] ?? {}
|
||||
for (const row of rows) {
|
||||
const current = row[rule.field]
|
||||
const allowed = frozen[row.path] ?? 0
|
||||
if (current > allowed) {
|
||||
violations.push({ rule: rule.key, path: row.path, current, allowed })
|
||||
}
|
||||
}
|
||||
}
|
||||
return violations.sort((a, b) => b.current - b.allowed - (a.current - a.allowed))
|
||||
}
|
||||
|
||||
export function buildBaseline(rows, date) {
|
||||
const rules = {}
|
||||
for (const rule of RULES) {
|
||||
const frozen = {}
|
||||
for (const row of rows) {
|
||||
if (row[rule.field] > 0) frozen[row.path] = row[rule.field]
|
||||
}
|
||||
rules[rule.key] = frozen
|
||||
}
|
||||
return { generatedAt: date, note: 'TDD 2.0 래칫 기준선 — 증가만 막는다. --update 로만 갱신.', rules }
|
||||
}
|
||||
|
||||
function loadBaseline() {
|
||||
const full = join(CWD, BASELINE_PATH)
|
||||
if (!existsSync(full)) return { generatedAt: null, rules: {} }
|
||||
return JSON.parse(readFileSync(full, 'utf8'))
|
||||
}
|
||||
|
||||
function runSelfTest() {
|
||||
const baseline = {
|
||||
generatedAt: 'test',
|
||||
rules: { 'weak-assertion': { 'a.test.ts': 2 }, 'ambient-time': { 'b.test.ts': 1 } },
|
||||
}
|
||||
const fixtures = [
|
||||
{
|
||||
name: '기준선과 같으면 통과',
|
||||
rows: [
|
||||
{ path: 'a.test.ts', weak: 2, ambient: 0 },
|
||||
{ path: 'b.test.ts', weak: 0, ambient: 1 },
|
||||
],
|
||||
expected: 0,
|
||||
},
|
||||
{
|
||||
name: '약한 단정 증가 → 위반',
|
||||
rows: [{ path: 'a.test.ts', weak: 3, ambient: 0 }],
|
||||
expected: 1,
|
||||
},
|
||||
{
|
||||
name: '줄었으면 통과 (래칫은 증가만 막는다)',
|
||||
rows: [{ path: 'a.test.ts', weak: 1, ambient: 0 }],
|
||||
expected: 0,
|
||||
},
|
||||
{
|
||||
name: '기준선에 없는 파일에서 새 약한 단정 → 위반',
|
||||
rows: [{ path: 'c.test.ts', weak: 1, ambient: 0 }],
|
||||
expected: 1,
|
||||
},
|
||||
{
|
||||
name: 'ambient 증가 → 위반',
|
||||
rows: [{ path: 'b.test.ts', weak: 0, ambient: 2 }],
|
||||
expected: 1,
|
||||
},
|
||||
]
|
||||
|
||||
let failures = 0
|
||||
for (const fixture of fixtures) {
|
||||
const got = compareToBaseline(fixture.rows, baseline).length
|
||||
if (got !== fixture.expected) {
|
||||
failures += 1
|
||||
process.stdout.write(`FAIL ${fixture.name} — 기대 ${fixture.expected}, 실제 ${got}\n`)
|
||||
} else {
|
||||
process.stdout.write(`ok ${fixture.name}\n`)
|
||||
}
|
||||
}
|
||||
|
||||
const rebuilt = buildBaseline([{ path: 'a.test.ts', weak: 2, ambient: 0 }], 'test')
|
||||
if (rebuilt.rules['weak-assertion']['a.test.ts'] !== 2 || rebuilt.rules['ambient-time']['a.test.ts']) {
|
||||
failures += 1
|
||||
process.stdout.write('FAIL 기준선 생성 규칙\n')
|
||||
} else {
|
||||
process.stdout.write('ok 기준선 생성 규칙\n')
|
||||
}
|
||||
|
||||
if (failures > 0) {
|
||||
process.stdout.write(`\ncheck-test-quality self-test 실패 ${failures}건\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
process.stdout.write('\ncheck-test-quality self-test 통과\n')
|
||||
}
|
||||
|
||||
function main() {
|
||||
const args = new Set(process.argv.slice(2))
|
||||
if (args.has('--self-test')) {
|
||||
runSelfTest()
|
||||
return
|
||||
}
|
||||
|
||||
const rows = scanQuality(CWD)
|
||||
const today = new Date().toISOString().slice(0, 10)
|
||||
|
||||
if (args.has('--update')) {
|
||||
const baseline = buildBaseline(rows, today)
|
||||
writeFileSync(join(CWD, BASELINE_PATH), JSON.stringify(baseline, null, 2) + '\n', 'utf8')
|
||||
const weak = Object.values(baseline.rules['weak-assertion']).reduce((a, b) => a + b, 0)
|
||||
const ambient = Object.values(baseline.rules['ambient-time']).reduce((a, b) => a + b, 0)
|
||||
process.stdout.write(`[test-quality] 기준선 갱신: ${BASELINE_PATH} (weak ${weak} / ambient ${ambient})\n`)
|
||||
return
|
||||
}
|
||||
|
||||
const violations = compareToBaseline(rows, loadBaseline())
|
||||
if (violations.length === 0) {
|
||||
process.stdout.write(`[test-quality] GREEN (${rows.length} test files, 기준선 대비 증가 없음)\n`)
|
||||
return
|
||||
}
|
||||
|
||||
const byRule = new Map()
|
||||
for (const v of violations) byRule.set(v.rule, (byRule.get(v.rule) ?? 0) + 1)
|
||||
process.stdout.write('[test-quality] 테스트 품질이 기준선보다 나빠졌습니다.\n')
|
||||
for (const v of violations.slice(0, 20)) {
|
||||
process.stdout.write(` ✗ ${v.path} · ${v.rule} ${v.allowed} → ${v.current}\n`)
|
||||
}
|
||||
if (violations.length > 20) process.stdout.write(` … 외 ${violations.length - 20}건\n`)
|
||||
for (const rule of RULES) {
|
||||
if (byRule.has(rule.key)) process.stdout.write(`\n${rule.key}: ${rule.hint}\n`)
|
||||
}
|
||||
process.stdout.write(
|
||||
'\n정당한 사유(예: 기존 테스트를 캐릭터라이제이션으로 교체)가 있으면 사람 리뷰 후\n' +
|
||||
' npm run test:quality:update\n' +
|
||||
'로 기준선을 갱신하고 커밋 본문에 이유를 적으세요.\n',
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
main()
|
||||
138
scripts/ci/test-quality-baseline.json
Normal file
138
scripts/ci/test-quality-baseline.json
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
{
|
||||
"generatedAt": "2026-11-08",
|
||||
"note": "TDD 2.0 래칫 기준선 — 증가만 막는다. --update 로만 갱신.",
|
||||
"rules": {
|
||||
"weak-assertion": {
|
||||
"apps/desktop/tests/integration/cross-device-sync.supabase.test.ts": 1,
|
||||
"apps/desktop/tests/integration/meeting-import-media.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/CustomInstructionService.test.ts": 3,
|
||||
"apps/desktop/tests/main/services/DictionaryService.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/HistoryService.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/KeyBindingService.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/SuggestionService.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/TypoCorrectionService.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/VoiceModeService.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/caption-owner-redteam-r1-3.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/file-transcription-cancel-redteam-r2-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/i18n-locale-parity.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/input-intelligence.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/input-telemetry-redteam-r1-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/input-telemetry-stale-snapshot.test.ts": 8,
|
||||
"apps/desktop/tests/main/services/license-entitlement-r1-11.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/runtime-install-release-redteam-r2-14.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/screen-context-redteam-r1-3.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/screen-context-redteam-r2-7.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/update-service-status.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/voice-mode-redteam-r1-3.test.ts": 2,
|
||||
"apps/desktop/tests/main/sync/cloud-credentials-redteam-r3-1.test.ts": 5,
|
||||
"apps/desktop/tests/main/sync/sync-redteam-r1-0.test.ts": 1,
|
||||
"apps/desktop/tests/main/update-policy.test.ts": 1,
|
||||
"apps/desktop/tests/main/windows/popup-navigation.test.ts": 1,
|
||||
"apps/desktop/tests/main/windows/recording-tip-error-menu-redteam-r3-4.test.ts": 1,
|
||||
"apps/desktop/tests/red/ads/admob-ssv.test.ts": 1,
|
||||
"apps/desktop/tests/red/ads/ads-mediation.test.ts": 4,
|
||||
"apps/desktop/tests/red/auth-login.usecase.test.ts": 2,
|
||||
"apps/desktop/tests/red/dictionary-redteam-r1-12.test.ts": 2,
|
||||
"apps/desktop/tests/red/history.usecase.test.ts": 5,
|
||||
"apps/desktop/tests/red/instruction.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/ipc-surfaces.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/meeting-import.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/meeting-mode-redteam-r1-3.test.ts": 2,
|
||||
"apps/desktop/tests/red/meeting-recording-redteam-r2-1.test.ts": 2,
|
||||
"apps/desktop/tests/red/meeting.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/silent-errors.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/voice.usecase.test.ts": 2,
|
||||
"apps/desktop/tests/unit/AdMediationEngine.test.ts": 3,
|
||||
"apps/desktop/tests/unit/error-recovery-redteam-r3-21.test.ts": 2,
|
||||
"apps/desktop/tests/unit/keybinding-picker-capture-redteam-r3-23.test.ts": 1,
|
||||
"apps/desktop/tests/unit/meeting-transcript-view-redteam-r2-32.test.ts": 1,
|
||||
"apps/desktop/tests/unit/ollama-model-pull-redteam-r2-34.test.ts": 1,
|
||||
"apps/desktop/tests/unit/realtime-session-redteam-r1-30.test.ts": 2,
|
||||
"apps/desktop/tests/unit/stt-model-download-redteam-r3-24.test.ts": 6,
|
||||
"apps/mobile-rn/__tests__/auth-privacy-boundary.test.tsx": 9,
|
||||
"apps/mobile-rn/__tests__/auth-redteam-r3-16.test.tsx": 2,
|
||||
"apps/mobile-rn/__tests__/incoming-media-intent.test.ts": 1,
|
||||
"apps/mobile-rn/__tests__/meeting-creation-screen.test.tsx": 1,
|
||||
"apps/mobile-rn/__tests__/navigation-shell.test.tsx": 1,
|
||||
"apps/web/e2e/dashboard-dictionary-commands.spec.ts": 7,
|
||||
"apps/web/tests/billing-catalog.test.ts": 2,
|
||||
"packages/api-client/__tests__/client.test.ts": 2,
|
||||
"packages/api-client/__tests__/types.test.ts": 1,
|
||||
"packages/core/__tests__/keybinding.test.ts": 10,
|
||||
"packages/core/__tests__/terminal-prompt.test.ts": 1,
|
||||
"packages/core/__tests__/typo-correction.test.ts": 3
|
||||
},
|
||||
"ambient-time": {
|
||||
"apps/desktop/tests/eval/suggestion-latency.eval.test.ts": 2,
|
||||
"apps/desktop/tests/eval/suggestion-replay.eval.test.ts": 4,
|
||||
"apps/desktop/tests/integration/cross-device-sync.supabase.test.ts": 10,
|
||||
"apps/desktop/tests/integration/meeting-import-media.test.ts": 1,
|
||||
"apps/desktop/tests/integration/suggestion-quality.ollama.test.ts": 2,
|
||||
"apps/desktop/tests/main/db-open-atomic-redteam-r2-1.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/KeyBindingService.test.ts": 4,
|
||||
"apps/desktop/tests/main/services/SuggestionService.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/TypoCorrectionService.test.ts": 4,
|
||||
"apps/desktop/tests/main/services/file-transcription-cancel-redteam-r2-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/file-transcription-glossary.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/file-transcription-redteam-r1-5.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/file-transcription-repetition.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/history-redteam-r1-0.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/input-flow-services.test.ts": 6,
|
||||
"apps/desktop/tests/main/services/input-intelligence.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/input-telemetry-focus-flicker.test.ts": 5,
|
||||
"apps/desktop/tests/main/services/input-telemetry-redteam-r1-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/input-telemetry-stale-snapshot.test.ts": 4,
|
||||
"apps/desktop/tests/main/services/modifier-state.test.ts": 6,
|
||||
"apps/desktop/tests/main/services/personal-graph-context.test.ts": 1,
|
||||
"apps/desktop/tests/main/services/suggestion-accept-hold.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-accept-word.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-app-scoped-learning.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-copy-guard.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-instant-personal.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-no-suggestion-notice.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/suggestion-presence.test.ts": 3,
|
||||
"apps/desktop/tests/main/services/suggestion-redteam-r1-1.test.ts": 11,
|
||||
"apps/desktop/tests/main/services/suggestion-redteam-r2-3.test.ts": 6,
|
||||
"apps/desktop/tests/main/services/suggestion-redteam-r3-1.test.ts": 6,
|
||||
"apps/desktop/tests/main/services/suggestion-typo-correction.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/textinsert-redteam-r2-4.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/voice-mode-redteam-r1-3.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/voice-mode-redteam-r2-7.test.ts": 2,
|
||||
"apps/desktop/tests/main/services/voice-recording-store-redteam-r3-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/sync/SyncEngine.test.ts": 10,
|
||||
"apps/desktop/tests/main/sync/SyncExtensions.test.ts": 2,
|
||||
"apps/desktop/tests/main/sync/SyncTranscriptsPresets.test.ts": 3,
|
||||
"apps/desktop/tests/main/sync/audio-sync-redteam-r3-1.test.ts": 1,
|
||||
"apps/desktop/tests/main/sync/meeting-recording-pull.test.ts": 1,
|
||||
"apps/desktop/tests/main/sync/sync-redteam-r1-0.test.ts": 3,
|
||||
"apps/desktop/tests/red/ads/admob-ssv.test.ts": 3,
|
||||
"apps/desktop/tests/red/ads/ads-mediation.test.ts": 2,
|
||||
"apps/desktop/tests/red/chained.usecase.test.ts": 2,
|
||||
"apps/desktop/tests/red/crypto-license.usecase.test.ts": 8,
|
||||
"apps/desktop/tests/red/data-policy-redteam-r2-1.test.ts": 1,
|
||||
"apps/desktop/tests/red/meeting-import.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/meeting-llm.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/meeting-mode-redteam-r1-3.test.ts": 3,
|
||||
"apps/desktop/tests/red/meeting-recording-redteam-r2-1.test.ts": 6,
|
||||
"apps/desktop/tests/red/meeting.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/rag.usecase.test.ts": 1,
|
||||
"apps/desktop/tests/red/templates-wiring-redteam-r2-15.test.ts": 1,
|
||||
"apps/desktop/tests/red/voice.usecase.test.ts": 2,
|
||||
"apps/desktop/tests/shared/entitlement.test.ts": 1,
|
||||
"apps/desktop/tests/unit/desktop-ux-gaps.test.ts": 3,
|
||||
"apps/mobile-rn/__tests__/admin-mobile.local.e2e.mjs": 5,
|
||||
"apps/mobile-rn/__tests__/data-portability.local.integration.mjs": 2,
|
||||
"apps/mobile-rn/__tests__/incoming-media-intent.test.ts": 4,
|
||||
"apps/mobile-rn/__tests__/knowledge-actions.local.integration.mjs": 2,
|
||||
"apps/mobile-rn/__tests__/talk.local.integration.mjs": 2,
|
||||
"apps/mobile-rn/__tests__/teams-push.local.integration.mjs": 3,
|
||||
"apps/mobile-rn/__tests__/templates-memos.local.integration.mjs": 6,
|
||||
"apps/web/e2e/billing.spec.ts": 3,
|
||||
"apps/web/e2e/dashboard-dictionary-commands.spec.ts": 1,
|
||||
"apps/web/e2e/history.spec.ts": 1,
|
||||
"packages/core/__tests__/personal-graph.test.ts": 1,
|
||||
"packages/core/__tests__/transcript-correction-hardening.test.ts": 2,
|
||||
"server/supabase/functions/_shared/admob-ssv.test.ts": 7
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue