Merge pull request 'feat(plans): משיכת תב"ע מ-מנהל-התכנון (mavat) — Phase C backend-slice' (#292) from worktree-plan-fetch-mavat into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m28s
G12 Leak-Guard / leak-guard (push) Successful in 5s
Lint — undefined names / undefined-names (push) Successful in 10s

This commit was merged in pull request #292.
This commit is contained in:
2026-06-17 11:14:44 +00:00
6 changed files with 442 additions and 0 deletions

View File

@@ -7653,6 +7653,32 @@ async def plan_merge(req: PlanMergeRequest):
raise HTTPException(400, str(e))
class PlanFetchRequest(BaseModel):
plan_number: str
@app.post("/api/plans/fetch")
async def plan_fetch_from_mavat(req: PlanFetchRequest):
"""Pull a plan's identity + validity from mavat (מנהל התכנון) for the chair form.
Returns a candidate dict (display_name/plan_type/purpose/gazette_date/
yalkut_number/source_url) — does NOT write the registry; the chair saves via
POST /api/plans (review_status gate stays, INV-AH source_url carried). The
browser work runs on the host bridge (Camoufox past F5); 503 if it's down,
404 if the plan wasn't found.
"""
from legal_mcp.services import plans_fetch
if not req.plan_number.strip():
raise HTTPException(400, "חסר מספר-תכנית")
try:
return await plans_fetch.fetch_plan(req.plan_number)
except plans_fetch.PlanFetchUnavailable as e:
raise HTTPException(503, str(e))
except plans_fetch.PlanFetchError as e:
raise HTTPException(404, str(e))
# ── Missing Precedents (TaskMaster #35) ────────────────────────────
# Track citations from party briefs that aren't yet in the precedent
# corpus. Researcher logs gaps; chair closes them by uploading the