Skip to content

Migrate batch strategy enum to lookup table#597

Merged
maxachis merged 7 commits intodevfrom
fix-586-batch-strategy-lookup
Mar 19, 2026
Merged

Migrate batch strategy enum to lookup table#597
maxachis merged 7 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>
Add missing batch_strategy_lookup migration (3a9f8e1d5b2c) to the
merge_heads migration and include new materialized view refreshes
from dev.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gitguardian
Copy link

gitguardian bot commented Mar 18, 2026

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
15086721 Triggered Generic Password d16e50e .github/workflows/benchmark.yml View secret
15086721 Triggered Generic Password d16e50e .github/workflows/benchmark.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@maxachis maxachis merged commit f799e10 into dev Mar 19, 2026
3 of 4 checks passed
@maxachis maxachis deleted the fix-586-batch-strategy-lookup branch March 19, 2026 13:41
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