fix(family): a decision read as precedent says its reason once - to_brief for precedents and idea history; the decision log keeps the full row (#5131)
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 1m13s
CI & Build / Python tests (push) Successful in 1m54s
CI & Build / Build & push image (push) Successful in 40s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / integration (push) Successful in 1m13s
CI & Build / Python tests (push) Successful in 1m54s
CI & Build / Build & push image (push) Successful in 40s
Each decision stored its reason three times (reason, before.reason, after.reason) and a promotion carried the whole criteria reasoning in evidence. Precedents (assess, promote, get_family_adoption, get_family_idea) and get_family_idea's history now serve FamilyDecision.to_brief(): reason once, before/after as status, canon_version and platforms, evidence as the cited list. list_family_decisions and the decision echoed back by a write keep to_dict. The precedent count was already bounded at five. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -211,7 +211,8 @@ async def get_idea(user_id: int, note_id: int) -> dict | None:
|
||||
"platforms": await _platform_slugs(session, note_id),
|
||||
"topic": await _topic(session, user_id, idea.topic_id, rules=True),
|
||||
"adoptions": counts,
|
||||
"decisions": [_decision_dict(d) for d in decisions],
|
||||
# Brief: the history is read in bulk; the full rows are list_decisions (#5131).
|
||||
"decisions": [d.to_brief() for d in decisions],
|
||||
"undoable_decision_id": _undoable_id(decisions),
|
||||
})
|
||||
out["criteria"] = list(CRITERIA)
|
||||
@@ -383,8 +384,8 @@ async def precedents(user_id: int, note_id: int, limit: int = 5) -> list[dict]:
|
||||
for score, n in ranked:
|
||||
d = decisions.get(latest.get(n.id))
|
||||
if d is not None:
|
||||
item = _decision_dict(d, n.title)
|
||||
item["similarity"] = round(float(score), 3)
|
||||
item = {**d.to_brief(), "idea_title": n.title,
|
||||
"similarity": round(float(score), 3)}
|
||||
out.append(item)
|
||||
return out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user