feat(modelling): legacy writers set recommendation.plan_id (dual-write)

upload_recommendations and bulk_upload_recommendations_and_materials now set
plan_id on each recommendation row (the plan id is already in scope), while
still writing the plan_recommendations m2m — the dual-write that lets readers
move onto plan_id with no breakage during the transition (ADR-0017 amendment /
docs/migrations/recommendation-plan-id.md). The m2m write is removed in a later
slice once no reader depends on it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-03 21:01:56 +00:00
parent c1c7b06f09
commit 27fcc5b184

View file

@ -261,6 +261,7 @@ def upload_recommendations(
recommendations_data = [
{
"property_id": property_id,
"plan_id": new_plan_id,
"type": rec["type"],
"measure_type": rec["measure_type"],
"description": rec["description"],
@ -353,6 +354,7 @@ def bulk_upload_recommendations_and_materials(
recommendation_rows.append(
{
"property_id": rec["property_id"],
"plan_id": rec["plan_id"],
"type": rec["type"],
"measure_type": rec["measure_type"],
"description": rec["description"],