Turn two State Hub sync failures into clean outcomes.
An over-long blocked_on now returns a 422 instead of a 500, and decided decision records such as 'approved' map onto the hub's made type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 57383@bnt-lap001 Assistant-Session: ef71febe-2a37-4c34-a979-2508ca973c91
This commit is contained in:
parent
2b5d8f90f8
commit
7d992821fb
5 changed files with 79 additions and 4 deletions
|
|
@ -247,6 +247,23 @@ FILE_TO_DB_WORKSTREAM_STATUS: dict[str, str] = dict(LEGACY_WORKSTREAM_STATUS_ALI
|
|||
STATUS_ORDER: dict[str, int] = dict(TASK_STATUS_ORDER)
|
||||
|
||||
|
||||
def normalise_decision_type(meta: dict) -> str:
|
||||
"""Map a file's decision_type onto the hub's two values, made and pending.
|
||||
|
||||
Repos record decided outcomes with words like ``approved``; the hub rejects
|
||||
anything else with a 422, which left those decisions unindexed.
|
||||
"""
|
||||
value = str(meta.get("decision_type") or "").strip().lower()
|
||||
if value in {"made", "pending"}:
|
||||
return value
|
||||
status = str(meta.get("status") or "").strip().lower()
|
||||
if status == "resolved" or value in {
|
||||
"approved", "accepted", "decided", "rejected", "declined", "resolved",
|
||||
}:
|
||||
return "made"
|
||||
return "pending"
|
||||
|
||||
|
||||
def historical_view_paths(repo_slug: str) -> set[str]:
|
||||
"""Repo-relative paths of bound historical views that share a parent row.
|
||||
|
||||
|
|
@ -3879,7 +3896,7 @@ def fix_repo(
|
|||
"id": desired_record_id,
|
||||
"title": title,
|
||||
"topic_id": topic_id,
|
||||
"decision_type": meta.get("decision_type", "pending"),
|
||||
"decision_type": normalise_decision_type(meta),
|
||||
"description": meta.get("description"),
|
||||
"rationale": meta.get("agent_recommendation") or meta.get("rationale"),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue