feat: 회의 파일 가져오기와 입력 엔진 배포 보완

This commit is contained in:
Yun Chan 2026-11-01 19:39:06 +09:00
parent 5a8c5cd792
commit b3519e5da7
54 changed files with 1129 additions and 116 deletions

View file

@ -1,5 +1,5 @@
// Deterministic source A/B. No GUI, input injection, checkout mutation, or personal data.
// Run from this checkout: node scripts/verification/typing-race-proof.mjs
// Run from this checkout: node scripts/verification/typing-race-proof.mjs [--baseline <commit>]
import { execFileSync, spawnSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
@ -28,9 +28,17 @@ mkdirSync(output, { recursive: true })
const sha256 = (text) => createHash('sha256').update(text).digest('hex')
const normalized = (file) => path.resolve(file).replaceAll('\\', '/').toLowerCase()
const head = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim()
const args = process.argv.slice(2)
if (args.length !== 0 && (args.length !== 2 || args[0] !== '--baseline')) {
throw new Error('Usage: typing-race-proof.mjs [--baseline <commit>]')
}
// The fix is now committed: HEAD is no longer a broken baseline.
const baselineRef = args[1] ?? 'f49acf01057cc100b9caeace6eada26cf7bf4b54'
const baselineCommit = execFileSync('git', ['rev-parse', '--verify', '--end-of-options', `${baselineRef}^{commit}`],
{ cwd: root, encoding: 'utf8' }).trim()
const overrides = {}
const evidence = sources.map((file) => {
const baseline = execFileSync('git', ['show', `${head}:${file}`], { cwd: root, encoding: 'utf8', maxBuffer: 4_000_000 })
const baseline = execFileSync('git', ['show', `${baselineCommit}:${file}`], { cwd: root, encoding: 'utf8', maxBuffer: 4_000_000 })
const current = readFileSync(path.join(root, file), 'utf8')
overrides[normalized(path.join(root, file))] = baseline
return { file, baselineSha256: sha256(baseline), currentSha256: sha256(current) }
@ -38,14 +46,14 @@ const evidence = sources.map((file) => {
const testEvidence = tests.map((file) => ({
file: `apps/desktop/${file}`, currentSha256: sha256(readFileSync(path.join(desktop, file), 'utf8'))
}))
writeFileSync(path.join(output, 'head-source-overrides.json'), JSON.stringify(overrides))
writeFileSync(path.join(output, 'baseline-source-overrides.json'), JSON.stringify(overrides))
const configPath = path.join(output, 'vitest.proof.config.mjs')
writeFileSync(configPath, `
import { readFileSync } from 'node:fs';
const overrides = process.env.D3RO_RACE_BASELINE === '1'
? JSON.parse(readFileSync(${JSON.stringify(path.join(output, 'head-source-overrides.json'))}, 'utf8')) : {};
? JSON.parse(readFileSync(${JSON.stringify(path.join(output, 'baseline-source-overrides.json'))}, 'utf8')) : {};
export default {
plugins: [{ name: 'read-only-head-source-overlay', enforce: 'pre', load(id) {
plugins: [{ name: 'read-only-baseline-source-overlay', enforce: 'pre', load(id) {
return overrides[id.split('?')[0].replaceAll('\\\\', '/').toLowerCase()] ?? null;
}}],
test: { environment: 'node', globals: true,
@ -59,7 +67,7 @@ export default {
`)
const runs = []
for (const baseline of [true, false]) {
const label = baseline ? 'baseline-head' : 'current-fix'
const label = baseline ? 'baseline-source' : 'current-fix'
const resultPath = path.join(output, `${label}.json`)
const result = spawnSync(process.execPath, [vitest, 'run', ...tests, '--config', configPath,
'--reporter=json', `--outputFile=${resultPath}`], {
@ -77,9 +85,9 @@ for (const baseline of [true, false]) {
}
const report = {
capturedAt: new Date().toISOString(), kind: 'deterministic-source-ab-not-gui',
head, node: process.version, sources: evidence, tests: testEvidence, runs,
head, baselineCommit, node: process.version, sources: evidence, tests: testEvidence, runs,
sourcesUnchangedDuringRun: [...evidence, ...testEvidence].every(({ file, currentSha256 }) => sha256(readFileSync(path.join(root, file), 'utf8')) === currentSha256),
baselineScope: 'Only the three listed services are loaded from HEAD; dependencies, test doubles and tests are current in both runs. This is not a full historical release test.',
baselineScope: 'Only the three listed services are loaded from baselineCommit; dependencies, test doubles and tests are current in both runs. This is not a full historical release test.',
scope: 'Actual TypoCorrectionService + TextInsertService with an in-memory text sink, and actual InputTelemetryService with delayed UIA responses. Three text-preservation cases isolate timestamp, revision and native-tick guards; one unchanged-input control must still correct. The remaining 13 cases check snapshot invalidation/metadata/coalescing contracts, not 13 independent text-loss reproductions. Native keys, OS IME, model loading and CPU stress are not exercised.'
}
writeFileSync(path.join(output, 'report.json'), JSON.stringify(report, null, 2) + '\n')