Skip to content

feat(registry): unified CheckRegistry and granular rule execution (tff#146) - #152

Merged
tjirab merged 3 commits into
mainfrom
feat/146-unified-check-registry
Sep 7, 2026
Merged

feat(registry): unified CheckRegistry and granular rule execution (tff#146)#152
tjirab merged 3 commits into
mainfrom
feat/146-unified-check-registry

Conversation

@tjirab

@tjirab tjirab commented Sep 7, 2026

Copy link
Copy Markdown
Owner

🚀 What changed?

  • Introduced centralized declarative CheckRegistry and CheckDefinition in packages/tff-core/src/tff/core/registry.py defining typed metadata (id, label, category, scope, default_severity, aliases, finding_check_id, lazy dynamic loader for rule classes / collector functions, and is_enabled_fn).
  • Replaced duplicated hardcoded mapping dictionaries across health.py (CATEGORIES, is_check_enabled, PROJECT_LEVEL_CHECKS) and report.py (CHECK_LABELS, CONNASCENCE_CATEGORIES, ARCHITECTURAL_CHECKS) with single-source-of-truth registry queries.
  • Refactored run_all_checks across dbt (tff.dbt.runner), Dataform (tff.dataform.runner), and SQLMesh (tff.sqlmesh.runner) to support granular check execution via registry.run_checks(..., checks=...) while maintaining 100% backward compatibility for container keys ("rules", "sqlmesh") and legacy check aliases.
  • Added comprehensive unit tests in packages/tff-core/tests/test_registry.py covering registry lookups, resolution, fallback runners, and granular check execution across dbt, Dataform, and SQLMesh runners.
  • Verified 100% diff test coverage (526 lines covered, 0 missing) enforced by .githooks/pre-push.

🤔 Why is this change needed?

Resolves issue #146 (Phase 3 of the architectural improvements):

  • Eliminates duplicated, desynchronized rule and check metadata definitions across health.py, report.py, and runner modules.
  • Enables granular execution of individual rules or checks via tff lint --checks no_missing_owner,ban_select_star on dbt, Dataform, and SQLMesh projects.
  • Provides a clean foundation for Phase 4 (external plugins and community rules).

🔗 Related Issues (Optional)

Closes #146

✅ Next Steps / Checklist (Optional)

  • All 283 unit tests passing
  • Ruff linter & dependency audit passing
  • 100% diff coverage achieved and verified by pre-push hook
  • Documentation updated in README.md

@tjirab
tjirab merged commit d690825 into main Sep 7, 2026
2 checks passed
@tjirab
tjirab deleted the feat/146-unified-check-registry branch September 7, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(registry): unified CheckRegistry and granular rule execution

1 participant