-
Notifications
You must be signed in to change notification settings - Fork 0
chore: align MCP corruption manifest with evidence index #161
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
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,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| from __future__ import annotations | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Any | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -29,6 +30,15 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| "evidence_bearing": True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "visualization_only": False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "path": "artifacts/mcp_trace_corruption_manifest.json", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "json", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "generator": "scripts/generate_mcp_trace_corruptions.py", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "evidence_category": "corruption_manifest", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "evidence_role": "deterministic MCP trace corruption manifest evidence", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "evidence_bearing": True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "visualization_only": False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "path": "artifacts/mcp_trace_replay_results.json", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "format": "json", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -85,6 +95,11 @@ def _manifest_families() -> set[str]: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| manifest = _load_json(MANIFEST_PATH) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return {str(fixture["family"]) for fixture in manifest["fixtures"]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _family_from_fixture_slug(slug: str) -> str | None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| match = re.match(r"^(?P<family>.+)_[^_]+_v\d+$", slug) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not match: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return match.group("family") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _extract_fixture_families(payload: dict[str, Any]) -> list[str]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| families: set[str] = set() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -94,6 +109,18 @@ def _extract_fixture_families(payload: dict[str, Any]) -> list[str]: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| families.add(family["family"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if isinstance(payload.get("family"), str): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| families.add(payload["family"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if isinstance(payload.get("corruptions"), list): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for corruption in payload["corruptions"]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not isinstance(corruption, dict): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| source_fixture = corruption.get("source_fixture") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not isinstance(source_fixture, str): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixture_slug = source_fixture.rsplit("/", 1)[-1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| family = _family_from_fixture_slug(fixture_slug) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if family: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| families.add(family) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+113
to
+123
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. This block violates the general rule regarding JSON list processing. It should treat
Suggested change
References
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| return sorted(families) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
The regex
r"^(?P<family>.+)_[^_]+_v\d+$"is incorrect for fixture slugs that do not include a degradation level (e.g., baseline fixtures likemcp_trace_replay_v1). In such cases, it would incorrectly extractmcp_traceas the family instead ofmcp_trace_replay. Additionally, it is fragile if a family name contains multiple underscores. Using a non-greedy match for the family and explicitly handling the optional degradation levels is more robust.