diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..24bac102 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Ensure shell scripts always use LF line endings regardless of OS +*.sh text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 04904306..9b014106 100644 --- a/.gitignore +++ b/.gitignore @@ -102,4 +102,9 @@ backend/__pycache__/ Thumbs.db backend/data/reports/* -!backend/data/reports/.gitkeep \ No newline at end of file +!backend/data/reports/.gitkeep + +# Frontend generated test artifacts (see CONTRIBUTING.md) +frontend/playwright-report/ +frontend/test-results/ +frontend/.vite/ \ No newline at end of file diff --git a/frontend/playwright-report/index.html b/frontend/playwright-report/index.html deleted file mode 100644 index a185633a..00000000 --- a/frontend/playwright-report/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - Playwright Test Report - - - - -
- - - \ No newline at end of file diff --git a/frontend/test-results/.last-run.json b/frontend/test-results/.last-run.json deleted file mode 100644 index cbcc1fba..00000000 --- a/frontend/test-results/.last-run.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "passed", - "failedTests": [] -} \ No newline at end of file diff --git a/scripts/check-artifacts.sh b/scripts/check-artifacts.sh index badb209f..8485dd37 100644 --- a/scripts/check-artifacts.sh +++ b/scripts/check-artifacts.sh @@ -9,22 +9,51 @@ BLOCKED_PATTERNS=( "frontend/node_modules/" ".vite/deps/" ) -echo "Checking for generated frontend artifacts..." + +# ── Check 1: files already tracked in git history ───────────────────────────── +# The diff-only check below cannot catch artifacts already committed to the base +# branch. This check catches those. +echo "Checking for tracked generated artifacts in git history..." +TRACKED_FOUND=() +for pattern in "${BLOCKED_PATTERNS[@]}"; do + while IFS= read -r match; do + TRACKED_FOUND+=("$match") + done < <(git ls-files "${pattern}" 2>/dev/null || true) +done + +if [[ ${#TRACKED_FOUND[@]} -gt 0 ]]; then + echo "ERROR: Generated artifact is tracked by git and must be removed:" + for f in "${TRACKED_FOUND[@]}"; do echo " - $f"; done + echo "" + echo "Fix:" + echo " git rm --cached " + echo " Add the path to .gitignore" + echo " See CONTRIBUTING.md for details." + exit 1 +fi + +# ── Check 2: files newly added in this PR/branch ────────────────────────────── +echo "Checking for generated artifacts in PR diff..." if git rev-parse --verify "${BASE_BRANCH}" >/dev/null 2>&1; then CHANGED_FILES=$(git diff --name-only "${BASE_BRANCH}"...HEAD 2>/dev/null || git diff --name-only HEAD) else CHANGED_FILES=$(git diff --name-only --cached) fi + FOUND=() for pattern in "${BLOCKED_PATTERNS[@]}"; do - while IFS= read -r match; do FOUND+=("$match") + while IFS= read -r match; do + FOUND+=("$match") done < <(echo "$CHANGED_FILES" | grep -E "^${pattern}" 2>/dev/null || true) done + if [[ ${#FOUND[@]} -gt 0 ]]; then - echo "ERROR: Artifact files found:" + echo "ERROR: Artifact files found in this branch:" for f in "${FOUND[@]}"; do echo " - $f"; done + echo "" echo "Fix: git rm --cached " exit 1 fi + echo "All clear!" exit 0 \ No newline at end of file