generated from coulomb/repo-seed
Add quality criteria registry
This commit is contained in:
@@ -12,6 +12,7 @@ from fastapi.responses import PlainTextResponse
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
from repo_registry.acceptance import criteria_registry_dict, load_quality_criteria
|
||||
from repo_registry.core.service import RegistryService
|
||||
from repo_registry.llm_extraction import LLMCandidateExtractor, create_llm_connect_adapter
|
||||
from repo_registry.repo_ingestion.git import GitIngestionService
|
||||
@@ -58,6 +59,7 @@ from repo_registry.web_api.schemas import (
|
||||
FeatureUpdate,
|
||||
IdResponse,
|
||||
ObservedFactResponse,
|
||||
QualityCriteriaRegistryResponse,
|
||||
RepositoryAbilityMapResponse,
|
||||
RepositoryComparisonResponse,
|
||||
RepositoryCreate,
|
||||
@@ -183,6 +185,15 @@ def health(settings: Settings = Depends(get_settings)) -> dict[str, object]:
|
||||
}
|
||||
|
||||
|
||||
@app.get(
|
||||
"/quality-criteria",
|
||||
tags=["review"],
|
||||
response_model=QualityCriteriaRegistryResponse,
|
||||
)
|
||||
def list_quality_criteria() -> dict[str, object]:
|
||||
return criteria_registry_dict(load_quality_criteria())
|
||||
|
||||
|
||||
@app.post(
|
||||
"/repos",
|
||||
status_code=201,
|
||||
|
||||
@@ -502,6 +502,48 @@ class ReviewDecisionResponse(BaseModel):
|
||||
created_at: str
|
||||
|
||||
|
||||
class QualityCriterionResponse(BaseModel):
|
||||
id: str
|
||||
title: str
|
||||
category: str
|
||||
severity: str
|
||||
applies_to: list[str]
|
||||
description: str
|
||||
deterministic_action: str
|
||||
deterministic_action_when: str
|
||||
reviewer_guidance: str
|
||||
agentic_guidance: str = ""
|
||||
examples: list[str] = Field(default_factory=list)
|
||||
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"examples": [
|
||||
{
|
||||
"id": "RREG-QC-002",
|
||||
"title": "Native Utility Is Repo-Owned",
|
||||
"category": "native-utility",
|
||||
"severity": "high",
|
||||
"applies_to": ["ability", "capability"],
|
||||
"description": "Owned claims require product evidence.",
|
||||
"deterministic_action": "downgraded",
|
||||
"deterministic_action_when": "Evidence is dependency-only.",
|
||||
"reviewer_guidance": "Check whether the repo owns the utility.",
|
||||
"agentic_guidance": "Approve only with product and source evidence.",
|
||||
"examples": ["Dependency use is not native product behavior."],
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class QualityCriteriaRegistryResponse(BaseModel):
|
||||
schema_version: str
|
||||
criteria_version: str
|
||||
status: str
|
||||
updated_at: str
|
||||
criteria: list[QualityCriterionResponse]
|
||||
|
||||
|
||||
class ObservedFactResponse(BaseModel):
|
||||
id: int
|
||||
repository_id: int
|
||||
|
||||
Reference in New Issue
Block a user