diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.yml index 7c5c269f899..dc469e758d6 100644 --- a/.github/workflows/test-linting.yml +++ b/.github/workflows/test-linting.yml @@ -74,3 +74,7 @@ jobs: - name: Check import safety run: | poetry run python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) + + - name: Check schema.prisma files are in sync + run: | + bash ci_cd/check_schema_sync.sh diff --git a/Makefile b/Makefile index 74031f418d6..3839fa96cf9 100644 --- a/Makefile +++ b/Makefile @@ -128,11 +128,14 @@ check-circular-imports: install-dev check-import-safety: install-dev @poetry run python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) + +check-schema-sync: + bash ci_cd/check_schema_sync.sh # Combined linting (matches test-linting.yml workflow) -lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety +lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety check-schema-sync # Faster linting for local development (only checks changed code) -lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety +lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety check-schema-sync # Testing targets test: diff --git a/ci_cd/check_schema_sync.sh b/ci_cd/check_schema_sync.sh new file mode 100755 index 00000000000..38474ecfe00 --- /dev/null +++ b/ci_cd/check_schema_sync.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# check_schema_sync.sh +# Ensures all three copies of schema.prisma are identical. +# Exits non-zero if any differ. + +set -euo pipefail + +SOURCE="schema.prisma" +COPY1="litellm/proxy/schema.prisma" +COPY2="litellm-proxy-extras/litellm_proxy_extras/schema.prisma" + +FAILED=0 + +diff_files() { + local a="$1" + local b="$2" + if ! diff -q "$a" "$b" > /dev/null 2>&1; then + echo "FAIL: $a and $b are out of sync." + diff "$a" "$b" || true + FAILED=1 + else + echo "OK: $a and $b match." + fi +} + +diff_files "$SOURCE" "$COPY1" +diff_files "$SOURCE" "$COPY2" + +if [ "$FAILED" -ne 0 ]; then + echo "" + echo "schema.prisma files are out of sync. The source of truth is '$SOURCE'." + echo "Copy it to the other locations and commit the result." + exit 1 +fi + +echo "" +echo "All schema.prisma files are in sync."