Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Add a no-progress watchdog to the release DMG smoke (#5749)
Nick Gomezddcc2eb4c376
diff --git a/.github/scripts/smoke-packaged-dmg.mjs b/.github/scripts/smoke-packaged-dmg.mjsindex 85ba90797..c8eb5f44f 100644--- a/.github/scripts/smoke-packaged-dmg.mjs+++ b/.github/scripts/smoke-packaged-dmg.mjs@@ -2,8 +2,10 @@import { spawn } from 'node:child_process';import { appendFileSync } from 'node:fs';-import { readFile } from 'node:fs/promises';+import { mkdtemp, open, readFile, rm } from 'node:fs/promises';+import { tmpdir } from 'node:os';import { dirname, join, resolve } from 'node:path';+import { StringDecoder } from 'node:string_decoder';import { fileURLToPath, pathToFileURL } from 'node:url';import { withMountedDmg } from './dmg-mount.mjs';@@ -19,12 +21,160 @@ export const EXIT_CODES = {[VERDICT.error]: 2,};-const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));+const SCRIPT_PATH = fileURLToPath(import.meta.url);+const SCRIPT_DIR = dirname(SCRIPT_PATH);const DESKTOP_DIR = resolve(SCRIPT_DIR, '..', '..', 'packages', 'desktop');const PACKAGED_CONFIG = 'playwright.packaged.config.ts';export const PACKAGED_REPORT = join('test-results', 'desktop-smoke-packaged-results.json');-export function classifyRun({ runExitCode, report, runnerError }) {+export const PROGRESS_FILE_ENV = 'OK_SMOKE_PROGRESS_FILE';+export const PLAYWRIGHT_REPORTER_ENV = 'PW_TEST_REPORTER';++export const WATCHDOG = {+ stallWindowMs: 10 * 60_000,+ stallWindowTestTimeouts: 4,+ pollMs: 1_000,+ stopGraceMs: 10_000,+ drainMs: 2_000,+ diagnosticBoundMs: 15_000,+};++const RECENT_EVENTS_KEPT = 12;+const OUTPUT_TAIL_LINES = 80;+const DIAGNOSTIC_OUTPUT_CAP_BYTES = 16 * 1024 * 1024;+const DIAGNOSTIC_LINE_CAP_CHARS = 400;+const EXIT_FLUSH_BOUND_MS = 10_000;++const PROCESS_TABLE_COLUMNS = 'pid,ppid,pgid,etime,pcpu,pmem,rss,stat,command';++const ON_SCREEN_WINDOWS_JXA = `ObjC.import('CoreGraphics');+const list = ObjC.castRefToObject($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID));+const rows = ['owner-pid\\tlayer\\towner\\ttitle'];+for (let i = 0; i < list.count; i++) {+ const w = list.objectAtIndex(i);+ const get = (k) => { const v = w.objectForKey(k); return v && !v.isNil() ? String(ObjC.unwrap(v)) : ''; };+ rows.push([get('kCGWindowOwnerPID'), get('kCGWindowLayer'), get('kCGWindowOwnerName'), get('kCGWindowName')].join('\\t'));+}+rows.join('\\n');`;++function testTitle(test) {+ return test.titlePath().filter(Boolean).join(' › ');+}++export default class SmokeProgressReporter {+ constructor() {+ this.progressFile = process.env[PROGRESS_FILE_ENV] || null;+ this.failedWrites = 0;+ this.record(() => ({ kind: 'ready' }));+ }++ printsToStdio() {+ return false;+ }++ onBegin(config, suite) {+ this.record(() => ({+ kind: 'begin',+ tests: suite.allTests().length,+ testTimeoutMs: Math.max(0, ...config.projects.map((project) => project.timeout ?? 0)),+ }));+ }++ onTestBegin(test, result) {+ this.record(() => ({ kind: 'test-begin', test: testTitle(test), retry: result.retry }));+ }++ onStepBegin(test, result, step) {+ this.record(() => ({+ kind: 'step-begin',+ test: testTitle(test),+ retry: result.retry,+ step: step.title,+ category: step.category,+ }));+ }++ onStepEnd(test, result, step) {+ this.record(() => ({+ kind: 'step-end',+ test: testTitle(test),+ retry: result.retry,+ step: step.title,+ category: step.category,+ }));+ }++ onTestEnd(test, result) {+ this.record(() => ({+ kind: 'test-end',+ test: testTitle(test),+ retry: result.retry,+ status: result.status,+ durationMs: result.duration,+ }));+ }++ onEnd(result) {+ this.record(() => ({ kind: 'end', status: result.status, failedWrites: this.failedWrites }));+ }++ record(describeEvent) {+ if (!this.progressFile) return;+ let event;+ try {+ event = describeEvent();+ } catch (err) {+ event = { kind: 'unrecorded', error: err?.message ?? String(err) };+ }+ try {+ appendFileSync(+ this.progressFile,+ `${JSON.stringify({ at: new Date().toISOString(), ...event })}\n`,+ );+ } catch (err) {+ this.failedWrites += 1;+ if (this.failedWrites === 1) {+ process.stderr.write(+ `[smoke-packaged-dmg] the progress reporter could not append to ${this.progressFile}: ${err?.message ?? String(err)}; later progress events are not recorded, so the no-progress watchdog may stop this run as a stall\n`,+ );+ }+ }+ }+}++function clipLine(line) {+ return line.length > DIAGNOSTIC_LINE_CAP_CHARS+ ? `${line.slice(0, DIAGNOSTIC_LINE_CAP_CHARS)}…`+ : line;+}++function formatDuration(ms) {+ const totalSeconds = Math.round(ms / 1000);+ const minutes = Math.floor(totalSeconds / 60);+ const seconds = totalSeconds % 60;+ return minutes > 0 ? `${minutes}m${String(seconds).padStart(2, '0')}s` : `${seconds}s`;+}++export function describeProgressEvent(event) {+ if (!event) return 'none';+ const parts = [event.kind ?? 'unknown'];+ if (event.test) parts.push(`"${event.test}"`);+ if (event.step) parts.push(`step "${event.step}"`);+ if (event.retry) parts.push(`retry ${event.retry}`);+ if (event.status) parts.push(event.status);+ if (event.at) parts.push(`at ${event.at}`);+ return parts.join(' ');+}++export function stallReason(stall) {+ const last = stall.recent.at(-1);+ return `the smoke stalled: no Playwright progress for ${formatDuration(stall.silentMs)} (watchdog window ${formatDuration(stall.windowMs)}); the last progress was ${describeProgressEvent(last)}. The run was stopped, and its diagnostics are in the step log`;+}++export function classifyRun({ runExitCode, runSignal, report, runnerError, stall }) {+ if (stall) {+ return { verdict: VERDICT.error, reason: stallReason(stall) };+ }if (runnerError) {return {verdict: VERDICT.error,@@ -32,10 +182,11 @@ export function classifyRun({ runExitCode, report, runnerError }) {};}if (report === null || report === undefined) {+ const missing =+ 'the Playwright JSON report was missing or unparseable, so no verdict could be read from the run';return {verdict: VERDICT.error,- reason:- 'the Playwright JSON report was missing or unparseable, so no verdict could be read from the run',+ reason: runSignal ? `${missing}; the Playwright runner was ended by ${runSignal}` : missing,};}const stats = report.stats ?? {};@@ -58,9 +209,10 @@ export function classifyRun({ runExitCode, report, runnerError }) {};}if (runExitCode !== 0) {+ const ended = runSignal ? `was ended by ${runSignal}` : `exited ${runExitCode}`;return {verdict: VERDICT.error,- reason: `the Playwright runner exited ${runExitCode} with no failing test — treat as an infrastructure problem, not an app verdict`,+ reason: `the Playwright runner ${ended} with no failing test — treat as an infrastructure problem, not an app verdict`,};}return {@@ -91,20 +243,410 @@ export function publishVerdict({ verdict, reason }, deps = {}) {}}-async function defaultRunPlaywright(appPath, deps = {}) {+function createLineTail(limit) {+ const decoder = new StringDecoder('utf8');+ let lines = [];+ let partial = '';+ return {+ push(chunk) {+ const pieces = (partial + decoder.write(chunk)).split('\n');+ partial = pieces.pop() ?? '';+ lines.push(...pieces);+ if (lines.length > limit) lines = lines.slice(-limit);+ },+ lines() {+ return partial ? [...lines, partial].slice(-limit) : [...lines];+ },+ };+}++function parseProgressLine(line) {+ try {+ const event = JSON.parse(line);+ return event && typeof event === 'object'+ ? event+ : { kind: 'unparsed', raw: line.slice(0, 200) };+ } catch {+ return { kind: 'unparsed', raw: line.slice(0, 200) };+ }+}++async function readNewProgress(progress) {+ let handle;+ try {+ handle = await open(progress.file, 'r');+ } catch (err) {+ if (err?.code === 'ENOENT') return [];+ throw err;+ }+ try {+ const { size } = await handle.stat();+ if (size <= progress.offset) return [];+ const buffer = Buffer.alloc(size - progress.offset);+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, progress.offset);+ progress.offset += bytesRead;+ const pieces = (progress.partial + progress.decoder.write(buffer.subarray(0, bytesRead))).split(+ '\n',+ );+ progress.partial = pieces.pop() ?? '';+ return pieces.filter((line) => line.trim() !== '').map(parseProgressLine);+ } finally {+ await handle.close();+ }+}++function cancellableDelay(ms) {+ let timer;+ const promise = new Promise((resolvePromise) => {+ timer = setTimeout(resolvePromise, ms);+ });+ return { promise, cancel: () => clearTimeout(timer) };+}++async function settleWithin(promise, ms) {+ const delay = cancellableDelay(ms);+ try {+ return await Promise.race([promise, delay.promise.then(() => null)]);+ } finally {+ delay.cancel();+ }+}++function childIsRunning(child) {+ return typeof child.pid === 'number' && child.exitCode === null && child.signalCode === null;+}++export function signalHeldGroup(child, signal, send) {+ if (!childIsRunning(child)) return { sent: false, reason: 'the runner had already exited' };+ try {+ send(child, signal);+ return { sent: true };+ } catch (err) {+ return { sent: false, reason: err?.message ?? String(err) };+ }+}++const sendToHeldGroup = (child, signal) => {+ process.kill(-child.pid, signal);+};++export async function runBoundedCommand(command, args, boundMs, deps = {}) {const spawnImpl = deps.spawn ?? spawn;- return await new Promise((resolvePromise) => {- const child = spawnImpl('pnpm', ['exec', 'playwright', 'test', '--config', PACKAGED_CONFIG], {- cwd: DESKTOP_DIR,- stdio: 'inherit',- env: {- ...process.env,- OK_DESKTOP_PACKAGED_APP: appPath,- OK_DESKTOP_E2E_SMOKE: '1',- },+ let child;+ try {+ child = spawnImpl(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });+ } catch (err) {+ return { error: err?.message ?? String(err), stdout: '', stderr: '' };+ }+ const chunks = { stdout: [], stderr: [] };+ let captured = 0;+ const collect = (name) => (chunk) => {+ if (captured >= DIAGNOSTIC_OUTPUT_CAP_BYTES) return;+ captured += chunk.length;+ chunks[name].push(chunk);+ };+ child.stdout?.on('data', collect('stdout'));+ child.stderr?.on('data', collect('stderr'));+ const finished = new Promise((resolvePromise) => {+ child.once('close', (code, signal) => resolvePromise({ code, signal }));+ child.once('error', (err) => resolvePromise({ error: err?.message ?? String(err) }));+ });+ const outcome = await settleWithin(finished, boundMs);+ const text = (name) => Buffer.concat(chunks[name]).toString('utf8');+ if (outcome === null) {+ child.stdout?.destroy();+ child.stderr?.destroy();+ child.unref();+ return { timedOut: true, stdout: text('stdout'), stderr: text('stderr') };+ }+ return { ...outcome, stdout: text('stdout'), stderr: text('stderr') };+}++export function renderProcessTree(table, rootPid) {+ const rows = table+ .split('\n')+ .slice(1)+ .map((line) => {+ const match = /^\s*(\d+)\s+(\d+)\s/.exec(line);+ return match ? { pid: Number(match[1]), ppid: Number(match[2]), line: line.trim() } : null;+ })+ .filter(Boolean);+ const children = new Map();+ for (const row of rows) {+ if (!children.has(row.ppid)) children.set(row.ppid, []);+ children.get(row.ppid).push(row);+ }+ const out = [];+ const seen = new Set();+ const walk = (pid, depth) => {+ for (const row of children.get(pid) ?? []) {+ if (seen.has(row.pid)) continue;+ seen.add(row.pid);+ out.push(`${' '.repeat(depth)}${row.line}`);+ walk(row.pid, depth + 1);+ }+ };+ const root = rows.find((row) => row.pid === rootPid);+ if (root) {+ seen.add(root.pid);+ out.push(root.line);+ }+ walk(rootPid, root ? 1 : 0);+ return out;+}++function describeCommandOutcome(outcome, boundMs) {+ if (outcome.error) return `could not run: ${outcome.error}`;+ if (outcome.timedOut) {+ return `did not finish within ${formatDuration(boundMs)}; left running, output so far is above`;+ }+ if (outcome.code !== 0)+ return `exited ${outcome.code ?? outcome.signal}: ${outcome.stderr.trim()}`;+ return null;+}++export async function collectStallDiagnostics({+ stall,+ outputTail,+ log,+ boundMs,+ rootPid = process.pid,+ platform = process.platform,+ runBounded = runBoundedCommand,+}) {+ log('::group::DMG smoke stall: the last Playwright progress events');+ for (const event of stall.recent) log(` ${describeProgressEvent(event)}`);+ log('::endgroup::');++ log(`::group::DMG smoke stall: the last ${outputTail.length} lines of Playwright output`);+ for (const line of outputTail) log(` ${clipLine(line)}`);+ log('::endgroup::');++ log(`::group::DMG smoke stall: processes (${PROCESS_TABLE_COLUMNS})`);+ const ps = await runBounded('ps', ['-A', '-ww', '-o', PROCESS_TABLE_COLUMNS], boundMs);+ const psProblem = describeCommandOutcome(ps, boundMs);+ if (ps.stdout) {+ log(`The smoke driver (pid ${rootPid}) and everything under it:`);+ for (const line of renderProcessTree(ps.stdout, rootPid)) log(` ${clipLine(line)}`);+ log('Every process:');+ for (const line of ps.stdout.trimEnd().split('\n')) log(` ${clipLine(line)}`);+ }+ if (psProblem) log(`ps ${psProblem}`);+ log('::endgroup::');++ if (platform === 'darwin') {+ log('::group::DMG smoke stall: on-screen windows (owner pid, layer, owner, title)');+ const windows = await runBounded(+ 'osascript',+ ['-l', 'JavaScript', '-e', ON_SCREEN_WINDOWS_JXA],+ boundMs,+ );+ if (windows.stdout) {+ for (const line of windows.stdout.trimEnd().split('\n')) log(` ${clipLine(line)}`);+ }+ const windowsProblem = describeCommandOutcome(windows, boundMs);+ if (windowsProblem) log(`the window listing ${windowsProblem}`);+ log('::endgroup::');+ }+}++export async function runWatchedPlaywright({+ command,+ args,+ cwd,+ env,+ watchdog = WATCHDOG,+ out = (chunk) => process.stdout.write(chunk),+ err = (chunk) => process.stderr.write(chunk),+ log = (line) => process.stdout.write(`${line}\n`),+ now = () => Date.now(),+ spawnImpl = spawn,+ sendGroupSignal = sendToHeldGroup,+ diagnose = collectStallDiagnostics,+ signalSource = process,+}) {+ const settings = { ...WATCHDOG, ...watchdog };+ const progressDir = await mkdtemp(join(tmpdir(), 'ok-smoke-progress-'));+ const progress = {+ file: join(progressDir, 'progress.jsonl'),+ offset: 0,+ decoder: new StringDecoder('utf8'),+ partial: '',+ recent: [],+ lastAt: null,+ };+ const outputTail = createLineTail(OUTPUT_TAIL_LINES);++ let child;+ try {+ child = spawnImpl(command, args, {+ cwd,+ env: { ...env, [PROGRESS_FILE_ENV]: progress.file, [PLAYWRIGHT_REPORTER_ENV]: SCRIPT_PATH },+ detached: true,+ stdio: ['ignore', 'pipe', 'pipe'],+ });+ } catch (spawnError) {+ await rm(progressDir, { recursive: true, force: true });+ return { exitCode: 1, runnerError: spawnError?.message ?? String(spawnError), stall: null };+ }++ const exited = new Promise((resolvePromise) => {+ child.once('exit', (code, signal) => resolvePromise({ code, signal }));+ child.once('error', (error) => resolvePromise({ code: null, signal: null, error }));+ });+ const closed = new Promise((resolvePromise) => child.once('close', resolvePromise));+ child.stdout?.on('data', (chunk) => {+ out(chunk);+ outputTail.push(chunk);+ });+ child.stderr?.on('data', (chunk) => {+ err(chunk);+ outputTail.push(chunk);+ });++ const forwarders = ['SIGINT', 'SIGTERM'].map((signal) => {+ const forward = () => {+ signalHeldGroup(child, signal, sendGroupSignal);+ };+ signalSource.on(signal, forward);+ return () => signalSource.off(signal, forward);+ });++ const dumpDiagnostics = async (stallState) => {+ try {+ await diagnose({+ stall: stallState,+ outputTail: outputTail.lines(),+ log,+ boundMs: settings.diagnosticBoundMs,+ });+ } catch (diagnosticError) {+ log(`The stall diagnostics failed: ${diagnosticError?.message ?? String(diagnosticError)}`);+ }+ };++ const startedAt = now();+ let windowMs = settings.stallWindowMs;+ let warnedUnarmed = false;+ let progressUnreadable = false;+ let stall = null;+ let settled = null;+ try {+ while (settled === null) {+ const tick = cancellableDelay(settings.pollMs);+ settled = await Promise.race([exited, tick.promise.then(() => null)]);+ tick.cancel();+ if (settled !== null) break;+ if (progressUnreadable) continue;++ let events = [];+ try {+ events = await readNewProgress(progress);+ } catch (readError) {+ progressUnreadable = true;+ log(+ `::warning::The DMG smoke's progress file became unreadable (${readError?.message ?? String(readError)}), so the no-progress watchdog stands down; only the step's timeout bounds this run.`,+ );+ continue;+ }+ if (events.length > 0) {+ if (progress.lastAt === null) {+ log(+ `DMG smoke watchdog: the progress reporter is connected; the run is stopped after ${formatDuration(windowMs)} without progress.`,+ );+ }+ progress.lastAt = now();+ progress.recent = [...progress.recent, ...events].slice(-RECENT_EVENTS_KEPT);+ const testTimeoutMs = Math.max(+ 0,+ ...events+ .filter((event) => event.kind === 'begin')+ .map((event) => event.testTimeoutMs ?? 0),+ );+ const derivedWindowMs = settings.stallWindowTestTimeouts * testTimeoutMs;+ if (derivedWindowMs > windowMs) {+ windowMs = derivedWindowMs;+ log(+ `DMG smoke watchdog: the window is now ${formatDuration(windowMs)}, ${settings.stallWindowTestTimeouts} times the run's ${formatDuration(testTimeoutMs)} per-test timeout.`,+ );+ }+ }+ const at = now();+ if (progress.lastAt === null) {+ if (!warnedUnarmed && at - startedAt >= windowMs) {+ warnedUnarmed = true;+ log(+ `::warning::The DMG smoke's progress reporter has not reported in ${formatDuration(at - startedAt)}, so the no-progress watchdog cannot see this run; only the step's timeout bounds it. Dumping diagnostics once; the run is left running.`,+ );+ await dumpDiagnostics({ silentMs: at - startedAt, windowMs, recent: progress.recent });+ }+ continue;+ }+ if (at - progress.lastAt >= windowMs) {+ stall = { silentMs: at - progress.lastAt, windowMs, recent: progress.recent };+ break;+ }+ }++ if (stall) {+ log(+ `::warning::DMG smoke stalled: no Playwright progress for ${formatDuration(stall.silentMs)} (window ${formatDuration(stall.windowMs)}). Last progress: ${describeProgressEvent(stall.recent.at(-1))}. Dumping diagnostics, then stopping the run.`,+ );+ await dumpDiagnostics(stall);+ let lastSent = null;+ for (const signal of ['SIGTERM', 'SIGKILL']) {+ const attempt = signalHeldGroup(child, signal, sendGroupSignal);+ if (!attempt.sent) {+ log(+ `Did not send ${signal} to the Playwright runner's process group: ${attempt.reason}.`,+ );+ break;+ }+ lastSent = signal;+ log(`Sent ${signal} to the Playwright runner's process group (${child.pid}).`);+ settled = await settleWithin(exited, settings.stopGraceMs);+ if (settled !== null) break;+ }+ if (settled === null && lastSent !== 'SIGKILL') {+ settled = await settleWithin(exited, settings.stopGraceMs);+ }+ if (settled === null) {+ log(+ `The Playwright runner (${child.pid}) had not exited ${formatDuration(settings.stopGraceMs)} after ${lastSent ?? 'the stall'}; leaving it.`,+ );+ }+ }+ } finally {+ for (const remove of forwarders) remove();+ await settleWithin(closed, settings.drainMs);+ child.stdout?.destroy();+ child.stderr?.destroy();+ await rm(progressDir, { recursive: true, force: true }).catch((cleanupError) => {+ log(`Could not remove ${progressDir}: ${cleanupError?.message ?? String(cleanupError)}`);});- child.on('exit', (code) => resolvePromise({ exitCode: code ?? 1 }));- child.on('error', (err) => resolvePromise({ exitCode: 1, runnerError: err.message }));+ }++ if (settled?.error) {+ return {+ exitCode: 1,+ runnerError: settled.error.message ?? String(settled.error),+ stall,+ };+ }+ return { exitCode: settled?.code ?? 1, signal: settled?.signal ?? null, stall };+}++async function defaultRunPlaywright(appPath, deps = {}) {+ return await runWatchedPlaywright({+ command: 'pnpm',+ args: ['exec', 'playwright', 'test', '--config', PACKAGED_CONFIG],+ cwd: DESKTOP_DIR,+ env: {+ ...process.env,+ OK_DESKTOP_PACKAGED_APP: appPath,+ OK_DESKTOP_E2E_SMOKE: '1',+ },+ spawnImpl: deps.spawn ?? spawn,});}@@ -127,9 +669,15 @@ export async function smokePackagedDmg(dmgPath, deps = {}) {return await withMount(dmgPath,async (appPath) => {- const { exitCode, runnerError } = await runPlaywright(appPath);- const report = await readReport(appPath);- return classifyRun({ runExitCode: exitCode, report, runnerError });+ const { exitCode, signal, runnerError, stall } = await runPlaywright(appPath);+ const report = stall ? null : await readReport(appPath);+ return classifyRun({+ runExitCode: exitCode,+ runSignal: signal,+ report,+ runnerError,+ stall,+ });},deps,);@@ -158,5 +706,8 @@ export async function runDriver(argv, deps = {}) {}if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {- runDriver(process.argv).then((code) => process.exit(code));+ runDriver(process.argv).then((code) => {+ process.exitCode = code;+ setTimeout(() => process.exit(code), EXIT_FLUSH_BOUND_MS).unref();+ });}diff --git a/.github/scripts/smoke-packaged-dmg.test.mjs b/.github/scripts/smoke-packaged-dmg.test.mjsindex 6c96ae4cf..fa20bebfa 100644--- a/.github/scripts/smoke-packaged-dmg.test.mjs+++ b/.github/scripts/smoke-packaged-dmg.test.mjs@@ -1,12 +1,26 @@-import { describe, expect, test } from 'vitest';+import { spawn } from 'node:child_process';+import { EventEmitter } from 'node:events';+import { existsSync, readFileSync } from 'node:fs';+import { mkdtemp, rm, writeFile } from 'node:fs/promises';+import { createRequire } from 'node:module';+import { tmpdir } from 'node:os';+import { dirname, join, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import { afterAll, beforeAll, describe, expect, test } from 'vitest';import { DmgMountError, MOUNT_ERROR_CODES } from './dmg-mount.mjs';+import { selectPromotion } from './select-beta-to-promote.mjs';import {annotationFor,classifyRun,EXIT_CODES,+ PROGRESS_FILE_ENV,publishVerdict,+ renderProcessTree,+ runBoundedCommand,runDriver,+ runWatchedPlaywright,smokePackagedDmg,+ stallReason,VERDICT,} from './smoke-packaged-dmg.mjs';@@ -191,6 +205,30 @@ describe('smokePackagedDmg', () => {const v = await smokePackagedDmg('/tmp/OpenKnowledge.dmg', deps({ read: async () => null }));expect(v.verdict).toBe(VERDICT.error);});++ test('a runner ended by a signal and leaving no report is an error that names the signal', async () => {+ const v = await smokePackagedDmg(+ '/tmp/OpenKnowledge.dmg',+ deps({+ run: async () => ({ exitCode: 1, signal: 'SIGKILL', stall: null }),+ read: async () => null,+ }),+ );+ expect(v.verdict).toBe(VERDICT.error);+ expect(v.reason).toContain('report was missing or unparseable');+ expect(v.reason).toContain('ended by SIGKILL');+ });++ test('a runner ended by a signal with no failing test is an error that names the signal, not an exit code', async () => {+ const v = await smokePackagedDmg(+ '/tmp/OpenKnowledge.dmg',+ deps({ run: async () => ({ exitCode: 1, signal: 'SIGTERM', stall: null }) }),+ );+ expect(v.verdict).toBe(VERDICT.error);+ expect(v.reason).toContain('with no failing test');+ expect(v.reason).toContain('ended by SIGTERM');+ expect(v.reason).not.toContain('exited 1');+ });});describe('runDriver', () => {@@ -260,3 +298,459 @@ describe('defensive defaults are pinned, not incidental', () => {);});});++const DRIVER_PATH = fileURLToPath(new URL('./smoke-packaged-dmg.mjs', import.meta.url));+const DESKTOP_DIR = resolve(dirname(DRIVER_PATH), '..', '..', 'packages', 'desktop');++const FAKE_RUNNER_SOURCE = `import { spawn } from 'node:child_process';+import { pathToFileURL } from 'node:url';+const [driverPath, grandchildPath, planJson] = process.argv.slice(2);+const plan = JSON.parse(planJson);+const pause = (ms) => new Promise((done) => setTimeout(done, ms));+const fakeTest = (n) => ({ titlePath: () => ['', '', 'fake.e2e.ts', 'fake test ' + n] });+const Reporter = (await import(pathToFileURL(driverPath).href)).default;+const reporter = plan.reporter === false ? null : new Reporter();+reporter?.onBegin({ projects: [{ timeout: plan.testTimeoutMs ?? 0 }] }, { allTests: () => [fakeTest(0)] });+process.stdout.write('fake runner started\\n');+for (const grandchild of plan.grandchildren ?? []) {+ spawn(process.execPath, [grandchildPath, ...grandchild.files], {+ detached: grandchild.detached,+ stdio: ['ignore', 'inherit', 'inherit'],+ }).unref();+}+for (let n = 0; n < plan.tests; n += 1) {+ await pause(plan.testMs);+ reporter?.onTestBegin(fakeTest(n), { retry: 0 });+ reporter?.onTestEnd(fakeTest(n), { retry: 0, status: 'passed', duration: plan.testMs });+ process.stdout.write(' ok ' + (n + 1) + ' fake.e2e.ts > fake test ' + n + '\\n');+}+await pause(plan.idleMs ?? 0);+if (plan.finish === 'stall') {+ process.stdout.write('fake runner: stalling\\n');+ setInterval(() => {}, 1 << 30);+ setTimeout(() => process.exit(0), 60_000);+} else {+ process.exitCode = plan.exitCode;+}+`;++const GRANDCHILD_SOURCE = `import { appendFileSync, existsSync } from 'node:fs';+const [heartbeatFile, releaseFile, signalFile] = process.argv.slice(2);+process.on('SIGTERM', () => {+ appendFileSync(signalFile, 'SIGTERM\\n');+ process.exit(0);+});+const startedAt = Date.now();+const beat = setInterval(() => {+ appendFileSync(heartbeatFile, 'beat\\n');+ if (existsSync(releaseFile) || Date.now() - startedAt > 60_000) {+ clearInterval(beat);+ process.exit(0);+ }+}, 20);+`;++const SCALED_WATCHDOG = {+ stallWindowMs: 1_500,+ stallWindowTestTimeouts: 4,+ pollMs: 50,+ stopGraceMs: 5_000,+ drainMs: 300,+ diagnosticBoundMs: 10_000,+};++let fixtures;++beforeAll(async () => {+ const dir = await mkdtemp(join(tmpdir(), 'ok-smoke-watchdog-'));+ fixtures = {+ dir,+ runner: join(dir, 'fake-runner.mjs'),+ grandchild: join(dir, 'grandchild.mjs'),+ };+ await writeFile(fixtures.runner, FAKE_RUNNER_SOURCE);+ await writeFile(fixtures.grandchild, GRANDCHILD_SOURCE);+});++afterAll(async () => {+ await rm(fixtures.dir, { recursive: true, force: true });+});++async function waitFor(condition) {+ while (!condition()) await new Promise((done) => setTimeout(done, 20));+}++function beats(file) {+ return existsSync(file) ? readFileSync(file, 'utf8').split('\n').length - 1 : 0;+}++function watchFake(plan, over = {}) {+ const logs = [];+ const output = [];+ const sent = [];+ const spawned = [];+ const promise = runWatchedPlaywright({+ command: process.execPath,+ args: [fixtures.runner, DRIVER_PATH, fixtures.grandchild, JSON.stringify(plan)],+ cwd: fixtures.dir,+ env: { ...process.env },+ watchdog: SCALED_WATCHDOG,+ out: (chunk) => output.push(chunk.toString()),+ err: (chunk) => output.push(chunk.toString()),+ log: (line) => logs.push(line),+ spawnImpl: (...args) => {+ const child = spawn(...args);+ spawned.push(child);+ return child;+ },+ sendGroupSignal: (child, signal) => {+ sent.push({ pid: child.pid, signal });+ process.kill(-child.pid, signal);+ },+ signalSource: new EventEmitter(),+ ...over,+ });+ return { promise, logs, output, sent, spawned };+}++describe('the no-progress watchdog over real child processes', () => {+ test('a run that progresses and then stalls is stopped after a full window without progress, diagnostics first', async () => {+ const run = watchFake({ tests: 3, testMs: 30, finish: 'stall' });+ const result = await run.promise;+ const runnerPid = run.spawned[0].pid;++ expect(result.stall).not.toBeNull();+ expect(result.stall.silentMs).toBeGreaterThanOrEqual(SCALED_WATCHDOG.stallWindowMs);+ expect(result.stall.recent.at(-1)).toMatchObject({+ kind: 'test-end',+ test: 'fake.e2e.ts › fake test 2',+ status: 'passed',+ });+ expect(run.sent).toEqual([{ pid: runnerPid, signal: 'SIGTERM' }]);+ expect(result.signal).toBe('SIGTERM');++ const stalledAt = run.logs.findIndex((line) => line.includes('DMG smoke stalled'));+ const outputAt = run.logs.findIndex((line) => line.includes('fake runner: stalling'));+ const tableAt = run.logs.findIndex((line) => line.includes('Every process:'));+ const stoppedAt = run.logs.findIndex((line) => line.startsWith('Sent SIGTERM'));+ expect(stalledAt).toBeGreaterThan(-1);+ expect(outputAt).toBeGreaterThan(stalledAt);+ expect(tableAt).toBeGreaterThan(stalledAt);+ expect(stoppedAt).toBeGreaterThan(tableAt);+ expect(run.logs[tableAt + 1]).toMatch(/ELAPSED.*%CPU.*%MEM/);+ expect(run.logs.some((line) => line.trim().split(/\s+/)[0] === String(runnerPid))).toBe(true);+ });++ test('the window follows the per-test timeout the run reports, once four of them pass the floor', async () => {+ const run = watchFake({ tests: 1, testMs: 20, testTimeoutMs: 1_000, finish: 'stall' });+ const result = await run.promise;++ expect(result.stall).toMatchObject({ windowMs: 4_000 });+ expect(result.stall.silentMs).toBeGreaterThanOrEqual(4_000);+ expect(run.logs).toContain(+ "DMG smoke watchdog: the window is now 4s, 4 times the run's 1s per-test timeout.",+ );+ expect(run.sent).toEqual([{ pid: run.spawned[0].pid, signal: 'SIGTERM' }]);+ });++ test('a slow run that keeps advancing is never stopped, however long it runs in total', async () => {+ const startedAt = Date.now();+ const run = watchFake({ tests: 10, testMs: 300, finish: 'exit', exitCode: 0 });+ const result = await run.promise;++ expect(Date.now() - startedAt).toBeGreaterThan(SCALED_WATCHDOG.stallWindowMs);+ expect(result).toMatchObject({ exitCode: 0, stall: null });+ expect(run.sent).toEqual([]);+ expect(run.output.join('')).toContain('fake test 9');+ });++ test.each([0, 1, 3])('the runner exit code %i passes through untouched', async (exitCode) => {+ const run = watchFake({ tests: 2, testMs: 20, finish: 'exit', exitCode });+ const result = await run.promise;++ expect(result).toMatchObject({ exitCode, stall: null });+ expect(run.sent).toEqual([]);+ });++ test('the stop reaches only the held runner group: an attached descendant ends, a detached one keeps running and holds nothing up', async () => {+ const files = (name) =>+ ['beats', 'release', 'signal'].map((kind) => join(fixtures.dir, `${name}.${kind}`));+ const attached = files('attached');+ const detached = files('detached');+ const run = watchFake({+ tests: 1,+ testMs: 20,+ finish: 'stall',+ grandchildren: [+ { detached: false, files: attached },+ { detached: true, files: detached },+ ],+ });+ const result = await run.promise;+ const beatsAtReturn = beats(detached[0]);++ expect(result.stall).not.toBeNull();+ expect(run.sent).toEqual([{ pid: run.spawned[0].pid, signal: 'SIGTERM' }]);+ await waitFor(() => existsSync(attached[2]));+ await waitFor(() => beats(detached[0]) > beatsAtReturn);+ expect(existsSync(detached[2])).toBe(false);+ expect(existsSync(detached[1])).toBe(false);++ await writeFile(detached[1], 'release');+ await writeFile(attached[1], 'release');+ });++ test('a SIGINT or SIGTERM to the driver is forwarded to the held runner group while it runs', async () => {+ const source = new EventEmitter();+ const run = watchFake(+ { tests: 1, testMs: 20, finish: 'stall' },+ {+ signalSource: source,+ out: (chunk) => {+ if (chunk.toString().includes('fake runner started')) source.emit('SIGTERM');+ },+ },+ );+ const result = await run.promise;++ expect(result).toMatchObject({ stall: null, signal: 'SIGTERM' });+ expect(run.sent).toEqual([{ pid: run.spawned[0].pid, signal: 'SIGTERM' }]);+ expect(source.listenerCount('SIGTERM')).toBe(0);+ expect(source.listenerCount('SIGINT')).toBe(0);+ });++ test('a run whose progress reporter never reports is not stopped, says the step timeout is its only bound, and prints the diagnostics once', async () => {+ const run = watchFake({+ reporter: false,+ tests: 0,+ idleMs: 2 * SCALED_WATCHDOG.stallWindowMs,+ finish: 'exit',+ exitCode: 0,+ });+ const result = await run.promise;++ expect(result).toMatchObject({ exitCode: 0, stall: null });+ expect(run.sent).toEqual([]);+ expect(run.logs.filter((line) => line.includes('has not reported'))).toHaveLength(1);+ const warnedAt = run.logs.findIndex((line) => line.includes('has not reported'));+ const tables = run.logs.flatMap((line, at) => (line === 'Every process:' ? [at] : []));+ expect(tables).toHaveLength(1);+ expect(tables[0]).toBeGreaterThan(warnedAt);+ expect(run.logs[tables[0] + 1]).toMatch(/ELAPSED.*%CPU.*%MEM/);+ });++ test('a stalled smoke publishes verdict=error and exits 2, which the fast tier reads as an infrastructure error', async () => {+ const outputs = [];+ const lines = [];+ let reportRead = false;+ const code = await runDriver(['node', 'x', '/tmp/OpenKnowledge.dmg'], {+ withMountedDmg: mountOk,+ runPlaywright: () => watchFake({ tests: 1, testMs: 20, finish: 'stall' }).promise,+ readReport: async () => {+ reportRead = true;+ return report({ expected: 16, unexpected: 0, flaky: 0, skipped: 0 });+ },+ log: (s) => lines.push(s),+ env: { GITHUB_OUTPUT: '/tmp/out.txt' },+ appendFileSync: (_p, s) => outputs.push(s),+ });++ expect(code).toBe(EXIT_CODES[VERDICT.error]);+ expect(reportRead).toBe(false);+ expect(outputs).toHaveLength(1);+ expect(outputs[0]).toMatch(+ /^verdict=error\nreason=the smoke stalled: no Playwright progress for /,+ );+ expect(lines.at(-1)).toContain('DMG smoke ERRORED');++ const verdict = /^verdict=(\w+)$/m.exec(outputs[0])[1];+ const logs = [];+ const selection = selectPromotion({+ betaTags: ['v0.10.0-beta.6'],+ isAlreadyShipped: () => false,+ fetchReleaseMeta: () => ({+ isDraft: false,+ publishedAt: '2026-07-08T19:00:00Z',+ assets: [{ name: 'OpenKnowledge-universal.dmg' }, { name: 'beta-mac.yml' }],+ }),+ soakSeconds: 86400,+ nowMs: Date.parse('2026-07-08T20:00:00Z'),+ qualifiesForFastTier: () => true,+ smokeBeta: () => verdict,+ log: (m) => logs.push(m),+ });+ expect(selection).toEqual({ kind: 'none' });+ expect(logs.join('\n')).toContain('infrastructure error and never reached a verdict');+ });+});++describe('the stall diagnostics never wait on a diagnostic', () => {+ test('a diagnostic command that outlives its bound is abandoned there, unsignalled', async () => {+ const finished = join(fixtures.dir, 'slow-diagnostic.finished');+ const script = `setTimeout(() => require('node:fs').writeFileSync(${JSON.stringify(finished)}, 'x'), 3000);`;+ const outcome = await runBoundedCommand(process.execPath, ['-e', script], 200);++ expect(outcome.timedOut).toBe(true);+ expect(existsSync(finished)).toBe(false);+ });++ test('the process tree lists the driver and its descendants only, indented by depth', () => {+ const table = [+ ' PID PPID PGID ELAPSED %CPU %MEM RSS STAT COMMAND',+ ' 1 0 1 01:00:00 0.0 0.1 1000 Ss /sbin/launchd',+ ' 100 1 100 05:00 0.1 0.2 2000 S node smoke-packaged-dmg.mjs',+ ' 200 100 200 04:00 1.0 1.0 3000 S pnpm exec playwright test',+ ' 300 200 200 03:59 50.0 4.0 9000 R node playwright test',+ ' 400 1 400 03:00 0.0 0.3 4000 S unrelated',+ ].join('\n');++ expect(renderProcessTree(table, 100)).toEqual([+ '100 1 100 05:00 0.1 0.2 2000 S node smoke-packaged-dmg.mjs',+ ' 200 100 200 04:00 1.0 1.0 3000 S pnpm exec playwright test',+ ' 300 200 200 03:59 50.0 4.0 9000 R node playwright test',+ ]);+ });++ test('a stall verdict names the stall, its window and the last progress', () => {+ const verdict = classifyRun({+ runExitCode: null,+ report: report({ expected: 16, unexpected: 0, flaky: 0, skipped: 0 }),+ stall: {+ silentMs: 601_000,+ windowMs: 600_000,+ recent: [+ {+ kind: 'test-begin',+ test: 'consent-dialog.e2e.ts › starts',+ at: '2026-10-06T13:30:00Z',+ },+ ],+ },+ });++ expect(verdict.verdict).toBe(VERDICT.error);+ expect(verdict.reason).toBe(+ stallReason({+ silentMs: 601_000,+ windowMs: 600_000,+ recent: [+ {+ kind: 'test-begin',+ test: 'consent-dialog.e2e.ts › starts',+ at: '2026-10-06T13:30:00Z',+ },+ ],+ }),+ );+ expect(verdict.reason).toContain('no Playwright progress for 10m01s (watchdog window 10m00s)');+ expect(verdict.reason).toContain(+ 'test-begin "consent-dialog.e2e.ts › starts" at 2026-10-06T13:30:00Z',+ );+ });+});++describe('the progress reporter against the installed Playwright', () => {+ test('a real run reports progress through PW_TEST_REPORTER, and a hung test is stopped once the window passes', async () => {+ const desktopRequire = createRequire(join(DESKTOP_DIR, 'package.json'));+ const cli = desktopRequire.resolve('@playwright/test/cli');+ const dir = await mkdtemp(join(tmpdir(), 'ok-smoke-real-playwright-'));+ try {+ const config = join(dir, 'playwright.config.mjs');+ await writeFile(+ config,+ "export default { testDir: '.', testMatch: '**/*.e2e.mjs', timeout: 0, retries: 0, workers: 1, reporter: [['list']] };\n",+ );+ await writeFile(+ join(dir, 'stall.e2e.mjs'),+ [+ "import { createRequire } from 'node:module';",+ `const { test } = createRequire(${JSON.stringify(join(DESKTOP_DIR, 'package.json'))})('@playwright/test');`,+ "test('advances', async () => { await test.step('a step that finishes', async () => {}); });",+ "test('hangs', async () => { await test.step('a step that hangs', async () => { await new Promise(() => {}); }); });",+ '',+ ].join('\n'),+ );+ const logs = [];+ const sent = [];+ const result = await runWatchedPlaywright({+ command: process.execPath,+ args: [cli, 'test', '--config', config],+ cwd: dir,+ env: { ...process.env },+ watchdog: { ...SCALED_WATCHDOG, stallWindowMs: 6_000 },+ out: () => {},+ err: () => {},+ log: (line) => logs.push(line),+ sendGroupSignal: (child, signal) => {+ sent.push(signal);+ process.kill(-child.pid, signal);+ },+ signalSource: new EventEmitter(),+ diagnose: async () => {},+ });++ expect(logs.some((line) => line.includes('progress reporter is connected'))).toBe(true);+ expect(result.stall).not.toBeNull();+ expect(result.stall.recent.at(-1)).toMatchObject({+ kind: 'step-begin',+ test: expect.stringContaining('hangs'),+ step: 'a step that hangs',+ });+ expect(result.stall.recent).toContainEqual(+ expect.objectContaining({ kind: 'test-begin', test: expect.stringContaining('hangs') }),+ );+ expect(sent[0]).toBe('SIGTERM');+ } finally {+ await rm(dir, { recursive: true, force: true });+ }+ });+});++async function runReporterInChild(progressFile) {+ const plan = { tests: 3, testMs: 0, finish: 'exit', exitCode: 0 };+ const child = spawn(+ process.execPath,+ [fixtures.runner, DRIVER_PATH, fixtures.grandchild, JSON.stringify(plan)],+ {+ cwd: fixtures.dir,+ env: { ...process.env, [PROGRESS_FILE_ENV]: progressFile },+ stdio: ['ignore', 'ignore', 'pipe'],+ },+ );+ let stderr = '';+ child.stderr.setEncoding('utf8');+ child.stderr.on('data', (chunk) => {+ stderr += chunk;+ });+ const exitCode = await new Promise((done) => child.on('close', done));+ return { exitCode, stderr };+}++describe('a progress file the reporter cannot write is said in the runner output', () => {+ test('every append failing yields one stderr line that names the file and the error', async () => {+ const progressFile = join(fixtures.dir, 'no-such-dir', 'progress.jsonl');+ const run = await runReporterInChild(progressFile);++ expect(run.exitCode).toBe(0);+ expect(existsSync(progressFile)).toBe(false);+ const lines = run.stderr.split('\n').filter(Boolean);+ expect(lines).toHaveLength(1);+ expect(lines[0]).toMatch(/^\[smoke-packaged-dmg\] /);+ expect(lines[0]).toContain(progressFile);+ expect(lines[0]).toContain('ENOENT');+ });++ test('a reporter whose appends succeed writes nothing to stderr', async () => {+ const progressFile = join(fixtures.dir, 'writable-progress.jsonl');+ const run = await runReporterInChild(progressFile);++ expect(run.exitCode).toBe(0);+ const kinds = readFileSync(progressFile, 'utf8')+ .trim()+ .split('\n')+ .map((line) => JSON.parse(line).kind);+ expect(kinds).toContain('ready');+ expect(kinds).toContain('test-end');+ expect(run.stderr).toBe('');+ });+});diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 210fcfd8d..6cabc88af 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -951,6 +951,9 @@ jobs:- name: Smoke the packaged DMG (FR5b)id: dmg_smokeif: steps.channel.outputs.channel == 'latest'+ # WARN: interim diagnostic bound behind the smoke driver's no-progress+ # watchdog; RELEASES.md "When the smoke stalls" derives it, so change both together.+ timeout-minutes: 30env:RELEASE_TAG: ${{ github.event.client_payload.release_tag || inputs.release_tag }}run: |diff --git a/knip.config.ts b/knip.config.tsindex d3638888e..65f0e8807 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -147,15 +147,11 @@ export default {'packages/server': {entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],project: 'src/**',- ignoreDependencies: [- '@types/shell-quote',- ],+ ignoreDependencies: ['@types/shell-quote'],},'packages/cli': {entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],- ignoreDependencies: [- 'yjs',- ],+ ignoreDependencies: ['yjs'],},'packages/desktop': {entry: [diff --git a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts b/packages/app/tests/integration/bug3-source-mode-writeback.test.tsindex 4549c74b3..a50b00123 100644--- a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts+++ b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts@@ -1,4 +1,3 @@-import { readFileSync } from 'node:fs';import { join } from 'node:path';import { setTimeout as wait } from 'node:timers/promises';diff --git a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts b/packages/app/tests/integration/indented-jsx-byte-sacred.test.tsindex 4fc2c11f9..6fcdc23f2 100644--- a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts+++ b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts@@ -1,4 +1,3 @@-import { setTimeout as wait } from 'node:timers/promises';import { normalizeBridge } from '@inkeep/open-knowledge-core';import { updateYFragment } from '@tiptap/y-tiptap';diff --git a/packages/app/tests/integration/interior-edit-freshness.test.ts b/packages/app/tests/integration/interior-edit-freshness.test.tsindex 9f2f6feb6..40b5cdfd6 100644--- a/packages/app/tests/integration/interior-edit-freshness.test.ts+++ b/packages/app/tests/integration/interior-edit-freshness.test.ts@@ -1,4 +1,3 @@-import { setTimeout as wait } from 'node:timers/promises';import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';import { afterAll, beforeAll, describe, expect, test } from 'vitest';diff --git a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts b/packages/app/tests/integration/keystroke-cadence-danger-space.test.tsindex 2a085742b..93666af70 100644--- a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts+++ b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts@@ -1,4 +1,3 @@-import { setTimeout as wait } from 'node:timers/promises';import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';import { afterAll, beforeAll, describe, expect, test } from 'vitest';diff --git a/packages/app/tests/integration/producer-guard-wiring.test.ts b/packages/app/tests/integration/producer-guard-wiring.test.tsindex 878d5196b..867598d34 100644--- a/packages/app/tests/integration/producer-guard-wiring.test.ts+++ b/packages/app/tests/integration/producer-guard-wiring.test.ts@@ -1,4 +1,3 @@-import { setTimeout as wait } from 'node:timers/promises';import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';import { afterAll, beforeAll, describe, expect, test } from 'vitest';diff --git a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.tsindex 4ada3cf26..0970ac12f 100644--- a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts+++ b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts@@ -1,4 +1,3 @@-import { randomUUID } from 'node:crypto';import { afterEach, describe, expect, test } from 'vitest';import { agentWriteMd, createTestServer, type TestServer } from './test-harness';diff --git a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts b/packages/app/tests/integration/qa-045-restore-after-gc.test.tsindex cbe2b705f..b632185e1 100644--- a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts+++ b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts@@ -1,4 +1,3 @@-import { execFileSync } from 'node:child_process';import { randomUUID } from 'node:crypto';import { join } from 'node:path';diff --git a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.tsindex 89bc9b4d9..c530ce4ba 100644--- a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts+++ b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts@@ -1,4 +1,3 @@-import { randomUUID } from 'node:crypto';import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';import type * as Y from 'yjs';diff --git a/packages/app/tests/integration/undo-after-rollback.test.ts b/packages/app/tests/integration/undo-after-rollback.test.tsindex a78aeb0e4..d3767adc9 100644--- a/packages/app/tests/integration/undo-after-rollback.test.ts+++ b/packages/app/tests/integration/undo-after-rollback.test.ts@@ -1,4 +1,3 @@-import { ROLLBACK_ORIGIN } from '@inkeep/open-knowledge-server';import { afterAll, beforeAll, describe, expect, test } from 'vitest';import * as Y from 'yjs';diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.tsindex e7cc69c3f..b076f955c 100644--- a/packages/app/tests/integration/undo-recycle-reset.test.ts+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts@@ -1,4 +1,3 @@-import { writeFileSync } from 'node:fs';import { join } from 'node:path';import { setTimeout as wait } from 'node:timers/promises';diff --git a/packages/app/tests/integration/undo-rederive-survival.test.ts b/packages/app/tests/integration/undo-rederive-survival.test.tsindex 9ddcd0730..7935e35f8 100644--- a/packages/app/tests/integration/undo-rederive-survival.test.ts+++ b/packages/app/tests/integration/undo-rederive-survival.test.ts@@ -1,4 +1,3 @@-import { prependFrontmatter } from '@inkeep/open-knowledge-core';import { Plugin, PluginKey } from '@tiptap/pm/state';import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.tsindex 2a597ec3d..f4cc8a286 100644--- a/packages/core/src/bridge/compose.ts+++ b/packages/core/src/bridge/compose.ts@@ -1,4 +1,3 @@-import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.tsindex 01ef76a9f..8fb428b90 100644--- a/packages/core/src/bridge/doc-boundary-space.ts+++ b/packages/core/src/bridge/doc-boundary-space.ts@@ -1,4 +1,3 @@-import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.tsindex fb0ba5a7c..fc267cbea 100644--- a/packages/core/src/markdown/comment-promoter.ts+++ b/packages/core/src/markdown/comment-promoter.ts@@ -1,4 +1,3 @@-import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.tsindex fa3cfcd86..bfd7e3109 100644--- a/packages/core/src/markdown/merged-walker.ts+++ b/packages/core/src/markdown/merged-walker.ts@@ -1,4 +1,3 @@-import type { Nodes, Parent, Root } from 'mdast';import { SKIP, visit } from 'unist-util-visit';import type { VFile } from 'vfile';diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.tsindex 8be632ba4..4d3250d3a 100644--- a/packages/core/src/markdown/safe-url.ts+++ b/packages/core/src/markdown/safe-url.ts@@ -1,4 +1,3 @@-export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');