|
All checks were successful
CI / changes (push) Successful in 6s
CI / frontend-tests (push) Has been skipped
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (pull_request) Has been skipped
CI / backend-tests (push) Successful in 6m25s
CI / backend-tests (pull_request) Successful in 6m32s
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. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| best_layouts.py | ||
| cadastre_fetch.py | ||
| competitors.py | ||
| custom_pois.py | ||
| district_resolver.py | ||
| filters.py | ||
| functional_zone_lookup.py | ||
| future_supply.py | ||
| gate_verdict.py | ||
| granddoc_lookup.py | ||
| ird_analyze.py | ||
| ird_overlay_lookup.py | ||
| krt_lookup.py | ||
| layout_signature.py | ||
| layout_velocity_refresh.py | ||
| macro.py | ||
| market_metrics.py | ||
| noise_loader.py | ||
| okn_lookup.py | ||
| parser.py | ||
| pat_lookup.py | ||
| planning_lookup.py | ||
| poi_loader.py | ||
| poi_score.py | ||
| pzz_loader.py | ||
| quarter_dump_lookup.py | ||
| quarter_price_index_refresh.py | ||
| quarter_price_refresh.py | ||
| reservation_lookup.py | ||
| scorer.py | ||
| supply_layers.py | ||
| velocity.py | ||
| weight_profiles.py | ||
| zone_regulation.py | ||