-
Notifications
You must be signed in to change notification settings - Fork 230
Align result metadata validation with Pydantic schemas / 统一结果元数据与 Pydantic 模式验证 #2208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,10 @@ | |
| import os | ||
| from pathlib import Path | ||
|
|
||
| from pydantic import ValidationError | ||
|
|
||
| from matrix_logic.validation import ComponentMetadata | ||
|
Comment on lines
+6
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 BLOCKING: These new top-level imports make Why it matters: This script runs as Fix: Either (a) verify/ensure every benchmark runner host has |
||
|
|
||
|
|
||
| def get_required_env_vars(required_vars): | ||
| """Load and validate required environment variables.""" | ||
|
|
@@ -33,11 +37,12 @@ def get_optional_component_metadata(env_var): | |
| except json.JSONDecodeError as exc: | ||
| raise ValueError(f"{env_var} must contain valid JSON") from exc | ||
|
|
||
| if not isinstance(metadata, dict) or set(metadata) != {"name", "version"}: | ||
| raise ValueError(f"{env_var} must contain exactly 'name' and 'version'") | ||
| if not all(isinstance(metadata[key], str) and metadata[key] for key in metadata): | ||
| raise ValueError(f"{env_var} name and version must be non-empty strings") | ||
| return metadata | ||
| try: | ||
| return ComponentMetadata.model_validate(metadata).model_dump() | ||
| except ValidationError as exc: | ||
| raise ValueError( | ||
| f"{env_var} does not match ComponentMetadata: {exc}" | ||
| ) from exc | ||
|
|
||
|
|
||
| # Base required env vars | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 WARNING: This module runs under
$AIPERF_PYTHON— the isolated venv built inbenchmarks/benchmark_lib.sh:1329fromutils/agentic-benchmark/requirements.txt+ theaiperfsubmodule — and neither explicitly declarespydanticorpyyaml(whichutils/matrix_logic/validation.pyimports at module load).Why it matters: The import only works if the
aiperffork's own dependency tree happens to pull in both packages. If it does today, fine — but this is an implicit transitive dependency: if the pinned aiperf branch (cquil11/aiperf-agentx-v1.0) ever drops or reshuffles either dep, agentic aggregation fails at import withModuleNotFoundErrorafter the benchmark has completed. Unit tests won't catch it because they don't run inside the aiperf venv.Fix: Add the deps explicitly so the venv is self-describing:
(applies to
utils/agentic-benchmark/requirements.txt— please confirmpydantic/pyyamlare currently present in the aiperf venv before merging)