Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Cap Actions cache access in OK's credentialed jobs with cache-mode (#5618)
Nick Gomez7e2b86e4135a
diff --git a/.github/scripts/cache-mode-shape.test.mjs b/.github/scripts/cache-mode-shape.test.mjsnew file mode 100644index 000000000..1abb7bb02--- /dev/null+++ b/.github/scripts/cache-mode-shape.test.mjs@@ -0,0 +1,532 @@+// biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub expression fixtures must remain literal.+import {+ existsSync,+ mkdirSync,+ mkdtempSync,+ readdirSync,+ readFileSync,+ rmSync,+ writeFileSync,+} from 'node:fs';+import { tmpdir } from 'node:os';+import { dirname, join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { afterAll, describe, expect, test } from 'vitest';+import { parse } from 'yaml';+import { credentialReasons } from './workflow-credentials.test-helper.mjs';++const OK_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');+const WORKFLOWS = join(OK_ROOT, '.github', 'workflows');+const MODES = ['none', 'read', 'write-only', 'write'];++const isFalse = (value) => /^false$/i.test(String(value));+const isLiteralTrue = (value) => String(value) === 'true';++const CACHE_FREE = () => [];+const ACTIONS = {+ 'actions/checkout': CACHE_FREE,+ 'actions/upload-artifact': CACHE_FREE,+ 'actions/download-artifact': CACHE_FREE,+ 'actions/create-github-app-token': CACHE_FREE,+ 'dtolnay/rust-toolchain': CACHE_FREE,+ 'taiki-e/install-action': CACHE_FREE,+ 'linear/linear-release-action': CACHE_FREE,+ 'actions/cache': () => ['extract', 'save'],+ 'actions/cache/restore': (inputs) =>+ isLiteralTrue(inputs['lookup-only']) ? ['lookup'] : ['extract'],+ 'actions/cache/save': () => ['save'],+ 'actions/setup-node': (inputs) => {+ if (inputs.cache !== undefined) return ['extract', 'save'];+ return isFalse(inputs['package-manager-cache']) ? [] : ['incidental'];+ },+ 'pnpm/action-setup': (inputs) =>+ inputs.cache === undefined || isFalse(inputs.cache) ? [] : ['extract', 'save'],+ 'pnpm/setup': (inputs) =>+ inputs.cache === undefined || isFalse(inputs.cache) ? [] : ['extract', 'save'],+ 'astral-sh/setup-uv': (inputs) => (isFalse(inputs['enable-cache']) ? [] : ['incidental']),+ 'mlugg/setup-zig': (inputs) => (isFalse(inputs['use-cache']) ? [] : ['incidental']),+ 'actions/stale': () => ['incidental'],+};++function cacheOps(steps, root = OK_ROOT, seen = []) {+ const ops = [];+ for (const step of steps ?? []) {+ const uses = step.uses;+ if (uses === undefined) continue;+ if (uses.startsWith('./')) {+ if (seen.includes(uses)) throw new Error(`composite cycle through ${uses}`);+ const dir = join(root, uses);+ const file = ['action.yml', 'action.yaml'].map((name) => join(dir, name)).find(existsSync);+ if (file === undefined) throw new Error(`local action ${uses} has no action.yml`);+ const action = parse(readFileSync(file, 'utf8'));+ if (action.runs?.using !== 'composite') {+ throw new Error(+ `local action ${uses} runs ${action.runs?.using}, not composite, so this sweep cannot see what cache it touches`,+ );+ }+ ops.push(+ ...cacheOps(action.runs.steps, root, [...seen, uses]).map((op) => ({+ ...op,+ via: [uses, ...op.via],+ })),+ );+ continue;+ }+ const at = uses.indexOf('@');+ const classify = at === -1 ? undefined : ACTIONS[uses.slice(0, at)];+ if (classify === undefined) {+ throw new Error(+ `${uses} is not classified for cache access; add it to ACTIONS in cache-mode-shape.test.mjs`,+ );+ }+ for (const kind of classify(step.with ?? {}))+ ops.push({ kind, step: step.name ?? uses, via: [] });+ }+ return ops;+}++function narrowestMode(ops) {+ const reads = ops.some((op) => op.kind === 'lookup' || op.kind === 'extract');+ const writes = ops.some((op) => op.kind === 'save');+ if (reads && writes) return 'write';+ if (reads) return 'read';+ return writes ? 'write-only' : 'none';+}++const effectiveMode = (workflow, job) => job['cache-mode'] ?? workflow['cache-mode'] ?? null;++function cacheModeProblems(workflow, job, root = OK_ROOT) {+ if (credentialReasons(workflow, job).length === 0) return [];+ if (job.uses !== undefined)+ return [`calls the reusable workflow ${job.uses}, which this sweep does not trace`];+ const ops = cacheOps(job.steps, root);+ const mode = effectiveMode(workflow, job);+ const problems = [];+ for (const op of ops.filter((candidate) => candidate.kind === 'extract')) {+ problems.push(`extracts a cache entry at ${[...op.via, op.step].join(' > ')}`);+ }+ if (mode === null) problems.push('declares no cache-mode, so the trigger default applies');+ else if (!MODES.includes(mode))+ problems.push(`declares cache-mode ${mode}, which is not one of ${MODES.join(', ')}`);+ else if (mode !== narrowestMode(ops)) {+ problems.push(+ `declares cache-mode ${mode}, but its cache operations need exactly ${narrowestMode(ops)}`,+ );+ }+ if (mode === 'read' || mode === 'write') {+ for (const op of ops.filter((candidate) => candidate.kind === 'incidental')) {+ problems.push(+ `cache-mode ${mode} lets ${[...op.via, op.step].join(' > ')} restore its own cache`,+ );+ }+ }+ return problems;+}++const workflows = readdirSync(WORKFLOWS)+ .filter((name) => /\.ya?ml$/.test(name))+ .sort()+ .map((file) => ({ file, workflow: parse(readFileSync(join(WORKFLOWS, file), 'utf8')) }));+const allJobs = workflows.flatMap(({ file, workflow }) =>+ Object.entries(workflow.jobs ?? {}).map(([id, job]) => ({+ label: `${file}#${id}`,+ workflow,+ job,+ })),+);+const credentialed = allJobs.filter(+ ({ workflow, job }) => credentialReasons(workflow, job).length > 0,+);++describe('credentialed jobs in public/open-knowledge/.github/workflows declare the narrowest cache-mode their cache operations need', () => {+ test('the credentialed jobs and their modes are exactly these', () => {+ expect(+ Object.fromEntries(+ credentialed.map(({ label, workflow, job }) => [label, effectiveMode(workflow, job)]),+ ),+ ).toEqual({+ 'bug-lane-verify.yml#bug-lane-verify': 'write',+ 'bug-lane.yml#bug-lane': 'none',+ 'desktop-build-win-linux.yml#build-windows': 'none',+ 'desktop-build.yml#build-macos-dmg': 'none',+ 'desktop-release-draft-janitor.yml#sweep': 'none',+ 'desktop-release.yml#prepare': 'none',+ 'desktop-release.yml#build-macos': 'none',+ 'desktop-release.yml#build-windows': 'none',+ 'desktop-release.yml#publish-assets': 'none',+ 'desktop-release.yml#finalize': 'none',+ 'desktop-release.yml#release-consumers': 'none',+ 'desktop-release.yml#alert': 'none',+ 'linear-pr-relay.yml#relay': 'none',+ 'linear-release.yml#stamp': 'none',+ 'monorepo-pr-bridge.yml#acknowledge': 'none',+ 'monorepo-pr-bridge.yml#sync': 'none',+ 'monorepo-pr-bridge.yml#close': 'none',+ 'monorepo-pr-bridge.yml#refresh-cla': 'none',+ 'point-release.yml#point-release': 'none',+ 'promote-stable.yml#promote': 'none',+ 'publish-linux-repo.yml#publish': 'none',+ 'release.yml#read-releases': 'none',+ 'release.yml#release': 'none',+ 'release.yml#publish': 'none',+ 'select-beta-to-promote.yml#evaluate': 'read',+ 'select-beta-to-promote.yml#dispatch-fast-tier-candidate': 'none',+ 'select-beta-to-promote.yml#page-smoke-incident': 'write-only',+ 'share-contract-deployment-gate.yml#reader-contract': 'none',+ 'share-contract-monitor.yml#probe': 'none',+ 'stale.yml#stale': 'none',+ 'write-back.yml#notify': 'none',+ });+ });++ test.each(credentialed.map(({ label, workflow, job }) => [label, workflow, job]))(+ '%s extracts no cache entry and its mode matches its operations',+ (_label, workflow, job) => {+ expect(cacheModeProblems(workflow, job)).toEqual([]);+ },+ );++ test('no credentialed job touches an ok-pnpm-store- cache key', () => {+ for (const { label, job } of credentialed) {+ const storeSteps = (job.steps ?? []).filter((step) =>+ /ok-pnpm-store-/.test(JSON.stringify(step.with ?? {})),+ );+ expect(storeSteps, label).toEqual([]);+ }+ });++ test('the lookup-only restores that read and write jobs keep never extract', () => {+ const lookups = credentialed.flatMap(({ label, job }) =>+ cacheOps(job.steps)+ .filter((op) => op.kind === 'lookup')+ .map((op) => `${label} ${op.step}`),+ );+ expect(lookups).toEqual([+ 'bug-lane-verify.yml#bug-lane-verify Has this drop already been paged?',+ 'bug-lane-verify.yml#bug-lane-verify Has this refusal already been paged?',+ 'select-beta-to-promote.yml#evaluate Look up an earlier smoke failure for the fast-tier candidate',+ ]);+ });+});++describe('cache-mode sweep self-tests', () => {+ const sha = '668228422ae6a00e4ad889ee87cd7109ec5666a7';+ const nodeSha = '48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e';+ const save = { name: 'save', uses: `actions/cache/save@${sha}`, with: { path: 'p', key: 'k' } };+ const lookup = {+ name: 'lookup',+ uses: `actions/cache/restore@${sha}`,+ with: { path: 'p', key: 'k', 'lookup-only': true },+ };+ const restore = {+ name: 'restore',+ uses: `actions/cache/restore@${sha}`,+ with: { path: 'p', key: 'k' },+ };+ const implicitNode = {+ name: 'node',+ uses: `actions/setup-node@${nodeSha}`,+ with: { 'node-version': '24' },+ };+ const slack = { name: 'page', run: 'post', env: { HOOK: '${{ secrets.SLACK_WEBHOOK_URL }}' } };+ const credentialedJob = (mode, ...steps) => ({+ permissions: { contents: 'read' },+ ...(mode === undefined ? {} : { 'cache-mode': mode }),+ steps: [slack, ...steps],+ });+ const kinds = (step) => cacheOps([step]).map((op) => op.kind);++ test('a credential is a non-GITHUB_TOKEN secret, an App token, or any write scope, wherever it is declared', () => {+ const fires = {+ 'a secret in step env': [{}, { permissions: {}, steps: [slack] }],+ 'a secret in a run script': [+ {},+ { permissions: {}, steps: [{ run: 'curl "${{ secrets.TOKEN }}"' }] },+ ],+ 'a secret in job env': [+ {},+ { permissions: {}, env: { T: '${{ secrets.TOKEN }}' }, steps: [] },+ ],+ 'a secret in workflow env': [+ { env: { T: '${{ secrets.TOKEN }}' } },+ { permissions: {}, steps: [] },+ ],+ 'a secret beside GITHUB_TOKEN': [+ {},+ { permissions: {}, steps: [{ run: '${{ secrets.GITHUB_TOKEN || secrets.PAT }}' }] },+ ],+ 'the whole secrets context': [+ {},+ { permissions: {}, steps: [{ run: '${{ toJSON(secrets) }}' }] },+ ],+ 'an indexed secret': [{}, { permissions: {}, steps: [{ run: "${{ secrets['PAT'] }}" }] }],+ 'a secret in a bare if': [+ {},+ { permissions: {}, steps: [{ if: "secrets.PAT != ''", run: 'true' }] },+ ],+ 'a job write scope': [{}, { permissions: { contents: 'write' }, steps: [] }],+ 'an inherited workflow write scope': [{ permissions: { issues: 'write' } }, { steps: [] }],+ 'id-token write': [{}, { permissions: { 'id-token': 'write' }, steps: [] }],+ 'write-all': [{}, { permissions: 'write-all', steps: [] }],+ 'no permissions anywhere': [{}, { steps: [] }],+ 'an App token step': [+ {},+ {+ permissions: {},+ steps: [+ { uses: 'actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3' },+ ],+ },+ ],+ 'inherited secrets on a reusable call': [+ {},+ { permissions: {}, uses: './.github/workflows/x.yml', secrets: 'inherit' },+ ],+ };+ for (const [form, [workflow, job]] of Object.entries(fires)) {+ expect(credentialReasons(workflow, job), form).not.toEqual([]);+ }+ const quiet = {+ 'GITHUB_TOKEN only': [+ {},+ {+ permissions: { contents: 'read' },+ steps: [{ env: { GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' } }],+ },+ ],+ 'github.token': [+ {},+ {+ permissions: { contents: 'read' },+ steps: [{ env: { GH_TOKEN: '${{ github.token }}' } }],+ },+ ],+ 'an empty permissions map': [{}, { permissions: {}, steps: [] }],+ 'a job read scope over a workflow write scope': [+ { permissions: { contents: 'write' } },+ { permissions: { contents: 'read' }, steps: [] },+ ],+ 'read-all': [{}, { permissions: 'read-all', steps: [] }],+ 'a bare if that reads no secret': [+ {},+ { permissions: {}, steps: [{ if: "github.event_name == 'push'", run: 'true' }] },+ ],+ 'the word secrets outside an expression': [+ {},+ { permissions: {}, steps: [{ run: 'echo secrets.TOKEN' }] },+ ],+ };+ for (const [form, [workflow, job]] of Object.entries(quiet)) {+ expect(credentialReasons(workflow, job), form).toEqual([]);+ }+ });++ test('cache steps classify by what they restore and save', () => {+ expect(kinds(save)).toEqual(['save']);+ expect(kinds(lookup)).toEqual(['lookup']);+ expect(kinds({ ...lookup, with: { ...lookup.with, 'lookup-only': 'true' } })).toEqual([+ 'lookup',+ ]);+ expect(kinds({ ...lookup, with: { ...lookup.with, 'lookup-only': false } })).toEqual([+ 'extract',+ ]);+ expect(+ kinds({ ...lookup, with: { ...lookup.with, 'lookup-only': '${{ inputs.lookup }}' } }),+ ).toEqual(['extract']);+ expect(kinds(restore)).toEqual(['extract']);+ expect(+ kinds({ uses: `actions/cache@${sha}`, with: { path: 'p', key: 'k', 'lookup-only': true } }),+ ).toEqual(['extract', 'save']);+ expect(kinds(implicitNode)).toEqual(['incidental']);+ expect(kinds({ ...implicitNode, with: { 'package-manager-cache': 'FALSE' } })).toEqual([]);+ expect(+ kinds({ ...implicitNode, with: { cache: 'pnpm', 'package-manager-cache': false } }),+ ).toEqual(['extract', 'save']);+ expect(kinds({ uses: 'pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86' })).toEqual(+ [],+ );+ expect(+ kinds({+ uses: 'pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86',+ with: { cache: true },+ }),+ ).toEqual(['extract', 'save']);+ expect(+ kinds({+ uses: 'pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2',+ with: { cache: 'true' },+ }),+ ).toEqual(['extract', 'save']);+ expect(+ kinds({+ uses: 'astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990',+ with: { 'enable-cache': false },+ }),+ ).toEqual([]);+ expect(kinds({ uses: 'astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990' })).toEqual([+ 'incidental',+ ]);+ expect(kinds({ uses: 'mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29' })).toEqual([+ 'incidental',+ ]);+ expect(kinds({ uses: 'actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f' })).toEqual([+ 'incidental',+ ]);+ expect(kinds({ run: 'pnpm install' })).toEqual([]);+ });++ test('composites are traced, and an unclassified or missing action fails the sweep', () => {+ const composite = cacheOps([+ { uses: './.github/composite-actions/share-contract-reader-gate' },+ ]);+ expect(composite.map((op) => op.kind)).toEqual(['incidental']);+ expect(composite[0].via).toEqual(['./.github/composite-actions/share-contract-reader-gate']);+ expect(() => cacheOps([{ uses: 'someone/cache@v1' }])).toThrow(/not classified/);+ expect(() => cacheOps([{ uses: 'docker://alpine:3' }])).toThrow(/not classified/);+ expect(() => cacheOps([{ uses: './.github/composite-actions/does-not-exist' }])).toThrow(+ /no action\.yml/,+ );+ });++ const fixtureRoot = mkdtempSync(join(tmpdir(), 'cache-mode-local-actions-'));+ afterAll(() => rmSync(fixtureRoot, { recursive: true, force: true }));+ const localAction = (name, runs) => {+ const dir = join(fixtureRoot, '.github', 'actions', name);+ mkdirSync(dir, { recursive: true });+ writeFileSync(join(dir, 'action.yml'), JSON.stringify({ name, runs }));+ return `./.github/actions/${name}`;+ };++ test('a local action that is not a composite fails the sweep, at any depth', () => {+ const node = localAction('node-action', { using: 'node20', main: 'index.js' });+ const docker = localAction('docker-action', { using: 'docker', image: 'Dockerfile' });+ const noRuns = localAction('no-runs', undefined);+ const wrapsNode = localAction('wraps-node', { using: 'composite', steps: [{ uses: node }] });+ const saves = localAction('saves', { using: 'composite', steps: [save] });+ expect(() => cacheOps([{ uses: node }], fixtureRoot)).toThrow(+ /node-action runs node20, not composite/,+ );+ expect(() => cacheOps([{ uses: docker }], fixtureRoot)).toThrow(+ /docker-action runs docker, not composite/,+ );+ expect(() => cacheOps([{ uses: noRuns }], fixtureRoot)).toThrow(+ /no-runs runs undefined, not composite/,+ );+ expect(() => cacheOps([{ uses: wrapsNode }], fixtureRoot)).toThrow(/node-action runs node20/);+ expect(cacheOps([{ uses: saves }], fixtureRoot).map((op) => op.kind)).toEqual(['save']);+ expect(() =>+ cacheModeProblems({}, credentialedJob('none', { uses: node }), fixtureRoot),+ ).toThrow(/node-action runs node20/);+ expect(() =>+ cacheModeProblems({}, credentialedJob('write-only', save, { uses: docker }), fixtureRoot),+ ).toThrow(/docker-action runs docker/);+ expect(+ cacheModeProblems({}, { permissions: {}, steps: [{ uses: node }] }, fixtureRoot),+ ).toEqual([]);+ });++ test('each mode is accepted exactly where the operations need it', () => {+ const accepted = {+ 'none with no cache step': [{}, credentialedJob('none')],+ 'none with an implicit setup-node cache': [{}, credentialedJob('none', implicitNode)],+ 'read with a lookup-only restore': [{}, credentialedJob('read', lookup)],+ 'write-only with a save': [{}, credentialedJob('write-only', save)],+ 'write-only with a save and an implicit setup-node cache': [+ {},+ credentialedJob('write-only', save, implicitNode),+ ],+ 'write with a lookup-only restore and a save': [{}, credentialedJob('write', lookup, save)],+ 'none inherited from the workflow': [{ 'cache-mode': 'none' }, credentialedJob(undefined)],+ 'a job mode overriding the workflow mode': [+ { 'cache-mode': 'write' },+ credentialedJob('none'),+ ],+ 'an uncredentialed job at the default': [{}, { permissions: {}, steps: [restore, save] }],+ };+ for (const [form, [workflow, job]] of Object.entries(accepted)) {+ expect(cacheModeProblems(workflow, job), form).toEqual([]);+ }+ const refused = {+ 'no mode, so the trigger default applies': [+ {},+ credentialedJob(undefined),+ /declares no cache-mode/,+ ],+ 'write with no cache step': [{}, credentialedJob('write'), /need exactly none/],+ 'read with no cache step': [{}, credentialedJob('read'), /need exactly none/],+ 'write-only with no cache step': [{}, credentialedJob('write-only'), /need exactly none/],+ 'none with a save that would be dropped': [+ {},+ credentialedJob('none', save),+ /need exactly write-only/,+ ],+ 'read with a save that would be dropped': [+ {},+ credentialedJob('read', lookup, save),+ /need exactly write/,+ ],+ 'write for a lookup alone': [{}, credentialedJob('write', lookup), /need exactly read/],+ 'write for a save alone': [{}, credentialedJob('write', save), /need exactly write-only/],+ 'an extracting restore under none': [+ {},+ credentialedJob('none', restore),+ /extracts a cache entry at restore/,+ ],+ 'the combined cache action': [+ {},+ credentialedJob('none', { uses: `actions/cache@${sha}`, with: { path: 'p', key: 'k' } }),+ /extracts/,+ ],+ 'an implicit setup-node cache under read': [+ {},+ credentialedJob('read', lookup, implicitNode),+ /lets node restore/,+ ],+ 'an implicit setup-node cache in a composite under write': [+ {},+ credentialedJob('write', lookup, save, {+ uses: './.github/composite-actions/share-contract-reader-gate',+ }),+ /share-contract-reader-gate > Set up Node restore/,+ ],+ 'a misspelt mode': [{}, credentialedJob('read-only'), /not one of/],+ 'a workflow write that the job inherits': [+ { 'cache-mode': 'write' },+ credentialedJob(undefined),+ /need exactly none/,+ ],+ 'a reusable workflow call': [+ {},+ { permissions: { contents: 'write' }, uses: './.github/workflows/x.yml' },+ /reusable workflow/,+ ],+ };+ for (const [form, [workflow, job, reason]] of Object.entries(refused)) {+ expect(cacheModeProblems(workflow, job).join('\n'), form).toMatch(reason);+ }+ });++ test('the real signing jobs turn red at the default or at write', () => {+ const { workflow } = workflows.find(({ file }) => file === 'desktop-release.yml');+ for (const id of ['build-macos', 'build-windows', 'prepare']) {+ const { 'cache-mode': _mode, ...atDefault } = workflow.jobs[id];+ expect(cacheModeProblems(workflow, atDefault).join('\n'), `${id} at the default`).toMatch(+ /declares no cache-mode/,+ );+ expect(+ cacheModeProblems(workflow, { ...atDefault, 'cache-mode': 'write' }).join('\n'),+ `${id} at write`,+ ).toMatch(/need exactly none/);+ }+ const selector = workflows.find(({ file }) => file === 'select-beta-to-promote.yml').workflow;+ expect(+ cacheModeProblems(selector, { ...selector.jobs.evaluate, 'cache-mode': 'write' }).join('\n'),+ ).toMatch(/need exactly read/);+ expect(+ cacheModeProblems(selector, {+ ...selector.jobs['page-smoke-incident'],+ 'cache-mode': 'write',+ }).join('\n'),+ ).toMatch(/need exactly write-only/);+ });+});diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex f39a89c09..7795bc8dd 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -11,6 +11,7 @@ import { parse } from 'yaml';import { buildSlackPayload } from './build-smoke-alert-payload.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';const WORKFLOWS = join(dirname(fileURLToPath(import.meta.url)), '..', 'workflows');const read = (name) => readFileSync(join(WORKFLOWS, name), 'utf8');@@ -1669,18 +1670,6 @@ describe('the release App credential never shares a job with installed packages'...kept.filter((step) => SETUP_NODE.test(step.uses ?? '') && !setupNodeRestoresNothing(step)).map((step) => step.uses),];};- const writesWith = (permissions) =>- permissions === undefined ||- permissions === 'write-all' ||- (typeof permissions === 'object' && Object.values(permissions).includes('write'));- const otherSecrets = (value) =>- expressions(value)- .map(({ expr }) => expr.replace(/\bsecrets\.GITHUB_TOKEN\b/g, ''))- .filter((expr) => /\bsecrets\b/.test(expr));- const holdsCredential = (workflow, job) =>- writesWith(job.permissions ?? workflow.permissions) ||- otherSecrets(job).length > 0 ||- otherSecrets(workflow.env ?? {}).length > 0;const SANCTIONED_IF =/^(?:always\(\) && )?needs\.smoke-fast-tier-candidate\.outputs\.verdict == '(?:pass|fail)'$/;const readerOutputReads = (job, readers) => {@@ -1719,10 +1708,7 @@ describe('the release App credential never shares a job with installed packages'expect(installers.length).toBe(4);for (const { file, id, job, workflow } of installers) {expect(job.permissions, `${file}#${id}`).toBeDefined();- expect(writesWith(job.permissions), `${file}#${id}`).toBe(false);- expect(otherSecrets(job), `${file}#${id}`).toEqual([]);- expect(otherSecrets(workflow.env ?? {}), file).toEqual([]);- expect(holdsCredential(workflow, job), `${file}#${id}`).toBe(false);+ expect(credentialReasons(workflow, job), `${file}#${id}`).toEqual([]);}});@@ -1876,6 +1862,10 @@ describe('the release App credential never shares a job with installed packages''a secret in an action input': { ...readOnly, steps: [{ uses: 'x/y@v1', with: { token: '${{ secrets.APP_KEY }}' } }] },'a secret in job-level env': { ...readOnly, env: { KEY: '${{ secrets.LINEAR_API_KEY }}' } },'a secret in workflow-level env': [{ ...workflow, env: { KEY: '${{ secrets.LINEAR_API_KEY }}' } }, readOnly],+ 'a secret in a bare if': { ...readOnly, steps: [{ if: "secrets.SLACK_WEBHOOK_URL != ''", run: 'true' }] },+ 'id-token write': { permissions: { 'id-token': 'write' } },+ 'an App token step': { ...readOnly, steps: [{ uses: 'actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3' }] },+ 'inherited secrets on a reusable call': { ...readOnly, uses: './.github/workflows/x.yml', secrets: 'inherit' },};for (const [form, value] of Object.entries(holders)) {const [wf, job] = Array.isArray(value) ? value : [workflow, value];diff --git a/.github/scripts/workflow-credentials.test-helper.mjs b/.github/scripts/workflow-credentials.test-helper.mjsnew file mode 100644index 000000000..430e3c743--- /dev/null+++ b/.github/scripts/workflow-credentials.test-helper.mjs@@ -0,0 +1,37 @@+const EXPRESSION = /\$\{\{([\s\S]*?)\}\}/g;++function expressionsIn(value, key) {+ if (typeof value === 'string') {+ if (key === 'if') return [value.trim()];+ return [...value.matchAll(EXPRESSION)].map((match) => match[1].trim());+ }+ if (Array.isArray(value)) return value.flatMap((item) => expressionsIn(item));+ if (value !== null && typeof value === 'object') {+ return Object.entries(value).flatMap(([name, item]) => expressionsIn(item, name));+ }+ return [];+}++export function credentialReasons(workflow, job) {+ const reasons = [];+ const permissions = job.permissions ?? workflow.permissions;+ if (permissions === undefined || permissions === null) reasons.push('default token permissions');+ else if (permissions === 'write-all') reasons.push('write-all');+ else if (typeof permissions === 'object') {+ for (const [scope, level] of Object.entries(permissions)) {+ if (level === 'write') reasons.push(`${scope}: write`);+ }+ }+ for (const expr of [...expressionsIn(job), ...expressionsIn(workflow.env ?? {})]) {+ if (/\bsecrets\b/.test(expr.replace(/\bsecrets\.GITHUB_TOKEN\b/g, ''))) {+ reasons.push(`secret: ${expr}`);+ }+ }+ if (job.secrets === 'inherit') reasons.push('secrets: inherit');+ if ((job.steps ?? []).some((step) => step.uses?.startsWith('actions/create-github-app-token@'))) {+ reasons.push('App token');+ }+ return reasons;+}++export const holdsCredential = (workflow, job) => credentialReasons(workflow, job).length > 0;diff --git a/.github/workflows/bug-lane-verify.yml b/.github/workflows/bug-lane-verify.ymlindex db349c172..a85962a54 100644--- a/.github/workflows/bug-lane-verify.yml+++ b/.github/workflows/bug-lane-verify.yml@@ -91,6 +91,7 @@ jobs:bug-lane-verify:name: Verify the synthetic tree and (when armed) dispatchruns-on: ubuntu-latest+ cache-mode: write# 60 not 45: bounding turbo's concurrency below trades wall clock for the# contention that was refusing good fixes, and the 25m06s this used to run# in was measured in the UNBOUNDED shape. This is the outer backstop only.@@ -136,6 +137,7 @@ jobs:uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0with:node-version: "24"+ package-manager-cache: false- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10diff --git a/.github/workflows/bug-lane.yml b/.github/workflows/bug-lane.ymlindex ee43d81d8..d11faaa80 100644--- a/.github/workflows/bug-lane.yml+++ b/.github/workflows/bug-lane.yml@@ -106,6 +106,7 @@ jobs:name: Evaluate qualifying fixesneeds: read-bumpsruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10steps:- name: Checkout with full history and tagsdiff --git a/.github/workflows/desktop-build-win-linux.yml b/.github/workflows/desktop-build-win-linux.ymlindex 3cfd04bcb..541261b13 100644--- a/.github/workflows/desktop-build-win-linux.yml+++ b/.github/workflows/desktop-build-win-linux.yml@@ -191,6 +191,7 @@ jobs:if: inputs.platforms == 'both' || inputs.platforms == 'windows'needs: prepareruns-on: windows-latest+ cache-mode: nonetimeout-minutes: 45steps:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1@@ -202,19 +203,6 @@ jobs:- uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2with:install: false- - name: Get pnpm store directory- shell: bash- run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"- - name: Hash the lockfile for the pnpm store key- id: lockfile- shell: bash- run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4- with:- path: ${{ env.STORE_PATH }}- key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}- restore-keys: |- ${{ runner.os }}-ok-pnpm-store-- name: Install dependenciesenv:diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.ymlindex bcc277717..3024caad1 100644--- a/.github/workflows/desktop-build.yml+++ b/.github/workflows/desktop-build.yml@@ -80,6 +80,7 @@ jobs:# `build/okglass.icon` into `Assets.car` via Apple's `actool`, which only# ships with Xcode 26+.runs-on: macos-26+ cache-mode: none# 45 min budget. Local `pnpm run build:mac:unsigned` baseline on M3 Max# is ~3-4 min wall-clock; CI runners are ~2× slower; signing +# notarization adds 2-5 min of Apple round-trip on top. 45 min leaves@@ -98,19 +99,6 @@ jobs:- uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2with:install: false- - name: Get pnpm store directory- shell: bash- run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"- - name: Hash the lockfile for the pnpm store key- id: lockfile- shell: bash- run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4- with:- path: ${{ env.STORE_PATH }}- key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}- restore-keys: |- ${{ runner.os }}-ok-pnpm-store-- name: Install dependencies# ELECTRON_SKIP_REBUILD=0 overrides the default CI skip indiff --git a/.github/workflows/desktop-release-draft-janitor.yml b/.github/workflows/desktop-release-draft-janitor.ymlindex 7fc07a9fa..0961477b3 100644--- a/.github/workflows/desktop-release-draft-janitor.yml+++ b/.github/workflows/desktop-release-draft-janitor.yml@@ -57,6 +57,7 @@ concurrency:jobs:sweep:runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10env:MAX_SWEEP_PER_RUN: "5"diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex 7b83665fe..fd831a31f 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -123,6 +123,7 @@ jobs:# as it was; unifying it onto the bundle is a separate, QA-able change.)prepare:runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 30permissions:# write, not read, for one reason: the "Assert the target Release@@ -288,18 +289,6 @@ jobs:node-version: "24"- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10- - name: Get pnpm store directory- run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"- - name: Hash the lockfile for the pnpm store key- id: lockfile- shell: bash- run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4- with:- path: ${{ env.STORE_PATH }}- key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}- restore-keys: |- ${{ runner.os }}-ok-pnpm-store-- name: Install dependenciesrun: pnpm install --frozen-lockfile@@ -495,6 +484,7 @@ jobs:# electron-builder compiles `build/okglass.icon` → `Assets.car` via# `actool`, which only ships with Xcode 26+.runs-on: macos-26+ cache-mode: nonetimeout-minutes: 75permissions:# Explicit so a future step needing more fails at review, not with a@@ -558,19 +548,6 @@ jobs:node-version: "24"- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10- - name: Get pnpm store directory- shell: bash- run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"- - name: Hash the lockfile for the pnpm store key- id: lockfile- shell: bash- run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4- with:- path: ${{ env.STORE_PATH }}- key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}- restore-keys: |- ${{ runner.os }}-ok-pnpm-store-- name: Install dependenciesenv:@@ -1036,6 +1013,7 @@ jobs:matrix:variant: ${{ fromJSON(contains(github.event.client_payload.release_tag || inputs.release_tag, '-beta.') && '["legacy-beta","beta"]' || '["stable"]') }}runs-on: windows-latest+ cache-mode: nonetimeout-minutes: 45env:OK_DESKTOP_VARIANT: ${{ matrix.variant }}@@ -1064,18 +1042,6 @@ jobs:node-version: "24"- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10- - name: Get pnpm store directory- run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"- - name: Hash the lockfile for the pnpm store key- id: lockfile- shell: bash- run: echo "hash=${{ hashFiles('pnpm-lock.yaml') }}" >> "$GITHUB_OUTPUT"- - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4- with:- path: ${{ env.STORE_PATH }}- key: ${{ runner.os }}-ok-pnpm-store-${{ steps.lockfile.outputs.hash }}- restore-keys: |- ${{ runner.os }}-ok-pnpm-store-- name: Install dependenciesenv:@@ -1626,6 +1592,7 @@ jobs:(needs.build-windows.result == 'success' || !contains(needs.prepare.outputs.required, 'windows')) &&(needs.build-linux.result == 'success' || !contains(needs.prepare.outputs.required, 'linux'))runs-on: ubuntu-latest+ cache-mode: none# Sized to the upload retry envelope: 3 bounded 300s attempts + backoffs# (see the upload step) plus download/verify overhead.timeout-minutes: 20@@ -1819,6 +1786,7 @@ jobs:needs.publish-assets.result == 'success' &&needs.build-macos.result == 'success'runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 15permissions:# Body edit, draft→published flip, and the repository_dispatch POST all@@ -2095,6 +2063,7 @@ jobs:needs: finalizeif: ${{ !cancelled() && needs.finalize.outputs.published == 'true' }}runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 5permissions:contents: write@@ -2141,6 +2110,7 @@ jobs:# below treat that as "not stable" (FR5c skips, STUCK-DRAFT still logs).if: ${{ !cancelled() && needs.finalize.result != 'success' }}runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10permissions:# Reads scripts from the checkout, posts to a webhook — nothing more.diff --git a/.github/workflows/linear-pr-relay.yml b/.github/workflows/linear-pr-relay.ymlindex 46b8c066b..292eb4e8f 100644--- a/.github/workflows/linear-pr-relay.yml+++ b/.github/workflows/linear-pr-relay.yml@@ -57,6 +57,7 @@ jobs:if: github.event.pull_request.head.repo.full_name != github.repositoryname: Relay the pull request number to agents-privateruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 5steps:- name: Generate agents-private dispatch tokendiff --git a/.github/workflows/linear-release.yml b/.github/workflows/linear-release.ymlindex f3fa7489d..b39e8d4c5 100644--- a/.github/workflows/linear-release.yml+++ b/.github/workflows/linear-release.yml@@ -88,6 +88,7 @@ concurrency:jobs:stamp:runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10env:# Secrets are unavailable in step/job `if` on some event types, so mapdiff --git a/.github/workflows/monorepo-pr-bridge.yml b/.github/workflows/monorepo-pr-bridge.ymlindex cc48a0088..28b36964d 100644--- a/.github/workflows/monorepo-pr-bridge.yml+++ b/.github/workflows/monorepo-pr-bridge.yml@@ -30,6 +30,7 @@ jobs:&& (github.event.pull_request.head.repo.full_name != github.repository|| github.event.pull_request.head.ref != 'copybara/sync')runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 5steps:- name: Checkout public repo automation@@ -61,6 +62,7 @@ jobs:|| github.event.pull_request.head.ref != 'copybara/sync')environment: inkeep-oss-syncruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 15steps:- name: Checkout public repo automation@@ -137,6 +139,7 @@ jobs:&& (github.event.pull_request.head.repo.full_name != github.repository|| github.event.pull_request.head.ref != 'copybara/sync')runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 15steps:- name: Checkout public repo automation@@ -175,6 +178,7 @@ jobs:pull-requests: readstatuses: readruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 15steps:- name: Checkout public repo automationdiff --git a/.github/workflows/point-release.yml b/.github/workflows/point-release.ymlindex 51fdc91a4..0a12e81fe 100644--- a/.github/workflows/point-release.yml+++ b/.github/workflows/point-release.yml@@ -150,6 +150,7 @@ jobs:name: ${{ inputs.dry_run && 'Plan' || 'Ship' }} point release (${{ inputs.mode }})needs: read-bumpsruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 20steps:- name: Generate GitHub App tokendiff --git a/.github/workflows/promote-stable.yml b/.github/workflows/promote-stable.ymlindex cdb6452d7..ad18358a0 100644--- a/.github/workflows/promote-stable.yml+++ b/.github/workflows/promote-stable.yml@@ -178,6 +178,7 @@ jobs:name: Promote ${{ inputs.beta_tag || 'newest beta' }} to stableneeds: read-bumpsruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 20steps:- name: Generate GitHub App tokendiff --git a/.github/workflows/publish-linux-repo.yml b/.github/workflows/publish-linux-repo.ymlindex 70bd50256..02113a0d3 100644--- a/.github/workflows/publish-linux-repo.yml+++ b/.github/workflows/publish-linux-repo.yml@@ -59,6 +59,7 @@ jobs:# createrepo-c, and rpm from the runner image's Ubuntu release — a# surprise image bump must not land mid-release-window.runs-on: ubuntu-24.04+ cache-mode: nonetimeout-minutes: 20env:# inputs.tag is free-text: NEVER interpolate it into run: blocksdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 1dcc0e8f2..a92750156 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -107,6 +107,7 @@ jobs:read-releases:name: Read the previous beta Releaseruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 5permissions:contents: write@@ -554,6 +555,7 @@ jobs:needs: buildif: github.event.action == 'publish-stable' || needs.build.outputs.run_beta == 'true'runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10permissions:contents: write@@ -712,6 +714,7 @@ jobs:needs: [build, release]if: github.event.action == 'publish-stable' || needs.build.outputs.run_beta == 'true'runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10permissions:id-token: writediff --git a/.github/workflows/select-beta-to-promote.yml b/.github/workflows/select-beta-to-promote.ymlindex 330992173..cfa966c91 100644--- a/.github/workflows/select-beta-to-promote.yml+++ b/.github/workflows/select-beta-to-promote.yml@@ -184,6 +184,7 @@ jobs:name: Evaluate 24h soak + business-hours gateneeds: read-bumpsruns-on: ubuntu-latest+ cache-mode: readtimeout-minutes: 10outputs:# Seam for the FR5a fast tier: the armed soak-tier verdict nominates a@@ -435,6 +436,7 @@ jobs:needs: [evaluate, smoke-fast-tier-candidate]if: needs.smoke-fast-tier-candidate.outputs.verdict == 'pass'runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10steps:- name: Dispatch promote-stable for the smoke-proven candidate@@ -575,6 +577,7 @@ jobs:needs: [aggregate-smoke-alarm, read-smoke-incident]if: needs.aggregate-smoke-alarm.outputs.observed == 'true'runs-on: ubuntu-latest+ cache-mode: write-onlytimeout-minutes: 10permissions:contents: readdiff --git a/.github/workflows/share-contract-deployment-gate.yml b/.github/workflows/share-contract-deployment-gate.ymlindex ebb5c2d7c..8739ed6c3 100644--- a/.github/workflows/share-contract-deployment-gate.yml+++ b/.github/workflows/share-contract-deployment-gate.yml@@ -30,6 +30,7 @@ jobs:(github.event.client_payload.environment == 'production' &&github.event.client_payload.project.name == 'open-knowledge-docs')runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10steps:- name: Mark candidate reader check pendingdiff --git a/.github/workflows/share-contract-monitor.yml b/.github/workflows/share-contract-monitor.ymlindex a6387d551..6e46bb100 100644--- a/.github/workflows/share-contract-monitor.yml+++ b/.github/workflows/share-contract-monitor.yml@@ -16,6 +16,7 @@ concurrency:jobs:probe:runs-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10steps:- name: Checkoutdiff --git a/.github/workflows/stale.yml b/.github/workflows/stale.ymlindex 8831e562d..a99726c1b 100644--- a/.github/workflows/stale.yml+++ b/.github/workflows/stale.yml@@ -15,6 +15,7 @@ permissions:jobs:stale:runs-on: ubuntu-latest+ cache-mode: nonesteps:- name: Mark stale pull requestsdiff --git a/.github/workflows/write-back.yml b/.github/workflows/write-back.ymlindex e316ec888..2c7aec6a8 100644--- a/.github/workflows/write-back.yml+++ b/.github/workflows/write-back.yml@@ -73,6 +73,7 @@ jobs:group: reporter-write-back-${{ matrix.channel }}cancel-in-progress: falseruns-on: ubuntu-latest+ cache-mode: nonetimeout-minutes: 10env:WRITE_BACK_CHANNEL: ${{ matrix.channel }}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('|');