From 48038afbcc743f5b625b0b3f9873141012c08649 Mon Sep 17 00:00:00 2001 From: MarMar Labs Date: Wed, 19 Aug 2026 00:31:20 -0500 Subject: [PATCH] fix(ci): stop treating markdown as frontend evidence-bearing code (#16693) Co-authored-by: vasco --- .github/scripts/check_pr_description.py | 6 +++++- .github/scripts/tests/test_pr_description.py | 22 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/scripts/check_pr_description.py b/.github/scripts/check_pr_description.py index 93f91ff38f..185eef34e2 100644 --- a/.github/scripts/check_pr_description.py +++ b/.github/scripts/check_pr_description.py @@ -57,6 +57,8 @@ FRONTEND_FILE_EXTENSIONS: tuple[str, ...] = ( ".sass", ".less", ) +# Docs carry no visual state, so a screenshot can't evidence a change to them. +DOCUMENTATION_FILE_EXTENSIONS: tuple[str, ...] = (".md", ".mdx") FRONTEND_CONFIG_GLOBS: tuple[str, ...] = ( "tailwind.config.*", "vite.config.*", @@ -155,9 +157,11 @@ def extract_human_note(body: str) -> str: def is_frontend_file(path: str) -> bool: """Return True if a changed file should be treated as frontend code.""" normalized = path.lstrip("./") + lower = normalized.lower() + if lower.endswith(DOCUMENTATION_FILE_EXTENSIONS): + return False if any(normalized.startswith(prefix) for prefix in FRONTEND_PATH_PREFIXES): return True - lower = normalized.lower() if any(lower.endswith(ext) for ext in FRONTEND_FILE_EXTENSIONS): return True name = normalized.split("/")[-1] diff --git a/.github/scripts/tests/test_pr_description.py b/.github/scripts/tests/test_pr_description.py index dcb4cda38e..8fe26393af 100644 --- a/.github/scripts/tests/test_pr_description.py +++ b/.github/scripts/tests/test_pr_description.py @@ -8,6 +8,8 @@ from unittest.mock import patch sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from check_pr_description import ( + is_frontend_file, + touches_frontend, extract_linked_issue_numbers, extract_pr_type, validate_linked_issue_ready, @@ -222,3 +224,23 @@ https://youtube.com/watch?v=abc123 """ errors = validate_bug_fix_evidence(body) assert errors == [] + + +def test_markdown_under_frontend_prefix_is_not_frontend(): + assert not is_frontend_file("__tests__/router.md") + assert not is_frontend_file("src/notes.md") + assert not is_frontend_file("public/README.mdx") + +def test_markdown_outside_frontend_prefix_still_not_frontend(): + assert not is_frontend_file("docs/README.md") + +def test_frontend_code_under_prefix_still_frontend(): + assert is_frontend_file("src/app.tsx") + assert is_frontend_file("__tests__/routes/launch.test.tsx") + assert is_frontend_file("src/styles/main.css") + +def test_docs_only_change_does_not_require_frontend_evidence(): + assert not touches_frontend(["__tests__/router.md", "docs/README.md"]) + +def test_mixed_change_still_requires_frontend_evidence(): + assert touches_frontend(["__tests__/router.md", "src/app.tsx"])