Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions saee_backend/services/evidence_adequacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})"
)

_DIGEST_PATTERN = re.compile(r"[0-9a-f]{64}")
_URI_PATTERN = re.compile(r"https://[a-z0-9.-]+/[A-Za-z0-9._~/-]+")

ROOT = Path(__file__).resolve().parents[2]
PROFILE_SCHEMA_PATH = ROOT / "agent-interface/schemas/evidence-adequacy-profile.schema.json"
PROFILE_DIRECTORY = ROOT / "agent-interface/profiles/evidence-adequacy"
Expand Down Expand Up @@ -279,9 +282,9 @@ def _check_causal_binding_complete(source_ok: bool, source: Any, target_ok: bool
and source.get("content_digest") == target.get("content_digest") == link.get("content_digest")
and source.get("resolved_uri") == target.get("resolved_uri")
and isinstance(digest, str)
and re.fullmatch(r"[0-9a-f]{64}", digest) is not None
and _DIGEST_PATTERN.fullmatch(digest) is not None
and isinstance(resolved_uri, str)
and re.fullmatch(r"https://[a-z0-9.-]+/[A-Za-z0-9._~/-]+", resolved_uri) is not None
and _URI_PATTERN.fullmatch(resolved_uri) is not None
and isinstance(target.get("sandbox_ref"), str)
and bool(target.get("sandbox_ref"))
)
Expand Down