Merge dev: family canon, milestone 463 steps 1-6 #206

Merged
bvandeusen merged 10 commits from dev into main 2026-10-06 14:11:29 -04:00
Showing only changes of commit faa1b72307 - Show all commits
+5 -2
View File
@@ -620,9 +620,12 @@ async def undo(user_id: int, decision_id: int, *, reason: str, decided_via: str
raise ValueError(f"decision {decision_id} cannot be undone: {why}")
idea = await session.get(FamilyIdea, target.idea_id)
before = await _snapshot(session, idea)
# No recorded prior state means the decision CREATED the idea: before
# it, the record had no applicability test and no scope. It comes back
# as retired, with neither, rather than being deleted with its log.
prior = target.before or {
"status": "retired", "applies_when": idea.applies_when or "",
"canon_version": idea.canon_version, "platforms": before["platforms"],
"status": "retired", "applies_when": "",
"canon_version": idea.canon_version, "platforms": [],
}
if prior["status"] == "canon" and not (prior.get("applies_when") or "").strip():
raise ValueError("the recorded prior state is canon with no 'applies when'")