-
Notifications
You must be signed in to change notification settings - Fork 0
Add deterministic fixture manifest #129
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
Merged
ProfRandom92
merged 2 commits into
main
from
codex/implement-deterministic-fixture-manifest
May 19, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| { | ||
| "manifest_version": "1.0", | ||
| "fixtures": [ | ||
| { | ||
| "fixture_id": "coding_workflow_pr_review_v1", | ||
| "fixture_version": "1.0.0", | ||
| "category": "coding_workflow", | ||
| "family": "coding_workflow_pr_review", | ||
| "degradation_level": "baseline", | ||
| "path": "fixtures/coding_workflow_pr_review_v1", | ||
| "expected_admissible": true, | ||
| "contracts": [ | ||
| "no_orphan_tool_calls", | ||
| "pre_merge_review", | ||
| "recovery_path_available", | ||
| "security_causal_block" | ||
| ], | ||
| "expected_failure_labels": [] | ||
| }, | ||
| { | ||
| "fixture_id": "coding_workflow_pr_review_mild_v1", | ||
| "fixture_version": "1.0.0", | ||
| "category": "coding_workflow", | ||
| "family": "coding_workflow_pr_review", | ||
| "degradation_level": "mild", | ||
| "path": "fixtures/coding_workflow_pr_review_mild_v1", | ||
| "expected_admissible": false, | ||
| "contracts": [ | ||
| "no_orphan_tool_calls", | ||
| "pre_merge_review", | ||
| "recovery_path_available", | ||
| "security_causal_block" | ||
| ], | ||
| "expected_failure_labels": [ | ||
| "RECOVERY_PATH_INVALID" | ||
| ] | ||
| }, | ||
| { | ||
| "fixture_id": "coding_workflow_pr_review_moderate_v1", | ||
| "fixture_version": "1.0.0", | ||
| "category": "coding_workflow", | ||
| "family": "coding_workflow_pr_review", | ||
| "degradation_level": "moderate", | ||
| "path": "fixtures/coding_workflow_pr_review_moderate_v1", | ||
| "expected_admissible": false, | ||
| "contracts": [ | ||
| "no_orphan_tool_calls", | ||
| "pre_merge_review", | ||
| "recovery_path_available", | ||
| "security_causal_block" | ||
| ], | ||
| "expected_failure_labels": [ | ||
| "CAUSAL_DEPENDENCY_LOSS", | ||
| "RECOVERY_PATH_INVALID" | ||
| ] | ||
| }, | ||
| { | ||
| "fixture_id": "coding_workflow_pr_review_degraded_v1", | ||
| "fixture_version": "1.0.0", | ||
| "category": "coding_workflow", | ||
| "family": "coding_workflow_pr_review", | ||
| "degradation_level": "severe", | ||
| "path": "fixtures/coding_workflow_pr_review_degraded_v1", | ||
| "expected_admissible": false, | ||
| "contracts": [ | ||
| "no_orphan_tool_calls", | ||
| "pre_merge_review", | ||
| "recovery_path_available", | ||
| "security_causal_block" | ||
| ], | ||
| "expected_failure_labels": [ | ||
| "CAUSAL_DEPENDENCY_LOSS", | ||
| "INVARIANT_VIOLATION", | ||
| "POLICY_ORDER_BROKEN", | ||
| "RECOVERY_PATH_INVALID" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,127 @@ | ||||||
| from __future__ import annotations | ||||||
|
|
||||||
| import json | ||||||
| from pathlib import Path | ||||||
|
|
||||||
| ROOT = Path(__file__).resolve().parent.parent | ||||||
| MANIFEST_PATH = ROOT / "fixtures" / "manifest.json" | ||||||
| ALLOWED_DEGRADATION_LEVELS = ["baseline", "mild", "moderate", "severe"] | ||||||
| EXPECTED_FIXTURE_ORDER = [ | ||||||
| "coding_workflow_pr_review_v1", | ||||||
| "coding_workflow_pr_review_mild_v1", | ||||||
| "coding_workflow_pr_review_moderate_v1", | ||||||
| "coding_workflow_pr_review_degraded_v1", | ||||||
| ] | ||||||
|
|
||||||
|
|
||||||
| def _load_json(path: Path) -> dict: | ||||||
| with path.open("r", encoding="utf-8") as f: | ||||||
| return json.load(f) | ||||||
|
|
||||||
|
|
||||||
| def _load_manifest() -> dict: | ||||||
| return _load_json(MANIFEST_PATH) | ||||||
|
|
||||||
|
|
||||||
| def test_manifest_is_json_serializable_and_sorted() -> None: | ||||||
| manifest = _load_manifest() | ||||||
| json.dumps(manifest, sort_keys=True) | ||||||
|
|
||||||
| fixture_ids = [entry["fixture_id"] for entry in manifest["fixtures"]] | ||||||
| assert fixture_ids == EXPECTED_FIXTURE_ORDER | ||||||
|
|
||||||
|
|
||||||
| def test_manifest_paths_exist() -> None: | ||||||
| manifest = _load_manifest() | ||||||
| required_paths = [ | ||||||
| Path("original/trace.json"), | ||||||
| Path("original/state.json"), | ||||||
| Path("original/dependency_graph.json"), | ||||||
| Path("original/contracts"), | ||||||
| Path("reconstructed/trace.json"), | ||||||
| Path("reconstructed/state.json"), | ||||||
| Path("reconstructed/dependency_graph.json"), | ||||||
| Path("expected/admissibility.json"), | ||||||
| Path("expected/failures.json"), | ||||||
| Path("README.md"), | ||||||
| ] | ||||||
|
|
||||||
| for entry in manifest["fixtures"]: | ||||||
| fixture_dir = ROOT / entry["path"] | ||||||
| assert fixture_dir.exists(), f"Missing fixture directory: {fixture_dir}" | ||||||
| for rel_path in required_paths: | ||||||
| assert (fixture_dir / rel_path).exists(), f"Missing path: {fixture_dir / rel_path}" | ||||||
|
|
||||||
|
|
||||||
| def test_manifest_matches_fixture_admissibility_metadata() -> None: | ||||||
| manifest = _load_manifest() | ||||||
|
|
||||||
| for entry in manifest["fixtures"]: | ||||||
| admissibility = _load_json(ROOT / entry["path"] / "expected" / "admissibility.json") | ||||||
| assert entry["fixture_id"] == admissibility["fixture_id"] | ||||||
| assert entry["fixture_version"] == admissibility["fixture_version"] | ||||||
| assert entry["expected_admissible"] == admissibility["expected_admissible"] | ||||||
| assert entry["expected_failure_labels"] == sorted(admissibility.get("expected_failure_labels", [])) | ||||||
|
|
||||||
|
|
||||||
| def test_manifest_contracts_match_contract_files() -> None: | ||||||
| manifest = _load_manifest() | ||||||
|
|
||||||
| for entry in manifest["fixtures"]: | ||||||
| contracts_dir = ROOT / entry["path"] / "original" / "contracts" | ||||||
| contract_ids = [] | ||||||
| for contract_file in sorted(contracts_dir.glob("*.json")): | ||||||
| contract_ids.append(_load_json(contract_file)["contract_id"]) | ||||||
| assert sorted(contract_ids) == entry["contracts"] | ||||||
|
|
||||||
|
|
||||||
| def test_manifest_expected_failure_labels_match_failures_file() -> None: | ||||||
| manifest = _load_manifest() | ||||||
|
|
||||||
| for entry in manifest["fixtures"]: | ||||||
| failures = _load_json(ROOT / entry["path"] / "expected" / "failures.json") | ||||||
| assert entry["expected_failure_labels"] == sorted(failures.get("expected_failures", [])) | ||||||
|
|
||||||
|
|
||||||
| def test_benchmark_artifact_references_only_manifest_fixtures() -> None: | ||||||
| manifest = _load_manifest() | ||||||
| benchmark = _load_json(ROOT / "artifacts" / "layered_admissibility_results.json") | ||||||
|
|
||||||
| manifest_index = { | ||||||
| entry["fixture_id"]: { | ||||||
| "fixture_version": entry["fixture_version"], | ||||||
| "path": entry["path"], | ||||||
| } | ||||||
| for entry in manifest["fixtures"] | ||||||
| } | ||||||
|
|
||||||
| for point in benchmark["points"]: | ||||||
| fixture_id = point["fixture_id"] | ||||||
| assert fixture_id in manifest_index | ||||||
| assert point["fixture_version"] == manifest_index[fixture_id]["fixture_version"] | ||||||
| assert point["fixture_path"] == manifest_index[fixture_id]["path"] | ||||||
|
|
||||||
|
|
||||||
| def test_degradation_levels_are_known_and_unique_per_family() -> None: | ||||||
| manifest = _load_manifest() | ||||||
| family_to_levels: dict[str, set[str]] = {} | ||||||
|
|
||||||
| for entry in manifest["fixtures"]: | ||||||
| level = entry["degradation_level"] | ||||||
| family = entry["family"] | ||||||
| assert level in ALLOWED_DEGRADATION_LEVELS | ||||||
| family_to_levels.setdefault(family, set()) | ||||||
| assert level not in family_to_levels[family] | ||||||
| family_to_levels[family].add(level) | ||||||
|
|
||||||
|
|
||||||
| def test_no_unregistered_fixture_directories() -> None: | ||||||
| manifest = _load_manifest() | ||||||
| registered_paths = {entry["path"] for entry in manifest["fixtures"]} | ||||||
|
|
||||||
| discovered_fixture_paths = { | ||||||
| str(path.parent.parent.relative_to(ROOT)).replace("\\", "/") | ||||||
|
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. Using
Suggested change
|
||||||
| for path in (ROOT / "fixtures").glob("*/expected/admissibility.json") | ||||||
| } | ||||||
|
|
||||||
| assert discovered_fixture_paths.issubset(registered_paths) | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 call to
json.dumps(manifest, sort_keys=True)is redundant. Since themanifestobject was just loaded from a JSON file usingjson.load(via_load_manifest), it is already guaranteed to be serializable. Additionally, the result of the call is not assigned or asserted against, making this a no-op. If the intention was to verify the formatting or key ordering of the manifest file on disk, this line does not achieve that.