Skip to content

refactor(client): split schema-drift validator into schema_validation.py#139

Merged
lesnik512 merged 1 commit into
mainfrom
refactor/split-schema-validator
Jul 17, 2026
Merged

refactor(client): split schema-drift validator into schema_validation.py#139
lesnik512 merged 1 commit into
mainfrom
refactor/split-schema-validator

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Behavior-preserving move of the opt-in schema-drift validator out of the transport client (client.py) into a new sibling module schema_validation.py. No public-API change, no behavior change — every moved symbol is verbatim and the pre-existing 100%-coverage suite is the spec.

Comes out of an architecture-deepening review: the validator was ~285 LOC of module-level functions merely co-located with the transport hot-path, sharing nothing with it but self._table/self._engine. Splitting it deepens the transport client (its file halves) and concentrates the schema-drift concern — and its optional alembic dependency — in one module.

Changes

  • schema_validation.py (new, 381 LOC) — the 9 validator functions + 7 constants + the alembic guard block, fronted by one free function validate_schema(engine, table, *, dlq_table=None, check_autovacuum=False).
  • client.py: 796 → 471 LOCOutboxClient.validate_schema keeps its signature/docstring and delegates in one line; the transport client no longer imports alembic. ping, _row_to_message, and the DLQ CTE stay put.
  • tests/test_unit.py — five validator symbols repointed to the new module (+ one patch() target). No test body changed.
  • architecture/schema.md — truth-home pointer promoted client.pyschema_validation.py (same PR, per the promotion rule).
  • planning/changes/2026-07-16.04-split-schema-validator.md — Lightweight change record.

Verification

  • just test599 passed, Postgres 17, coverage 100.00% (integration ran)
  • just lint — ruff clean, ty: All checks passed
  • just check-planningplanning: OK

🤖 Generated with Claude Code

Move the opt-in schema-drift validator out of the transport client into a
new sibling module. Behavior-preserving: OutboxClient.validate_schema keeps
its signature and delegates in one line; every moved symbol is verbatim.

- client.py: 796 -> 471 LOC; no longer imports alembic
- schema_validation.py: the validator + free validate_schema(engine, table, ...)
- isolates the optional alembic dependency in the module that needs it
- architecture/schema.md truth-home pointer promoted to the new module
- tests repoint the five validator imports; no test body changed

Full suite green (599 passed, coverage 100%), just lint + ty clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512
lesnik512 merged commit 7d362ad into main Jul 17, 2026
7 checks passed
@lesnik512
lesnik512 deleted the refactor/split-schema-validator branch July 17, 2026 06:34
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.

1 participant