fix(site-finder): isolate zone-regulation cache write off the request session (#1850 item 4) #1902

Merged
bot-backend merged 1 commit from fix/zone-resolver-write-session into main 2026-06-25 11:16:27 +00:00

1 commit

Author SHA1 Message Date
7eee75f657 fix(site-finder): isolate zone-regulation cache write off the request session
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / backend-tests (pull_request) Successful in 11m7s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 1m44s
get_or_fetch_zone_regulation no longer commits the shared /analyze transaction
mid-request on cache-miss. The upsert now runs in a fresh short-lived
SessionLocal() (commit/rollback/close), mirroring the zone_regulation_refresh
Celery task. Read-back still uses the shared session (READ COMMITTED sees the
committed row), so caller return shape is unchanged.

Resolves the #1850 item-4 SMELL (the outer analyze tx is designed to commit
exactly once via persist_analysis_run).

Refs #1850
2026-06-25 15:54:08 +05:00