veza/tmt/tests/backend/core_isolation.sh
senke ad60247f33 feat: global update including storybook setup and backend fixes
- Web: Setup Storybook, added addons, configured Tailwind, added stories for UI components.
- Backend: Updated API router, database, workers, and auth in common.
- Stream Server: Removed SQLx queries and updated auth.
- Docs & Scripts: Updated documentation and recovery scripts.
2026-02-02 19:34:14 +01:00

38 lines
884 B
Bash
Executable file

#!/bin/bash
set -e
REPO_ROOT=$(git rev-parse --show-toplevel)
BACKEND_DIR="$REPO_ROOT/veza-backend-api"
CORE_DIR="internal/core"
echo "📍 Backend Core Isolation Check"
cd "$BACKEND_DIR"
if [ ! -d "$CORE_DIR" ]; then
echo "⚠️ $CORE_DIR does not exist. Skipping."
exit 0
fi
echo "🔎 Analyzing dependencies of $CORE_DIR..."
# List all imports of packages in internal/core
IMPORTS=$(go list -f '{{.Imports}}' ./$CORE_DIR/...)
# Check for forbidden packages
FORBIDDEN="database/sql github.com/lib/pq github.com/jackc/pgx"
FAILED=0
for PKG in $FORBIDDEN; do
if echo "$IMPORTS" | grep -q "$PKG"; then
echo "❌ Violation: $CORE_DIR depends on $PKG"
FAILED=1
fi
done
if [ $FAILED -eq 1 ]; then
echo "❌ Core isolation check FAILED. Core domain logic must not be coupled to DB drivers."
exit 1
fi
echo "✅ Core isolation verified."