Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .agents/skills/manage-ci/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,26 @@ contract; no downstream product's workflow topology applies here.
Independent declarative PR filters select hosted offline automation, source
checks, and Linux ARM64 CUDA 13 plus macOS ARM64 Metal package/device smoke.
Qualification scripts and reporting do not select PR package builds. Reporting
and offline check recipes belong in `ci/automation.just`; root `Justfile` edits
remain conservative build inputs. Main pushes retain conservative source
and offline check recipes belong in `ci/automation.just`; qualification controller
and execution recipes belong in `ci/inference.just` and select the Spark ladder
without package rebuilds. Include that file in qualification native cache identities.
Root `Justfile` edits remain conservative build inputs. Test-support directories
and named display modules avoid PR hardware; mixed production changes retain it.
Keep shared Windows/build inputs conservative until platform validation replaces
the coverage being removed. Main pushes retain conservative source
checks. Inference, packaging and native main changes select both device
smokes; native changes additionally select Graph Contracts. Compare main
changes since a verified successful ancestor main-push CI run so coalesced
and failed pushes cannot hide untested inputs. If previous coverage cannot
be verified, require both device smokes and Graph Contracts. The protected
inference workflow uses its separate qualification paths in its native
trigger for the seven Spark configurations. Matching PRs automatically run
inference workflow starts without a native PR path filter and applies the
protected YAML inference route to a complete, paginated PR diff before admission.
Missing file coverage, API failures and changed PR identities fail closed.
Only an explicit successful unrelated route can avoid the seven Spark configurations. Matching PRs automatically run
qualification on each head without a label. Skipped admission or matrix jobs
cannot satisfy qualification or `PR checks`; nightly and releases stay automatic. Main pushes
do not start the Spark ladder. `PR checks` reads protected trigger paths to determine
which runs it expects. Hosted offline
do not start the Spark ladder. `PR checks` reads protected trigger paths and the same complete-diff inference
route to determine which runs it expects. Hosted offline
automation gates Quality canary and package jobs; Quality canary gates package
jobs whenever source checks apply. Full CI
runs Graph Contracts in parallel with fifteen build, package and smoke jobs.
Expand Down
8 changes: 8 additions & 0 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ packages:
- '!**/*_tests.rs'
- '!**/tests_*.rs'
- '!**/test_support.rs'
- '!**/test_support/**'
- '!crates/llama-spec-bench/**'
- '!crates/metrics-server/**'
- '!crates/skippy-gpu-bench/**'
Expand Down Expand Up @@ -139,6 +140,7 @@ inference:
- 'scripts/lib/lld.sh'
- 'scripts/lib/macos-deployment-target*'
- '.gi/templates.yaml'
- 'ci/inference.just'
- 'ci/inference-ladder.json'
- 'ci/inference-artifacts.json'
- 'ci/inference-quality.json'
Expand All @@ -160,6 +162,7 @@ inference:
- '!**/*_tests.rs'
- '!**/tests_*.rs'
- '!**/test_support.rs'
- '!**/test_support/**'
- '!crates/llama-spec-bench/**'
- '!crates/metrics-server/**'
- '!crates/skippy-gpu-bench/**'
Expand All @@ -170,6 +173,11 @@ inference:
- '!scripts/lib/inference_markdown.py'
- '!scripts/lib/inference_charts.py'
- '!scripts/lib/inference_png.py'
- '!scripts/lib/inference_labels.py'
- '!scripts/lib/inference_mermaid.py'
- '!scripts/lib/inference_health.py'
- '!scripts/lib/inference_health_charts.py'
- '!scripts/lib/inference_health_markdown.py'

# Additional main-only smoke inputs; PRs use the independent packages filter.
packaging:
Expand Down
96 changes: 96 additions & 0 deletions .github/scripts/fixtures/hardware-routing-prs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
[
{
"number": 252,
"title": "Compare inference changes on fixed hardware with calibrated intervals",
"url": "https://github.com/Mesh-LLM/skippy/pull/252",
"files": [
".gi/templates.yaml",
".github/workflows/inference.yml",
"Justfile",
"ci/README.md",
"ci/automation.just",
"scripts/inference-dispatch.py",
"scripts/inference-execute.py",
"scripts/inference-paired.py",
"scripts/inference-plan.py",
"scripts/inference-report.sh",
"scripts/lib/inference-report-baseline.sh",
"scripts/lib/inference_paired_collect.py",
"scripts/lib/inference_pairs.py",
"scripts/lib/inference_probe.py",
"scripts/lib/inference_rendezvous.py",
"scripts/tests/inference-report.sh",
"scripts/tests/inference_deadlines.py",
"scripts/tests/inference_paired_execution.py",
"scripts/tests/inference_pairs.py",
"scripts/tests/inference_peer_evidence.py",
"scripts/tests/inference_probe.py"
]
},
{
"number": 241,
"title": "Load a test runtime named directly, not only its parent directory",
"url": "https://github.com/Mesh-LLM/skippy/pull/241",
"files": [
"crates/skippy-runtime/src/test_support.rs",
"crates/skippy-runtime/src/test_support/libraries.rs"
]
},
{
"number": 240,
"title": "Keep Clippy clean on Windows in skippy-hf-hub and skippy-package-builder",
"url": "https://github.com/Mesh-LLM/skippy/pull/240",
"files": [
"crates/skippy-hf-hub/src/cache/storage.rs",
"crates/skippy-package-builder/src/cli.rs"
]
},
{
"number": 248,
"title": "Build and verify Skippy CPU runtimes for Windows ARM64",
"url": "https://github.com/Mesh-LLM/skippy/pull/248",
"files": [
".agents/skills/manage-ci/SKILL.md",
".github/actions/ci-package/action.yml",
".github/scripts/ci-gate.test.cjs",
".github/workflows/ci.yml",
".github/workflows/release.yml",
"CONTRIBUTING.md",
"Justfile",
"ci/README.md",
"ci/targets.json",
"scripts/build-llama.sh",
"scripts/build-windows.ps1",
"scripts/ci-plan.sh",
"scripts/ci-product.py",
"scripts/ci-release.py",
"scripts/enable-msvc-dev-env.ps1",
"scripts/lib/native_policy.py",
"scripts/native-inspect.py",
"scripts/package-cli-release.sh",
"scripts/package-native-runtime.sh",
"scripts/tests/release_contracts.py"
]
},
{
"number": 192,
"title": "Run the native build scripts with a Windows bash, not WSL's",
"url": "https://github.com/Mesh-LLM/skippy/pull/192",
"files": [
"crates/skippy-ffi/build/native_link.rs",
"crates/skippy-ffi/tests/windows_bash_paths.rs"
]
},
{
"number": 193,
"title": "Make a hardware probe die with the process that started it on Windows",
"url": "https://github.com/Mesh-LLM/skippy/pull/193",
"files": [
"Cargo.lock",
"crates/skippy-hardware-profile/Cargo.toml",
"crates/skippy-hardware-profile/src/probe.rs",
"crates/skippy-hardware-profile/src/probe/owner_job.rs",
"crates/skippy-hardware-profile/src/probe/tests.rs"
]
}
]
31 changes: 31 additions & 0 deletions .github/scripts/fork-admission.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,34 @@ test('approved fork Cargo cache keys and restores stay outside main and branch n
]) assert.equal(prefix({ event_name }), expected, `${event_name}: ${line}`);
}
});


test('test support and display reports admit offline fork CI without native work', async () => {
for (const filename of ['crates/skippy-runtime/src/test_support/libraries.rs',
'scripts/lib/inference_labels.py', 'scripts/lib/inference_health.py']) {
const outputs = await admission({ files: [{ filename }] });
assert.equal(outputs.ci, 'true');
assert.equal(outputs.inference, 'false');
const selected = JSON.parse(outputs.routes);
assert.equal(selected.packages, false);
assert.equal(selected.inference, false);
assert.equal(selected.code, filename.startsWith('crates/'));
}
const outputs = await admission({ files: [{ filename: 'ci/inference.just' }] });
assert.equal(outputs.inference, 'true');
assert.equal(JSON.parse(outputs.routes).packages, false);
});

test('fork aggregate does not wait for excluded inference jobs but still requires offline CI', async () => {
const checked = { ...run, event: 'workflow_run' };
const successful = ['admission', 'ci / CI'].map((name, index) =>
({ name, id: index + 1, status: 'completed', conclusion: 'success', run_attempt: 1 }));
const files = [{ filename: 'crates/skippy-runtime/src/test_support/libraries.rs' }];
const github = { rest: { actions: { listJobsForWorkflowRun: 'jobs' } },
paginate: async () => successful };
await forkRuns.requireForkJobs(github, { owner: 'Mesh-LLM', repo: 'skippy' }, checked, files);
await assert.rejects(forkRuns.requireForkJobs({ ...github, paginate: async () => successful.slice(0, 1) },
{ owner: 'Mesh-LLM', repo: 'skippy' }, checked, files), /ci \/ CI: missing or incomplete/);
await assert.rejects(forkRuns.requireForkJobs(github, { owner: 'Mesh-LLM', repo: 'skippy' }, checked,
[{ filename: 'ci/inference.just' }]), /Inference qualification: plan: missing or incomplete/);
});
35 changes: 35 additions & 0 deletions .github/scripts/inference-pr-route.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Metadata-only routing from protected main; never check out candidate code.
const { routes } = require('./pr-trigger-paths.cjs');

module.exports = async function route({ github, context, core }) {
const event = context.payload.pull_request;
const repository = context.payload.repository;
if (context.eventName !== 'pull_request_target' || !event ||
!Number.isInteger(event.number) || event.number <= 0 ||
!/^[a-f0-9]{40}$/.test(event.head?.sha || '') ||
event.head.repo?.id !== repository?.id) {
throw new Error('Inference routing requires a same-repository PR target event');
}
const parameters = { ...context.repo, pull_number: event.number };
const { data: pr } = await github.rest.pulls.get(parameters);
if (pr.state !== 'open' || pr.head.sha !== event.head.sha ||
pr.head.repo?.id !== repository.id || pr.base.repo?.id !== repository.id) {
throw new Error('PR identity changed before inference routing');
}
const files = await github.paginate(github.rest.pulls.listFiles, { ...parameters, per_page: 100 });
if (!Number.isInteger(pr.changed_files) || pr.changed_files < 0 || files.length !== pr.changed_files) {
throw new Error('Incomplete PR file list for inference routing');
}
if (files.some(file => typeof file.filename !== 'string' || !file.filename ||
(file.previous_filename !== undefined && typeof file.previous_filename !== 'string'))) {
throw new Error('Invalid PR file path for inference routing');
}
const { data: current } = await github.rest.pulls.get(parameters);
if (current.state !== 'open' || current.head.sha !== pr.head.sha ||
current.base.sha !== pr.base.sha || current.changed_files !== pr.changed_files) {
throw new Error('PR changed during inference routing');
}
const required = routes(files).inference;
core.setOutput('required', String(required));
core.info(`Complete PR diff: ${files.length} files; inference required: ${required}`);
};
90 changes: 90 additions & 0 deletions .github/scripts/inference-pr-route.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const { readFileSync } = require('node:fs');
const { join } = require('node:path');
const route = require('./inference-pr-route.cjs');
const expected = require('./pr-trigger-paths.cjs');
const sha = 'a'.repeat(40), base = 'b'.repeat(40);
const excluded = Array.from({ length: 300 }, (_, index) =>
({ filename: `crates/skippy-runtime/src/test_support/helper-${index}.rs` }));

async function routing(files, options = {}) {
const pr = { number: 259, state: 'open', changed_files: files.length,
head: { sha, repo: { id: 42 } }, base: { sha: base, repo: { id: 42 } }, ...options.pr };
let reads = 0;
const outputs = {};
const github = { rest: { pulls: { get: async () => ({ data: ++reads > 1 ? { ...pr, ...options.current } : pr }),
listFiles: 'files' } }, paginate: async (method, parameters) => {
assert.equal(method, 'files');
assert.deepEqual(parameters, { owner: 'Mesh-LLM', repo: 'skippy', pull_number: 259, per_page: 100 });
if (options.apiError) throw new Error('GitHub API failed');
return files;
} };
const context = { repo: { owner: 'Mesh-LLM', repo: 'skippy' }, eventName: 'pull_request_target',
payload: { repository: { id: 42 }, pull_request: { number: 259, head: { sha, repo: { id: 42 } } } },
...options.context };
await route({ github, context, core: { setOutput: (name, value) => { outputs[name] = value; }, info() {} } });
return outputs;
}

test('a runtime change beyond the first 300 excluded paths requires qualification', async () => {
const files = [...excluded, { filename: 'crates/skippy-serving/src/split_dflash.rs' }];
assert.equal((await routing(files)).required, 'true');
assert.equal(expected(files).has('.github/workflows/inference.yml'), true);
assert.equal(expected(files, false).has('.github/workflows/fork-native.yml'), true);
const renamed = [...excluded, { filename: 'docs/retired.md', previous_filename: 'crates/skippy-runtime/src/native.rs' }];
assert.equal((await routing(renamed)).required, 'true');
assert.equal(expected(renamed).has('.github/workflows/inference.yml'), true);
});

test('complete test-support, report and documentation diffs do not dispatch native jobs', async () => {
for (const files of [excluded, [{ filename: 'scripts/lib/inference_labels.py' }], [{ filename: 'README.md' }]]) {
assert.equal((await routing(files)).required, 'false');
assert.equal(expected(files).has('.github/workflows/inference.yml'), false);
}
});

test('incomplete or failed file reads and stale PR identities cannot report not required', async () => {
const files = [{ filename: 'README.md' }];
await assert.rejects(routing(files, { pr: { changed_files: 301 } }), /Incomplete/);
await assert.rejects(routing(files, { pr: { changed_files: undefined } }), /Incomplete/);
await assert.rejects(routing(files, { apiError: true }), /GitHub API failed/);
await assert.rejects(routing([{}]), /Invalid PR file path/);
await assert.rejects(routing(files, { pr: { state: 'closed' } }), /identity changed/);
await assert.rejects(routing(files, { pr: { head: { sha: 'c'.repeat(40), repo: { id: 42 } } } }), /identity changed/);
for (const current of [{ state: 'closed' }, { changed_files: 2 },
{ head: { sha: 'c'.repeat(40) } }, { base: { sha: 'd'.repeat(40) } }]) {
await assert.rejects(routing(files, { current }), /changed during/);
}
await assert.rejects(routing(files, { context: { eventName: 'pull_request' } }), /same-repository/);
await assert.rejects(routing(files, { context: { payload: { repository: { id: 42 },
pull_request: { number: 259, head: { sha, repo: { id: 43 } } } } } }), /same-repository/);
});

const workflow = readFileSync(join(__dirname, '../workflows/inference.yml'), 'utf8');
const plan = workflow.split('\n plan:\n')[1].split('\n qualification:\n')[0];
const condition = plan.match(/ if: >-\n([\s\S]+?)\n #/)[1];
const plans = new Function('github', 'needs', 'always', 'cancelled', `return (${condition});`);

test('unfiltered protected routing gates PR hardware and preserves manual, nightly and fork calls', () => {
const trigger = workflow.split('\n schedule:\n')[0];
assert.doesNotMatch(trigger, /paths(?:-ignore)?:/);
const routingJob = workflow.split('\n route:\n')[1].split('\n plan:\n')[0];
assert.match(routingJob, /ref: main/);
assert.match(routingJob, /inference-pr-route.cjs/);
assert.doesNotMatch(routingJob, /head.sha|JIANYANG|secrets/);
assert.match(plan, /needs: route/);
const pr = { event_name: 'pull_request_target', repository: 'Mesh-LLM/skippy',
event: { repository: { id: 42 }, pull_request: { head: { repo: { id: 42 } } } } };
const need = (result, required) => ({ route: { result, outputs: { required } } });
assert.equal(plans(pr, need('success', 'true'), () => true, () => false), true);
for (const pair of [['success', 'false'], ['failure', 'true'], ['skipped', ''], ['success', '']]) {
assert.equal(plans(pr, need(...pair), () => true, () => false), false);
}
const fork = { ...pr, event: { pull_request: { head: { repo: { id: 43 } } }, repository: { id: 42 } } };
assert.equal(plans(fork, need('success', 'true'), () => true, () => false), false);
for (const event_name of ['schedule', 'workflow_dispatch', 'workflow_run', 'workflow_call']) {
assert.equal(plans({ event_name }, need('skipped', ''), () => true, () => false), true);
assert.equal(plans({ event_name }, need('skipped', ''), () => true, () => true), false);
}
});
23 changes: 19 additions & 4 deletions .github/scripts/inference-schedule.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ const script = summary.split(' script: |\n')[1].replace(/^ {12}/gm, '')
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
const evaluate = new AsyncFunction('process', 'context', 'github', 'core', script);

async function status(profile, publication, result = 'success', plan = 'success', eventName = 'schedule') {
async function status(profile, publication, result = 'success', plan = 'success', eventName = 'schedule', route = 'success', required = 'true') {
const statuses = [], failures = [];
await evaluate({ env: {
SOURCE_SHA: 'a'.repeat(40), PROFILE: profile, PLAN: plan, RESULT: result,
SOURCE_SHA: 'a'.repeat(40), PROFILE: profile, PLAN: plan, RESULT: result, ROUTE: route, REQUIRED: required,
PUBLICATION: publication, RUN_URL: 'https://example.invalid/run',
} }, { eventName, repo: { owner: 'Mesh-LLM', repo: 'skippy' } }, {
rest: { repos: { createCommitStatus: async value => statuses.push(value) } },
Expand All @@ -59,7 +59,8 @@ test('matching PRs always plan qualification without a label or label-change eve
const trigger = workflow.split('\n schedule:\n')[0];
assert.match(trigger, /types: \[opened, synchronize, reopened, ready_for_review\]/);
const plan = workflow.split('\n plan:\n')[1].split('\n qualification:\n')[0];
assert.match(plan, /if: github.event_name != 'pull_request_target' \|\| github.event.pull_request.head.repo.id == github.event.repository.id/);
assert.match(plan, /github.event.pull_request.head.repo.id == github.event.repository.id/);
assert.match(plan, /needs.route.result == 'success' && needs.route.outputs.required == 'true'/);
assert.doesNotMatch(plan, /qualify|labels/);
assert.match(plan, /run: just inference-admit/);
assert.match(plan, /just inference-matrix/);
Expand All @@ -77,5 +78,19 @@ test('PR summary requires successful admission and matrix; skipped plans cannot
});

test('ungated fork target events cannot publish a failing qualification status before approval', () => {
assert.match(summary, /if: always\(\) && needs.plan.result != 'skipped'/);
assert.match(summary, /if: always\(\) && \(github.event_name != 'pull_request_target' \|\| needs.route.result != 'skipped'\)/);
});


test('only a successful full-diff route may report qualification unnecessary', async () => {
assert.equal((await status('pr', 'skipped', 'skipped', 'skipped', 'pull_request_target', 'success', 'false')).state, 'success');
for (const route of ['failure', 'cancelled', 'skipped', '']) {
assert.equal((await status('pr', 'skipped', 'success', 'success', 'pull_request_target', route, 'false')).state, 'failure');
}
for (const [plan, matrix] of [['failure', 'skipped'], ['skipped', 'failure'], ['success', 'success']]) {
assert.equal((await status('pr', 'skipped', matrix, plan, 'pull_request_target', 'success', 'false')).state, 'failure');
}
for (const required of ['', 'true']) {
assert.equal((await status('pr', 'skipped', 'skipped', 'skipped', 'pull_request_target', 'success', required)).state, 'failure');
}
});
Loading
Loading