feat(validators): add Check protocol and base types

Define the Check protocol for validation checks that compute a score
and return pass/fail results with diagnostics.
This commit is contained in:
2026-02-03 17:14:03 +00:00
parent b8ab5811dd
commit 9e7b0131b3

View File

@@ -0,0 +1,31 @@
"""Base types and protocols for validation checks."""
from typing import Protocol, runtime_checkable
from veritext.core.types import CheckResult, ValidationContext
@runtime_checkable
class Check(Protocol):
"""Protocol for validation checks.
A Check computes a score or property of text and compares it against
a threshold to produce a pass/fail result.
"""
@property
def name(self) -> str:
"""Return the name of this check."""
...
def check(self, text: str, context: ValidationContext) -> CheckResult:
"""Run the check and return a result.
Args:
text: The text to validate.
context: Validation context containing reference text and metadata.
Returns:
CheckResult with pass/fail status and diagnostics.
"""
...