Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ dist/
build/
*.egg-info/
artifacts/

# Node / Playwright UI test artifacts (tests/ui)
node_modules/
playwright-report/
test-results/
.playwright/
23 changes: 12 additions & 11 deletions src/cas_evals/reference_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import concurrent.futures
import hashlib
import json
from collections.abc import Callable
Expand Down Expand Up @@ -122,9 +123,8 @@ def evaluate_reference_suite(
suite = json.loads(fixture_path.read_text(encoding="utf-8"))
released_at = suite.get("releasedAt", DEFAULT_RELEASED_AT)
invoke = transport or _http_transport(endpoint, timeout_seconds)
evaluated = []

for source_case in suite["cases"]:
def process_case(source_case: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:
envelope = _build_envelope(source_case, suite["suiteId"], released_at)
output, events = _validate_response(invoke(envelope), envelope)
live_case = {**source_case, "response": output}
Expand All @@ -142,17 +142,18 @@ def evaluate_reference_suite(
"normalization": "fixture-observed",
},
}
evaluated.append(
_evaluate_case_with_evidence(
live_case,
suite["suiteId"],
released_at,
source_case=source_case,
metadata=envelope,
execution_evidence=evidence,
)
return _evaluate_case_with_evidence(
live_case,
suite["suiteId"],
released_at,
source_case=source_case,
metadata=envelope,
execution_evidence=evidence,
)

with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
evaluated = list(executor.map(process_case, suite["cases"]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop scheduling cases after the first adapter failure

In a multi-case reference-product suite where the endpoint times out or returns an invalid contract, this executor.map call submits the whole suite before any result is inspected, and list(...) exits the with only after those queued HTTP calls finish. That regresses the fail-closed path from stopping on the first bad response to spending up to one timeout per batch, and it can send later prompts even after an earlier case has already made the run invalid.

Useful? React with 👍 / 👎.


results = [result for result, _ in evaluated]
return {
"schemaVersion": "0.2.0",
Expand Down
96 changes: 96 additions & 0 deletions tests/ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading