Skip to content

test: add family-agnostic manifest fixture family validation coverage#134

Merged
ProfRandom92 merged 2 commits into
mainfrom
codex/add-fixture-validation-tests-for-families
May 19, 2026
Merged

test: add family-agnostic manifest fixture family validation coverage#134
ProfRandom92 merged 2 commits into
mainfrom
codex/add-fixture-validation-tests-for-families

Conversation

@ProfRandom92
Copy link
Copy Markdown
Owner

Summary:
Add a new focused test module that validates fixture-family invariants and baseline/severe behavioral expectations across all fixture families registered in fixtures/manifest.json.

Changed files:

  • tests/test_manifest_fixture_families.py

Testing:

  • pytest tests/test_manifest_fixture_families.py -q — passed (3 passed).
  • pytest tests/test_fixture_manifest.py -q — passed (8 passed).
  • pytest tests/test_incident_response_fixture_contract_bundle.py -q — passed (2 passed).
  • pytest tests/test_degradation_curve_generator.py -q — passed (13 passed).
  • npm run check — passed (full test suite: 202 passed).

Risks:

  • Low; test-only changes that reuse existing ContractValidator and AdmissibilityScorer and do not modify fixtures, manifest, or runtime logic.

Next:

  • Open a Draft PR with these changes and run CI, then iterate on any review feedback until Actions are green.

Codex Task

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new test suite, tests/test_manifest_fixture_families.py, to ensure the structural and behavioral consistency of fixture families defined in the manifest. The tests verify that each family contains the necessary degradation levels and that the validation results for baseline and severe fixtures align with expectations. Feedback identifies opportunities to improve sorting robustness by using the defined REQUIRED_LEVELS order and suggests removing a redundant assertion.

Comment thread tests/test_manifest_fixture_families.py Outdated
manifest = _load_json(MANIFEST_PATH)
fixtures = manifest["fixtures"]
assert isinstance(fixtures, list)
return sorted(fixtures, key=lambda entry: (str(entry["family"]), str(entry["degradation_level"]), str(entry["fixture_id"])))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Sorting degradation_level alphabetically is brittle. This works for the current levels, but if a new level is added that doesn't fit the alphabetical order (e.g., critical), the sorting will be incorrect. It's more robust to sort based on the order defined in REQUIRED_LEVELS.

Suggested change
return sorted(fixtures, key=lambda entry: (str(entry["family"]), str(entry["degradation_level"]), str(entry["fixture_id"])))
return sorted(fixtures, key=lambda entry: (str(entry["family"]), REQUIRED_LEVELS.index(str(entry["degradation_level"])), str(entry["fixture_id"])))

Comment thread tests/test_manifest_fixture_families.py Outdated
grouped: dict[str, list[dict[str, object]]] = defaultdict(list)
for entry in entries:
grouped[str(entry["family"])].append(entry)
return {family: sorted(grouped[family], key=lambda entry: str(entry["degradation_level"])) for family in sorted(grouped)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the sorting in _load_manifest_entries, sorting degradation_level alphabetically here is brittle. For robustness, it's better to use the explicit order from REQUIRED_LEVELS to ensure correctness if new levels are added in the future.

Suggested change
return {family: sorted(grouped[family], key=lambda entry: str(entry["degradation_level"])) for family in sorted(grouped)}
return {family: sorted(grouped[family], key=lambda entry: REQUIRED_LEVELS.index(str(entry["degradation_level"]))) for family in sorted(grouped)}

Comment thread tests/test_manifest_fixture_families.py Outdated
expected_failure_labels = sorted(severe["expected_failure_labels"])
observed_failure_labels = sorted({result.failure_label for result in severe_results if result.failure_label is not None})
assert observed_failure_labels == expected_failure_labels
assert set(observed_failure_labels).issubset(set(expected_failure_labels))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This assertion is redundant because the check on the previous line (assert observed_failure_labels == expected_failure_labels) is stricter and already guarantees equality. If the sorted lists are identical, the set of observed labels is guaranteed to be a subset of the expected ones. This line can be safely removed.

@ProfRandom92 ProfRandom92 merged commit 90a0114 into main May 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant