feat(engineering): enforce V1-0 write invariants
This commit is contained in:
@@ -1457,6 +1457,11 @@ class EntityCreateRequest(BaseModel):
|
||||
status: str = "active"
|
||||
confidence: float = 1.0
|
||||
source_refs: list[str] | None = None
|
||||
# V1-0 provenance enforcement (F-8). Clients must either pass
|
||||
# non-empty source_refs or set hand_authored=true. The service layer
|
||||
# raises ValueError otherwise, surfaced here as 400.
|
||||
hand_authored: bool = False
|
||||
extractor_version: str | None = None
|
||||
|
||||
|
||||
class EntityPromoteRequest(BaseModel):
|
||||
@@ -1486,6 +1491,8 @@ def api_create_entity(req: EntityCreateRequest) -> dict:
|
||||
confidence=req.confidence,
|
||||
source_refs=req.source_refs,
|
||||
actor="api-http",
|
||||
hand_authored=req.hand_authored,
|
||||
extractor_version=req.extractor_version,
|
||||
)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e))
|
||||
|
||||
Reference in New Issue
Block a user