From ca18ad69836215eeba9c2de99075c9900c916e0d Mon Sep 17 00:00:00 2001 From: YMuskrat <101849520+YMuskrat@users.noreply.github.com> Date: Sun, 18 Oct 2026 23:53:23 +0100 Subject: [PATCH 1/2] Keep quality score thresholds after policy changes Signed-off-by: YMuskrat --- CHANGELOG.md | 2 + src/skillevaluator/models/result.py | 31 +++- .../validators/quality_score.py | 4 +- tests/test_quality_policy_gate.py | 174 ++++++++++++++++++ 4 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 tests/test_quality_policy_gate.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e2412f69c..d62c63117 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,6 +132,8 @@ All notable changes to SkillEvaluator are documented in this file. ### Fixed +- Changing finding severities through a policy no longer clears an independent + quality-score threshold failure. A score below `--min-score` still fails. - Tier 3 now uses one versioned, equal-weight five-dimension overall-score policy across Harbor rewards, pass@k, Skill Lift, reports, comparisons, and best-agent selection. Previously, some paths averaged all six evaluators diff --git a/src/skillevaluator/models/result.py b/src/skillevaluator/models/result.py index 1cfb8db47..ede11b9f1 100644 --- a/src/skillevaluator/models/result.py +++ b/src/skillevaluator/models/result.py @@ -285,6 +285,14 @@ def incomplete_scans(self) -> list[str]: return [] return [name for name in value if isinstance(name, str) and name] + @property + def gate_failures(self) -> list[str]: + """Failed requirements independent of finding severity, such as a minimum score.""" + value = self.metadata.get("gate_failures") + if not isinstance(value, list): + return [] + return [message for message in value if isinstance(message, str) and message] + @property def is_incomplete(self) -> bool: """Whether required validation evidence is missing or unusable.""" @@ -415,12 +423,16 @@ def recalculate_from_findings(self) -> None: Call after mutating finding severities (e.g. LLM verification downgrade) so that result state is consistent with the actual finding objects. + Independent gate failures remain errors regardless of those severities. """ self.errors.clear() self.warnings.clear() self.passed = not self.is_incomplete self.summary.reset_finding_counts() + for message in self.gate_failures: + self.add_error(message) + for finding in self.findings: sev = ( finding.severity if isinstance(finding.severity, Severity) else Severity(str(finding.severity).lower()) @@ -454,6 +466,14 @@ def add_warning(self, message: str) -> None: self.warnings.append(message) self.summary.warnings += 1 + def fail_gate(self, message: str) -> None: + """Record a failed requirement that severity overrides cannot waive.""" + failures = self.gate_failures + if message not in failures: + failures.append(message) + self.metadata["gate_failures"] = failures + self.add_error(message) + def add_message(self, message: str) -> None: """Add an informational message. @@ -487,9 +507,12 @@ def merge(self, other: ValidationResult) -> None: # dict.update would let one sub-result's incomplete_scans clobber # another's (e.g. bandit and semgrep both failing); concatenate. incomplete = list(dict.fromkeys([*self.incomplete_scans, *other.incomplete_scans])) + gate_failures = [*self.gate_failures, *other.gate_failures] self.metadata.update(other.metadata) if incomplete: self.metadata["incomplete_scans"] = incomplete + if gate_failures: + self.metadata["gate_failures"] = gate_failures # Merge summary self.summary.files_scanned += other.summary.files_scanned @@ -538,6 +561,9 @@ def merge_with_prefix(self, other: ValidationResult, prefix: str) -> None: incomplete = list(dict.fromkeys([*self.incomplete_scans, *other.incomplete_scans])) if incomplete: self.metadata["incomplete_scans"] = incomplete + gate_failures = [*self.gate_failures, *(f"[{prefix}] {message}" for message in other.gate_failures)] + if gate_failures: + self.metadata["gate_failures"] = gate_failures # Merge summary self.summary.errors += other.summary.errors @@ -545,7 +571,7 @@ def merge_with_prefix(self, other: ValidationResult, prefix: str) -> None: def to_dict(self) -> dict: """Convert to dictionary for JSON serialization.""" - return { + result = { "validator": self.validator_name, "description": self.validator_description, "passed": self.passed, @@ -555,3 +581,6 @@ def to_dict(self) -> dict: "findings": [f.to_dict() for f in self.findings], "success_details": [s.to_dict() for s in self.success_details], } + if self.gate_failures: + result["gate_failures"] = self.gate_failures + return result diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index d62e37d64..30a897245 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -315,7 +315,9 @@ def _validate_single_skill(self, skill_path: Path) -> ValidationResult: # Determine pass/fail based on min_score if qs.overall_score < self.min_score: - result.passed = False + result.fail_gate( + f"Quality score {qs.overall_score:.1f}/100 is below the required {self.min_score}/100 in {manifest}" + ) result.metadata["quality_scores"] = qs.to_dict() diff --git a/tests/test_quality_policy_gate.py b/tests/test_quality_policy_gate.py new file mode 100644 index 000000000..aa6191c0f --- /dev/null +++ b/tests/test_quality_policy_gate.py @@ -0,0 +1,174 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Quality thresholds remain binding when policies reclassify findings.""" + +from pathlib import Path + +import pytest +from click.testing import CliRunner + +from skillevaluator.cli import cli +from skillevaluator.models.result import Finding, Severity, ValidationResult +from skillevaluator.validators.policy import ValidationPolicy, apply_policy +from skillevaluator.validators.quality_score import QualityScoreValidator + + +@pytest.fixture +def below_threshold_skill(tmp_path: Path) -> Path: + skill = tmp_path / "minimal-skill" + skill.mkdir() + (skill / "SKILL.md").write_text( + "---\n" + "name: minimal-skill\n" + "description: I can handle various things and stuff for your data documents and projects. " + "This general tool processes files and helps your workflow.\n" + "---\n" + "Short content.\n\n" + "## Instructions\n\n" + "The paradigm is synergy and awareness.\n", + encoding="utf-8", + ) + return skill + + +def test_raising_efficiency_severity_keeps_cli_minimum_score_failure( + below_threshold_skill: Path, tmp_path: Path +) -> None: + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill) + assert result.metadata["quality_scores"]["overall_score"] == 67.8 + assert not result.passed + policy = tmp_path / "stricter-policy.yaml" + policy.write_text("severity_overrides:\n QUALITY.quality_efficiency: medium\n", encoding="utf-8") + args = [ + "validate", + str(below_threshold_skill), + "--tiers", + "1", + "--checks", + "quality", + "--no-llm", + "-r", + "cli", + "-o", + str(tmp_path / "reports"), + ] + + runner = CliRunner() + default = runner.invoke(cli, args) + stricter = runner.invoke(cli, [*args, "--policy", str(policy)]) + + assert default.exit_code == 1, default.output + assert stricter.exit_code == 1, stricter.output + assert "[PASS] All validations passed" not in stricter.output + assert "67.8/100 is below the required 70/100" in stricter.output + + +def test_quality_minimum_survives_recalculation(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill) + errors = list(result.errors) + + result.recalculate_from_findings() + result.recalculate_from_findings() + + assert not result.passed + assert result.errors == errors + assert result.summary.errors == 1 + assert result.to_dict()["gate_failures"] == result.gate_failures + + +def test_lowering_all_quality_severities_does_not_disable_minimum(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill) + + apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.*": Severity.INFO})) + + assert not result.passed + + +@pytest.mark.parametrize("merge_method", ["merge", "merge_with_prefix"]) +def test_quality_minimum_survives_merged_results(below_threshold_skill: Path, merge_method: str) -> None: + parent = ValidationResult() + for min_score in (70, 80): + child = QualityScoreValidator(min_score=min_score).validate(below_threshold_skill) + if merge_method == "merge_with_prefix": + parent.merge_with_prefix(child, "minimal-skill") + else: + parent.merge(child) + + apply_policy([parent], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM})) + + assert not parent.passed + assert len(parent.gate_failures) == 2 + assert parent.summary.errors == 2 + assert "required 70/100" in parent.errors[0] + assert "required 80/100" in parent.errors[1] + + +def test_folder_average_does_not_hide_a_skill_below_minimum(below_threshold_skill: Path) -> None: + good_skill = below_threshold_skill.parent / "good-skill" + good_skill.mkdir() + (good_skill / "SKILL.md").write_text( + "---\n" + "name: good-skill\n" + "description: Converts CSV documents to JSON. Use when converting tabular files.\n" + "version: 1.0.0\n" + "metadata:\n" + " author: Test User \n" + " tags: [csv, json]\n" + "---\n" + "## Purpose\n\nConvert tabular data.\n\n" + "## Instructions\n\n1. Read the input file.\n2. Write the JSON output.\n\n" + "## Examples\n\n```text\ninput.csv -> output.json\n```\n\n" + "## Prerequisites\n\nNone.\n\n" + "## Limitations\n\nOnly CSV files are supported.\n\n" + "## Troubleshooting\n\nReport invalid input errors.\n", + encoding="utf-8", + ) + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill.parent) + assert result.metadata["quality_scores"]["overall_score"] > 70 + + apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM})) + + assert not result.passed + assert len(result.gate_failures) == 1 + assert result.gate_failures[0].startswith("[minimal-skill]") + + +def test_minimum_below_score_still_passes_after_policy(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=67).validate(below_threshold_skill) + + apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.quality_efficiency": Severity.MEDIUM})) + + assert result.passed + assert "gate_failures" not in result.to_dict() + + +def test_quality_severity_waiver_still_passes_when_score_is_above_minimum(below_threshold_skill: Path) -> None: + manifest = below_threshold_skill / "SKILL.md" + manifest.write_text(manifest.read_text(encoding="utf-8").replace("name: minimal-skill", "name: Bad_Name")) + result = QualityScoreValidator(min_score=0).validate(below_threshold_skill) + assert not result.passed + assert result.metadata["quality_scores"]["overall_score"] > 0 + + apply_policy([result], ValidationPolicy(severity_overrides={"QUALITY.*": Severity.INFO})) + + assert result.passed + assert result.errors == [] + + +def test_policy_can_still_clear_a_severity_based_failure() -> None: + result = ValidationResult(validator_name="SCHEMA") + result.add_finding( + Finding( + category="SCHEMA", + severity=Severity.HIGH, + check_name="author_missing", + message="Missing author", + file_path="SKILL.md", + ) + ) + + apply_policy([result], ValidationPolicy(severity_overrides={"SCHEMA.author_missing": Severity.INFO})) + + assert result.passed + assert result.errors == [] From 9411e1fa1515e86dc7e3da6e1403836ef1c0f660 Mon Sep 17 00:00:00 2001 From: YMuskrat <101849520+YMuskrat@users.noreply.github.com> Date: Mon, 19 Oct 2026 13:20:14 +0100 Subject: [PATCH 2/2] Show independent quality gate failures across reports Surface gate failures in the default terminal view, Tier 1 HTML, BENCHMARK.md, and JSON. Normalize ANSI output in the CLI regression test and cover reporter visibility, escaping, redaction, and limits. Signed-off-by: YMuskrat --- CHANGELOG.md | 3 +- src/skillevaluator/reporting/benchmark.py | 17 ++- src/skillevaluator/reporting/console_ui.py | 12 +- src/skillevaluator/reporting/json_reporter.py | 3 + .../reporting/templates/report.html.j2 | 5 +- tests/reporting/test_quality_gate_reports.py | 138 ++++++++++++++++++ tests/test_quality_policy_gate.py | 35 ++++- 7 files changed, 203 insertions(+), 10 deletions(-) create mode 100644 tests/reporting/test_quality_gate_reports.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d62c63117..e549071d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,7 +133,8 @@ All notable changes to SkillEvaluator are documented in this file. ### Fixed - Changing finding severities through a policy no longer clears an independent - quality-score threshold failure. A score below `--min-score` still fails. + quality-score threshold failure. A score below `--min-score` still fails, + and its reason appears in the terminal, HTML, benchmark, and JSON reports. - Tier 3 now uses one versioned, equal-weight five-dimension overall-score policy across Harbor rewards, pass@k, Skill Lift, reports, comparisons, and best-agent selection. Previously, some paths averaged all six evaluators diff --git a/src/skillevaluator/reporting/benchmark.py b/src/skillevaluator/reporting/benchmark.py index 44eb7534b..12405c54b 100644 --- a/src/skillevaluator/reporting/benchmark.py +++ b/src/skillevaluator/reporting/benchmark.py @@ -522,10 +522,23 @@ def _render_findings( for finding, result in findings_with_result if not result.passed or finding.severity.value in {"critical", "high"} ] + gate_failures = [ + (result.validator_name, message) + for result in results + if not result.passed + for message in result.gate_failures + ] - if blocking: + if gate_failures or blocking: lines.extend(["## Blocking Findings", ""]) - for finding in _top_findings(blocking, limit=self.max_findings_shown): + shown_gates = gate_failures[: max(0, self.max_findings_shown)] + for validator, message in shown_gates: + lines.append( + f"- **GATE** {_publication_safe_inline(validator, private_labels)}: " + f"{_publication_safe_inline(message, private_labels)}" + ) + remaining_slots = max(0, self.max_findings_shown - len(shown_gates)) + for finding in _top_findings(blocking, limit=remaining_slots): lines.append(_finding_line(finding, private_labels)) lines.append("") diff --git a/src/skillevaluator/reporting/console_ui.py b/src/skillevaluator/reporting/console_ui.py index 3375f0ea1..9ba42f675 100644 --- a/src/skillevaluator/reporting/console_ui.py +++ b/src/skillevaluator/reporting/console_ui.py @@ -879,6 +879,8 @@ def summarize_tier3(result: ValidationResult) -> tuple[bool, bool, list[TierRow] def _first_error(result: ValidationResult) -> str: + if result.gate_failures: + return result.gate_failures[0] for finding in result.findings: severity = getattr(finding.severity, "value", str(finding.severity)).lower() if severity in ("critical", "high"): @@ -893,8 +895,8 @@ def _first_error(result: ValidationResult) -> str: def first_fix(results: list[ValidationResult]) -> list[tuple[str, str]] | None: """The single most actionable fix: the gating finding's suggestion. - Prefers critical/high findings (the ones that actually failed the gate) - over advisory-severity ones, and trims to one terse directive line. + Prefers independent gate failures, then critical/high findings over + advisory-severity ones, and trims to one terse directive line. """ severity_rank = {"critical": 0, "high": 1, "medium": 2, "low": 3} @@ -905,8 +907,10 @@ def rank(finding) -> int: for result in results: if result.passed or _is_skipped(result): continue - for finding in sorted(result.findings, key=rank): - text = finding.suggestion or finding.message + for text in [ + *result.gate_failures, + *(finding.suggestion or finding.message for finding in sorted(result.findings, key=rank)), + ]: if text: text = text.split(". ")[0].strip().rstrip(".") if len(text) > 150: diff --git a/src/skillevaluator/reporting/json_reporter.py b/src/skillevaluator/reporting/json_reporter.py index 31bb2bf00..2e9fac9d2 100644 --- a/src/skillevaluator/reporting/json_reporter.py +++ b/src/skillevaluator/reporting/json_reporter.py @@ -296,6 +296,9 @@ def _result_to_dict(self, result: ValidationResult) -> dict[str, Any]: }, } + if result.gate_failures: + data["gate_failures"] = result.gate_failures + # Quality scores (from QualityScoreValidator) coverage = result.metadata.get("dependency_coverage") if isinstance(coverage, list): diff --git a/src/skillevaluator/reporting/templates/report.html.j2 b/src/skillevaluator/reporting/templates/report.html.j2 index 269a3f604..de645760d 100644 --- a/src/skillevaluator/reporting/templates/report.html.j2 +++ b/src/skillevaluator/reporting/templates/report.html.j2 @@ -1907,6 +1907,9 @@ {% endif %} {% else %}
+ {% for error in result | additional_errors %} +
{{ error }}
+ {% endfor %} {% if result.findings %}{% for finding in result.findings %}
@@ -1920,7 +1923,7 @@ {% if finding.line_content %}
{{ finding.line_content | truncate(200) }}
{% endif %} {% if finding.suggestion %}
Suggestion: {{ finding.suggestion }}
{% endif %}
- {% endfor %}{% elif result.errors %}{% for error in result.errors %}
{{ error }}
{% endfor %}{% endif %} + {% endfor %}{% endif %}
{% endif %}
diff --git a/tests/reporting/test_quality_gate_reports.py b/tests/reporting/test_quality_gate_reports.py new file mode 100644 index 000000000..8b2e8cfd7 --- /dev/null +++ b/tests/reporting/test_quality_gate_reports.py @@ -0,0 +1,138 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Independent quality failures remain visible alongside structured findings.""" + +import html +import re + +import pytest + +from skillevaluator.models import Finding, Severity, ValidationResult +from skillevaluator.reporting import BenchmarkReporter, HTMLReporter + +_GATE_MESSAGE = "Quality score 67.8/100 is below the required 70/100 in SKILL.md" + + +def _quality_result() -> ValidationResult: + result = ValidationResult(validator_name="QUALITY") + result.fail_gate(_GATE_MESSAGE) + return result + + +def _add_finding(result: ValidationResult, severity: Severity, message: str) -> None: + result.add_finding( + Finding( + category="QUALITY", + severity=severity, + check_name="quality_efficiency", + message=message, + file_path="SKILL.md", + ) + ) + + +def _blocking_section(output: str) -> str: + return output.split("## Blocking Findings\n\n", 1)[1].split("\n## ", 1)[0] + + +@pytest.mark.parametrize("with_findings", [False, True]) +def test_html_shows_gate_without_repeating_finding_errors(with_findings: bool) -> None: + result = _quality_result() + if with_findings: + _add_finding(result, Severity.MEDIUM, "Advisory quality observation") + _add_finding(result, Severity.HIGH, "Blocking quality finding") + + output = HTMLReporter().render(result) + messages = [ + html.unescape(message) + for message in re.findall(r'(.*?)', output, re.DOTALL) + ] + + expected = [_GATE_MESSAGE] + if with_findings: + expected.extend(["Advisory quality observation", "Blocking quality finding"]) + assert messages == expected + + +def test_html_escapes_gate_error_text() -> None: + result = ValidationResult(validator_name="QUALITY") + result.fail_gate("Quality score is below & requires review") + + output = HTMLReporter().render(result) + + assert 'Quality score is below <minimum> & requires review' in output + + +@pytest.mark.parametrize("with_findings", [False, True]) +def test_benchmark_lists_gate_before_findings(with_findings: bool) -> None: + result = _quality_result() + if with_findings: + _add_finding(result, Severity.MEDIUM, "Advisory quality observation") + + output = BenchmarkReporter(include_timestamp=False).render(result) + blocking = _blocking_section(output) + + assert blocking.startswith(f"- **GATE** QUALITY: {_GATE_MESSAGE}\n") + assert blocking.count(_GATE_MESSAGE) == 1 + if with_findings: + assert blocking.index(_GATE_MESSAGE) < blocking.index("Advisory quality observation") + + +def test_benchmark_prioritizes_gates_within_blocking_findings_limit() -> None: + result = _quality_result() + result.fail_gate("Second required quality check failed") + result.fail_gate("Third required quality check failed") + _add_finding(result, Severity.CRITICAL, "Critical quality finding") + + output = BenchmarkReporter(include_timestamp=False, max_findings_shown=2).render(result) + blocking = _blocking_section(output) + + assert len([line for line in blocking.splitlines() if line.startswith("- ")]) == 2 + assert _GATE_MESSAGE in blocking + assert "Second required quality check failed" in blocking + assert "Third required quality check failed" not in blocking + assert "Critical quality finding" not in blocking + assert "Critical quality finding" in output + + +def test_benchmark_shares_limit_between_gates_and_findings() -> None: + finding_result = ValidationResult(validator_name="QUALITY") + _add_finding(finding_result, Severity.HIGH, "High quality finding") + _add_finding(finding_result, Severity.CRITICAL, "Critical quality finding") + + output = BenchmarkReporter(include_timestamp=False, max_findings_shown=2).render_all( + [finding_result, _quality_result()] + ) + blocking = _blocking_section(output) + + assert len([line for line in blocking.splitlines() if line.startswith("- ")]) == 2 + assert blocking.index(_GATE_MESSAGE) < blocking.index("Critical quality finding") + assert "High quality finding" not in blocking + + +@pytest.mark.parametrize( + "private_path", + ["/Users/private/catalog/SKILL.md", "/home/private/catalog/SKILL.md", r"C:\Users\private\catalog\SKILL.md"], +) +def test_benchmark_sanitizes_gate_messages_for_publication(private_path: str) -> None: + private_environment = "private-evaluation-runner" + result = ValidationResult(validator_name="QUALITY ") + result.fail_gate( + f"Quality score is below the required minimum in {private_path}; " + f"review
[policy](https://example.invalid) on {private_environment}" + ) + tier3 = ValidationResult(validator_name="AGENT_EVAL") + tier3.metadata["agent_eval"] = {"summary": {"environment": private_environment}} + + output = BenchmarkReporter(include_timestamp=False).render_all([result, tier3]) + blocking = _blocking_section(output) + + assert "Quality score is below the required minimum" in blocking + assert "SKILL.md" in blocking + assert private_path not in output + assert private_environment not in output + assert "Isolated sandbox" in blocking + assert "QUALITY <threshold>" in blocking + assert "<details>" in blocking + assert r"\[policy\](https://example.invalid)" in blocking diff --git a/tests/test_quality_policy_gate.py b/tests/test_quality_policy_gate.py index aa6191c0f..077f8243a 100644 --- a/tests/test_quality_policy_gate.py +++ b/tests/test_quality_policy_gate.py @@ -3,6 +3,7 @@ """Quality thresholds remain binding when policies reclassify findings.""" +import json from pathlib import Path import pytest @@ -10,6 +11,9 @@ from skillevaluator.cli import cli from skillevaluator.models.result import Finding, Severity, ValidationResult +from skillevaluator.reporting.console_ui import first_fix, summarize_tier1 +from skillevaluator.reporting.json_reporter import JSONReporter +from skillevaluator.utils.rich_markup import strip_terminal_controls from skillevaluator.validators.policy import ValidationPolicy, apply_policy from skillevaluator.validators.quality_score import QualityScoreValidator @@ -60,8 +64,35 @@ def test_raising_efficiency_severity_keeps_cli_minimum_score_failure( assert default.exit_code == 1, default.output assert stricter.exit_code == 1, stricter.output - assert "[PASS] All validations passed" not in stricter.output - assert "67.8/100 is below the required 70/100" in stricter.output + output = strip_terminal_controls(stricter.output) + assert "[PASS] All validations passed" not in output + assert "67.8/100 is below the required 70/100" in output + + +def test_pipeline_explains_minimum_score_failure(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill) + passed, rows = summarize_tier1([result]) + + assert not passed + failure_row = next(row for row in rows if row.label == "failed") + assert result.gate_failures[0] in "".join(text for text, _style in failure_row.segments) + fix = first_fix([result]) + assert fix is not None + assert "67.8/100 is below the required 70/100" in fix[0][0] + + +def test_json_report_includes_minimum_score_failure(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=70).validate(below_threshold_skill) + data = json.loads(JSONReporter().render_all([result])) + + assert data["results"][0]["gate_failures"] == result.gate_failures + + +def test_json_report_omits_gate_failures_when_minimum_is_met(below_threshold_skill: Path) -> None: + result = QualityScoreValidator(min_score=67).validate(below_threshold_skill) + data = json.loads(JSONReporter().render_all([result])) + + assert "gate_failures" not in data["results"][0] def test_quality_minimum_survives_recalculation(below_threshold_skill: Path) -> None: