Skip to content

Migrate batch strategy enum to lookup table#597

Open
maxachis wants to merge 6 commits intodevfrom
fix-586-batch-strategy-lookup
Open

Migrate batch strategy enum to lookup table#597
maxachis wants to merge 6 commits intodevfrom
fix-586-batch-strategy-lookup

Conversation

@maxachis
Copy link
Collaborator

Summary

  • migrate batches.strategy from Postgres enum storage to a batch_strategies lookup table with FK batches.batch_strategy_id
  • add BatchStrategy ORM model and refactor batch write/read paths to resolve strategy names via lookup IDs
  • update metrics/task queries to join through strategy lookup values while preserving API behavior
  • add compatibility for existing tests/usages via Batch.strategy property and preserve lookup rows during test DB wipes
  • add ruff as a dev dependency and run lint checks on touched files

Testing

  • UV_CACHE_DIR=.uv-cache uv run ruff check (touched files)
  • UV_CACHE_DIR=.uv-cache uv run pytest -q tests/automated/integration/api/metrics/batches tests/automated/integration/api/test_manual_batch.py tests/automated/integration/api/submit/data_source/test_core.py tests/automated/integration/db/client/test_insert_urls.py

Copy link
Contributor

@josh-chamberlain josh-chamberlain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a test, it fails

maxachis and others added 3 commits March 9, 2026 16:47
…ed strategy enum

The migration to a batch_strategies lookup table removed the strategy enum
column from batches, but the structure test still referenced it, causing a
NOT NULL violation on batch_strategy_id during raw INSERT.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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