Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Report red runs of the OK browser coverage map job (PRD-9548) (#6729)
Andrew Mikofalvy97ff26e015a5
diff --git a/.github/scripts/cache-mode-shape.test-helper.mjs b/.github/scripts/cache-mode-shape.test-helper.mjsindex d63605312..fd7aa961c 100644--- a/.github/scripts/cache-mode-shape.test-helper.mjs+++ b/.github/scripts/cache-mode-shape.test-helper.mjs@@ -102,10 +102,26 @@ function narrowestMode(ops) {export const effectiveMode = (workflow, job) => job['cache-mode'] ?? workflow['cache-mode'] ?? null;+function calledWorkflow(uses, root) {+ if (typeof uses !== 'string' || !uses.startsWith('./.github/workflows/')) return null;+ const path = join(root, uses);+ if (!existsSync(path)) return null;+ const workflow = parse(readFileSync(path, 'utf8'));+ return workflow?.jobs ? workflow : null;+}++function throughCall(job, root, check) {+ const called = calledWorkflow(job.uses, root);+ if (called === null)+ return [`calls the reusable workflow ${job.uses}, which this sweep does not trace`];+ return Object.entries(called.jobs).flatMap(([id, inner]) =>+ check(called, inner, root).map((problem) => `through ${job.uses}#${id}: ${problem}`),+ );+}+export 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`];+ if (job.uses !== undefined) return throughCall(job, root, cacheModeProblems);const ops = cacheOps(job.steps, root);const mode = effectiveMode(workflow, job);const problems = [];@@ -131,8 +147,7 @@ export function cacheModeProblems(workflow, job, root = OK_ROOT) {}export function restoresNothingProblems(workflow, job, root = OK_ROOT) {- if (job.uses !== undefined)- return [`calls the reusable workflow ${job.uses}, which this sweep does not trace`];+ if (job.uses !== undefined) return throughCall(job, root, restoresNothingProblems);const problems = [];const mode = effectiveMode(workflow, job);if (mode === null) problems.push('declares no cache-mode, so the trigger default applies');diff --git a/.github/scripts/cache-mode-shape.test.mjs b/.github/scripts/cache-mode-shape.test.mjsindex db1a8546d..3806f8216 100644--- a/.github/scripts/cache-mode-shape.test.mjs+++ b/.github/scripts/cache-mode-shape.test.mjs@@ -380,6 +380,42 @@ describe('cache-mode sweep self-tests', () => {).toEqual([]);});+ test('a call into a local reusable workflow is swept through the jobs it calls', () => {+ const reusable = (name, jobs) => {+ const dir = join(fixtureRoot, '.github', 'workflows');+ mkdirSync(dir, { recursive: true });+ writeFileSync(join(dir, name), JSON.stringify({ on: { workflow_call: {} }, jobs }));+ return `./.github/workflows/${name}`;+ };+ const clean = reusable('clean.yml', {+ file: { permissions: { issues: 'write' }, 'cache-mode': 'none', steps: [slack] },+ });+ const restores = reusable('restores.yml', {+ file: { permissions: { issues: 'write' }, steps: [restore] },+ });+ const caller = (uses) => ({ permissions: { issues: 'write' }, uses });+ expect(restoresNothingProblems({}, caller(clean), fixtureRoot)).toEqual([]);+ expect(cacheModeProblems({}, caller(clean), fixtureRoot)).toEqual([]);+ const refused = restoresNothingProblems({}, caller(restores), fixtureRoot).join('\n');+ expect(refused).toMatch(+ /through \.\/\.github\/workflows\/restores\.yml#file: declares no cache-mode/,+ );+ expect(refused).toMatch(/touches the cache \(extract\)/);+ expect(cacheModeProblems({}, caller(restores), fixtureRoot).join('\n')).toMatch(+ /through \.\/\.github\/workflows\/restores\.yml#file: declares no cache-mode/,+ );+ expect(+ restoresNothingProblems({}, caller('./.github/workflows/missing.yml'), fixtureRoot),+ ).toEqual([+ 'calls the reusable workflow ./.github/workflows/missing.yml, which this sweep does not trace',+ ]);+ expect(+ restoresNothingProblems({}, caller('owner/repo/.github/workflows/x.yml@v1'), fixtureRoot),+ ).toEqual([+ 'calls the reusable workflow owner/repo/.github/workflows/x.yml@v1, which this sweep does not trace',+ ]);+ });+test('each mode is accepted exactly where the operations need it', () => {const accepted = {'none with no cache step': [{}, credentialedJob('none')],