system-prompts-and-models-o.../salesflow-saas/backend/app/api/v1/contradiction.py
Sami Assiri 1ceeea9004 feat(tier1): finalize production activation and revenue execution pack
Complete Tier-1 closure follow-through by wiring docs governance gates, RC release readiness checks, source-of-truth enforcement, executive weekly contract surface, and go-live severity notes.
Add full go-live revenue execution documentation set (production activation, real production playbook, trust expansion, first 3 clients, live deployment, and automated revenue engine) and register all canonical paths.

Made-with: Cursor
2026-04-17 14:13:57 +03:00

72 lines
2.2 KiB
Python

"""Contradiction Engine API — detect and manage system contradictions.
See repo root: `docs/trust/ledger-vs-tool-verification.md` for how this relates to
`VerificationLedger` / `tool_verification`.
"""
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel as PydanticBase
from typing import Any, Dict, List, Optional
router = APIRouter(prefix="/contradictions", tags=["Contradictions"])
class ContradictionCreate(PydanticBase):
source_a: str
source_b: str
claim_a: str
claim_b: str
contradiction_type: str = "factual"
severity: str = "medium"
detected_by: str = "manual"
evidence: Optional[Dict[str, Any]] = None
class ContradictionResolve(PydanticBase):
resolution: str
status: str = "resolved"
@router.post("/")
async def register_contradiction(body: ContradictionCreate) -> Dict[str, Any]:
"""Register a new contradiction."""
sev = (body.severity or "").strip().lower()
if sev in ("v3", "critical") and not (body.evidence or {}):
raise HTTPException(
status_code=422,
detail="severity V3/critical requires non-empty evidence (trust plane receipt)",
)
return {
"status": "registered",
"source_a": body.source_a,
"source_b": body.source_b,
"contradiction_type": body.contradiction_type,
"severity": body.severity,
}
@router.get("/")
async def list_contradictions() -> Dict[str, Any]:
"""List active contradictions."""
return {"contradictions": [], "total": 0}
@router.get("/stats")
async def contradiction_stats() -> Dict[str, Any]:
"""Get contradiction statistics."""
return {"total": 0, "active": 0, "resolved": 0, "critical_active": 0}
@router.get("/{contradiction_id}")
async def get_contradiction(contradiction_id: str) -> Dict[str, Any]:
"""Get a specific contradiction."""
return {"id": contradiction_id, "status": "not_found"}
@router.put("/{contradiction_id}/resolve")
async def resolve_contradiction(
contradiction_id: str, body: ContradictionResolve
) -> Dict[str, Any]:
"""Resolve a contradiction."""
return {"id": contradiction_id, "status": body.status, "resolution": body.resolution}