feat(translate,scheduler,trace): new-key-only mode, stale PENDING protection, trace_id propagation
Translations: - FR-045: new-key-only execution mode — translate only rows with unseen keys - Compare source row keys against TranslationRecord.source_data from last succeeded run - Baseline expired (>90 days) fallback to full mode with baseline_expired event - run_noop early return when zero new keys (skip LLM + SQL) Scheduler reliability: - Stale PENDING protection: runs older than 1h auto-marked FAILED, no longer block schedule - load_schedules() reloads active translation schedules from DB on restart - add_translation_job/remove_translation_job register/unregister with APScheduler - execution_mode column on translation_schedules with additive DB migration Automation view: - GET /settings/automation/translation-schedules endpoint - Translation schedules displayed on Automation page below validation policies Trace propagation: - seed_trace_id() in all background entry points: TaskManager._run_task/_flusher_loop, SchedulerService._trigger_backup, websocket_endpoint, IdMappingService, all standalone scripts Migrations: - dictionary_entries: origin_run_id, origin_row_key, origin_user_id - translation_schedules: execution_mode Tests: - 3 new test modules (22 tests): core_scheduler, executor_filter, scheduler_execution+guard - Fix pre-existing translate test isolation (conftest.py) - Fix test_list_runs_filter_status parameter
This commit is contained in:
25
backend/tests/conftest.py
Normal file
25
backend/tests/conftest.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# #region TestSessionConfig [C:2] [TYPE Module] [SEMANTICS test, conftest, db]
|
||||
# @BRIEF Shared pytest fixtures and session configuration for backend tests.
|
||||
# @RELATION BINDS_TO -> [init_db]
|
||||
# @PRE All test modules use sys.path patching to import from src/.
|
||||
# @POST Database tables exist before test session executes.
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def ensure_db_tables():
|
||||
"""Ensure all tables exist before test session.
|
||||
|
||||
This fixture runs once per test session, creating all registered
|
||||
SQLAlchemy tables. Individual test modules may also create their
|
||||
own in-memory engines — this guarantees the real engine schema
|
||||
is initialized for tests that depend on it.
|
||||
"""
|
||||
from src.core.database import init_db
|
||||
init_db()
|
||||
# #endregion TestSessionConfig
|
||||
Reference in New Issue
Block a user