"""Guard test: the live feature store defaults to Timescale (Postgres), never a throwaway DuckDB file.

`config.py` documents the safety invariant explicitly: `feature_store` defaults to `"postgres"` so a Job
that forgets `FXHNT_FEATURE_STORE` can't silently write to a throwaway DuckDB file instead of the live
`features` table. This test locks that invariant so a future change to the default can't regress it
silently.
"""
from __future__ import annotations


def test_default_feature_store_is_timescale_not_duckdb() -> None:
    from fxhnt.adapters.warehouse import get_feature_store
    from fxhnt.adapters.warehouse.timescale_feature_store import TimescaleFeatureStore
    from fxhnt.config import Settings

    s = Settings()  # defaults; feature_store should default to "postgres"
    assert s.feature_store == "postgres"
    # get_feature_store(settings.feature_store == "postgres") returns the Timescale store (not
    # DuckDbFeatureStore) regardless of the concrete DSN dialect — TimescaleFeatureStore itself supports
    # sqlite (see its `_is_pg` guard) for exactly this reason, so a unit test can assert the routing
    # invariant without requiring a live Postgres/Timescale server (matching every other TimescaleFeatureStore
    # test in this repo, e.g. tests/integration/test_timescale_bulk_upsert.py, which all use "sqlite://").
    s.operational_dsn = "sqlite://"
    assert isinstance(get_feature_store(s), TimescaleFeatureStore)
