Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
ci: harden docs-only workflow routing
Christopher Kevin197871022cfa
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex b2d46878..738c0795 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -9,6 +9,10 @@ on:permissions:contents: read+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}+ cancel-in-progress: true+jobs:classify-changes:name: Classify changes@@ -20,6 +24,7 @@ jobs:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0with:fetch-depth: 0+ persist-credentials: false- name: Classify pull-request pathsid: changesenv:@@ -30,10 +35,12 @@ jobs:test-python-312:name: Tests (Python 3.12)needs: classify-changes- if: ${{ always() }}+ if: ${{ !cancelled() }}runs-on: ubuntu-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- name: Set up Pythonif: ${{ needs.classify-changes.outputs.docs_only != 'true' }}uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0@@ -87,10 +94,12 @@ jobs:test-python-313:name: Tests (Python 3.13)needs: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: ubuntu-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0with:python-version: "3.13"@@ -104,13 +113,15 @@ jobs:rhel8-security-install:name: RHEL 8 security installneeds: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: ubuntu-latestcontainer: rockylinux/rockylinux:8.10steps:- name: Install container prerequisitesrun: dnf install --assumeyes findutils git gzip tar- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.0with:version: "0.11.27"@@ -140,10 +151,12 @@ jobs:package:name: Packageneeds: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: ubuntu-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0with:python-version: "3.13"@@ -179,10 +192,12 @@ jobs:tier3-macos:name: Tier 3 macOS contract and progressneeds: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: macos-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0with:python-version: "3.12"@@ -202,10 +217,12 @@ jobs:tier2-macos:name: Tier 2 (macos-latest)needs: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: macos-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0with:python-version: "3.12"@@ -225,10 +242,12 @@ jobs:tier2-windows:name: Tier 2 (windows-latest)needs: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: windows-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0with:python-version: "3.12"@@ -248,10 +267,12 @@ jobs:native-windows-local-mode:name: Native Windows local mode fails closedneeds: classify-changes- if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}+ if: ${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}runs-on: windows-lateststeps:- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ persist-credentials: false- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0with:python-version: "3.12"diff --git a/.github/workflows/security.yml b/.github/workflows/security.ymlindex add3cf6c..2e66b74a 100644--- a/.github/workflows/security.yml+++ b/.github/workflows/security.yml@@ -12,6 +12,10 @@ on:permissions:contents: read+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}+ cancel-in-progress: true+# Private/internal repositories can opt in after GitHub Advanced Security is# enabled by setting ENABLE_GITHUB_ADVANCED_SECURITY=true.jobs:@@ -25,6 +29,7 @@ jobs:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0with:fetch-depth: 0+ persist-credentials: false- name: Classify pull-request pathsid: changesenv:@@ -39,6 +44,7 @@ jobs:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0with:fetch-depth: 0+ persist-credentials: false- name: Verify full Git checkoutrun: |test -d .git@@ -54,20 +60,22 @@ jobs:name: Dependency reviewneeds: classify-changesif: >-- ${{ always() &&+ ${{ !cancelled() &&needs.classify-changes.outputs.docs_only != 'true' &&github.event_name == 'pull_request' &&(github.event.repository.private == false || vars.ENABLE_GITHUB_ADVANCED_SECURITY == 'true') }}runs-on: ubuntu-lateststeps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0codeql:name: CodeQLneeds: classify-changesif: >-- ${{ always() &&+ ${{ !cancelled() &&needs.classify-changes.outputs.docs_only != 'true' &&(github.event.repository.private == false || vars.ENABLE_GITHUB_ADVANCED_SECURITY == 'true') }}runs-on: ubuntu-latest@@ -78,6 +86,8 @@ jobs:security-events: writesteps:- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ persist-credentials: false- uses: github/codeql-action/init@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v4.36.3with:languages: pythondiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 60f0c95c..8aefe394 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -44,7 +44,8 @@ All notable changes to SkillEvaluator are documented in this file.- Reduced pull-request runner use for changes confined to `docs/**` and`fern/**`: DCO, Gitleaks, and pinned Fern validation still run, while mixedand non-docs changes retain the complete Linux, macOS, Windows, packaging,- and security matrix.+ and security matrix. Superseded pull-request CI and security runs are+ cancelled so they do not consume runners after a newer commit is pushed.- Simplified the repository README into a concise documentation landing page,retained a compact keyless `validate` quickstart, LLM-provider setup, and aone-command `validate --full` path through all three tiers, broadened thediff --git a/docs/superpowers/plans/2026-08-06-docs-only-ci.md b/docs/superpowers/plans/2026-08-06-docs-only-ci.mddeleted file mode 100644index 9305e665..00000000--- a/docs/superpowers/plans/2026-08-06-docs-only-ci.md+++ /dev/null@@ -1,321 +0,0 @@-# Docs-only CI Routing Implementation Plan--> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.--**Goal:** Route `docs/**`- and `fern/**`-only pull requests through DCO, Gitleaks, and pinned Fern validation without starting the complete SkillEvaluator platform matrix.--**Architecture:** A repository-local Python classifier parses NUL-delimited Git diff records and writes a fail-closed `docs_only` job output. CI and Security workflows use job-level conditions, preserving every existing required check context while full CI remains the default for mixed changes, errors, pushes, schedules, and manual runs.--**Tech Stack:** Python 3.12, pytest, Git, GitHub Actions YAML, Fern CLI 5.66.1-------## File structure--- Create `scripts/classify_ci_changes.py`: path-policy and Git-diff command-line tool shared by CI and Security.-- Create `tests/test_ci_change_classifier.py`: unit and temporary-Git-repository coverage for classification and fail-closed output.-- Create `tests/test_ci_workflows.py`: static contracts for triggers, job names, conditions, and always-on gates.-- Modify `.github/workflows/ci.yml`: explicit required jobs, docs validation lane, and full-lane conditions.-- Modify `.github/workflows/security.yml`: docs-only conditions for CodeQL and dependency review while keeping Gitleaks unconditional.-- Modify `CHANGELOG.md`: record the contributor-visible CI behavior.-- Modify `docs/superpowers/specs/2026-08-06-docs-only-ci-design.md`: record written-spec approval.--### Task 1: Build the fail-closed change classifier--**Files:**-- Create: `tests/test_ci_change_classifier.py`-- Create: `scripts/classify_ci_changes.py`--- [ ] **Step 1: Write pure path-policy tests**--Create parameterized tests that import `is_docs_only` and assert the exact policy:--```python- ("paths", "expected"),- [- ([b"docs/index.mdx"], True),- ([b"fern/docs.yml", b"docs/assets/logo.svg"], True),- ([b"README.md"], False),- ([b"src/skillevaluator/tier3/reference_skills/demo/SKILL.md"], False),- ([b"tests/golden/benchmark_tier1.md"], False),- ([b"docs/index.mdx", b"src/skillevaluator/cli.py"], False),- ([], False),- ],-)-def test_is_docs_only(paths: list[bytes], expected: bool) -> None:- assert is_docs_only(paths) is expected-```--- [ ] **Step 2: Run the path-policy tests and confirm they fail**--Run: `uv run pytest -q tests/test_ci_change_classifier.py`--Expected: collection fails because `scripts.classify_ci_changes` does not exist.--- [ ] **Step 3: Implement the pure path policy and NUL parser**--Implement these public functions in `scripts/classify_ci_changes.py`:--```python-DOC_PREFIXES = (b"docs/", b"fern/")-KNOWN_STATUSES = frozenset(b"ACDMRTUXB")---def is_docs_only(paths: Sequence[bytes]) -> bool:- return bool(paths) and all(path.startswith(DOC_PREFIXES) for path in paths)---def parse_name_status_z(payload: bytes) -> list[bytes]:- fields = payload.split(b"\0")- if fields and fields[-1] == b"":- fields.pop()- paths: list[bytes] = []- index = 0- while index < len(fields):- status = fields[index]- index += 1- if not status or status[0] not in KNOWN_STATUSES:- raise ValueError(f"unrecognized Git status record: {status!r}")- path_count = 2 if status[:1] in {b"R", b"C"} else 1- if index + path_count > len(fields):- raise ValueError(f"incomplete Git status record: {status!r}")- paths.extend(fields[index : index + path_count])- index += path_count- return paths-```--- [ ] **Step 4: Add parser tests for modifications, deletions, renames, copies, and malformed records**--Use byte payloads such as `b"M\0docs/index.mdx\0"`,-`b"R100\0docs/old.mdx\0src/new.py\0"`, and-`b"R100\0docs/old.mdx\0"`. Assert that both rename paths are returned and-malformed records raise `ValueError`.--- [ ] **Step 5: Implement Git execution and command-line output**--Add SHA validation with `re.fullmatch(r"[0-9a-fA-F]{40,64}", value)`, run:--```python-subprocess.run(- [- "git",- "-C",- str(repo),- "diff",- "--name-status",- "-z",- "--find-renames",- "--find-copies",- f"{base}...{head}",- "--",- ],- check=True,- capture_output=True,-)-```--The CLI prints `docs_only=true` or `docs_only=false`, appends the same line to-`GITHUB_OUTPUT` when it is set, and exits zero after operational errors while-printing a `docs_only=false` diagnostic to stderr. Argument-parser errors remain-nonzero because the workflow supplies all required arguments.--- [ ] **Step 6: Add temporary-repository integration tests**--Create real Git commits in `tmp_path`, then invoke `main()` for docs-only,-mixed, deleted, renamed-out-of-docs, empty-diff, and invalid-revision cases.-Assert the process output and `GITHUB_OUTPUT` contents for each case.--- [ ] **Step 7: Run focused tests and lint**--Run: `uv run pytest -q tests/test_ci_change_classifier.py`--Expected: all classifier tests pass.--Run: `uv run ruff check scripts/classify_ci_changes.py tests/test_ci_change_classifier.py`--Expected: no lint errors.--- [ ] **Step 8: Commit the classifier**--```bash-git add scripts/classify_ci_changes.py tests/test_ci_change_classifier.py-git commit -s -m "ci: classify docs-only pull requests"-```--### Task 2: Lock down workflow contracts with tests--**Files:**-- Create: `tests/test_ci_workflows.py`--- [ ] **Step 1: Write tests for required-context invariants**--Load workflow YAML with `yaml.load(..., Loader=yaml.BaseLoader)` and assert:--```python-REQUIRED_CI_NAMES = {- "Tests (Python 3.12)",- "Tests (Python 3.13)",- "Package",- "RHEL 8 security install",- "Tier 2 (macos-latest)",- "Tier 2 (windows-latest)",- "Tier 3 macOS contract and progress",- "Native Windows local mode fails closed",-}--assert {job["name"] for job in ci["jobs"].values()} >= REQUIRED_CI_NAMES-assert "paths-ignore" not in ci["on"]["pull_request"]-assert ci["jobs"]["test-python-312"]["if"] == "${{ always() }}"-```--Also assert the seven heavy jobs use `always()` and require classifier output-to differ from `true`, the 3.12 job contains both full-test and Fern conditions,-and the Fern command reads `fern/fern.config.json` before running `fern check`.--- [ ] **Step 2: Write Security and DCO invariants**--Assert Gitleaks has no job-level `if` or `needs`, CodeQL and dependency review-retain their existing eligibility expressions plus the docs-only condition, and-DCO has no path filter or job-level condition.--- [ ] **Step 3: Run workflow tests and confirm they fail**--Run: `uv run pytest -q tests/test_ci_workflows.py`--Expected: assertions fail because the workflows still use matrices and do not-have change-classification conditions.--### Task 3: Route CI without changing required contexts--**Files:**-- Modify: `.github/workflows/ci.yml`-- Modify: `.github/workflows/security.yml`--- [ ] **Step 1: Add the classifier jobs**--In each workflow, add a pull-request-only Ubuntu job named `Classify changes`.-Pin checkout by commit, use `fetch-depth: 0`, pass the event base/head SHAs as-environment variables, and expose `steps.changes.outputs.docs_only` as the job-output.--- [ ] **Step 2: Split CI matrices into explicit required jobs**--Create `test-python-312`, `test-python-313`, `tier2-macos`, and-`tier2-windows` job definitions. Preserve each existing display name, runner,-setup action, dependency sync, command, and fail-fast independence.--- [ ] **Step 3: Add fail-closed full-lane conditions**--Give all eight required jobs `needs: classify-changes`. Keep Python 3.12 at:--```yaml-if: ${{ always() }}-```--Give the other seven jobs:--```yaml-if: ${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}-```--Condition the Python setup, uv setup, sync, source scan, Ruff, and pytest steps-in the 3.12 job on `docs_only != 'true'`.--- [ ] **Step 4: Add pinned Fern validation to Python 3.12**--For `docs_only == 'true'`, pin `actions/setup-node` by commit, validate that-`fern/fern.config.json` contains a numeric semantic version, install exactly-`fern-api@$FERN_VERSION`, run `fern check`, and append a docs-lane explanation-to `$GITHUB_STEP_SUMMARY`.--- [ ] **Step 5: Condition nonessential Security jobs**--Keep Gitleaks independent. Add `needs: classify-changes` and `always()` to-CodeQL and Dependency review; retain their public-repository or Advanced-Security requirements and add-`needs.classify-changes.outputs.docs_only != 'true'`.--- [ ] **Step 6: Run workflow contract tests**--Run: `uv run pytest -q tests/test_ci_workflows.py`--Expected: all workflow-contract tests pass.--- [ ] **Step 7: Validate workflow syntax and action pins**--Run: `uv run python -c 'from pathlib import Path; import yaml; [yaml.safe_load(path.read_text()) for path in Path(".github/workflows").glob("*.yml")]'`--Expected: exit zero.--Inspect every `uses:` entry in the changed workflows and confirm each external-action is pinned to a full commit SHA.--- [ ] **Step 8: Commit workflow routing**--```bash-git add .github/workflows/ci.yml .github/workflows/security.yml tests/test_ci_workflows.py-git commit -s -m "ci: skip heavy jobs for docs-only pull requests"-```--### Task 4: Document, verify, review, and publish the pull request--**Files:**-- Modify: `CHANGELOG.md`--- [ ] **Step 1: Add the Unreleased changelog entry**--Under `Changed`, record that docs-only pull requests run DCO, Gitleaks, and-Fern validation while mixed and non-docs changes retain the full matrix.--- [ ] **Step 2: Run focused and full local verification**--Run:--```bash-uv run pytest -q tests/test_ci_change_classifier.py tests/test_ci_workflows.py-uv run ruff check .-uv run pytest -q-uv build --python 3.13 --no-sources-npx --yes [email protected] check --warnings-git diff --check origin/main...HEAD-```--Expected: all tests and lint pass, distributions build, Fern reports zero-errors, and Git reports no whitespace errors. The unauthenticated Fern redirect-warning is acceptable locally and must be reported.--- [ ] **Step 3: Perform the required code-review pass**--Review additions, modifications, deletions, copy/rename parsing, paths with-unusual bytes, empty diffs, invalid SHAs, classifier-job failure, push/schedule-behavior, existing check-name preservation, full-lane command parity, security-eligibility, and output/summary correctness. Fix and re-run affected tests for-every finding.--- [ ] **Step 4: Commit documentation and review fixes**--```bash-git add CHANGELOG.md docs/superpowers/specs/2026-08-06-docs-only-ci-design.md docs/superpowers/plans/2026-08-06-docs-only-ci.md-git commit -s -m "docs: record docs-only CI routing"-```--- [ ] **Step 5: Rebase safely and push**--Fetch `origin/main`, confirm the isolated worktree is clean, rebase without-discarding user changes, rerun focused verification if the base moved, and push-`feat/christopherk/docs-only-ci`.--- [ ] **Step 6: Open the dedicated pull request**--Create a ready-for-review PR whose description includes the problem, narrow-allowlist, required-check compatibility, local verification results, GitHub-outage caveat if still active, and the post-open live-canary acceptance plan.--- [ ] **Step 7: Review the live pull request**--Confirm the workflow-changing PR selects the full lane, required check names-match repository rules, DCO sees every signed commit, and no review or merge-claim is made while hosted jobs remain queued. Create the stacked docs-only and-mixed canaries only if GitHub Actions is accepting new jobs; otherwise document-the exact unverified live evidence in the PR.diff --git a/docs/superpowers/specs/2026-08-06-docs-only-ci-design.md b/docs/superpowers/specs/2026-08-06-docs-only-ci-design.mddeleted file mode 100644index 2a177fb8..00000000--- a/docs/superpowers/specs/2026-08-06-docs-only-ci-design.md+++ /dev/null@@ -1,211 +0,0 @@-<!-- SPDX-License-Identifier: Apache-2.0 -->-<!-- Copyright (c) 2026 NVIDIA Corporation. All rights reserved. -->------title: "Docs-only CI routing design"-description: "Design for validating documentation pull requests without consuming the full SkillEvaluator CI matrix."------**Status:** Approved-**Date:** 2026-08-06--## Context--SkillEvaluator currently starts the complete Linux, macOS, and Windows CI-matrix for every pull request. That is appropriate for code, packaging,-workflow, and runtime-artifact changes, but it makes small documentation pull-requests contend for scarce hosted runners that cannot add meaningful coverage-for those changes.--Workflow-level `paths-ignore` is not safe here. GitHub branch rules require the-existing CI check contexts, and a workflow excluded by path filtering does not-create completed contexts. The pull request can then remain blocked with those-checks pending.--## Goals--- Give pull requests that change only published documentation a small,- deterministic validation lane.-- Keep DCO and secret scanning enabled for every pull request.-- Preserve the current required check names so this change does not require a- coordinated repository-ruleset update.-- Fail closed: uncertain, malformed, mixed, or non-pull-request inputs run the- complete matrix.-- Prove the behavior on GitHub, including exact required-check conclusions,- before declaring the optimization complete.--## Non-goals--- Changing CODEOWNERS or review requirements.-- Changing the repository ruleset in the initial rollout.-- Optimizing pushes to `main`, scheduled security scans, or manually dispatched- security scans.-- Treating every Markdown file as documentation.-- Changing documentation publishing or broadening this work into dependency- pinning for the existing publish workflow.--## Considered approaches--### 1. Workflow-level path filters--Add `paths-ignore` to the CI and Security workflow triggers. This is the-smallest YAML change, but it can leave required checks pending because GitHub-never creates their contexts. This approach is rejected.--### 2. Classify changes and condition existing jobs--Run a lightweight classifier first, preserve the existing required contexts,-and skip expensive jobs only after GitHub has created those contexts. One-existing required Ubuntu context runs documentation validation in the docs-only-lane so invalid documentation still blocks the pull request. This is the-recommended initial design because it is repository-local and needs no ruleset-transition.--### 3. Introduce one aggregate required gate--Add separate `Docs`, `CI`, and `Security` jobs with a final aggregate gate, then-change the ruleset to require only that gate. This has the clearest long-term-shape, but changing branch protection at the same time makes rollout and-rollback more complex. It remains a possible follow-up after the first design-has live evidence.--## Change classification--A small repository-local script classifies the changed paths between the pull-request's base and head commits. It has two results:--- `docs_only=true` only when at least one path changed and every changed path is- under `docs/**` or `fern/**`.-- `docs_only=false` for every other case.--The allowlist is intentionally narrow:--- Root `README.md` remains full CI because it is package metadata through- `pyproject.toml`.-- Markdown under `src/skillevaluator/tier3/reference_skills/**` remains full CI- because it is packaged runtime data.-- Markdown under `tests/**` remains full CI because it contains fixtures and- golden outputs.-- Workflow, script, dependency, configuration, and mixed docs/code changes all- remain full CI.--The classifier accounts for additions, modifications, deletions, copies, and-both sides of renames. Missing SHAs, an empty diff, a Git error, or an-unrecognized path record returns `docs_only=false` and an actionable diagnostic-rather than silently reducing coverage. Full-lane job conditions use-`always()` and treat a missing classifier output as `false`, so even a failed-classification job cannot select the reduced lane.--Only `pull_request` events are eligible for docs-only routing. Pushes to `main`-run full CI. Scheduled and manually dispatched Security workflows also run all-applicable security jobs.--## Workflow design--### CI workflow--The CI workflow gains a lightweight Ubuntu classification job. The existing-matrix-generated required jobs for Python tests and Tier 2 are split into-explicit jobs while retaining these exact check names:--- `Tests (Python 3.12)`-- `Tests (Python 3.13)`-- `Package`-- `RHEL 8 security install`-- `Tier 2 (macos-latest)`-- `Tier 2 (windows-latest)`-- `Tier 3 macOS contract and progress`-- `Native Windows local mode fails closed`--Explicit jobs avoid relying on how GitHub expands a matrix whose entire job is-conditionally skipped.--For a docs-only pull request, `Tests (Python 3.12)` remains the blocking-required CI context but runs a named documentation-validation step instead of-Python setup and tests. It installs the Fern CLI version recorded in-`fern/fern.config.json` (currently `5.66.1`) and runs `fern check`. The other-seven required CI jobs are conditionally skipped, creating completed skipped-contexts without requesting their Linux, macOS, Windows, or container runners.--For a mixed or non-docs pull request, all eight contexts execute their current-commands on their current operating systems. A classifier failure also selects-this full lane.--This temporary reuse of `Tests (Python 3.12)` is a compatibility bridge for the-current ruleset. The step and summary must state clearly that it validated Fern-documentation. A later aggregate-gate migration can introduce a dedicated-required `Docs` context without changing this PR's safety boundary.--### Security workflow--`Gitleaks` runs unchanged on every pull request, push, schedule, and manual run.-The Security workflow uses the same repository-local classifier for pull-requests. `CodeQL` and `Dependency review` are skipped only for docs-only pull-requests; they retain their existing eligibility conditions for all other-events. The scheduled workflow always receives the full security lane.--### DCO and publishing workflows--The DCO workflow is unchanged and remains required on every pull request. The-Publish Docs workflow is unchanged; this change validates documentation but-does not alter the main-branch publishing path.--## Testing--Unit tests cover the classifier's observable behavior:--- docs-only changes under `docs/`;-- Fern-only changes under `fern/`;-- multiple docs and Fern paths;-- mixed docs and Python paths;-- root `README.md`;-- packaged reference-skill `SKILL.md` files;-- test fixtures and golden Markdown;-- workflow and configuration changes;-- deleted files;-- renamed files, checking old and new paths;-- empty changes and invalid Git revisions.--Static workflow checks verify that trigger filters do not exclude required-contexts, the eight required check names remain exact, DCO and Gitleaks are-unconditional, and non-pull-request events fail closed to the full lane.--The repository's complete local test suite must still pass after the change.--## Live verification and rollout--The implementation is developed on `feat/christopherk/docs-only-ci` in an-isolated worktree and submitted as one dedicated pull request. The pull request-itself changes workflows and scripts, so it must exercise the full CI and-Security lanes.--Before merge, create a temporary stacked docs-only canary pull request from the-implementation branch. Its live GitHub checks must demonstrate all of the-following on one SHA:--- DCO and Gitleaks run and pass.-- `Tests (Python 3.12)` runs `fern check` and passes.-- The other seven required CI contexts conclude as skipped rather than pending.-- No macOS, Windows, RHEL container, package, Python-test, CodeQL, or dependency- runner job starts for the docs-only change.-- GitHub reports the canary as mergeable with respect to required checks.--A second canary containing a docs change plus a harmless non-docs change must-show that the entire matrix returns. If the GitHub Actions incident prevents-jobs from starting, keep the PR open and report local/static evidence-separately; queued jobs are not live proof. Do not weaken checks to work around-an outage.--The canaries are closed after evidence is captured. No repository-ruleset-change is part of this initial rollout. If any required context is absent or-pending in the docs-only canary, do not merge the implementation; use the-aggregate-gate approach with an explicitly coordinated ruleset migration.--## Failure and rollback behavior--- Classifier errors select full CI, never the reduced lane.-- Fern failures fail the existing required `Tests (Python 3.12)` context.-- A GitHub-hosted runner outage remains distinguishable from a repository or- workflow defect; the change is not considered verified during an outage.-- Reverting the dedicated pull request restores the existing always-full- workflows without any repository-settings rollback.diff --git a/tests/test_ci_change_classifier.py b/tests/test_ci_change_classifier.pyindex 08a7ebb7..1106df10 100644--- a/tests/test_ci_change_classifier.py+++ b/tests/test_ci_change_classifier.py@@ -4,6 +4,7 @@from __future__ import annotationsimport subprocess+import sysfrom pathlib import Pathimport pytest@@ -41,8 +42,14 @@ def git_repo(tmp_path: Path) -> tuple[Path, str]:("paths", "expected"),[([b"docs/index.mdx"], True),+ ([b"fern/fern.config.json"], True),([b"fern/docs.yml", b"docs/assets/logo.svg"], True),+ ([b"docs"], False),+ ([b"fern"], False),+ ([b"docs-old/index.mdx"], False),+ ([b"fernicious/docs.yml"], False),([b"README.md"], False),+ ([b"CHANGELOG.md"], False),([b"src/skillevaluator/tier3/reference_skills/demo/SKILL.md"], False),([b"tests/golden/benchmark_tier1.md"], False),([b"docs/index.mdx", b"src/skillevaluator/cli.py"], False),@@ -66,6 +73,11 @@ def test_is_docs_only(paths: list[bytes], expected: bool) -> None:b"C075\0docs/source.mdx\0fern/copied.yml\0",[b"docs/source.mdx", b"fern/copied.yml"],),+ (+ b"M\0docs/file with spaces.mdx\0M\0docs/line\nbreak.mdx\0",+ [b"docs/file with spaces.mdx", b"docs/line\nbreak.mdx"],+ ),+ (b"M\0docs/non-utf8-\xff.mdx\0", [b"docs/non-utf8-\xff.mdx"]),(b"", []),],)@@ -161,6 +173,50 @@ def test_main_checks_both_sides_of_a_rename(assert (tmp_path / "github-output").read_text(encoding="utf-8") == "docs_only=false\n"+def test_main_treats_a_rename_within_docs_as_docs_only(+ git_repo: tuple[Path, str],+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ repo, base = git_repo+ _git(repo, "mv", "docs/index.mdx", "docs/renamed.mdx")+ head = _commit(repo, "rename within docs")++ assert _classify(repo, base, head, tmp_path / "github-output", monkeypatch) == 0+ assert (tmp_path / "github-output").read_text(encoding="utf-8") == "docs_only=true\n"+++def test_main_checks_the_source_of_a_rename_into_docs(+ git_repo: tuple[Path, str],+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ repo, base = git_repo+ _git(repo, "mv", "README.md", "docs/readme.mdx")+ head = _commit(repo, "rename into docs")++ assert _classify(repo, base, head, tmp_path / "github-output", monkeypatch) == 0+ assert (tmp_path / "github-output").read_text(encoding="utf-8") == "docs_only=false\n"+++def test_main_uses_the_merge_base_when_the_base_branch_advances(+ git_repo: tuple[Path, str],+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ repo, original_base = git_repo+ _git(repo, "checkout", "--quiet", "-b", "feature")+ (repo / "docs" / "index.mdx").write_text("feature docs\n", encoding="utf-8")+ feature_head = _commit(repo, "feature docs")++ _git(repo, "checkout", "--quiet", "--detach", original_base)+ (repo / "source.py").write_text("base advanced\n", encoding="utf-8")+ advanced_base = _commit(repo, "advance base")++ assert _classify(repo, advanced_base, feature_head, tmp_path / "github-output", monkeypatch) == 0+ assert (tmp_path / "github-output").read_text(encoding="utf-8") == "docs_only=true\n"++@pytest.mark.parametrize("revision", ["0" * 40, "not-a-sha"])def test_main_fails_closed_for_invalid_revisions(git_repo: tuple[Path, str],@@ -196,3 +252,63 @@ def test_main_fails_closed_for_an_empty_diff(assert captured.out == "docs_only=false\n"assert "no changed paths" in captured.errassert output.read_text(encoding="utf-8") == "existing=value\ndocs_only=false\n"+++def test_main_fails_closed_outside_a_git_repository(+ git_repo: tuple[Path, str],+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ capsys: pytest.CaptureFixture[str],+) -> None:+ _, head = git_repo+ output = tmp_path / "github-output"++ assert _classify(tmp_path / "missing-repo", head, head, output, monkeypatch) == 0++ captured = capsys.readouterr()+ assert captured.out == "docs_only=false\n"+ assert "falling back to full CI" in captured.err+ assert output.read_text(encoding="utf-8") == "docs_only=false\n"+++def test_cli_classifies_a_real_fern_only_diff(git_repo: tuple[Path, str], tmp_path: Path) -> None:+ repo, base = git_repo+ (repo / "fern").mkdir()+ (repo / "fern" / "docs.yml").write_text("navigation: []\n", encoding="utf-8")+ head = _commit(repo, "fern docs")+ output = tmp_path / "github-output"++ result = subprocess.run(+ [+ sys.executable,+ str(Path(__file__).resolve().parents[1] / "scripts" / "classify_ci_changes.py"),+ "--repo",+ str(repo),+ "--base",+ base,+ "--head",+ head,+ ],+ check=True,+ capture_output=True,+ text=True,+ env={"GITHUB_OUTPUT": str(output)},+ )++ assert result.stdout == "docs_only=true\n"+ assert result.stderr == ""+ assert output.read_text(encoding="utf-8") == "docs_only=true\n"+++def test_output_write_failure_is_not_silently_downgraded(+ git_repo: tuple[Path, str],+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ repo, base = git_repo+ (repo / "docs" / "index.mdx").write_text("updated\n", encoding="utf-8")+ head = _commit(repo, "docs")+ monkeypatch.setenv("GITHUB_OUTPUT", str(tmp_path))++ with pytest.raises(OSError):+ main(["--repo", str(repo), "--base", base, "--head", head])diff --git a/tests/test_ci_workflows.py b/tests/test_ci_workflows.pyindex afd8e452..cf24613d 100644--- a/tests/test_ci_workflows.py+++ b/tests/test_ci_workflows.py@@ -3,6 +3,7 @@from __future__ import annotations+import refrom pathlib import Pathfrom typing import Any@@ -22,9 +23,14 @@ REQUIRED_CI_JOBS = {"native-windows-local-mode": "Native Windows local mode fails closed",}HEAVY_CI_JOBS = set(REQUIRED_CI_JOBS) - {"test-python-312"}-FULL_LANE_IF = "${{ always() && needs.classify-changes.outputs.docs_only != 'true' }}"+RUN_UNLESS_CANCELLED_IF = "${{ !cancelled() }}"+FULL_LANE_IF = "${{ !cancelled() && needs.classify-changes.outputs.docs_only != 'true' }}"DOCS_ONLY_IF = "${{ needs.classify-changes.outputs.docs_only == 'true' }}"NOT_DOCS_ONLY_IF = "${{ needs.classify-changes.outputs.docs_only != 'true' }}"+PR_CONCURRENCY = {+ "group": "${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}",+ "cancel-in-progress": "true",+}def _load(name: str) -> dict[str, Any]:@@ -42,6 +48,14 @@ def _runs(job: dict[str, Any]) -> str:return "\n".join(step.get("run", "") for step in job["steps"])+def _all_uses(workflow: dict[str, Any]) -> list[str]:+ return [step["uses"] for job in workflow["jobs"].values() for step in job.get("steps", []) if "uses" in step]+++def _all_steps(workflow: dict[str, Any]) -> list[dict[str, Any]]:+ return [step for job in workflow["jobs"].values() for step in job.get("steps", [])]++def test_ci_preserves_required_contexts_as_explicit_jobs() -> None:ci = _load("ci.yml")@@ -51,12 +65,15 @@ def test_ci_preserves_required_contexts_as_explicit_jobs() -> None:def test_ci_classifier_is_pull_request_only_and_exports_docs_only() -> None:- classifier = _load("ci.yml")["jobs"]["classify-changes"]+ ci = _load("ci.yml")+ classifier = ci["jobs"]["classify-changes"]+ assert ci["concurrency"] == PR_CONCURRENCYassert classifier["name"] == "Classify changes"assert classifier["if"] == "${{ github.event_name == 'pull_request' }}"assert classifier["outputs"]["docs_only"] == "${{ steps.changes.outputs.docs_only }}"assert classifier["steps"][0]["with"]["fetch-depth"] == "0"+ assert classifier["steps"][0]["with"]["persist-credentials"] == "false"assert classifier["steps"][1]["id"] == "changes"assert "scripts/classify_ci_changes.py" in classifier["steps"][1]["run"]assert classifier["steps"][1]["run"].startswith("python3 ")@@ -70,21 +87,21 @@ def test_ci_docs_lane_uses_the_required_python_312_context() -> None:job = _load("ci.yml")["jobs"]["test-python-312"]assert job["needs"] == "classify-changes"- assert job["if"] == "${{ always() }}"+ assert job["if"] == RUN_UNLESS_CANCELLED_IFassert job["runs-on"] == "ubuntu-latest"- assert all(- step.get("if") == NOT_DOCS_ONLY_IF- for step in job["steps"]- if step.get("name")- in {- "Set up Python",- "Set up uv",- "Install dependencies",- "Scan OSS source boundary",- "Lint",- "Run tests with coverage",- }- )+ assert job["steps"][0]["with"]["persist-credentials"] == "false"++ full_lane_step_names = {+ "Set up Python",+ "Set up uv",+ "Install dependencies",+ "Scan OSS source boundary",+ "Lint",+ "Run tests with coverage",+ }+ full_lane_steps = {step.get("name"): step for step in job["steps"] if step.get("name") in full_lane_step_names}+ assert set(full_lane_steps) == full_lane_step_names+ assert all(step["if"] == NOT_DOCS_ONLY_IF for step in full_lane_steps.values())node_step = next(step for step in job["steps"] if step.get("name") == "Set up Node.js for docs")docs_step = next(step for step in job["steps"] if step.get("name") == "Validate Fern documentation")@@ -128,17 +145,20 @@ def test_security_keeps_gitleaks_always_on_and_skips_only_nonessential_jobs() ->jobs = security["jobs"]_assert_no_path_filter(security)+ assert security["concurrency"] == PR_CONCURRENCYassert "if" not in jobs["gitleaks"]assert "needs" not in jobs["gitleaks"]assert jobs["classify-changes"]["if"] == "${{ github.event_name == 'pull_request' }}"assert jobs["classify-changes"]["outputs"]["docs_only"] == "${{ steps.changes.outputs.docs_only }}"+ assert jobs["classify-changes"]["steps"][0]["with"]["persist-credentials"] == "false"assert jobs["classify-changes"]["steps"][1]["run"].startswith("python3 ")dependency_if = " ".join(jobs["dependency-review"]["if"].split())codeql_if = " ".join(jobs["codeql"]["if"].split())for job_id in ("dependency-review", "codeql"):assert jobs[job_id]["needs"] == "classify-changes"- assert "always()" in jobs[job_id]["if"]+ assert "!cancelled()" in jobs[job_id]["if"]+ assert "always()" not in jobs[job_id]["if"]assert "needs.classify-changes.outputs.docs_only != 'true'" in jobs[job_id]["if"]assert "github.event_name == 'pull_request'" in dependency_ifassert "github.event.repository.private == false" in dependency_if@@ -153,3 +173,16 @@ def test_dco_stays_unconditional_and_has_no_path_filter() -> None:_assert_no_path_filter(dco)assert "if" not in dco["jobs"]["dco"]assert "needs" not in dco["jobs"]["dco"]+++def test_changed_workflows_pin_every_action_to_a_commit() -> None:+ for workflow_name in ("ci.yml", "security.yml"):+ for uses in _all_uses(_load(workflow_name)):+ assert re.fullmatch(r"[^@]+@[0-9a-f]{40}", uses), uses+++def test_changed_workflows_do_not_persist_checkout_credentials() -> None:+ for workflow_name in ("ci.yml", "security.yml"):+ checkout_steps = [step for step in _all_steps(_load(workflow_name)) if step.get("uses", "").startswith("actions/checkout@")]+ assert checkout_steps+ assert all(step.get("with", {}).get("persist-credentials") == "false" for step in checkout_steps)