Skip to content

Commit 933b2e9

Browse files
committed
chore: remove kaizen.schema.policy mypy omit and fallback since it now exists
1 parent 19a09c0 commit 933b2e9

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

kaizen/frontend/api/routes.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,15 @@ def create_namespace_entity(namespace_id: str, req: EntityCreateRequest) -> dict
206206
logger.error(f"Guideline validation failed: {e}")
207207
raise HTTPException(status_code=422, detail=f"Invalid guideline metadata schema: {e}")
208208

209-
elif req.type == "policy":
209+
from kaizen.schema.policy import Policy, PolicyType
210+
210211
try:
211-
from kaizen.schema.policy import Policy # type: ignore[import-not-found]
212-
213-
try:
214-
# The Policy model checks the full payload
215-
policy_meta = {k: v for k, v in req.metadata.items() if k not in ("content", "type")}
216-
Policy(content=req.content, type=req.type, **policy_meta)
217-
except Exception as e:
218-
logger.error(f"Policy validation failed: {e}")
219-
raise HTTPException(status_code=422, detail=f"Invalid policy metadata schema: {e}")
220-
except ImportError:
221-
# Fallback if we're on a branch where kaizen.schema.policy doesn't exist yet
222-
logger.warning("Policy schema missing. Skipping strict validation.")
212+
# The Policy model checks the full payload
213+
policy_meta = {k: v for k, v in req.metadata.items() if k not in ("content", "type")}
214+
Policy(content=req.content, type=PolicyType(req.type), **policy_meta)
215+
except Exception as e:
216+
logger.error(f"Policy validation failed: {e}")
217+
raise HTTPException(status_code=422, detail=f"Invalid policy metadata schema: {e}")
223218

224219
client = get_client()
225220
try:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,5 @@ module = [
148148
"pgvector.*",
149149
"psycopg.*",
150150
"entity_io.*",
151-
"kaizen.schema.policy",
152151
]
153152
ignore_missing_imports = true

0 commit comments

Comments
 (0)