Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Bound CI probes and isolate Git and pnpm fixtures (#6576)
Nick Gomez4fff14bec3ff
diff --git a/.github/scripts/bridge-public-pr-to-monorepo.test.mjs b/.github/scripts/bridge-public-pr-to-monorepo.test.mjsindex 9a02cfb8e..63fcc04fc 100644--- a/.github/scripts/bridge-public-pr-to-monorepo.test.mjs+++ b/.github/scripts/bridge-public-pr-to-monorepo.test.mjs@@ -1,9 +1,10 @@import { execFileSync } from 'node:child_process';-import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import path from 'node:path';import { describe, expect, test } from 'vitest';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';import * as bridge from './bridge-public-pr-to-monorepo.mjs';import {applyPatchWithConflictDetection,@@ -19,6 +20,7 @@ import {readCommitClaStatus,syncPublicPr,} from './bridge-public-pr-to-monorepo.mjs';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';const fakeRequest = (response) => {const calls = [];@@ -355,13 +357,22 @@ describe('createClaGateGh', () => {});const git = (dir, ...args) =>- execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8', env: gitCleanEnv() }).trim();+ execFileSync('git', ['-C', dir, ...args], {+ encoding: 'utf8',+ env: {+ ...gitCleanEnv(),+ ...(existsSync(path.join(dir, '.git'))+ ? { GIT_TRACE2_EVENT: path.join(dir, '.git', 'fixture-maintenance.jsonl') }+ : {}),+ },+ }).trim();function setupBridgeRepo({ baseContent, oursContent, theirsContent }) {const root = mkdtempSync(path.join(tmpdir(), 'bridge-canary-'));const repoDir = path.join(root, 'repo');mkdirSync(repoDir);git(repoDir, 'init', '-q');+ configureTestGitRepository(repoDir, (args) => git(repoDir, ...args));git(repoDir, 'config', 'user.email', '[email protected]');git(repoDir, 'config', 'user.name', 'canary');writeFileSync(path.join(repoDir, 'f.ts'), baseContent);@@ -431,6 +442,7 @@ describe('applyPatchWithConflictDetection (graceful conflict routing canary)', (const repoDir = path.join(root, 'repo');mkdirSync(repoDir);git(repoDir, 'init', '-q');+ configureTestGitRepository(repoDir, (args) => git(repoDir, ...args));git(repoDir, 'config', 'user.email', '[email protected]');git(repoDir, 'config', 'user.name', 'canary');writeFileSync(path.join(repoDir, 'f.ts'), STRIPPED_BASE);@@ -453,6 +465,7 @@ describe('applyPatchWithConflictDetection (graceful conflict routing canary)', (expect(result.outcome).toBe('failed');expect(result.conflictedPaths).toHaveLength(0);expect(result.message).toBeTruthy();+ expectNoAutomaticGitMaintenance(repoDir);} finally {rmSync(root, { recursive: true, force: true });}@@ -867,7 +880,9 @@ function setupSyncRepo({ sourceContent = 'updated\n', mapForkToSource = true } =const internal = path.join(root, 'internal');const branch = 'public-pr/open-knowledge-310';git(root, 'init', '--bare', '--initial-branch=main', remote);+ configureTestGitRepository(remote, (args) => git(root, ...args));git(root, 'init', '--initial-branch=main', internal);+ configureTestGitRepository(internal, (args) => git(root, ...args));git(internal, 'config', 'user.name', 'Fixture');git(internal, 'config', 'user.email', '[email protected]');mkdirSync(path.join(internal, 'public/open-knowledge'), { recursive: true });@@ -886,7 +901,9 @@ function setupSyncRepo({ sourceContent = 'updated\n', mapForkToSource = true } =const source = path.join(root, 'public');const sourceRepoDir = path.join(root, 'public.git');git(root, 'init', '--bare', '--initial-branch=main', sourceRepoDir);+ configureTestGitRepository(sourceRepoDir, (args) => git(root, ...args));git(root, 'init', '--initial-branch=main', source);+ configureTestGitRepository(source, (args) => git(root, ...args));git(source, 'config', 'user.name', 'Contributor');git(source, 'config', 'user.email', '[email protected]');writeFileSync(path.join(source, 'fixture.txt'), 'base\n');@@ -945,7 +962,9 @@ function setupForkOnlySyncRepo() {const fork = path.join(fixture.root, 'fork');const forkRepoDir = path.join(fixture.root, 'fork.git');git(fixture.root, 'init', '--bare', '--initial-branch=main', forkRepoDir);+ configureTestGitRepository(forkRepoDir, (args) => git(fixture.root, ...args));git(fixture.root, 'clone', fixture.sourceRepoDir, fork);+ configureTestGitRepository(fork, (args) => git(fixture.root, ...args));git(fork, 'config', 'user.name', 'Fork Contributor');git(fork, 'config', 'user.email', '[email protected]');writeFileSync(path.join(fork, 'fixture.txt'), 'fork-only\n');@@ -963,6 +982,20 @@ function setupForkOnlySyncRepo() {return { ...fixture, forkHead };}+test.each([+ ['patch', () => setupBridgeRepo({ baseContent: 'base\n', oursContent: 'ours\n', theirsContent: 'theirs\n' }), (fixture) => fixture.repoDir],+ ['sync internal', () => setupSyncRepo(), (fixture) => fixture.internal],+ ['sync public', () => setupSyncRepo(), (fixture) => fixture.source],+ ['fork', () => setupForkOnlySyncRepo(), (fixture) => path.join(fixture.root, 'fork')],+])('bridge fixture Git operations do not launch automatic maintenance: %s', (_name, create, repository) => {+ const fixture = create();+ try {+ expect(() => expectNoAutomaticGitMaintenance(repository(fixture))).not.toThrow();+ } finally {+ fixture.cleanup();+ }+});+async function captureBridgeLogs(action) {const logs = [];const originalLog = console.log;diff --git a/.github/scripts/bug-lane-refusal-payload.test.mjs b/.github/scripts/bug-lane-refusal-payload.test.mjsindex 5555f6cab..a2a3cb1c1 100644--- a/.github/scripts/bug-lane-refusal-payload.test.mjs+++ b/.github/scripts/bug-lane-refusal-payload.test.mjs@@ -16,7 +16,7 @@ import { fileURLToPath } from 'node:url';import { afterAll, beforeAll, describe, expect, test } from 'vitest';import { parse } from 'yaml';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';-+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';import {actionLine,buildHeadline,@@ -28,6 +28,7 @@ import {parseArgs,reasonPhrase,} from './bug-lane-refusal-payload.mjs';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');const bugLane = readFileSync(join(REPO_ROOT, '.github', 'workflows', 'bug-lane.yml'), 'utf8');@@ -846,6 +847,8 @@ describe('the page a failed toolchain install sends', () => {{ cwd: repo, env, encoding: 'utf8' },).trim();git('init', '-q');+ env.GIT_TRACE2_EVENT = join(repo, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(repo, (args) => git(...args));writeFileSync(join(repo, 'stable.txt'), 'stable\n');git('add', '-A');git('commit', '-qm', 'stable');@@ -957,5 +960,6 @@ describe('the page a failed toolchain install sends', () => {expect(whole).toMatch(/toolchain|\brust/i);expect(payload.text).not.toMatch(TIMEOUT_CAUSE);expect(whole).not.toMatch(TIMEOUT_CAUSE);+ expectNoAutomaticGitMaintenance(repo, env);});});diff --git a/.github/scripts/bug-lane.test.mjs b/.github/scripts/bug-lane.test.mjsindex 0c643ea54..c52f8cd18 100644--- a/.github/scripts/bug-lane.test.mjs+++ b/.github/scripts/bug-lane.test.mjs@@ -5,7 +5,9 @@ import { delimiter, dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';import { evaluateBugLane, holdBugLaneBatch, makeIsInStable, readPendingBumps } from './bug-lane.mjs';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';const FIX_A = 'a'.repeat(40);const FIX_B = 'b'.repeat(40);@@ -187,12 +189,21 @@ describe('makeIsInStable', () => {let laterOnMain;const git = (...args) =>- execFileSync('git', args, { cwd: dir, encoding: 'utf8', env: gitCleanEnv() }).trim();+ execFileSync('git', args, {+ cwd: dir,+ encoding: 'utf8',+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(dir, '.git', 'fixture-maintenance.jsonl'),+ },+ }).trim();const inRepo = (args) => spawnSync('git', args, { cwd: dir, encoding: 'utf8', env: gitCleanEnv() });beforeAll(() => {dir = mkdtempSync(join(tmpdir(), 'ok-bug-lane-containment-'));git('init', '--initial-branch=main', '--quiet');+ configureTestGitRepository(dir, (args) => git(...args));git('config', 'user.email', 't@t');git('config', 'user.name', 't');git('config', 'commit.gpgsign', 'false');@@ -223,6 +234,10 @@ describe('makeIsInStable', () => {afterAll(() => rmSync(dir, { recursive: true, force: true }));+ test('fixture Git operations do not launch automatic maintenance', () => {+ expect(() => expectNoAutomaticGitMaintenance(dir)).not.toThrow();+ });+test('the cherry-picked copy on the stable is NOT an ancestor of it', () => {expect(git('rev-parse', 'v1.0.0')).not.toBe(fixOnMain);expect(inRepo(['merge-base', '--is-ancestor', fixOnMain, 'v1.0.0']).status).toBe(1);@@ -305,7 +320,11 @@ describe('the bug-lane entry points the two jobs run', () => {execFileSync('git', ['-c', 'user.name=t', '-c', '[email protected]', '-c', 'commit.gpgsign=false', ...args], {cwd,encoding: 'utf8',- env: gitCleanEnv(),+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(cwd, '.git', 'fixture-maintenance.jsonl'),+ },}).trim();const pendingRepo = () => {const root = scratch('bug-lane-entry-');@@ -317,6 +336,7 @@ describe('the bug-lane entry points the two jobs run', () => {return git(root, 'rev-parse', 'HEAD');};git(root, 'init', '-q', '-b', 'main');+ configureTestGitRepository(root, (args) => git(root, ...args));writeFileSync(join(root, 'README.md'), 'stable\n');git(root, 'add', '-A');git(root, 'commit', '-q', '-m', 'stable');@@ -380,6 +400,11 @@ describe('the bug-lane entry points the two jobs run', () => {return { ...res, output: readFileSync(output, 'utf8') };};+ test('fixture Git operations do not launch automatic maintenance', () => {+ const { root } = pendingRepo();+ expect(() => expectNoAutomaticGitMaintenance(root)).not.toThrow();+ });+test('--read-bumps writes the bump of every pending changeset, keyed by blob id', () => {const { root, blobs } = pendingRepo();const res = run(SCRIPT, root, { args: ['--read-bumps'] });diff --git a/.github/scripts/derive-release-stamp.test.mjs b/.github/scripts/derive-release-stamp.test.mjsindex 5b474ae20..f0c18e3f2 100644--- a/.github/scripts/derive-release-stamp.test.mjs+++ b/.github/scripts/derive-release-stamp.test.mjs@@ -14,12 +14,14 @@ import { fileURLToPath } from 'node:url';import { afterEach, describe, expect, test } from 'vitest';import { parse } from 'yaml';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';import {deriveReleaseStamp,formatOutputLines,parseReleaseTag,previousStableTag,} from './derive-release-stamp.mjs';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';const TAGS = ['v0.35.0',@@ -251,6 +253,8 @@ function makeReleaseRepo() {{ cwd: dir, encoding: 'utf8', env, stdio: ['ignore', 'pipe', 'pipe'] },).trim();git('init', '--quiet', '--initial-branch=main');+ env.GIT_TRACE2_EVENT = join(dir, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(dir, (args) => git(...args));const bin = join(dir, '.git', 'test-bin');mkdirSync(bin);writeFileSync(@@ -286,6 +290,12 @@ for (const tag_name of execFileSync('git', ['tag', '--list'], {encoding:'utf8'})return { dir, git, commit, run, env };}+test('release fixture Git operations do not launch automatic maintenance', () => {+ const repository = makeReleaseRepo();+ repository.commit('fixture');+ expect(() => expectNoAutomaticGitMaintenance(repository.dir, repository.env)).not.toThrow();+});+describe('release scan bounds with real Git histories', () => {test('recovery scans every unpublished beta and refuses writeback before publication', () => {const { git, commit, run } = makeReleaseRepo();diff --git a/.github/scripts/git-fixture-maintenance.test-helper.mjs b/.github/scripts/git-fixture-maintenance.test-helper.mjsnew file mode 100644index 000000000..5c93b3141--- /dev/null+++ b/.github/scripts/git-fixture-maintenance.test-helper.mjs@@ -0,0 +1,73 @@+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';++export function expectNoAutomaticGitMaintenance(repository, env = gitCleanEnv()) {+ const traceDir = mkdtempSync(join(tmpdir(), 'ok-script-git-trace-'));+ const tracePath = join(traceDir, 'events.jsonl');+ try {+ const operation = spawnSync(+ 'git',+ [+ '-c',+ 'user.name=Fixture',+ '-c',+ '[email protected]',+ '-c',+ 'commit.gpgsign=false',+ '-c',+ 'maintenance.autoDetach=true',+ '-c',+ 'maintenance.strategy=incremental',+ '-c',+ 'maintenance.loose-objects.auto=-1',+ 'commit',+ '--quiet',+ '--allow-empty',+ '-m',+ 'fixture operation',+ ],+ {+ cwd: repository,+ env: {+ ...gitCleanEnv(env),+ GIT_CONFIG_GLOBAL: '/dev/null',+ GIT_CONFIG_NOSYSTEM: '1',+ GIT_TRACE2_EVENT: tracePath,+ },+ encoding: 'utf8',+ stdio: ['ignore', 'pipe', 'pipe', 'pipe'],+ },+ );+ assert.equal(operation.error, undefined);+ assert.equal(operation.status, 0, operation.stderr);+ const events = [join(repository, '.git', 'fixture-maintenance.jsonl'), tracePath].flatMap(+ (path) => {+ const entries = readFileSync(path, 'utf8')+ .trim()+ .split('\n')+ .map((line) => JSON.parse(line));+ assert.ok(+ entries.some((event) => event.event === 'version'),+ 'Git emitted no Trace2 version event',+ );+ return entries;+ },+ );+ assert.deepEqual(+ events+ .filter(+ (event) =>+ event.event === 'child_start' && ['maintenance', 'gc'].includes(event.argv?.[1]),+ )+ .map((event) => event.argv),+ [],+ 'fixture Git operation launched automatic maintenance',+ );+ } finally {+ rmSync(traceDir, { recursive: true, force: true });+ }+}diff --git a/.github/scripts/point-release-plan.test.mjs b/.github/scripts/point-release-plan.test.mjsindex f23cbdc6c..1d0383238 100644--- a/.github/scripts/point-release-plan.test.mjs+++ b/.github/scripts/point-release-plan.test.mjs@@ -8,6 +8,8 @@ import { afterEach, describe, expect, test } from 'vitest';import { gitAt, withBumpVerdicts } from '../../scripts/compute-stable-version.mjs';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';import { NOTES_SOURCE_MARKER, withNoteLevels } from '../../scripts/render-stable-notes.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import {APP_CREDENTIAL_HELPER,deriveEntryLevelResolution,@@ -1933,7 +1935,11 @@ describe('a bump read in one job is found by blob in the other', () => {const git = (cwd, ...args) => {const res = spawnSync('git', ['-c', 'user.name=t', '-c', '[email protected]', ...args], {cwd,- env: gitCleanEnv(),+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(cwd, '.git', 'fixture-maintenance.jsonl'),+ },encoding: 'utf8',});if (res.status !== 0) throw new Error(`git ${args.join(' ')} failed: ${res.stderr}`);@@ -1948,6 +1954,7 @@ describe('a bump read in one job is found by blob in the other', () => {const root = mkdtempSync(join(tmpdir(), 'point-release-bumps-'));roots.push(root);git(root, 'init', '-q', '-b', 'main');+ configureTestGitRepository(root, (args) => git(root, ...args));changeset(root, 'keep-a', 'patch');git(root, 'add', '-A');git(root, 'commit', '-q', '-m', 'stable');@@ -1978,6 +1985,7 @@ describe('a bump read in one job is found by blob in the other', () => {verdicts,);expect(releaseJob.bumpTypeOf(synthetic, 'shiny-fix')).toBe('minor');+ expectNoAutomaticGitMaintenance(root);});});@@ -1996,7 +2004,11 @@ describe('the production entry points the release workflows run', () => {const git = (cwd, ...args) => {const res = spawnSync('git', ['-c', 'user.name=t', '-c', '[email protected]', ...args], {cwd,- env: gitCleanEnv(),+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(cwd, '.git', 'fixture-maintenance.jsonl'),+ },encoding: 'utf8',});if (res.status !== 0) throw new Error(`git ${args.join(' ')} failed: ${res.stderr}`);@@ -2009,6 +2021,7 @@ describe('the production entry points the release workflows run', () => {writeFileSync(join(root, '.changeset', `${id}.md`), `---\n"@inkeep/open-knowledge": ${type}\n---\n\nA change.\n`);};git(root, 'init', '-q', '-b', 'main');+ configureTestGitRepository(root, (args) => git(root, ...args));changeset('keep-a', 'patch');if (config) {writeFileSync(@@ -2061,6 +2074,11 @@ describe('the production entry points the release workflows run', () => {]);});+ test('fixture Git operations do not launch automatic maintenance', () => {+ const { root } = fixRepo('minor');+ expect(() => expectNoAutomaticGitMaintenance(root)).not.toThrow();+ });+test('--read-bumps writes the bump and note level of each changeset a fix ref writes, keyed by blob id', () => {const { root, fix, blob } = fixRepo('minor');const res = runScript(root, ['--read-bumps'], { MODE: 'cherry-pick', FIX_REFS: fix });diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex b8e658594..64f9a5b71 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -9,8 +9,10 @@ import { afterAll, describe, expect, test } from 'vitest';import { parse } from 'yaml';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';import { NOTES_SOURCE_MARKER, renderStableNotes } from '../../scripts/render-stable-notes.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';import { buildSlackPayload } from './build-smoke-alert-payload.mjs';import { execFileSync } from './child-tripwire.test-helper.mjs';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import { selectPromotion } from './select-beta-to-promote.mjs';import { smokePackagedDmg, VERDICT } from './smoke-packaged-dmg.mjs';import { credentialReasons, holdsCredential } from './workflow-credentials.test-helper.mjs';@@ -2613,6 +2615,8 @@ describe('the release App credential never shares a job with installed packages'const env = gitCleanEnv();const git = (...args) => execFileSync('git', args, { cwd: repo, env, encoding: 'utf8' });git('init', '-q', '-b', 'main');+ env.GIT_TRACE2_EVENT = join(repo, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(repo, (args) => git(...args));for (const [tag, date] of [['v0.86.1', '2026-01-01T00:00:00Z'],['v0.86.10', '2026-01-02T00:00:00Z'],@@ -2639,6 +2643,7 @@ describe('the release App credential never shares a job with installed packages'expect(refused.status, base).toBe(1);expect(refused.stdout).toMatch(/^::error::The build job numbered this beta from base .* does not lead the newest stable tag v0\.86\.10: .*Re-run all jobs/m);}+ expectNoAutomaticGitMaintenance(repo, env);} finally {rmSync(repo, { recursive: true, force: true });}diff --git a/.github/scripts/resolve-shipped-version-cli.test.mjs b/.github/scripts/resolve-shipped-version-cli.test.mjsindex f93af850d..3feeb477b 100644--- a/.github/scripts/resolve-shipped-version-cli.test.mjs+++ b/.github/scripts/resolve-shipped-version-cli.test.mjs@@ -5,6 +5,8 @@ import { join } from 'node:path';import { fileURLToPath } from 'node:url';import { expect, test } from 'vitest';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';test('the operator CLI resolves only published desktop releases and fails closed on API errors', () => {const cwd = mkdtempSync(join(tmpdir(), 'ok-shipped-cli-'));@@ -13,6 +15,8 @@ test('the operator CLI resolves only published desktop releases and fails closedexecFileSync('git', args, { cwd, env, encoding: 'utf8', stdio: 'pipe' }).trim();try {git('init', '--quiet');+ env.GIT_TRACE2_EVENT = join(cwd, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(cwd, (args) => git(...args));git('-c','user.name=Test',@@ -57,6 +61,7 @@ console.log(${JSON.stringify(releases.map((r) => JSON.stringify(r)).join('\n'))}const failure = run({ TEST_API_FAILURE: 'true' });expect(failure.status).toBe(1);expect(failure.stdout).toBe('');+ expectNoAutomaticGitMaintenance(cwd, env);} finally {rmSync(cwd, { recursive: true, force: true });}diff --git a/.github/scripts/select-beta-to-promote.test.mjs b/.github/scripts/select-beta-to-promote.test.mjsindex fc3d269c5..9a8e97ff5 100644--- a/.github/scripts/select-beta-to-promote.test.mjs+++ b/.github/scripts/select-beta-to-promote.test.mjs@@ -6,6 +6,8 @@ import { fileURLToPath } from 'node:url';import { afterEach, describe, expect, test } from 'vitest';import { computeStablePromotion, withBumpVerdicts } from '../../scripts/compute-stable-version.mjs';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import {evaluateFastTier,makeResolveChangesetPrUrl,@@ -580,9 +582,19 @@ function makeRepoWithChangesets(commits) {'commit.gpgsign=false',...args,],- { cwd: dir, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], env: gitCleanEnv() },+ {+ cwd: dir,+ encoding: 'utf8',+ stdio: ['ignore', 'pipe', 'pipe'],+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(dir, '.git', 'fixture-maintenance.jsonl'),+ },+ },);git('init', '--quiet', '--initial-branch=main');+ configureTestGitRepository(dir, (args) => git(...args));execFileSync('mkdir', ['-p', join(dir, '.changeset')]);for (const { id, subject } of commits) {writeFileSync(@@ -595,6 +607,11 @@ function makeRepoWithChangesets(commits) {return dir;}+test('changeset fixture Git operations do not launch automatic maintenance', () => {+ const repository = makeRepoWithChangesets([{ id: 'fix', subject: 'fix: fixture' }]);+ expect(() => expectNoAutomaticGitMaintenance(repository)).not.toThrow();+});+describe('screenShippedFixes (no dispatch promote-stable would refuse)', () => {const refused = (candidate) => ({ok: false,@@ -972,7 +989,11 @@ describe('the selector entry points the two jobs run', () => {execFileSync('git', ['-c', 'user.name=t', '-c', '[email protected]', '-c', 'commit.gpgsign=false', ...args], {cwd,encoding: 'utf8',- env: gitCleanEnv(),+ env: {+ ...gitCleanEnv(),+ GIT_TRACE2_EVENT:+ args[0] === 'init' ? undefined : join(cwd, '.git', 'fixture-maintenance.jsonl'),+ },}).trim();const betaRepo = () => {const root = scratch('select-beta-entry-');@@ -984,6 +1005,7 @@ describe('the selector entry points the two jobs run', () => {git(root, 'tag', tag);};git(root, 'init', '-q', '-b', 'main');+ configureTestGitRepository(root, (args) => git(root, ...args));commit('keep', 'patch', 'chore: the shipped change (#100)', 'v1.0.0');commit('fix-crash', 'patch', 'fix: stop the crash (#201)', 'v1.0.1-beta.0');commit('new-thing', 'minor', 'feat: a new thing (#202)', 'v1.1.0-beta.0');@@ -1062,6 +1084,11 @@ describe('the selector entry points the two jobs run', () => {const readBumps = (root) =>run(SCRIPT, root, { args: ['--read-bumps'], bin: ghBin('#!/bin/sh\necho "the reader job must not call gh" >&2\nexit 97\n') });+ test('fixture Git operations do not launch automatic maintenance', () => {+ const { root } = betaRepo();+ expect(() => expectNoAutomaticGitMaintenance(root)).not.toThrow();+ });+test('--read-bumps writes the bump of every changeset an unshipped beta adds, keyed by blob id, without gh', () => {const { root, blobs } = betaRepo();const res = readBumps(root);diff --git a/.github/scripts/select-native-config-prebuild.test.mjs b/.github/scripts/select-native-config-prebuild.test.mjsindex 0f07ebddb..859c8e94d 100644--- a/.github/scripts/select-native-config-prebuild.test.mjs+++ b/.github/scripts/select-native-config-prebuild.test.mjs@@ -14,6 +14,8 @@ import { fileURLToPath } from 'node:url';import { describe, expect, test } from 'vitest';import { parse } from 'yaml';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import {DEFAULT_CANDIDATE_LIMIT,describeNoSelection,@@ -426,6 +428,8 @@ describe('git boundary', () => {{ cwd: repo, encoding: 'utf8', env },).stdout.trim();git('init', '--quiet', '--initial-branch=main');+ env.GIT_TRACE2_EVENT = join(repo, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(repo, (args) => git(...args));git('commit', '--quiet', '--allow-empty', '-m', 'before native-config');const first = git('rev-parse', 'HEAD');mkdirSync(join(repo, 'packages', 'native-config'), { recursive: true });@@ -447,6 +451,7 @@ describe('git boundary', () => {spawnSync(cmd, args, { ...options, cwd: outside, env });expect(() => makeIsAncestor(inNoRepo)(first, 'HEAD')).toThrow('not a git repository');expect(() => makeTreeAt(inNoRepo)('HEAD')).toThrow('not a git repository');+ expectNoAutomaticGitMaintenance(repo, env);} finally {rmSync(repo, { recursive: true, force: true });rmSync(outside, { recursive: true, force: true });diff --git a/.github/scripts/shipped-fix-containment-shape.test.mjs b/.github/scripts/shipped-fix-containment-shape.test.mjsindex 591a823d8..cd653e3f2 100644--- a/.github/scripts/shipped-fix-containment-shape.test.mjs+++ b/.github/scripts/shipped-fix-containment-shape.test.mjs@@ -7,6 +7,8 @@ import { fileURLToPath } from 'node:url';import { afterAll, describe, expect, test } from 'vitest';import { parse } from 'yaml';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';const SCRIPTS = dirname(fileURLToPath(import.meta.url));const OK_ROOT = join(SCRIPTS, '..', '..');@@ -136,6 +138,7 @@ describe('direct recovery: desktop-release refuses a stable in prepare', () => {test('the archived guard runs on its own against a tag checkout that predates it', () => {const root = realpathSync(mkdtempSync(join(tmpdir(), 'ok-shipped-fix-archive-')));scratch.push(root);+ const env = gitCleanEnv();const git = (...args) =>execFileSync('git',@@ -148,10 +151,12 @@ describe('direct recovery: desktop-release refuses a stable in prepare', () => {'commit.gpgsign=false',...args,],- { cwd: join(root, 'checkout'), env: gitCleanEnv(), encoding: 'utf8' },+ { cwd: join(root, 'checkout'), env, encoding: 'utf8' },).trim();mkdirSync(join(root, 'checkout'));git('init', '-q', '-b', 'main');+ env.GIT_TRACE2_EVENT = join(root, 'checkout', '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(join(root, 'checkout'), (args) => git(...args));writeFileSync(join(root, 'checkout', 'notes.txt'), 'first\n');git('add', '-A');git('commit', '-q', '-m', 'Initial (#1)');@@ -185,6 +190,7 @@ describe('direct recovery: desktop-release refuses a stable in prepare', () => {expect(refused.stdout).toContain('::error::refs/tags/v1.0.0 lacks 1 fix that a published stable already shipped: #2 (v1.0.1).',);+ expectNoAutomaticGitMaintenance(join(root, 'checkout'), env);});});diff --git a/.github/scripts/shipped-fix-containment.test.mjs b/.github/scripts/shipped-fix-containment.test.mjsindex a40413fc9..5d193d5eb 100644--- a/.github/scripts/shipped-fix-containment.test.mjs+++ b/.github/scripts/shipped-fix-containment.test.mjs@@ -5,6 +5,8 @@ import { delimiter, join } from 'node:path';import { fileURLToPath } from 'node:url';import { afterAll, beforeAll, describe, expect, test } from 'vitest';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import {appliedOrigins,COVERAGE,@@ -33,6 +35,7 @@ afterAll(() => {function makeRepo() {const dir = realpathSync(mkdtempSync(join(tmpdir(), 'ok-shipped-fix-')));scratch.push(dir);+ const fixtureEnv = gitCleanEnv();const git = (args, { env = {}, input } = {}) =>execFileSync('git',@@ -47,9 +50,11 @@ function makeRepo() {'tag.gpgsign=false',...args,],- { cwd: dir, env: { ...gitCleanEnv(), ...env }, encoding: 'utf8', input, stdio: 'pipe' },+ { cwd: dir, env: { ...fixtureEnv, ...env }, encoding: 'utf8', input, stdio: 'pipe' },).trim();git(['init', '--quiet', '--initial-branch=main']);+ fixtureEnv.GIT_TRACE2_EVENT = join(dir, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(dir, (args) => git(args));const commit = ({files = {},message,@@ -73,6 +78,12 @@ function makeRepo() {return { dir, git, commit };}+test('shipped-fix fixture Git operations do not launch automatic maintenance', () => {+ const repository = makeRepo();+ repository.commit({ message: 'fixture' });+ expect(() => expectNoAutomaticGitMaintenance(repository.dir)).not.toThrow();+});+const AUTOSAVE = {message: 'fix: keep autosave working (#11)\n\nBody one.',author: 'Alice <[email protected]>',diff --git a/.github/scripts/tag-containment.test.mjs b/.github/scripts/tag-containment.test.mjsindex d940610a1..376496c59 100644--- a/.github/scripts/tag-containment.test.mjs+++ b/.github/scripts/tag-containment.test.mjs@@ -4,6 +4,8 @@ import { tmpdir } from 'node:os';import { join } from 'node:path';import { expect, test } from 'vitest';import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';+import { configureTestGitRepository } from '../../test-support/configure-git-fixture.test-helper.ts';+import { expectNoAutomaticGitMaintenance } from './git-fixture-maintenance.test-helper.mjs';import { createTagContainment } from './tag-containment.mjs';test('batched containment agrees with Git across divergent and annotated tags, using one scan per fix', () => {@@ -27,6 +29,8 @@ test('batched containment agrees with Git across divergent and annotated tags, u).trim();try {git('init', '--quiet', '--initial-branch=main');+ env.GIT_TRACE2_EVENT = join(cwd, '.git', 'fixture-maintenance.jsonl');+ configureTestGitRepository(cwd, (args) => git(...args));git('commit', '--allow-empty', '-m', 'base');const base = git('rev-parse', 'HEAD');git('tag', 'v0.1.0');@@ -68,6 +72,22 @@ test('batched containment agrees with Git across divergent and annotated tags, uexpect(calls).toBe(5);expect(() => contains('v9.9.9', feature)).toThrow('absent');expect(() => contains('v0.1.2', 'f'.repeat(40))).toThrow();+ expectNoAutomaticGitMaintenance(cwd, env);+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+});++test('the maintenance oracle reports a repository that keeps automatic maintenance enabled', () => {+ const cwd = mkdtempSync(join(tmpdir(), 'ok-unconfigured-maintenance-'));+ const env = { ...gitCleanEnv(), GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };+ try {+ execFileSync('git', ['init', '--quiet', '--initial-branch=main'], { cwd, env, stdio: 'pipe' });+ env.GIT_TRACE2_EVENT = join(cwd, '.git', 'fixture-maintenance.jsonl');+ execFileSync('git', ['rev-parse', '--git-dir'], { cwd, env, stdio: 'pipe' });+ expect(() => expectNoAutomaticGitMaintenance(cwd, env)).toThrow(+ 'fixture Git operation launched automatic maintenance',+ );} finally {rmSync(cwd, { recursive: true, force: true });}diff --git a/knip.config.ts b/knip.config.tsindex eb9727af8..e43118957 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -155,15 +155,11 @@ export default {'src/shadow-fixture-launch.test-helper.mjs',],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 ffd8fce06..e7e63f43d 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 ae8cb390b..861003fb4 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('|');