gendesign/backend/app/services
Light1YT 8206a0b067
All checks were successful
Deploy / changes (push) Successful in 6s
Deploy / build-backend (push) Successful in 1m49s
Deploy / build-frontend (push) Has been skipped
Deploy / build-worker (push) Successful in 2m45s
Deploy / deploy (push) Successful in 1m10s
perf(forecast): per-request memoization cache for §22 cold build (#1129)
Cold §22 forecast measured ~215-233s on prod: §9.x layers re-execute the same
horizon/segment-invariant DB loads with identical args hundreds of times per
report (profiled: get_competitors x69, market_metrics x124, get_monthly_macro
x290). Add a per-report ContextVar cache (forecast_cache(), opened once in the
orchestrator) + @cached(key_builder) on the expensive §9.x loaders so each
unique load runs ONCE and reuses the same frozen, read-only instance.

Output is byte-identical (memoized producers are frozen dataclasses / read-only
Pydantic, callers never mutate; cache is per-report, discarded on exit; no-op
outside the report build). No concurrency, no signature changes.

- forecast_request_cache.py: ContextVar cache + cached() decorator (no-op
  outside context, reentrant, _MISS sentinel for cached None)
- @cached on competitors/future_supply/market_metrics/macro_series/
  sales_series/macro_coefficient/demand_normalization/regression loaders
- orchestrator: wrap build_site_finder_report in forecast_cache()
- 58 tests: key discrimination (call-counting regression guard), no-op-outside,
  per-report isolation, reentrancy, frozen-producer canary, amplification proof
  (real get_monthly_macro xN->1)

code-reviewer APPROVE (keys correct, mutation-safe, output identical). 1265
forecast/cache tests green. No new deps. Refs #1129.
2026-06-08 05:26:27 +00:00
..
analysis_runs feat(parcels): typed AnalyzeResponse + run-history read endpoints (#961) 2026-06-06 18:13:34 +00:00
cadastre fix(nspd-geo): coerce geom to MultiPolygon + wide cad_buildings schema in on-demand ingest 2026-06-04 13:11:47 +05:00
etl feat(etl): fuzzy matcher v2 — pruned threshold 0.85→0.80 for objective mapping coverage 2026-05-17 16:28:20 +03:00
exporters feat(export): add PPTX presentation export of §22 forecast report (#959) 2026-06-07 14:09:35 +05:00
forecasting perf(forecast): per-request memoization cache for §22 cold build (#1129) 2026-06-08 05:26:27 +00:00
generative deploy.yml: sync compose+Caddyfile from git, reload caddy after up 2026-04-26 13:31:26 +03:00
photos fix ui lag 2026-04-27 20:26:55 +03:00
scrapers feat(sf): OCR-пайплайн изъятия ЕКБ (Tesseract rus) → land_reservation (#1062) 2026-06-07 18:07:06 +03:00
site_finder perf(forecast): per-request memoization cache for §22 cold build (#1129) 2026-06-08 05:26:27 +00:00
__init__.py init 2026-04-25 13:45:19 +03:00
analytics_queries.py feat(recommend): horizon-aware recommend_mix opt-in overlay (#982, 953-A) (#1014) 2026-06-03 07:40:33 +00:00
analytics_refresh.py fix(scrape): SQLAlchemy text() парсил ':00:' regex как named-param 2026-04-30 23:16:11 +03:00
forecast_request_cache.py perf(forecast): per-request memoization cache for §22 cold build (#1129) 2026-06-08 05:26:27 +00:00
job_settings.py fix(cadastre,nspd_sync): SQL syntax bugs surfaced by ekb_full v2 (#186) 2026-05-15 19:18:43 +03:00
objective_etl.py fix(worker): port objective_etl from psycopg2 → psycopg v3 2026-05-11 12:07:57 +03:00
objective_sync_config.py feat(objective): full sync pipeline + dynamic admin config 2026-05-10 19:54:15 +03:00