gendesign/backend/tests
Light1YT 9a845646fd
All checks were successful
Deploy / deploy (push) Successful in 1m9s
Deploy / changes (push) Successful in 5s
Deploy / build-frontend (push) Has been skipped
Deploy / build-backend (push) Successful in 1m29s
Deploy / build-worker (push) Successful in 2m20s
fix(#978): train-only detrend in rate backtest + Almon distributed-lag regression
REOPENED 951-B §9.6.
PART A: fix look-ahead leakage in backtest_rate_sensitivity --detrend. The
ln(units) trend was fit over train+test then split, so test data shaped the
detrend and inflated the OOS hit-rate. _detrend_log now takes fit_n; backtest_tier
fits the trend on TRAIN months only (same split evaluate_oos uses) and projects
(a,b) point-in-time onto test. Default fit_n=None preserves prior behaviour.

PART B (DoD): new app/services/forecasting/regression.py — Almon polynomial
distributed-lag (deg 2) of Δln(district demand) on Δkey_rate lags 0..6 via
OLS-on-Almon-regressors (numpy lstsq) + per-lag reconstruction + manual
Newey-West HAC SEs (NO statsmodels). Output {best_lag_months, coef=long-run
multiplier, x_pct, r2, n, per_lag_coef, hac_se,...}; gate mirrors _elasticity_coef
(n<30 OR R²<0.1 OR Σβ≥0 → fallback); §9.6 phrase from the lag shape. ADVISORY,
shipped standalone (integration point documented), NOT wired — protects the live
compute_rate_sensitivity consumers.

125+31 tests (synthetic known-lag recovery, HAC computed/differs-from-OLS,
fallback gating, no-leakage detrend). ruff clean. Refs #978
2026-06-04 11:39:32 +05:00
..
api test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
integration test(infra): integration phantom column gate (#197) (#216) 2026-05-16 13:07:13 +00:00
scrapers feat(site-finder): live CBR key-rate scraper → macro_indicator (#945 PR B) (#964) 2026-06-02 19:05:57 +00:00
scripts fix(#978): train-only detrend in rate backtest + Almon distributed-lag regression 2026-06-04 11:39:32 +05:00
services fix(#978): train-only detrend in rate backtest + Almon distributed-lag regression 2026-06-04 11:39:32 +05:00
smoke fix(parcels): _parse_floors handle int (post-migration #169) (#176) 2026-05-15 15:08:16 +03:00
sql test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
workers fix(supply-layers): thread dev_group_name into L3 upsert key (#970 CRITICAL) 2026-06-04 10:06:30 +05:00
__init__.py init 2026-04-25 13:45:19 +03:00
conftest.py test(rbac): test-mode bypass so api/v1 suite can authenticate (CI-rehab 1/3) 2026-06-03 18:29:20 +05:00
test_admin_weight_profiles.py test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
test_concepts_stub.py init 2026-04-25 13:45:19 +03:00
test_gate_verdict.py feat(#29,#232): wire cad_parcels.permitted_use in analyze + cad_zouit fallback (G2+G3) 2026-05-17 08:17:22 +03:00
test_health.py init 2026-04-25 13:45:19 +03:00
test_layout_signature.py feat(parcels): layout signature schemas + extractor (#113 PR A) (#193) 2026-05-16 07:52:34 +00:00
test_layout_tz_pdf.py test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
test_nspd_client.py test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
test_nspd_sync.py fix(#244): harvest_quarter — CAST CASE WHEN params (psycopg3 AmbiguousParameter) (#246) 2026-05-17 05:53:08 +00:00
test_ping.py feat(backend): add /api/v1/ping liveness endpoint (#634) 2026-05-29 15:53:29 +00:00
test_poi_score.py feat(sf-b6): GET /parcels/{cad}/poi-score — weighted top-7 (#333) 2026-05-17 21:11:25 +00:00
test_quarter_dump_lookup.py test(suite): re-align drifted tests with current code (CI-rehab 2/3) 2026-06-03 19:05:43 +05:00
test_rbac.py feat(rbac): pilot scope → только /trade-in/** (#587) 2026-05-26 07:40:44 +00:00
test_sentry_init.py feat(backend): sentry-sdk init для FastAPI + Celery (#204 backend) (#207) 2026-05-16 15:09:16 +00:00
test_velocity.py feat(obj-3): SF backend migrate to objective_lots ground truth (price 0.3% -> 81%) (#324) 2026-05-17 20:08:17 +00:00
test_weight_profiles.py feat(site-finder): weight profiles service — Pydantic + CRUD (#114 sub-PR 2/4) (#137) 2026-05-15 00:29:37 +03:00