Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
test(tier3): time the masking linear-time checks in CPU time, in turn (#665)
Narendran Raghavan6fab14cda810
diff --git a/tests/tier3/test_judge_contracts.py b/tests/tier3/test_judge_contracts.pyindex b82b8b0b..e9d7babc 100644--- a/tests/tier3/test_judge_contracts.py+++ b/tests/tier3/test_judge_contracts.py@@ -8,7 +8,6 @@ from __future__ import annotationsimport jsonimport randomimport string-import timefrom pathlib import Pathfrom types import ModuleTypefrom typing import Any@@ -21,6 +20,7 @@ from tests.tier3.test_security_finding_evidence import (_KEY_BLOCK,_READINGS_THAT_START_THE_TEXT,_generated_texts,+ _masking_seconds,_only_adds_markers,)@@ -1768,16 +1768,7 @@ def test_judge_evidence_masking_escaped_again_only_adds_markers(monkeypatch: pyt],)def test_judge_evidence_masking_escaped_again_stays_linear_on_adversarial_input(unit: str) -> None:- def elapsed(size: int) -> float:- text = unit * (size // len(unit))- times = []- for _ in range(2):- started = time.perf_counter()- eval_template._redact_judge_evidence(text)- times.append(time.perf_counter() - started)- return min(times)-- small, large = elapsed(20_000), elapsed(200_000)+ small, large = _masking_seconds(eval_template._redact_judge_evidence, unit, 20_000, 200_000)# Ten times the text takes about ten times as long. The margin allows for# a slow CI runner.assert large < 16 * small + 0.05diff --git a/tests/tier3/test_security_finding_evidence.py b/tests/tier3/test_security_finding_evidence.pyindex 2045857c..c49f5347 100644--- a/tests/tier3/test_security_finding_evidence.py+++ b/tests/tier3/test_security_finding_evidence.py@@ -12,8 +12,10 @@ entry points are exercised.from __future__ import annotations+import gcimport importlib.utilimport json+import mathimport randomimport reimport time@@ -1677,22 +1679,38 @@ def test_only_adds_markers_rejects_a_marker_taken_back() -> None:],)def test_masking_escaped_again_stays_linear_on_adversarial_input(unit: str) -> None:- def elapsed(size: int) -> float:- text = unit * (size // len(unit))- times = []- for _ in range(3):- started = time.perf_counter()- eval_core_checks._mask_finding_evidence_credentials(text)- times.append(time.perf_counter() - started)- return min(times)-- small, large = elapsed(25_000), elapsed(250_000)+ small, large = _masking_seconds(eval_core_checks._mask_finding_evidence_credentials, unit, 25_000, 250_000)# Ten times the text takes about ten times as long. A step quadratic in# the number of markers took twenty times as long on the escaped quotes# between markers. The margin allows for a slow CI runner.assert large < 16 * small + 0.05+def _masking_seconds(mask: Callable[[str], object], unit: str, small: int, large: int) -> tuple[float, float]:+ """Return the CPU seconds *mask* takes on *unit* repeated to *small* and to *large* characters.++ The two texts are masked in turn, three times each, and the fastest time+ of each counts, so a burst of load on a busy CI runner slows both rather+ than only the large one. The time is this thread's CPU time with garbage+ collection paused: neither another process or thread holding the CPU nor+ a collection of the test worker's whole heap is counted.+ """+ texts = (unit * (small // len(unit)), unit * (large // len(unit)))+ fastest = [math.inf, math.inf]+ collecting = gc.isenabled()+ gc.disable()+ try:+ for _ in range(3):+ for index, text in enumerate(texts):+ started = time.thread_time()+ mask(text)+ fastest[index] = min(fastest[index], time.thread_time() - started)+ finally:+ if collecting:+ gc.enable()+ return fastest[0], fastest[1]++@pytest.mark.parametrize(("text", "expected"),[