Skip to content

test(jobs): guard against lakets schema drift in workflow files#33

Merged
taran-dbx merged 1 commit into
mainfrom
test/schema-drift-guard
Jun 1, 2026
Merged

test(jobs): guard against lakets schema drift in workflow files#33
taran-dbx merged 1 commit into
mainfrom
test/schema-drift-guard

Conversation

@taran-dbx
Copy link
Copy Markdown
Collaborator

Summary

Adds a static guard (no live DB, no GitHub Actions needed — GHA is disabled org-wide) that asserts every lakets.<object> referenced by databricks/workflows/*.py is actually defined by a CREATE TABLE/VIEW/FUNCTION/AGGREGATE/PROCEDURE in sql/*.sql. Logger names (getLogger("lakets.<job>")) are excluded.

Why

partition_manager.py and retention_job.py referenced lakets._hypertable_registry (and pr.hypertable_id / p_hypertable_id) long after the hypertable→chronotable rename. Nothing exercised those jobs, so the breakage only surfaced when run against a live Lakebase (PR #32). This guard fails fast on any such stale reference.

Verified: injecting lakets._hypertable_registry into a source string makes the check report _hypertable_registry as undefined — i.e. it would have failed on the original bug.

Test plan

  • pytest tests/test_python_patterns.py → 13 passed (2 new)
  • Demonstrated the guard flags a stale _hypertable_registry reference

Adds a static check (no live DB needed) asserting every `lakets.<object>`
referenced by databricks/workflows/*.py is actually defined by a
CREATE TABLE/VIEW/FUNCTION/AGGREGATE in sql/*.sql. Logger names
(getLogger("lakets.<job>")) are excluded.

This catches the class of bug that only surfaced at runtime: the
hypertable->chronotable rename left lakets._hypertable_registry references
in partition_manager.py / retention_job.py. The guard fails on any such
stale reference. GHA is disabled org-wide, so this runs in the existing
pytest suite rather than a live-run CI.
@taran-dbx taran-dbx merged commit 0eb04bb into main Jun 1, 2026
9 checks passed
@taran-dbx taran-dbx deleted the test/schema-drift-guard branch June 1, 2026 17:06
@github-actions github-actions Bot added the tests label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant