Skip to content

feat!: v1.5.0 — remove fixer, fix coverage measurement, fix VARCHAR seed bug, 90% coverage#91

Merged
croc100 merged 2 commits into
mainfrom
feat/remove-fixer-v2
Jun 15, 2026
Merged

feat!: v1.5.0 — remove fixer, fix coverage measurement, fix VARCHAR seed bug, 90% coverage#91
croc100 merged 2 commits into
mainfrom
feat/remove-fixer-v2

Conversation

@croc100

@croc100 croc100 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove auto-fix subsystem (mrt fix, mrt clean-backups, core/fixer.py, adapters/django_fixer.py) — fixer transforms migrations rather than verifying them; out of scope for a rollback-safety tool. Breaking change → v1.5.0.
  • Fix coverage measurement — CI was using pytest --cov which imports pytest_mrt as a plugin before coverage starts, leaving config.py, exceptions.py, __init__.py at 0%. Switching to coverage run -m pytest brings overall coverage from 80% → 90%.
  • Fix seeder VARCHAR suffix truncation (Bug 2)seed_table() was doing (val + f"_{i}")[:255] with a hardcoded 255 limit. For VARCHAR(5) columns the suffix was silently dropped, causing UNIQUE violations. Now parses the actual column limit from type_str and trims the base value to make room.
  • Behavioral tests — new test_verifier_unit.py (timeout, error recovery, chain-advance failure); expanded test_plugin.py and test_seeder.py with genuine gap coverage (mode guards, env fallbacks, parse-error handling, short-varchar uniqueness).

Breaking changes

mrt fix and mrt clean-backups CLI commands removed. Projects using these must remove them from their workflow. The verify/check/seed functionality is unchanged.

Test plan

  • CI green on all Python versions (3.10–3.14)
  • Codecov delta shows ≥ 90% (was 80%)
  • pytest_mrt/core/seeder.py VARCHAR short-column tests pass (no UNIQUE violations)
  • test_verifier_unit.py — timeout, recovery, chain-advance paths covered

croc100 added 2 commits June 16, 2026 03:12
…oral tests

Coverage: switch CI main test step from `pytest --cov` to `coverage run -m pytest`
so pytest_mrt plugin files are measured before coverage starts — closes the
module-not-measured gap that was incorrectly reporting config.py/exceptions.py/
__init__.py at 0% and suppressing ~9 points from the total. Overall: 80% → 90%.

seeder.py: fix VARCHAR suffix truncation (Bug 2) — for short VARCHAR(N) columns,
the unique-suffix appended to seed values was silently truncated because the
previous code did `(val + f"_{i}")[:255]` with a hardcoded 255 limit. Now parses
the actual column limit from type_str and trims the base value to make room,
so the suffix always survives and UNIQUE constraints are reliably satisfied.

Tests added:
- test_verifier_unit.py: timeout path, error recovery, chain-advance failure,
  risk_score capping, failure_summary format, skip logic (RollbackVerifier)
- test_seeder.py: VARCHAR(5), VARCHAR(3), and INT unique-suffix paths
- test_plugin.py: mode-guard RuntimeErrors (check_revision/check_migration/
  assert_reversible in wrong mode), _auto_detect_django ImportError branch,
  check_static with parse-error migration, metadata_path override,
  MRTConfigError exception type, pytest_sessionstart early-exit
ThreadPoolExecutor.__exit__ calls shutdown(wait=True), so the timeout test
was blocking for the full sleep duration (10s) even after FuturesTimeout fired.
Reduced to sleep=0.5s / timeout=0.05s — test now completes in ~0.6s.

seeder: when the VARCHAR column limit is shorter than the suffix itself
(e.g. VARCHAR(1) with suffix "_0"), fall back to a fresh uuid.uuid4().hex[:limit]
instead of truncating the suffix — prevents producing the same value ("_") for
every row, which caused silent UNIQUE violations on that edge case.
@croc100 croc100 force-pushed the feat/remove-fixer-v2 branch from 6289130 to 7e32d38 Compare June 15, 2026 18:13
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pytest_mrt/core/seeder.py 71.42% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@croc100 croc100 merged commit 6f54441 into main Jun 15, 2026
15 checks passed
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