Spaces:
Sleeping
Sleeping
Commit History
-
feat(mlflow): swap default tracking URI to sqlite:///mlflow.db
Closes ADR-0003's deferred position on the file-backed registry deprecation. The five default-constant sites flip from "file:./mlruns" to "sqlite:///mlflow.db": src/sentiment/training/mlflow_logging.py src/sentiment/training/baseline.py src/sentiment/training/lora.py src/sentiment/adapters/mlflow_registry_classifier.py (two sites) src/api/main.py Test fixtures in test_mlflow_logging.py, test_baseline_training.py, and test_lora_training.py build their per-test tracking URIs as sqlite:///<tmp>/mlflow.db instead of file://<tmp>/mlruns. test_api.py and test_mlflow_registry_classifier.py update their literal defaults. One new test pins the cross-module invariant (test_default_tracking_uri_is_sqlite_across_modules in test_mlflow_logging.py): asserts the constant in three training modules, both MLflowRegistryAdapter and load_from_registry_or_fallback signature defaults, and the os.environ.get default in api/main.py all equal "sqlite:///mlflow.db" with no remaining "file:./mlruns…5f2258e -
feat(api): make MLflow registry the serving source-of-truth
Phase 7 (ADR-0004) — /health.model_version now reflects what was actually loaded into memory, not whatever the report file last said. _build_classifier now returns (port, RegistryVersionInfo | None) and delegates catboost/lora dispatch to load_from_registry_or_fallback. Stub branch returns (StubClassifier(), None). Lifespan unpacks both onto app.state. /health serializes RegistryVersionInfo via dataclasses.asdict (name, version, run_id, source='registry') or null on filesystem fallback / stub. MODEL_VERSION env var pins a specific registry version; unset → latest non-archived. MLFLOW_TRACKING_URI honored (default file:./mlruns). *_MODEL_DIR env vars retained as the fallback path. _extract_model_version removed; _load_reference drops its third return value (drift signals only). The four Phase-6 report-driven /health tests are replaced by six Phase-7 loader-driven ones; existing lifespan tests now monkeypatch the loader rather than the adapter classes (which are no longer imported by …9b4857c -
feat(api): surface registry version in /health
4c20ba0
-
feat(api): wire /predict drift recording + /metrics/drift endpoint
9811dac -
feat(api): rewire /predict through Depends(get_classifier) with hardened error handling
- Add get_classifier(request) dependency so /predict receives the live classifier via FastAPI DI; tests override via app.dependency_overrides - Wrap classifier.predict in try/except: - ValueError → HTTPException 422 (detail echoes the message) - Any other exception → logger.exception(...) server-side and HTTPException 500 with fixed body "internal inference error" - Response carries no input text, no stack trace, no model internals on error (AGENTS.md review-checklist #5) - Releases D1 lock — /predict no longer pins to the module-level stub Tests: - test_predict_uses_overridden_classifier (DI override exercised) - test_predict_returns_500_when_classifier_raises_unexpected — body is the generic message; user text, exception message, traceback, and type name all absent from the raw response body - test_predict_returns_422_when_classifier_raises_value_error — body detail matches the adapter's exception string Phase 3 / spec 003 / Step 2.976efc5 -
refactor(api): introduce create_app() + lifespan with SENTIMENT_BACKEND dispatch
- Add create_app() factory and async lifespan that constructs the chosen classifier once at startup and stores it on app.state.classifier - SENTIMENT_BACKEND env var selects stub | catboost | lora (default stub); LORA_MODEL_DIR / CATBOOST_MODEL_DIR override paths - /health now reads app.state.backend_name (stub / catboost-baseline-v1 / arabert-lora-v1) for ops liveness probes - Unknown backend value raises ValueError listing valid set; missing model dir surfaces FileNotFoundError at startup (no silent fallback) - Drop module-global _classifier; predict reads from request.app.state Tests: - Add 5 lifespan tests (default stub, lora-env, catboost-env, fail-fast on bogus, fail-fast on missing lora dir); patch adapter classes via monkeypatch so unit tests stay offline - Tighten body["model"] == "stub" assertion on existing health test - Switch existing tests to a TestClient(create_app()) context-managed fixture so lifespan fires Phase 3 / spec 003 / Step 1.f88a246 -
chore(repo): bootstrap walking skeleton and governance
4e398cc