feat(llms): AI integrator metadata for all public modules #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: llms metadata — validation | |
| # Validates llms metadata YAMLs at two layers: | |
| # 1. JSON Schema conformance (per-module + per-package index) | |
| # 2. Cross-field semantic integrity (api.aborts ⊆ errors, affects exhaustive, | |
| # audit_grounding refs consistent — see scripts/validate-llms-semantics.py) | |
| # | |
| # Only runs on PRs that touch metadata, schemas, either validator, or this | |
| # workflow. Validates only the YAMLs the PR changed — unless the schemas, | |
| # either validator, or the workflow itself changed (anything that could alter | |
| # validation behavior), in which case every YAML is re-validated. | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/llms/**/*.yaml' | |
| - 'schemas/llms-metadata-v1.json' | |
| - 'schemas/llms-package-index-v1.json' | |
| - 'scripts/validate-llms-schema.py' | |
| - 'scripts/validate-llms-semantics.py' | |
| - '.github/workflows/llms-schema-validation.yml' | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # need history for `git diff` against base ref | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install --quiet pyyaml jsonschema | |
| - name: Determine affected YAMLs | |
| id: scope | |
| run: | | |
| BASE="origin/${{ github.base_ref }}" | |
| git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" | |
| # Full re-validation when anything that could change validation behavior | |
| # is touched: the schemas themselves (a stricter schema can retroactively | |
| # invalidate previously-passing YAMLs), the validator script (its | |
| # behavior may have changed), or this workflow (scope-detection logic | |
| # may have changed). In all three cases we want every YAML re-checked | |
| # on this PR. | |
| DIFF=$(git diff --name-only "$BASE"...HEAD) | |
| if echo "$DIFF" | grep -qE '^(schemas/(llms-metadata-v1|llms-package-index-v1)\.json|scripts/validate-llms-(schema|semantics)\.py|\.github/workflows/llms-schema-validation\.yml)$'; then | |
| echo "scope=ALL (schemas / validator / workflow changed)" | |
| find . -type f -name '*.yaml' -path '*/llms/*' | sort > affected.txt | |
| else | |
| echo "scope=DIFF" | |
| echo "$DIFF" \ | |
| | grep -E '/llms/.*\.yaml$' \ | |
| | sort > affected.txt || true | |
| fi | |
| echo "---affected---" | |
| cat affected.txt | |
| count=$(wc -l < affected.txt | tr -d ' ') | |
| echo "count=$count" >> "$GITHUB_OUTPUT" | |
| - name: Validate (schema + semantics) | |
| if: steps.scope.outputs.count != '0' | |
| run: | | |
| set +e | |
| rc=0 | |
| echo "::group::Schema validation" | |
| xargs -a affected.txt python3 scripts/validate-llms-schema.py | |
| [ $? -ne 0 ] && rc=1 | |
| echo "::endgroup::" | |
| echo "::group::Semantic validation (cross-field referential integrity)" | |
| xargs -a affected.txt python3 scripts/validate-llms-semantics.py | |
| [ $? -ne 0 ] && rc=1 | |
| echo "::endgroup::" | |
| exit $rc | |
| - name: No YAMLs to validate | |
| if: steps.scope.outputs.count == '0' | |
| run: echo "PR touched files in the path filter but no llms YAMLs in the diff. Nothing to validate." |