Skip to content

[CI] Add pre-commit hook to validate test/registered/ files have CI registry#22308

Merged
Kangyan-Zhou merged 3 commits intomainfrom
ci/add-registered-tests-lint-check
Apr 8, 2026
Merged

[CI] Add pre-commit hook to validate test/registered/ files have CI registry#22308
Kangyan-Zhou merged 3 commits intomainfrom
ci/add-registered-tests-lint-check

Conversation

@alisonshao
Copy link
Copy Markdown
Collaborator

Summary

  • Add scripts/ci/check_registered_tests.py pre-commit hook that validates all .py files under test/registered/ have a register_*_ci() call
  • Files in test/registered/ are collected by run_suite.py's collect_tests() which requires every file to have a CI registry entry — missing registrations break CI with ValueError: No CI registry found
  • This catches the error at commit time instead of waiting for CI to fail
  • Skips __init__.py, conftest.py, and testing_helpers.py

Context: #22298 fixed a case where a file was placed in test/registered/ without registration, breaking all CI suites

Test plan

  • Hook passes on current codebase
  • Hook correctly catches files missing registry (tested with a temp fake file)
  • Pre-commit integration works (pre-commit run check-registered-tests --all-files)

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@alisonshao
Copy link
Copy Markdown
Collaborator Author

…egistry

Files under test/registered/ are collected by run_suite.py's
collect_tests() which requires every file to have a register_*_ci()
call. Missing registrations break CI with:
  ValueError: No CI registry found in <file>

This pre-commit hook reuses ut_parse_one_file() from ci_register.py
(AST-based parsing) to catch the error at commit time. Uses the same
file filtering as run_suite.py (skips conftest.py and __init__.py).
@alisonshao alisonshao force-pushed the ci/add-registered-tests-lint-check branch from f128277 to f84e449 Compare April 8, 2026 03:14
@alisonshao
Copy link
Copy Markdown
Collaborator Author

@Kangyan-Zhou Kangyan-Zhou merged commit e41647f into main Apr 8, 2026
58 of 60 checks passed
@Kangyan-Zhou Kangyan-Zhou deleted the ci/add-registered-tests-lint-check branch April 8, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants