Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: CI
on:
push:
branches: [main]
pull_request:
# A new push to a PR branch makes the run already in flight irrelevant, so
# cancel it rather than pay for a full 3.10-3.13 matrix nobody will read.
# Scoped to pull_request on purpose: a push to main can be release-adjacent
# (tags, provenance, publish) and those runs are left to finish.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Both jobs only read the repo; nothing here writes to GitHub.
permissions:
contents: read
jobs:
# Is there anything here the Python matrix could possibly have an opinion
# about? A CHANGELOG or README commit used to pay for a full 3.10-3.13
# matrix plus a clean-install audit — ~25 minutes of runner time to test
# source nobody touched.
#
# Deliberately NOT `paths-ignore` on the trigger: that would skip the
# whole workflow, and public-language is precisely the gate a docs-only
# commit needs (it reads wording in the files being changed). So the
# filter is per-job, and public-language never carries it.
#
# FAIL-OPEN by construction. Every path where the comparison cannot be
# trusted — no base, a base this clone does not have, an empty diff —
# reports `code=true` and runs everything. A wrong "skip" hides a real
# failure; a wrong "run" costs minutes. Only one of those is a bug.
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout full history
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Did anything but Markdown change?
id: filter
env:
EVENT: ${{ github.event_name }}
BASE_PR: ${{ github.event.pull_request.base.sha }}
BASE_PUSH: ${{ github.event.before }}
HEAD_SHA: ${{ github.sha }}
run: |
set -uo pipefail
run_everything() {
echo "code=true" >> "$GITHUB_OUTPUT"
echo "::notice::$1 — running the full matrix."
exit 0
}
if [ "$EVENT" = "pull_request" ]; then BASE="$BASE_PR"; else BASE="$BASE_PUSH"; fi
case "$BASE" in
""|0000000000000000000000000000000000000000) run_everything "No usable base commit" ;;
esac
git cat-file -e "${BASE}^{commit}" 2>/dev/null || run_everything "Base $BASE not in this clone"
CHANGED=$(git diff --name-only "$BASE" "$HEAD_SHA") || run_everything "Could not diff"
[ -n "$CHANGED" ] || run_everything "Empty diff"
echo "Changed files:"; echo "$CHANGED"
# Only a pure-Markdown change may skip. Anything else — a .astro
# page, a JSON data file, a workflow, source — runs the matrix.
if echo "$CHANGED" | grep -qvE '\.md$'; then
echo "code=true" >> "$GITHUB_OUTPUT"
else
echo "code=false" >> "$GITHUB_OUTPUT"
echo "::notice::Markdown-only change — skipping the Python matrix."
fi
public-language:
runs-on: ubuntu-latest
steps:
- name: Checkout full history
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Public-language gate
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: python3 scripts/check_public_language.py --range "$BASE_SHA..$HEAD_SHA"
# Every other job here installs from requirements-lock.txt, which carries
# the full transitive set — so a package Kiln imports at runtime but does
# not DECLARE is present in all of them and missing only for real users.
# This job is the one that installs the way a user does: no lock file, no
# extras, empty HOME, then it RUNS the core capabilities and checks which
# engine served them. v1.4.1 shipped the studio-look renderer inert for
# everyone who installed the documented way because nothing asked that.
clean-install:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7.0.1
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Core capabilities work on a default install
run: python3 scripts/audit_clean_install.py
test:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
# STEP ISOLATION — every verdict step below carries a condition that
# survives an earlier red step.
#
# By default a failing step aborts the job and SKIPS the rest, so the
# first red gate blindfolds every gate after it. On 2026-07-30 `Lint
# kiln` failed on an E741, and across the next eight runs nobody could
# see that `Run kiln tests` was ALSO red — one test module imported
# trimesh (an optional extra) at module scope, and pytest treats a
# collection ImportError as fatal for the whole run. Fixing the lint is
# what revealed it. A job that has been red a while reads as scenery, so
# the second failure sat unseen for ~21 hours.
#
# The verdicts are independent by construction — a dependency check, an
# install-context guard, two linters, a leak gate, two test suites — so
# ordering buys nothing and costs visibility. The condition keeps the
# HARD contract (any red step still fails the job) while making every
# verdict visible in ONE run.
#
# `steps.deps.outcome == 'success'` rather than a plain `always()`:
# the installs are a real dependency chain, and running every verdict
# against a broken install produces a screenful of import errors instead
# of one honest message. Because the installs run in sequence, the LAST
# one reporting success means all of them did. The leak gate is the
# exception — it is stdlib-only and reads the checkout, so it needs no
# install and is gated on `!cancelled()` alone. It is a security gate;
# it should be the last thing allowed to go dark.
steps:
- name: Checkout code
uses: actions/checkout@v7.0.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install kiln with locked dev deps
run: |
python -m pip install --upgrade pip
pip install -r kiln/requirements-lock.txt
pip install -e "./kiln[dev,bambu]" --no-deps
- name: Install octoprint-cli with locked dev deps
run: |
pip install -r octoprint-cli/requirements-lock.txt
pip install -e "./octoprint-cli[dev]" --no-deps
- name: Install linter
id: deps
run: pip install ruff
- name: Verify installed dependency graph
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: pip check
- name: Verify kiln-pro is NOT installed in public CI
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
# The public Kiln test surface must pass standalone — no
# leakage from the private kiln-pro overlay. Past incident:
# 4 adhesion tests passed locally (where kiln-pro was on
# PYTHONPATH) but failed in CI without surface explanation
# until 2026-05-16. This guard asserts the install context
# matches what users get from `pip install kiln3d`.
run: |
if pip show kiln-pro >/dev/null 2>&1; then
echo "::error::kiln-pro is installed in the public CI environment — public tests must run without it. Investigate which install step pulled it in."
pip show kiln-pro
exit 1
fi
if python -c "import kiln_pro" 2>/dev/null; then
echo "::error::kiln_pro is importable in the public CI environment (likely sys.path leakage). Public tests must run without it."
python -c "import kiln_pro; print('kiln_pro at:', kiln_pro.__file__)"
exit 1
fi
echo "✓ kiln-pro is correctly absent from the public CI environment"
- name: Lint kiln
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: cd kiln && ruff check src/
- name: Lint octoprint-cli
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: cd octoprint-cli && ruff check src/
- name: Moat-comment leak gate
# Stdlib-only and reads the checkout, so it is gated on `!cancelled()`
# alone — no install can take this one dark.
if: ${{ !cancelled() }}
# Public Kiln must not, in code, tests, docs, scripts OR shipped data
# JSON: narrate HOW the kiln-pro overlay reasons, name its research
# PROVENANCE, self-label the private tier, inline a paid-tier answer
# key (`_PRO_*` tables), name a private kiln_pro path, or ship
# kiln/tests in the sdist. Rules are listed in
# the script's docstring. A first-class gate (not just a buried test)
# after a datasheet-source enumeration slipped a detection gap on
# 2026-06-27; extended to the test suite after a 2026-09-02 sweep found
# paid-tier tables and ~50 private module paths there while every
# existing gate stayed green. Exit 2 = leak.
run: python3 scripts/audit_moat_comment_leak.py
# Parallel, and quiet. The suite is ~14.4k tests; run serially with
# per-test output it took 24 minutes a job. `-n auto` spreads it over
# the runner's cores, and coverage is measured on ONE version because
# four identical percentages cost three extra traced runs.
- name: Run kiln tests
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: |
cd kiln
if [ "${{ matrix.python-version }}" = "3.12" ]; then
python -m pytest tests/ -q -n auto --cov=kiln --cov-report=term-missing
else
python -m pytest tests/ -q -n auto
fi
- name: Run octoprint-cli tests
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
run: |
cd octoprint-cli
if [ "${{ matrix.python-version }}" = "3.12" ]; then
python -m pytest tests/ -q --cov=octoprint_cli --cov-report=term-missing
else
python -m pytest tests/ -q
fi
- name: Served-surface leak gate
if: ${{ !cancelled() && steps.deps.outcome == 'success' }}
# Builds the free-install MCP registry in-process (kiln-pro blocked, so
# the paid-tool discovery stubs appear as a free user gets them), walks
# `kiln --help`, and reads the bundled manifest and data notes — every
# text a client receives verbatim. Fails on wording that names how the
# paid depth is built (private paths, docket numbers, bibliographies,
# field inventories, the internal label) rather than what a tier
# unlocks. Added after the 2026-09-02 sweep found 91 served tool
# descriptions carrying exactly that while the source gates stayed
# green. Exit 2 = leak, 3 = registry failed to load.
run: cd kiln && PYTHONPATH=src python ../scripts/audit_served_surface_leak.py
- name: Generate SBOM (CycloneDX)
if: ${{ !cancelled() && steps.deps.outcome == 'success' && matrix.python-version == '3.12' }}
run: |
pip install cyclonedx-bom
cyclonedx-py environment --output-format json -o sbom.json
echo "SBOM generated: $(wc -c < sbom.json) bytes"
continue-on-error: true
- name: Upload SBOM artifact
if: ${{ !cancelled() && steps.deps.outcome == 'success' && matrix.python-version == '3.12' }}
uses: actions/upload-artifact@v7
with:
name: sbom
path: sbom.json
retention-days: 90
continue-on-error: true
379833346This file is pinned to the selected release. Download the original to open it in your design tool.