chore: land in-progress workspace changes before 1.16.2
The tree carried uncommitted work from several areas (web push, mobile screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed as one commit so the release pipeline can start from a clean tree; the desktop transcript-correction behaviour shipped in the previous commit and is unchanged here.
This commit is contained in:
parent
9c2b6a9782
commit
7fe49c437e
144 changed files with 3760 additions and 4523 deletions
|
|
@ -38,6 +38,7 @@ async function main() {
|
|||
await runStep('Run Vitest Test Suites', 'npm', ['test']);
|
||||
await runStep('Build Desktop App (Renderer + Main + Preload)', 'npm', ['run', 'build', '--workspace=@d3ro/desktop']);
|
||||
await runStep('Build Admin Dashboard (Next.js 14)', 'npm', ['run', 'build', '--workspace=@d3ro/admin']);
|
||||
await runStep('Build Web App (Next.js)', 'npm', ['run', 'build', '--workspace=@d3ro/web']);
|
||||
|
||||
const totalDuration = ((Date.now() - totalStart) / 1000).toFixed(2);
|
||||
console.log(`\n==================================================`);
|
||||
|
|
|
|||
183
scripts/ci/check-test-hygiene.mjs
Normal file
183
scripts/ci/check-test-hygiene.mjs
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
#!/usr/bin/env node
|
||||
// scripts/ci/check-test-hygiene.mjs
|
||||
// 테스트 위생 게이트 — "의미 없는 RED" 를 커밋 단계에서 막는다.
|
||||
//
|
||||
// 정책 정본: docs/tdd-red/02-meaningful-vs-meaningless-red.md · 06-repo-application.md
|
||||
// 규칙은 테스트가 검증하는 행위를 흐리지 않는 것만 담는다 (스타일 취향 아님):
|
||||
//
|
||||
// focused-test .only / fit / fdescribe — 나머지 스위트를 조용히 건너뛴다
|
||||
// empty-skip 인자 없는 .skip() — 이유 없는 영구 스킵
|
||||
// trivial-assertion 항상 참인 단정 (expect(true).toBe(true) 류)
|
||||
// conditional-assertion isVisible() 를 조건으로 삼아 단정을 감싸는 형태 — 실패해도 초록
|
||||
// machine-path 개발 머신의 스크린샷/임시 경로(Antigravity brain, AppData Temp)
|
||||
// fixed-wait Playwright 의 waitForTimeout — web-first assert / auto-wait 로 대체
|
||||
// misnamed-e2e `.e2e.test.ts` — E2E 는 Playwright(`*.spec.ts`)만, 단위는 `*.test.ts`
|
||||
// spec-outside-e2e e2e/ 밖의 `*.spec.ts` — Vitest/Jest 는 `*.test.ts` 로
|
||||
// assertion-free 단정이 한 줄도 없는 테스트 파일 — 렌더만 하고 아무것도 증명하지 않음
|
||||
//
|
||||
// 사용:
|
||||
// node scripts/ci/check-test-hygiene.mjs
|
||||
// node scripts/ci/check-test-hygiene.mjs --self-test
|
||||
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
const TEST_FILE = /(?:^|\/)(?:tests?|__tests__|e2e)\/.*\.(?:test|spec)\.[cm]?[jt]sx?$|\.(?:test|spec)\.[cm]?[jt]sx?$/
|
||||
const EXCLUDED_PATH = /(?:^|\/)(?:node_modules|dist|build|out|coverage|playwright-report|test-results|scratch)(?:\/|$)/
|
||||
|
||||
const RULES = [
|
||||
{
|
||||
name: 'focused-test',
|
||||
pattern: /\b(?:describe|it|test)\.only\s*\(|\bf(?:it|describe)\s*\(/,
|
||||
hint: '.only 를 지우고 필요한 테스트만 -g 로 실행하세요.',
|
||||
},
|
||||
{
|
||||
name: 'empty-skip',
|
||||
pattern: /\b(?:describe|it|test)\.skip\(\s*\)/,
|
||||
hint: '스킵에는 조건과 이유를 인자로 넘기세요: test.skip(condition, reason).',
|
||||
},
|
||||
{
|
||||
name: 'trivial-assertion',
|
||||
pattern:
|
||||
/expect\(\s*(?:true|false|[01])\s*\)\.(?:toBe|toEqual|toStrictEqual)\(\s*(?:true|false|[01])\s*\)|assert\.(?:ok|equal|strictEqual)\(\s*(?:true|false|[01])\s*(?:,\s*(?:true|false|[01])\s*)?\)/,
|
||||
hint: '항상 참인 단정은 아무것도 증명하지 않습니다. 관찰 가능한 결과를 단정하세요.',
|
||||
},
|
||||
{
|
||||
name: 'conditional-assertion',
|
||||
pattern: /if\s*\(\s*await\s+[^\n]*\.isVisible\(\)\s*\)/,
|
||||
hint: 'isVisible() 로 단정을 감싸면 실패해도 초록입니다. expect(locator).toBeVisible() 로 바꾸세요.',
|
||||
},
|
||||
{
|
||||
name: 'machine-path',
|
||||
pattern:
|
||||
/(?:antigravity|\.gemini)[\\/]|[A-Za-z]:[\\/]{1,2}Users[\\/][^\\/\n'"`]+[\\/]AppData[\\/]Local[\\/]Temp/i,
|
||||
hint: '개발 머신 경로 대신 os.tmpdir()/mkdtemp 와 Playwright trace 를 쓰세요.',
|
||||
},
|
||||
{
|
||||
name: 'fixed-wait',
|
||||
pattern: /\.waitForTimeout\(\s*\d+\s*\)/,
|
||||
hint: 'Playwright auto-wait / web-first assertion 을 쓰세요. waitForTimeout 은 flaky 의 근원입니다.',
|
||||
},
|
||||
{
|
||||
name: 'misnamed-e2e',
|
||||
pathPattern: /\.e2e\.test\.[cm]?[jt]sx?$/,
|
||||
pattern: /^/,
|
||||
hint: '브라우저/E2E 는 `*.spec.ts`(Playwright), 단위·통합은 `*.test.ts`(Vitest/Jest)로 나누세요.',
|
||||
},
|
||||
{
|
||||
name: 'spec-outside-e2e',
|
||||
pathPattern: /\.spec\.[cm]?[jt]sx?$/,
|
||||
excludePathPattern: /(?:^|\/)e2e\//,
|
||||
pattern: /^/,
|
||||
hint: '`*.spec.ts` 는 Playwright E2E 전용입니다. Vitest/Jest 는 `*.test.ts` 로 바꾸세요.',
|
||||
},
|
||||
]
|
||||
|
||||
const ASSERTION_TOKEN = /\bexpect\s*\(|\bassert(?:\.\w+|[A-Z]\w*)?\s*\(|\bt\.(?:is|truthy|falsy|deepEqual|throws)\s*\(|\.should\b/
|
||||
|
||||
function normalize(path) {
|
||||
return path.replaceAll('\\', '/')
|
||||
}
|
||||
|
||||
function isCandidate(path) {
|
||||
const normalized = normalize(path)
|
||||
if (EXCLUDED_PATH.test(normalized)) return false
|
||||
return TEST_FILE.test(normalized)
|
||||
}
|
||||
|
||||
export function scanSource(path, source) {
|
||||
const normalized = normalize(path)
|
||||
const findings = []
|
||||
for (const rule of RULES) {
|
||||
if (rule.pathPattern && !rule.pathPattern.test(normalized)) continue
|
||||
if (rule.excludePathPattern?.test(normalized)) continue
|
||||
const match = rule.pattern.exec(source)
|
||||
if (!match) continue
|
||||
const line = source.slice(0, match.index).split('\n').length
|
||||
findings.push({ rule: rule.name, path: normalized, line, hint: rule.hint })
|
||||
}
|
||||
|
||||
if (!ASSERTION_TOKEN.test(source)) {
|
||||
findings.push({
|
||||
rule: 'assertion-free',
|
||||
path: normalized,
|
||||
line: 1,
|
||||
hint: '단정이 없습니다. 관찰 가능한 결과를 expect/assert 로 고정하세요.',
|
||||
})
|
||||
}
|
||||
|
||||
return findings
|
||||
}
|
||||
|
||||
function collectTestFiles() {
|
||||
const output = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '-z'], {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
return output.split('\0').filter(Boolean).filter(isCandidate)
|
||||
}
|
||||
|
||||
function selfTest() {
|
||||
const unsafeCases = [
|
||||
['apps/desktop/tests/unit/a.test.ts', `it.only('x', () => {})`],
|
||||
['apps/desktop/tests/unit/a.test.ts', `describe.skip()`],
|
||||
['apps/desktop/tests/unit/a.test.ts', `expect(true).toBe(true)`],
|
||||
['apps/web/e2e/a.spec.ts', `if (await page.getByText('x').isVisible()) { expect(await page.getByText('x').isVisible()).toBeTruthy() }`],
|
||||
['apps/desktop/tests/e2e/a.spec.ts', `const dir = 'C:/Users/me/AppData/Local/Temp/playwright-run'`],
|
||||
['apps/desktop/tests/e2e/a.spec.ts', `const dir = 'C:/Users/me/.gemini/antigravity/brain/x/screenshots'`],
|
||||
['apps/desktop/tests/e2e/a.spec.ts', `await page.waitForTimeout(1500)`],
|
||||
['apps/desktop/tests/red/ads/a.e2e.test.ts', `describe('x', () => {})`],
|
||||
['apps/web/tests/payple.test.ts', `describe('x', () => { it('y', () => {}) })`],
|
||||
['apps/desktop/tests/unit/a.spec.ts', `expect(1).toBe(1)`],
|
||||
]
|
||||
const safeCases = [
|
||||
[
|
||||
'apps/web/e2e/billing.spec.ts',
|
||||
`test.skip(!hasFixtureAccess, 'Local Supabase fixture credentials are required')\nexpect(page.url()).toContain('/login')`,
|
||||
],
|
||||
['packages/core/__tests__/url-policy.test.ts', `expect(isFileUrlWithinRoot('file:///C:/Users/me/app/index.html', ROOT)).toBe(true)`],
|
||||
['apps/desktop/tests/main/windows/x.test.ts', `expect(w.fire('will-navigate', 'file:///C:/Users/me/Downloads/evil.html')).toHaveBeenCalled()`],
|
||||
['apps/desktop/tests/unit/a.test.ts', `await expect(page.getByText('x')).toBeVisible()`],
|
||||
['apps/desktop/tests/e2e/a.spec.ts', `await expect(page.getByTestId('nav-home')).toHaveAttribute('aria-current', 'page')`],
|
||||
]
|
||||
|
||||
const failures = []
|
||||
for (const [path, source] of unsafeCases) {
|
||||
if (scanSource(path, source).length === 0) failures.push(`missed unsafe fixture: ${path} :: ${source}`)
|
||||
}
|
||||
for (const [path, source] of safeCases) {
|
||||
const found = scanSource(path, source)
|
||||
if (found.length > 0) failures.push(`flagged safe fixture: ${path} :: ${found.map((f) => f.rule).join(',')}`)
|
||||
}
|
||||
|
||||
if (failures.length > 0) {
|
||||
for (const failure of failures) console.error(failure)
|
||||
process.exit(1)
|
||||
}
|
||||
console.log('Test hygiene scanner self-test passed.')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (process.argv.includes('--self-test')) {
|
||||
selfTest()
|
||||
} else {
|
||||
const findings = []
|
||||
for (const path of collectTestFiles()) {
|
||||
let source
|
||||
try {
|
||||
source = readFileSync(path, 'utf8')
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
findings.push(...scanSource(path, source))
|
||||
}
|
||||
|
||||
if (findings.length > 0) {
|
||||
console.error('의미 없는 테스트 패턴이 발견되었습니다:')
|
||||
for (const finding of findings.sort((a, b) => a.path.localeCompare(b.path) || a.line - b.line)) {
|
||||
console.error(`- ${finding.path}:${finding.line} [${finding.rule}] ${finding.hint}`)
|
||||
}
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(`Test hygiene gate passed (${collectTestFiles().length} test files).`)
|
||||
}
|
||||
|
|
@ -17,14 +17,17 @@
|
|||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
|
||||
const inPlace = process.argv.includes('--in-place')
|
||||
const dirFlagIndex = process.argv.indexOf('--dir')
|
||||
const packagedDir = dirFlagIndex >= 0 ? process.argv[dirFlagIndex + 1] : null
|
||||
const packagedDir =
|
||||
dirFlagIndex >= 0 && process.argv[dirFlagIndex + 1]
|
||||
? resolve(process.argv[dirFlagIndex + 1])
|
||||
: null
|
||||
if (!inPlace && (!packagedDir || !existsSync(packagedDir))) {
|
||||
console.error('사용: node scripts/ci/fix-native-abi.mjs --dir <packagedDir> | --in-place')
|
||||
process.exit(1)
|
||||
|
|
@ -119,4 +122,4 @@ if (hostNodeLoads(scratchBinary)) {
|
|||
|
||||
copyFileSync(scratchBinary, targetBinary)
|
||||
console.log(`[native-abi] 교체 완료: ${targetBinary}`)
|
||||
rmSync(scratchRoot, { recursive: true, force: true })
|
||||
rmSync(scratchRoot, { recursive: true, force: true })
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ async function validateContract(source) {
|
|||
}
|
||||
|
||||
const quota = contract.PLAN_QUOTA
|
||||
const features = ['stt_transcribe', 'llm_haiku', 'llm_sonnet', 'llm_opus', 'realtime_session']
|
||||
const features = ['stt_transcribe', 'llm_haiku', 'llm_sonnet', 'llm_opus', 'realtime_session', 'knowledge_embedding']
|
||||
expectKeys('PLAN_QUOTA', quota, ['free', 'pro', 'pro_plus', 'team', 'enterprise'])
|
||||
for (const [tier, perFeature] of Object.entries(quota)) {
|
||||
expectKeys(`PLAN_QUOTA.${tier}`, perFeature, features)
|
||||
|
|
|
|||
|
|
@ -171,14 +171,8 @@ updateJson('apps/admin-swagger/openapi.json', (document) => {
|
|||
document.info.version = metadata.version
|
||||
})
|
||||
|
||||
updateText('apps/web/src/components/layout/sidebar.tsx', (text) =>
|
||||
replaceExactlyOnce(
|
||||
text,
|
||||
/\bv\d+\.\d+\.\d+\b/,
|
||||
`v${metadata.version}`,
|
||||
'Web sidebar product version',
|
||||
),
|
||||
)
|
||||
// The web sidebar imports apps/web/package.json at build time, so its displayed
|
||||
// version follows the package surface updated above without another text mirror.
|
||||
|
||||
// The download section (site/ only) builds the installer filename from these
|
||||
// constants. They once drifted to 1.2.0 while the feed served newer versions, so the
|
||||
|
|
|
|||
|
|
@ -13,16 +13,107 @@
|
|||
// 사용:
|
||||
// node scripts/ci/verify-native-abi.mjs # release/<version>/win-unpacked 자동 탐색
|
||||
// node scripts/ci/verify-native-abi.mjs --dir <packagedDir>
|
||||
// node scripts/ci/verify-native-abi.mjs --self-test # 필수 prebuild 누락 fixture 검증
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import {
|
||||
existsSync,
|
||||
mkdtempSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
readdirSync,
|
||||
rmSync,
|
||||
writeFileSync,
|
||||
} from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { basename, dirname, join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
|
||||
/** N-API 기반이라 Electron ABI 재빌드는 불필요하지만, 대상 플랫폼 prebuild는 필수다. */
|
||||
const REQUIRED_NAPI = [
|
||||
{ name: 'uiohook-napi', binaryName: 'uiohook-napi.node' },
|
||||
]
|
||||
|
||||
function inferPackagedTarget(directory) {
|
||||
const directoryName = basename(directory)
|
||||
if (directoryName === 'win-unpacked') return { platform: 'win32', arch: 'x64' }
|
||||
|
||||
const macDirectory = /^mac-(.+)$/.exec(directoryName)
|
||||
if (macDirectory) return { platform: 'darwin', arch: macDirectory[1] }
|
||||
if (directoryName === 'mac') return { platform: 'darwin', arch: process.arch }
|
||||
|
||||
return { platform: process.platform, arch: process.arch }
|
||||
}
|
||||
|
||||
function requiredNapiResults(unpackedRoot, target) {
|
||||
const failures = []
|
||||
const notes = []
|
||||
|
||||
for (const module of REQUIRED_NAPI) {
|
||||
const binaryPath = join(
|
||||
unpackedRoot,
|
||||
module.name,
|
||||
'prebuilds',
|
||||
`${target.platform}-${target.arch}`,
|
||||
module.binaryName,
|
||||
)
|
||||
if (!existsSync(binaryPath)) {
|
||||
failures.push(
|
||||
`${module.name}: ${target.platform}-${target.arch} 필수 N-API prebuild가 없습니다 → ${binaryPath}`,
|
||||
)
|
||||
} else {
|
||||
notes.push(
|
||||
`${module.name}: ${target.platform}-${target.arch} 필수 N-API prebuild 존재 확인`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return { failures, notes }
|
||||
}
|
||||
|
||||
function runSelfTest() {
|
||||
const fixtureRoot = mkdtempSync(join(tmpdir(), 'd3ro-native-abi-'))
|
||||
const target = { platform: 'win32', arch: 'x64' }
|
||||
const binaryPath = join(
|
||||
fixtureRoot,
|
||||
'uiohook-napi',
|
||||
'prebuilds',
|
||||
'win32-x64',
|
||||
'uiohook-napi.node',
|
||||
)
|
||||
|
||||
try {
|
||||
const missing = requiredNapiResults(fixtureRoot, target)
|
||||
if (missing.failures.length !== 1 || !missing.failures[0].includes(binaryPath)) {
|
||||
throw new Error('누락된 win32-x64 prebuild가 실패로 고정되지 않았습니다.')
|
||||
}
|
||||
|
||||
mkdirSync(dirname(binaryPath), { recursive: true })
|
||||
writeFileSync(binaryPath, 'fixture')
|
||||
|
||||
const present = requiredNapiResults(fixtureRoot, target)
|
||||
if (present.failures.length !== 0 || present.notes.length !== 1) {
|
||||
throw new Error('존재하는 win32-x64 prebuild fixture가 통과하지 못했습니다.')
|
||||
}
|
||||
|
||||
console.log('[native-abi] SELF-TEST GREEN — win32-x64 prebuild 누락/존재 계약 확인')
|
||||
} finally {
|
||||
rmSync(fixtureRoot, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv.includes('--self-test')) {
|
||||
runSelfTest()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const dirFlagIndex = process.argv.indexOf('--dir')
|
||||
let packagedDir = dirFlagIndex >= 0 ? process.argv[dirFlagIndex + 1] : null
|
||||
let packagedDir =
|
||||
dirFlagIndex >= 0 && process.argv[dirFlagIndex + 1]
|
||||
? resolve(process.argv[dirFlagIndex + 1])
|
||||
: null
|
||||
|
||||
if (!packagedDir) {
|
||||
const version = JSON.parse(
|
||||
|
|
@ -56,11 +147,6 @@ const REQUIRED_ELECTRON_ABI = [
|
|||
},
|
||||
]
|
||||
|
||||
/** N-API 기반이라 타임 무관 — 존재만 확인 */
|
||||
const NAPI_MODULES = [
|
||||
{ name: 'uiohook-napi', binary: join('uiohook-napi', 'build', 'Release', 'uiohook_napi.node') },
|
||||
]
|
||||
|
||||
const failures = []
|
||||
const notes = []
|
||||
|
||||
|
|
@ -97,14 +183,10 @@ for (const module of REQUIRED_ELECTRON_ABI) {
|
|||
}
|
||||
}
|
||||
|
||||
for (const module of NAPI_MODULES) {
|
||||
const binaryPath = join(unpackedRoot, module.binary)
|
||||
if (!existsSync(binaryPath)) {
|
||||
notes.push(`${module.name}: 바이너리 없음(선택) — ${binaryPath}`)
|
||||
} else {
|
||||
notes.push(`${module.name}: 존재 확인 (N-API)`)
|
||||
}
|
||||
}
|
||||
const target = inferPackagedTarget(packagedDir)
|
||||
const napiResults = requiredNapiResults(unpackedRoot, target)
|
||||
failures.push(...napiResults.failures)
|
||||
notes.push(...napiResults.notes)
|
||||
|
||||
for (const note of notes) console.log(`[native-abi] ${note}`)
|
||||
|
||||
|
|
@ -114,4 +196,4 @@ if (failures.length > 0) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('[native-abi] GREEN — 패키징된 네이티브 모듈이 Electron에서 실행 가능한 ABI입니다.')
|
||||
console.log('[native-abi] GREEN — 패키징된 네이티브 모듈이 Electron에서 실행 가능한 ABI입니다.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue