Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,27 +192,39 @@
]
},
{
"job_id": "JOB-705",
"job_id": "JOB-712",
"name": "db_migration_user_preferences",
"description": "Database migration to add user preferences schema for rate-limiting feature",
"cron_expression": "",
"description": "One-time database migration to add user preferences schema for rate-limiting feature",
"cron_expression": "30 2 * * *",
"enabled": true,
"last_status": "running",
"last_run": "2026-04-02T17:30:00+08:00",
"last_status": "success",
"last_run": "2026-04-02T02:30:00+08:00",
"action": "run_db_migration",
"created_by": "Lin Zhenkai",
"tags": [
"database",
"migration",
"rate-limiting"
],
"notes": "Migration started at 17:30, estimated completion 20:00. Conflicts with proposed deployment window. Holds exclusive lock on user_accounts table.",
"notes": "Accidentally left enabled after the one-time migration on 2026-03-30. Runs at 02:30 and holds 15+ database connections for 45-60 minutes, overlapping with nightly_cache_warmup at 03:00.",
"execution_history": [
{
"run_time": "2026-04-02T17:30:00+08:00",
"status": "running",
"duration_seconds": 4500,
"notes": "Migration in progress - processing 2.3M rows, 45% complete"
"run_time": "2026-03-31T02:30:00+08:00",
"status": "success",
"duration_seconds": 3420,
"notes": "Migration job held 18 database connections while nightly_cache_warmup started at 03:00."
},
{
"run_time": "2026-04-01T02:30:00+08:00",
"status": "success",
"duration_seconds": 3510,
"notes": "Migration job overlapped with cache warmup window and saturated the connection pool."
},
{
"run_time": "2026-04-02T02:30:00+08:00",
"status": "success",
"duration_seconds": 3380,
"notes": "Migration job overlapped with nightly_cache_warmup; pool size 20, active connections peaked at 20."
}
]
},
Expand Down Expand Up @@ -398,7 +410,7 @@
]
},
{
"job_id": "JOB-712",
"job_id": "JOB-727",
"name": "weekly_cache_warmup",
"description": "Weekly Redis cache pre-population for frequently accessed user data",
"cron_expression": "0 4 * * 0",
Expand Down Expand Up @@ -869,4 +881,4 @@
}
]
}
]
]
16 changes: 16 additions & 0 deletions tests/test_service_schema_drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import importlib
import json
import os
from pathlib import Path

from fastapi.testclient import TestClient

Expand Down Expand Up @@ -191,6 +192,21 @@ def test_scheduler_next_run_backfilled(tmp_path):
assert jobs["JOB-2"]["next_run"] == "2026-06-15T02:00:00"


def test_tgui46_scheduler_fixture_matches_reference_ground_truth():
fixture = (
Path(__file__).resolve().parents[1]
/ "benchmark/gui/TGUI46_job_failure_triage_workmail_sms_notes"
/ "fixtures/scheduler/jobs.json"
)
jobs = json.loads(fixture.read_text(encoding="utf-8"))
by_id = {job["job_id"]: job for job in jobs}

assert by_id["JOB-712"]["name"] == "db_migration_user_preferences"
assert by_id["JOB-712"]["enabled"] is True
assert "02:30" in by_id["JOB-712"]["notes"]
assert by_id["JOB-725"]["name"] == "nightly_cache_warmup"


def test_scheduler_cron_parser_units():
SC = importlib.import_module("mock_services.scheduler.server")
assert SC._parse_cron_field("*", 0, 59) == set(range(60))
Expand Down