From b5618cadc6d1c3f1ea102ec800ace436a64c225b Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 20:44:33 -0800 Subject: [PATCH 01/11] fix(tier1): keep the hook gate failure ahead of an incomplete scan under a policy override The gate failure for hooks SkillSpector cannot model is meant to keep the security check failed whatever a --policy severity override does. The reported status only put a blocking finding or confirmed_failure ahead of an incomplete scan. When an override lowered the Critical and another gap, such as the SkillSpector v2.13.4 parse-limit row for a hook "timeout" key, recorded the scan as incomplete, the check was reported as INCOMPLETE although its gate failure stood. The hook gate now also marks the result as a confirmed failure, and a folder merge keeps that mark from each skill. Other gate failures, such as the error for the remaining incomplete analysis, do not set it, so a scan that is only incomplete stays INCOMPLETE. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- src/skillevaluator/models/result.py | 4 ++ src/skillevaluator/validators/security.py | 5 ++ tests/reporting/test_shared_run_status.py | 20 ++++++ .../test_skillspector_hook_surface.py | 66 +++++++++++++++++-- 4 files changed, 90 insertions(+), 5 deletions(-) diff --git a/src/skillevaluator/models/result.py b/src/skillevaluator/models/result.py index e3ee89a08..304e45280 100644 --- a/src/skillevaluator/models/result.py +++ b/src/skillevaluator/models/result.py @@ -750,6 +750,10 @@ def merge_with_prefix(self, other: ValidationResult, prefix: str) -> None: gate_failures = [*self.gate_failures, *(f"[{prefix}] {message}" for message in other.gate_failures)] if gate_failures: self.metadata["gate_failures"] = gate_failures + # A member's confirmed failure outranks an incomplete scan in the + # merged result's reported status, as it does in the member's own. + if other.metadata.get("confirmed_failure") is True: + self.metadata["confirmed_failure"] = True if scanners := {**self.scanners, **other.scanners}: self.metadata["scanners"] = scanners # Keep each skill's unparsed files, prefixed like errors and findings so diff --git a/src/skillevaluator/validators/security.py b/src/skillevaluator/validators/security.py index b8e505ba3..6c1a624ba 100644 --- a/src/skillevaluator/validators/security.py +++ b/src/skillevaluator/validators/security.py @@ -5217,6 +5217,11 @@ def _report_unverified_hooks( result.fail_gate( f"{manifest}: SkillSpector could not model these hooks; this check cannot pass while they are present" ) + # The gate is a confirmed failure, so it outranks another gap that + # records the scan as incomplete, also when a --policy override + # lowers the Critical. Other gate failures, such as the residual + # incomplete-analysis error, do not set this. + result.metadata["confirmed_failure"] = True manifests.append(manifest) return manifests diff --git a/tests/reporting/test_shared_run_status.py b/tests/reporting/test_shared_run_status.py index f44d8c58c..77242512c 100644 --- a/tests/reporting/test_shared_run_status.py +++ b/tests/reporting/test_shared_run_status.py @@ -100,6 +100,26 @@ def test_confirmed_legacy_failure_survives_separate_missing_evidence(): assert status.of(result) == Status.FAILED +def test_confirmed_failure_survives_a_folder_merge(): + """A folder keeps a member's confirmed failure; a member's gate failure alone stays missing evidence.""" + confirmed = ValidationResult(validator_name="Security Scan") + confirmed.fail_gate("hooks/hooks.json: these hooks cannot pass this check") + confirmed.metadata["confirmed_failure"] = True + confirmed.mark_scan_incomplete("scanner") + incomplete = ValidationResult(validator_name="Security Scan") + incomplete.fail_gate("scanner reports incomplete analysis") + incomplete.mark_scan_incomplete("scanner") + + for members, expected in (((confirmed, incomplete), Status.FAILED), ((incomplete,), Status.INCOMPLETE)): + folder = ValidationResult(validator_name="Security Scan") + for index, member in enumerate(members): + folder.merge_with_prefix(member, f"skill-{index}") + status = resolve_run_status([folder]) + assert status.of(folder) == expected + assert status.headline == expected + assert status.missing == ("scanner",) + + def test_missing_scanner_process_error_alone_remains_incomplete(): result = ValidationResult(validator_name="Scanner") result.add_error("The scanner produced no trustworthy report") diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 6afcfe3f6..99e75eac4 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -49,6 +49,7 @@ import pytest +from skillevaluator.reporting.json_reporter import JSONReporter from skillevaluator.reporting.run_status import Status, resolve_run_status from skillevaluator.utils.tool_runner import ToolResult from skillevaluator.validators.base import Severity, ValidationResult @@ -456,20 +457,41 @@ def test_hooks_fail_with_a_critical_instead_of_an_incomplete_scan( pytest.param({"SECURITY.*": Severity.LOW}, id="security-low"), ], ) + @pytest.mark.parametrize( + ("name", "build"), + [ + pytest.param(_PLUGIN_REPORT, _plugin, id="complete"), + # The v2.13.4 parse-limit row records the scan as incomplete. + pytest.param(_TIMEOUT_REPORT, _timeout_plugin, id="timeout-parse-limit"), + ], + ) @patch("skillevaluator.validators.security.Tools") def test_policy_overrides_cannot_pass_the_hooks( - self, mock_tools, tmp_path: Path, overrides: dict[str, Severity] + self, + mock_tools, + tmp_path: Path, + overrides: dict[str, Severity], + name: str, + build: Callable[[Path], Path], ) -> None: - root = _plugin(tmp_path) - result = _validate(mock_tools, root, _report(_PLUGIN_REPORT)) + """The gate failure keeps the check failed, also when another gap records the scan as incomplete.""" + root = build(tmp_path) + result = _validate(mock_tools, root, _report(name)) apply_policy([result], ValidationPolicy(severity_overrides=overrides)) [finding] = _unverified(result) assert finding.severity in {Severity.INFO, Severity.LOW} assert not result.passed - assert result.status == "failed" - assert result.errors == [_gate("hooks/hooks.json")] + assert result.errors.count(_gate("hooks/hooks.json")) == 1 + if name == _TIMEOUT_REPORT: + _assert_failed_with_incomplete_scan(result) + else: + assert result.status == "failed" + assert result.errors == [_gate("hooks/hooks.json")] + assert resolve_run_status([result]).of(result) == Status.FAILED + exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) + assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") @patch("skillevaluator.validators.security.Tools") def test_llm_verification_cannot_downgrade_the_hook_critical(self, mock_tools, tmp_path: Path) -> None: @@ -735,6 +757,38 @@ def test_hooks_beside_a_missing_reference_in_a_folder_scan_stay_incomplete( f"[{name}] .claude/settings.json" for name in ("a", "b") ] + @pytest.mark.parametrize("method", ["validate_security_only", "validate"]) + @patch("skillevaluator.validators.security.Tools") + def test_a_policy_override_keeps_a_folder_scan_failed_beside_a_missing_reference( + self, mock_tools, tmp_path: Path, method: str + ) -> None: + """Each skill's gate failure is a confirmed failure that the folder result keeps. + + A ``--policy`` override lowers each Critical, and each skill's + reference row records the scan as incomplete, but the check is still + reported as failed, not as a scan that did not run. + """ + folder = tmp_path / "folder" + for name in ("a", "b"): + _write(folder / name, {**_SETTINGS_SKILL, "SKILL.md": _SETTINGS_MISSING_REFERENCE_SKILL_MD}) + report = _report(_settings_missing_reference_report("2.13.4")) + mock_tools.skillspector.is_available = True + mock_tools.skillspector.run.return_value = ToolResult( + success=True, stdout=json.dumps(report), stderr="", exit_code=0 + ) + result = getattr(SecurityValidator(use_llm=False), method)(folder) + + overrides = {"SECURITY.skillspector_hook_payload_unverified": Severity.INFO} + apply_policy([result], ValidationPolicy(severity_overrides=overrides)) + + assert {finding.severity for finding in _unverified(result)} == {Severity.INFO} + assert [gate for gate in result.gate_failures if "could not model" in gate] == [ + f"[{name}] {_gate('.claude/settings.json')}" for name in ("a", "b") + ] + _assert_failed_with_incomplete_scan(result) + exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) + assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") + class TestPartlyReadManifests: @pytest.mark.parametrize( @@ -890,6 +944,8 @@ def test_rows_of_another_shape_stay_incomplete(self, mutate: Callable[[dict], No "skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): " f"{label}; security scan did not complete" ) + # The incomplete-analysis gate alone is missing evidence, not a confirmed failure. + assert resolve_run_status([result]).of(result) == Status.INCOMPLETE def test_fatal_row_is_not_trusted(self) -> None: report = _report(_PLUGIN_REPORT) From 02ab027026d96af0c0780eb7051f7561272bc879 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 20:47:48 -0800 Subject: [PATCH 02/11] fix(cli): show a confirmed failure beside an incomplete scan as failed in the validate verdict The final box of the compact validate view chose between "failed" and "didn't run" from is_incomplete alone. A Tier 1 security check with the hook gate failure and another gap, such as the SkillSpector v2.13.4 parse-limit row for a hook "timeout" key, was therefore shown as "Security Scan didn't run in Tier 1", while its own detail line, the Tier 1 card and the reports said it failed. With several failed checks, such a check was counted as one that didn't run. A check now counts as not run only when it is incomplete and its reported status is not FAIL, as on the other surfaces. A check that is only incomplete still reads "didn't run". Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- src/skillevaluator/cli.py | 11 ++- .../test_skillspector_hook_surface.py | 73 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.py index 825164fe6..fa3f6df37 100644 --- a/src/skillevaluator/cli.py +++ b/src/skillevaluator/cli.py @@ -1953,7 +1953,12 @@ def _finish_pipeline_view( from skillevaluator.reporting.console_ui import MUTED, Verdict, _is_skipped, first_fix from skillevaluator.reporting.harbor_viewer import harbor_job_links from skillevaluator.reporting.presentation import build_final_render_context - from skillevaluator.reporting.run_status import Status + from skillevaluator.reporting.run_status import Status, result_status + + def did_not_run(result: ValidationResult) -> bool: + # A confirmed failure, such as a blocking finding or the hook gate, + # outranks an incomplete scan in the same result, as in the reports. + return result.is_incomplete and result_status(result) is not Status.FAILED context = presentation_context or build_final_render_context( [ @@ -1993,7 +1998,7 @@ def _finish_pipeline_view( if len(failed) == 1: only = failed[0] tier_no = (only.metadata.get("gating") or {}).get("tier") - state = "didn't run" if only.is_incomplete else "failed" + state = "didn't run" if did_not_run(only) else "failed" headline = f"{only.validator_name or 'validation'} {state}" + ( f" in Tier {tier_no}" if tier_no is not None else "" ) @@ -2003,7 +2008,7 @@ def _finish_pipeline_view( by_tier.setdefault((result.metadata.get("gating") or {}).get("tier"), []).append(result) parts = [] for tier_no, results in by_tier.items(): - broken = sum(1 for r in results if not r.is_incomplete) + broken = sum(1 for r in results if not did_not_run(r)) counts = [ f"{broken} failed" if broken else "", f"{len(results) - broken} didn't run" if broken < len(results) else "", diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 99e75eac4..8bc37fafb 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -790,6 +790,79 @@ def test_a_policy_override_keeps_a_folder_scan_failed_beside_a_missing_reference assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") +def _compact_verdict(results: list[ValidationResult], tmp_path: Path) -> str: + """Render the compact ``validate`` view's final box for these Tier 1 results.""" + from io import StringIO + + from rich.console import Console + + from skillevaluator.cli import _finish_pipeline_view + from skillevaluator.reporting.console_ui import ValidateView + + output = StringIO() + view = ValidateView("demo", [(1, "Tier 1", "")], console=Console(file=output, width=200, color_system=None)) + _finish_pipeline_view( + view, + tier_gate_results=results, + tier3_result=None, + gate_failed=True, + output_dir=tmp_path, + basename="report", + report_formats=(), + target_path=tmp_path, + agent_eval=False, + ) + return output.getvalue() + + +class TestCompactValidateVerdict: + @pytest.mark.parametrize("policy", [False, True], ids=["no-policy", "hook-check-info"]) + @pytest.mark.parametrize("case", ["timeout-parse-limit", "folder-job-missing-reference"]) + @patch("skillevaluator.validators.security.Tools") + def test_the_verdict_says_the_check_failed_beside_another_gap( + self, mock_tools, tmp_path: Path, case: str, policy: bool + ) -> None: + """The final box names the hook gate failure as a failed check, not as a scan that did not run. + + The scan is recorded as incomplete, so publication eligibility stays + Incomplete, but the check's reported status is FAIL. + """ + if case == "timeout-parse-limit": + result = _validate(mock_tools, _timeout_plugin(tmp_path), _report(_TIMEOUT_REPORT)) + else: + folder = tmp_path / "folder" + root = _settings_missing_reference_skill(folder) + validator = SecurityValidator(use_llm=False, content_type="skill", target_root=folder) + result = _validate(mock_tools, root, _report(_settings_missing_reference_report("2.13.4")), validator) + if policy: + overrides = {"SECURITY.skillspector_hook_payload_unverified": Severity.INFO} + apply_policy([result], ValidationPolicy(severity_overrides=overrides)) + # As validate records a Tier 1 check. + result.validator_name = "Security Scan" + result.metadata["gating"] = {"tier": 1, "blocking": True} + _assert_failed_with_incomplete_scan(result) + + panel = _compact_verdict([result], tmp_path) + + assert "Security Scan failed in Tier 1" in panel + assert "didn't run" not in panel + assert "Publication eligibility: Incomplete" in panel + + @patch("skillevaluator.validators.security.Tools") + def test_the_verdict_counts_the_check_as_failed_beside_one_that_did_not_run( + self, mock_tools, tmp_path: Path + ) -> None: + result = _validate(mock_tools, _timeout_plugin(tmp_path), _report(_TIMEOUT_REPORT)) + result.validator_name = "Security Scan" + result.metadata["gating"] = {"tier": 1, "blocking": True} + missing = ValidationResult(validator_name="Code Risk", metadata={"gating": {"tier": 1, "blocking": True}}) + missing.mark_scan_incomplete("bandit") + + panel = _compact_verdict([result, missing], tmp_path) + + assert "Tier 1: 1 failed, 1 didn't run" in panel + + class TestPartlyReadManifests: @pytest.mark.parametrize( ("version", "case"), From 960cbd99c433861c80958c138580326f0ee0cd98 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 20:50:51 -0800 Subject: [PATCH 03/11] fix(tier1): put the plugin member directory before AE1 reference lines A plugin scan maps each declared skill's results back to the plugin with _attribute_scan_result, which rewrote file_path and the grouped occurrences but not skillspector_occurrences. An AE1 finding then had file_path skills/perl-helper/SKILL.md while its reference lines still named SKILL.md, so the exported lines did not match the finding's own path, as they do for a folder of skills. The reference lines now get the member directory like the other paths. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- src/skillevaluator/tier1/plugin_checks.py | 16 ++++++---- .../test_skillspector_reference_summary.py | 30 +++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/skillevaluator/tier1/plugin_checks.py b/src/skillevaluator/tier1/plugin_checks.py index 350863bd3..a7b216dd5 100644 --- a/src/skillevaluator/tier1/plugin_checks.py +++ b/src/skillevaluator/tier1/plugin_checks.py @@ -191,12 +191,16 @@ def _attribute_scan_result(result: ValidationResult, unit: str, view: Path, root location = Path(finding.file_path) if finding.file_path and not location.is_absolute() and not finding.file_path.startswith(("<", "[")): finding.file_path = (Path(unit) / location).as_posix() - occurrences = finding.metadata.get("occurrences", []) - for occurrence in occurrences if isinstance(occurrences, list) else []: - if isinstance(occurrence, dict) and isinstance(occurrence.get("file"), str): - file = Path(occurrence["file"]) - if not file.is_absolute(): - occurrence["file"] = (Path(unit) / file).as_posix() + # Grouped repeats (occurrences) and the reference lines of a + # SkillSpector AE1 finding (skillspector_occurrences) name files + # like file_path, so they get the same member directory. + for key in ("occurrences", "skillspector_occurrences"): + occurrences = finding.metadata.get(key, []) + for occurrence in occurrences if isinstance(occurrences, list) else []: + if isinstance(occurrence, dict) and isinstance(occurrence.get("file"), str): + file = Path(occurrence["file"]) + if not file.is_absolute(): + occurrence["file"] = (Path(unit) / file).as_posix() _rebase(result, view, root / unit) diff --git a/tests/reporting/test_skillspector_reference_summary.py b/tests/reporting/test_skillspector_reference_summary.py index 10d503c80..c9372505f 100644 --- a/tests/reporting/test_skillspector_reference_summary.py +++ b/tests/reporting/test_skillspector_reference_summary.py @@ -214,6 +214,36 @@ def test_folder_reference_lines_name_their_skill(tmp_path: Path, monkeypatch: py } == {"scripts/helper.pl"} +def test_plugin_member_reference_lines_name_their_directory(tmp_path: Path) -> None: + """A plugin scan puts the declared skill's directory before each reference line, like the finding's own path.""" + from skillevaluator.tier1.plugin_checks import _attribute_scan_result + + view = tmp_path / "view" / "perl-helper" + _write_skill(view) + result = ValidationResult(validator_name="Security Scan") + report = json.loads(_REPORT.read_text(encoding="utf-8")) + SecurityValidator(use_llm=False)._process_skillspector_cli_result(report, result, source_root=view) + + _attribute_scan_result(result, "skills/perl-helper", view, tmp_path / "plugin") + + exported = json.loads(JSONReporter(include_timestamp=False).render(result)) + located = sorted( + (finding["file_path"], finding["line_number"], finding["metadata"]["skillspector_occurrences"]) + for finding in exported["findings"] + if finding["check_name"].endswith("(AE1)") + ) + assert located == [ + ("skills/perl-helper/SKILL.md", line, [{"file": "skills/perl-helper/SKILL.md", "start_line": line}]) + for line in (6, 8) + ] + # The referenced file stays relative to the skill, as in a folder. + assert { + finding["metadata"]["skillspector_evidence"]["target_path"] + for finding in exported["findings"] + if finding["check_name"].endswith("(AE1)") + } == {"scripts/helper.pl"} + + def test_a_cut_occurrence_list_is_a_lower_bound(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: result = _validate(tmp_path, monkeypatch, skills=("alpha", "beta"), lines=129) From b89f1d3a233f3abc272ee8d95f70e4da2a268930 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 20:51:04 -0800 Subject: [PATCH 04/11] docs(tier1): describe the hook gate under a policy override and plugin reference lines The tier1 docs and the unreleased CHANGELOG entries now say that the hook gate failure keeps the check FAIL beside another gap also when a --policy override lowers the Critical, that the compact validate verdict says the check failed, and that a plugin's AE1 reference lines name the declared skill's directory. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 20 ++++++++++++-------- docs/tier1-validation.mdx | 10 ++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce9658ba1..73180b782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,10 +71,12 @@ All notable changes to SkillEvaluator are documented in this file. SkillSpector gives, such as `static_parse_limit (static_patterns_tool_misuse)`, with any line and limits, and the finding's metadata records them under `skillspector_evidence` and - `skillspector_occurrences`. The suggestion leaves out the run time and the - time budget (`observed_seconds`, `limit_seconds`), which differ from run to - run, so a finding keeps its `finding_id` from run to run; because the - suggestion text is new, each AE1 `finding_id` changes once with this release. + `skillspector_occurrences`, whose reference lines name the skill's + directory in a plugin, like the finding's own path. The suggestion leaves out + the run time and the time budget (`observed_seconds`, `limit_seconds`), + which differ from run to run, so a finding keeps its `finding_id` from run + to run; because the suggestion text is new, each AE1 `finding_id` changes + once with this release. Before, the finding said only `Referenced artifact was not completely inspected`, and its reason had to be matched by hand against the incomplete-analysis error, which lists at most @@ -387,10 +389,12 @@ All notable changes to SkillEvaluator are documented in this file. folder or plugin, still records the SkillSpector scan as incomplete (`incomplete_scans` in the JSON report, and publication eligibility `Incomplete`), with an error that names only that gap. The check itself is - reported as `FAIL`, not `INCOMPLETE`, because the Critical is a confirmed - failure. With SkillSpector v2.13.4, a hook with a `"timeout"` key also gets - a `static_parse_limit` row on the manifest, so that scan is recorded as - incomplete in the same way. + reported as `FAIL`, not `INCOMPLETE`, because the Critical and its gate + failure are a confirmed failure, also when a `--policy` override lowers the + Critical, and the final line of the compact `validate` view says that the + check failed, not that it didn't run. With SkillSpector v2.13.4, a hook with + a `"timeout"` key also gets a `static_parse_limit` row on the manifest, so + that scan is recorded as incomplete in the same way. - `validate` no longer repeats its header box in short terminal windows or when a log warning prints mid-run. Only the tier that is still running is diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index e8d40b727..44b491a87 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -308,14 +308,14 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice From v2.13.4, SkillSpector no longer reports such a scan as `partial`. When it inspected every bundled file and the only gaps are references to files the skill does not bundle, it reports the status `complete_with_caveats` and lists each reference as a caveat. SkillEvaluator accepts these caveats under the same conditions and shows the missing-reference warning above, and the findings of an accepted report are checked as in any other complete scan. A caveat on a path that is not a bundled file, or one that fails a condition above, such as a line that names a file left out of the scan, leaves the scan `INCOMPLETE`; as for a `partial` report, the report's findings are still checked and reported. Unlike a v2.13.3 caveat, these caveats are never accepted from the report alone, so they leave a scan without a known target `INCOMPLETE`, and an accepted report carries no `skillspector_reference_caveats` entry. SkillSpector gives this status only when every gap is a nonfatal `reference_missing` row, so a report with no caveat, or with a caveat that is not a nonfatal `reference_missing` row in phase `reference_resolution`, contradicts itself: SkillEvaluator does not trust it, and the scan is `INCOMPLETE` without its findings. The same holds for `complete_with_caveats` from a release before v2.13.4. - SkillSpector v2.12.0 and later cannot model what an ordinary command or HTTP hook, such as one that runs `echo hi` or a bundled script, does with its hook input. The exception is a hook that SkillSpector recognizes as sending hook content to a remote host, which it reports as **BH2**; a manifest whose command and HTTP hooks are all of that kind counts as modeled. For other hooks it discovers in manifests such as `hooks/hooks.json` and `.claude/settings.json`, SkillSpector reports a **BH1** finding whose evidence says the payload is `unmodeled`, records a nonfatal `partial` `opaque_content` row from `bundled_execution_surface` on the manifest, and reports the analysis as `partial` although the scan finished. This rule applies only to manifests SkillSpector actually reports with that evidence and ledger row; it does not establish coverage for inline plugin-manifest hooks or other hook locations the scanner does not report. The scan's findings cannot show that such hooks are safe: a hook script that sends its input over a socket, `nc` or `/dev/tcp` gets no blocking SkillSpector finding. SkillEvaluator therefore reports the manifest as the Critical `skillspector_hook_payload_unverified`, with a gate failure that neither a `--policy` severity override nor `--llm-verify` clears, instead of `INCOMPLETE` (see [Troubleshooting](#troubleshooting)). This applies when the row is a whole-file row that names only `bundled_execution_surface` and no error class, on a manifest whose BH1 says `unmodeled` (also when a baseline suppresses that BH1), and the report accounts for it exactly: one such row per manifest, `bundled_execution_surface` degraded by exactly those rows with nothing failed or skipped, its `Analyzer bundled_execution_surface status: degraded.` limitation, and one partially inspected file for each manifest that no other row names. The rest of the report is then judged on its own: it is complete when it shows no other gap, and missing references and referenced images can still be accepted with their warnings as described above. The v2.13.3 missing-reference caveat that is accepted from the report alone does not apply, because that check reads the whole report, hook row included. Any other gap still records the SkillSpector scan as incomplete (`incomplete_scans` in the JSON report, and publication eligibility **Incomplete**), with an error that names the other rows, or the other gaps when no other row remains. The check itself is then reported as `FAIL`, not `INCOMPLETE`, because the Critical is a confirmed failure, which takes precedence over missing evidence (see [Reading the final status](/skills/skillevaluator/reports#reading-the-final-status)). A row that does not fit, such as one for a manifest in which SkillSpector parsed no hook (no `unmodeled` BH1), or a report that does not account for it, leaves the whole scan `INCOMPLETE` as before. + SkillSpector v2.12.0 and later cannot model what an ordinary command or HTTP hook, such as one that runs `echo hi` or a bundled script, does with its hook input. The exception is a hook that SkillSpector recognizes as sending hook content to a remote host, which it reports as **BH2**; a manifest whose command and HTTP hooks are all of that kind counts as modeled. For other hooks it discovers in manifests such as `hooks/hooks.json` and `.claude/settings.json`, SkillSpector reports a **BH1** finding whose evidence says the payload is `unmodeled`, records a nonfatal `partial` `opaque_content` row from `bundled_execution_surface` on the manifest, and reports the analysis as `partial` although the scan finished. This rule applies only to manifests SkillSpector actually reports with that evidence and ledger row; it does not establish coverage for inline plugin-manifest hooks or other hook locations the scanner does not report. The scan's findings cannot show that such hooks are safe: a hook script that sends its input over a socket, `nc` or `/dev/tcp` gets no blocking SkillSpector finding. SkillEvaluator therefore reports the manifest as the Critical `skillspector_hook_payload_unverified`, with a gate failure that neither a `--policy` severity override nor `--llm-verify` clears, instead of `INCOMPLETE` (see [Troubleshooting](#troubleshooting)). This applies when the row is a whole-file row that names only `bundled_execution_surface` and no error class, on a manifest whose BH1 says `unmodeled` (also when a baseline suppresses that BH1), and the report accounts for it exactly: one such row per manifest, `bundled_execution_surface` degraded by exactly those rows with nothing failed or skipped, its `Analyzer bundled_execution_surface status: degraded.` limitation, and one partially inspected file for each manifest that no other row names. The rest of the report is then judged on its own: it is complete when it shows no other gap, and missing references and referenced images can still be accepted with their warnings as described above. The v2.13.3 missing-reference caveat that is accepted from the report alone does not apply, because that check reads the whole report, hook row included. Any other gap still records the SkillSpector scan as incomplete (`incomplete_scans` in the JSON report, and publication eligibility **Incomplete**), with an error that names the other rows, or the other gaps when no other row remains. The check itself is then reported as `FAIL`, not `INCOMPLETE`, because the Critical and its gate failure are a confirmed failure, which takes precedence over missing evidence, also when a `--policy` override lowers the Critical (see [Reading the final status](/skills/skillevaluator/reports#reading-the-final-status)). A row that does not fit, such as one for a manifest in which SkillSpector parsed no hook (no `unmodeled` BH1), or a report that does not account for it, leaves the whole scan `INCOMPLETE` as before. SkillSpector records the same row when it could not parse part of the manifest or read only its first 2,048 hook, permission and settings records. How much of that SkillEvaluator can see depends on the release: - v2.13.4 reports `observed_records` and `limit_records` on the row. SkillEvaluator accepts the row only when `observed_records` equals the BH1 `declaration_count` and does not exceed `limit_records`. A manifest with more records than SkillSpector reads, or with a hook handler it counted but could not parse, therefore stays `INCOMPLETE`. So does a settings file with permission rules, `env` or other settings beside its hooks, because SkillSpector counts those records too. A part it does not count, such as a hook group that is not an object, is not visible and gets the Critical. - v2.13.3 does not report them. SkillEvaluator then refuses only a BH1 that counts 2,048 or more declarations, because SkillSpector may have cut that manifest short. A manifest that SkillSpector parsed only in part, such as one with a malformed handler beside a valid one, gets the same Critical as a manifest it read in full, and still fails. - **Incomplete referenced artifacts.** SkillSpector reports a High **Incomplete referenced artifact analysis (AE1)** finding at each line that names a file it did not completely inspect. Releases before v2.12.0 leave the finding's name empty, so SkillEvaluator names it by its rule instead of `Unknown (AE1)`. A `severity_overrides` entry for these findings uses `SECURITY.Incomplete referenced artifact analysis (AE1)`; one keyed on `SECURITY.Unknown (AE1)` no longer matches. The finding's suggestion names the file, its disposition (`partial`, `failed`, `out_of_scope` or `uninspected`) and each reason SkillSpector gives: the reason code, such as `static_parse_limit` or `read_error`, the analyzers, the line in the file, the message and any limits, such as `limit_characters=8000`. The suggestion is part of the finding's `finding_id`, so it leaves out the run time and the time budget (`observed_seconds`, `limit_seconds`), which differ from run to run; the metadata keeps them. Reasons that differ only in the analyzer, the run time or the time budget are listed once. SkillSpector's own remedy is kept. Releases before v2.12.0 give no reasons in the finding and a generic remedy that says to make the file available: SkillEvaluator then reads the reasons from the report's `analysis_completeness` rows for that file and gives a remedy for a parse limit, a read error, or any other reason. Without such a row the finding keeps SkillSpector's text. The finding's metadata records the file, its disposition and up to 16 reasons under `skillspector_evidence`, with `reasons_truncated` when SkillSpector gave more, and up to 128 reference lines under `skillspector_occurrences`. In a folder of skills each reference line's `file` starts with the skill's `[name]` prefix, like the finding's own path, and `target_path` stays relative to that skill. Text with control characters is left out, credential-shaped text is masked, and a path outside the scanned target is dropped. + **Incomplete referenced artifacts.** SkillSpector reports a High **Incomplete referenced artifact analysis (AE1)** finding at each line that names a file it did not completely inspect. Releases before v2.12.0 leave the finding's name empty, so SkillEvaluator names it by its rule instead of `Unknown (AE1)`. A `severity_overrides` entry for these findings uses `SECURITY.Incomplete referenced artifact analysis (AE1)`; one keyed on `SECURITY.Unknown (AE1)` no longer matches. The finding's suggestion names the file, its disposition (`partial`, `failed`, `out_of_scope` or `uninspected`) and each reason SkillSpector gives: the reason code, such as `static_parse_limit` or `read_error`, the analyzers, the line in the file, the message and any limits, such as `limit_characters=8000`. The suggestion is part of the finding's `finding_id`, so it leaves out the run time and the time budget (`observed_seconds`, `limit_seconds`), which differ from run to run; the metadata keeps them. Reasons that differ only in the analyzer, the run time or the time budget are listed once. SkillSpector's own remedy is kept. Releases before v2.12.0 give no reasons in the finding and a generic remedy that says to make the file available: SkillEvaluator then reads the reasons from the report's `analysis_completeness` rows for that file and gives a remedy for a parse limit, a read error, or any other reason. Without such a row the finding keeps SkillSpector's text. The finding's metadata records the file, its disposition and up to 16 reasons under `skillspector_evidence`, with `reasons_truncated` when SkillSpector gave more, and up to 128 reference lines under `skillspector_occurrences`. In a folder of skills each reference line's `file` starts with the skill's `[name]` prefix, and in a plugin with the declared skill's directory, such as `skills/perl-helper/SKILL.md`, like the finding's own path; `target_path` stays relative to that skill. Text with control characters is left out, credential-shaped text is masked, and a path outside the scanned target is dropped. When the check fails, the terminal output, the `references` row of the terminal summary, and the Markdown and HTML reports add one line, such as `skillspector could not completely inspect 1 referenced artifact(s) across 2 reference occurrence(s); each AE1 finding names the artifact and any reasons SkillSpector gave`. The HTML and Markdown reports that the CI workflow renders again from the JSON report show the same line. The JSON report records the counts for every result, passed or failed, in `skillspector_reference_summary`: `affected_artifacts`, `reference_occurrences`, and `reference_occurrences_truncated`, which is `true` when SkillSpector listed more than 128 lines for one finding, so the count is a lower bound. For a folder of skills the counts are totals. None of this changes the finding's severity or whether the scan is complete. A gate changes only where a policy lowered `SECURITY.Unknown (AE1)` and that was what let the check pass. @@ -842,7 +842,8 @@ Tier 1 checks always gate the exit code inside `validate`. Tier 2 gates when it the manifest and every file its hooks run. SkillEvaluator has no way to record that review: removing the hooks is the only way to pass the check. A `--policy` severity override can lower the finding's severity, but the - gate failure keeps the check failed. `--llm-verify` does not send the + gate failure keeps the check failed, also when another gap records the + scan as incomplete. `--llm-verify` does not send the finding to the verifier, so it keeps its severity and gets no verdict. The finding's metadata records the manifest's SHA-256 (`manifest_sha256`) and SkillSpector's row for it. @@ -862,7 +863,8 @@ Tier 1 checks always gate the exit code inside `validate`. Tier 2 gates when it scan of such a manifest is also recorded as incomplete (`incomplete_scans` in the JSON report, and publication eligibility **Incomplete**), with an error that names only that row. The check itself is still reported as - `FAIL` because of the Critical. v2.13.3 does not record the row. + `FAIL` because of the Critical and its gate failure. v2.13.3 does not + record the row. Each SkillSpector run (the static stage, and the LLM stage with `--llm`) From cfde3e30b4be2e73b2a2d792dc8425dddbc3bbb1 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 22:10:04 -0800 Subject: [PATCH 05/11] docs(changelog): note the compact validate verdict for a failed check beside an incomplete scan The final box of the compact validate view said that a check with a blocking finding didn't run when one of its scanners did not complete, although its detail line, the Tier 1 card and the reports said it failed. The fix applies to any such check, not only to the hook gate, and the released behavior had no CHANGELOG line of its own. Add one under Fixed, and pin the general case with a blocking High finding beside an incomplete Semgrep scan, next to a check that is only incomplete. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 ++ tests/reporting/test_final_render_context.py | 48 ++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73180b782..0ea0c2d3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -194,6 +194,11 @@ All notable changes to SkillEvaluator are documented in this file. ### Fixed +- The final box of the compact `validate` view now says that a check with a + confirmed failure, such as a blocking finding, failed when one of its + scanners did not complete. It said that the check didn't run, beside its own + detail line, the Tier 1 card and the reports, which all say it failed. A + check that is only incomplete still reads "didn't run". - The behavior evidence gate no longer keeps a score for an expectation that names an observed artifact but also asks for something only the final answer could show. "Writes `report.py` and explains why each column was dropped" was diff --git a/tests/reporting/test_final_render_context.py b/tests/reporting/test_final_render_context.py index 2d0488317..ff89c9cf7 100644 --- a/tests/reporting/test_final_render_context.py +++ b/tests/reporting/test_final_render_context.py @@ -178,6 +178,54 @@ def test_compact_panel_shares_incomplete_status_and_publication(tmp_path): assert "โœ— FAIL" not in output.getvalue() +@pytest.mark.parametrize( + ("blocking", "headline"), + [(True, "Security Scan failed in Tier 1"), (False, "Security Scan didn't run in Tier 1")], + ids=["blocking-finding", "incomplete-only"], +) +def test_compact_verdict_names_a_confirmed_failure_beside_an_incomplete_scan_as_failed(tmp_path, blocking, headline): + """A blocking finding outranks a scanner that did not complete, as in the detail line and the reports.""" + from io import StringIO + + from rich.console import Console + + from skillevaluator.cli import _finish_pipeline_view + from skillevaluator.models import Finding, Severity + from skillevaluator.reporting.console_ui import ValidateView + + source = result() + source.validator_name = "Security Scan" + if blocking: + source.add_finding( + Finding( + category="SECURITY", + severity=Severity.HIGH, + check_name="blocked", + message="Unsafe command", + file_path="scripts/run.sh", + ) + ) + source.mark_scan_incomplete("semgrep") + output = StringIO() + view = ValidateView("demo", [(1, "Tier 1", "")], console=Console(file=output, width=200, color_system=None)) + _finish_pipeline_view( + view, + tier_gate_results=[source], + tier3_result=None, + gate_failed=True, + output_dir=tmp_path, + basename="report", + report_formats=(), + target_path=tmp_path, + agent_eval=False, + ) + panel = output.getvalue() + assert headline in panel + assert "Publication eligibility: Incomplete" in panel + if blocking: + assert "didn't run" not in panel + + def test_html_coverage_uses_full_raw_counts_and_preserves_payload(): source = result( 3, From dfeb23227efa289a267c338331c25c953c566bff Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Fri, 13 Nov 2026 22:52:47 -0800 Subject: [PATCH 06/11] docs(changelog): name the Tier 1 card in the compact verdict Fixed entry In 0.9.0 the Tier 1 card also counted a check with a blocking finding and a scanner that did not complete under "didn't run", and its "what to fix" gave a scanner setup step instead of the check's own error. Only the final box's detail line and the reports said that the check failed. The Fixed entry named the box alone, so as release notes it left out that the card changed too. Name both surfaces in the entry and the setup step the card gave. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea0c2d3e..d11dc3d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -194,11 +194,12 @@ All notable changes to SkillEvaluator are documented in this file. ### Fixed -- The final box of the compact `validate` view now says that a check with a - confirmed failure, such as a blocking finding, failed when one of its - scanners did not complete. It said that the check didn't run, beside its own - detail line, the Tier 1 card and the reports, which all say it failed. A - check that is only incomplete still reads "didn't run". +- The Tier 1 card and the final box of the compact `validate` view now say + that a check with a confirmed failure, such as a blocking finding, failed + when one of its scanners did not complete. They said that the check didn't + run, beside the box's own detail line and the reports, which say it failed, + and the card's "what to fix" gave a scanner setup step instead of the + check's own error. A check that is only incomplete still reads "didn't run". - The behavior evidence gate no longer keeps a score for an expectation that names an observed artifact but also asks for something only the final answer could show. "Writes `report.py` and explains why each column was dropped" was From 52160021dcd9f6fcccecbe9ee424ee5ef25894b4 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Sat, 14 Nov 2026 04:33:25 -0800 Subject: [PATCH 07/11] revert(cli): leave the compact validate verdict to its own change Revert the change that made the final box of the compact validate view count a check with a confirmed failure beside an incomplete scan as failed, along with its tests and its CHANGELOG text. The open #394 changes the same lines and renames the "didn't run" wording to "incomplete", so this branch keeps only the hook gate fix: the check's reported status, the reports and the JSON status stay FAIL under a --policy override. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 13 +--- src/skillevaluator/cli.py | 11 +-- tests/reporting/test_final_render_context.py | 48 ------------ .../test_skillspector_hook_surface.py | 73 ------------------- 4 files changed, 6 insertions(+), 139 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 270b45df0..d45a4183a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -249,12 +249,6 @@ All notable changes to SkillEvaluator are documented in this file. ### Fixed -- The Tier 1 card and the final box of the compact `validate` view now say - that a check with a confirmed failure, such as a blocking finding, failed - when one of its scanners did not complete. They said that the check didn't - run, beside the box's own detail line and the reports, which say it failed, - and the card's "what to fix" gave a scanner setup step instead of the - check's own error. A check that is only incomplete still reads "didn't run". - Automatic SkillSpector selection now verifies the pinned release on first use and falls back to the verified managed wheel for a different or unverifiable version. Discovery stays free of subprocesses, version probes omit provider @@ -479,10 +473,9 @@ All notable changes to SkillEvaluator are documented in this file. `Incomplete`), with an error that names only that gap. The check itself is reported as `FAIL`, not `INCOMPLETE`, because the Critical and its gate failure are a confirmed failure, also when a `--policy` override lowers the - Critical, and the final line of the compact `validate` view says that the - check failed, not that it didn't run. With SkillSpector v2.13.4, a hook with - a `"timeout"` key also gets a `static_parse_limit` row on the manifest, so - that scan is recorded as incomplete in the same way. + Critical. With SkillSpector v2.13.4, a hook with a `"timeout"` key also gets + a `static_parse_limit` row on the manifest, so that scan is recorded as + incomplete in the same way. - `validate` no longer repeats its header box in short terminal windows or when a log warning prints mid-run. Only the tier that is still running is diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.py index 7bcdfca53..b6ac7e2ae 100644 --- a/src/skillevaluator/cli.py +++ b/src/skillevaluator/cli.py @@ -1962,12 +1962,7 @@ def _finish_pipeline_view( from skillevaluator.reporting.console_ui import MUTED, Verdict, _is_skipped, first_fix from skillevaluator.reporting.harbor_viewer import harbor_job_links from skillevaluator.reporting.presentation import build_final_render_context - from skillevaluator.reporting.run_status import Status, result_status - - def did_not_run(result: ValidationResult) -> bool: - # A confirmed failure, such as a blocking finding or the hook gate, - # outranks an incomplete scan in the same result, as in the reports. - return result.is_incomplete and result_status(result) is not Status.FAILED + from skillevaluator.reporting.run_status import Status context = presentation_context or build_final_render_context( [ @@ -2007,7 +2002,7 @@ def did_not_run(result: ValidationResult) -> bool: if len(failed) == 1: only = failed[0] tier_no = (only.metadata.get("gating") or {}).get("tier") - state = "didn't run" if did_not_run(only) else "failed" + state = "didn't run" if only.is_incomplete else "failed" headline = f"{only.validator_name or 'validation'} {state}" + ( f" in Tier {tier_no}" if tier_no is not None else "" ) @@ -2017,7 +2012,7 @@ def did_not_run(result: ValidationResult) -> bool: by_tier.setdefault((result.metadata.get("gating") or {}).get("tier"), []).append(result) parts = [] for tier_no, results in by_tier.items(): - broken = sum(1 for r in results if not did_not_run(r)) + broken = sum(1 for r in results if not r.is_incomplete) counts = [ f"{broken} failed" if broken else "", f"{len(results) - broken} didn't run" if broken < len(results) else "", diff --git a/tests/reporting/test_final_render_context.py b/tests/reporting/test_final_render_context.py index ff89c9cf7..2d0488317 100644 --- a/tests/reporting/test_final_render_context.py +++ b/tests/reporting/test_final_render_context.py @@ -178,54 +178,6 @@ def test_compact_panel_shares_incomplete_status_and_publication(tmp_path): assert "โœ— FAIL" not in output.getvalue() -@pytest.mark.parametrize( - ("blocking", "headline"), - [(True, "Security Scan failed in Tier 1"), (False, "Security Scan didn't run in Tier 1")], - ids=["blocking-finding", "incomplete-only"], -) -def test_compact_verdict_names_a_confirmed_failure_beside_an_incomplete_scan_as_failed(tmp_path, blocking, headline): - """A blocking finding outranks a scanner that did not complete, as in the detail line and the reports.""" - from io import StringIO - - from rich.console import Console - - from skillevaluator.cli import _finish_pipeline_view - from skillevaluator.models import Finding, Severity - from skillevaluator.reporting.console_ui import ValidateView - - source = result() - source.validator_name = "Security Scan" - if blocking: - source.add_finding( - Finding( - category="SECURITY", - severity=Severity.HIGH, - check_name="blocked", - message="Unsafe command", - file_path="scripts/run.sh", - ) - ) - source.mark_scan_incomplete("semgrep") - output = StringIO() - view = ValidateView("demo", [(1, "Tier 1", "")], console=Console(file=output, width=200, color_system=None)) - _finish_pipeline_view( - view, - tier_gate_results=[source], - tier3_result=None, - gate_failed=True, - output_dir=tmp_path, - basename="report", - report_formats=(), - target_path=tmp_path, - agent_eval=False, - ) - panel = output.getvalue() - assert headline in panel - assert "Publication eligibility: Incomplete" in panel - if blocking: - assert "didn't run" not in panel - - def test_html_coverage_uses_full_raw_counts_and_preserves_payload(): source = result( 3, diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 8bc37fafb..99e75eac4 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -790,79 +790,6 @@ def test_a_policy_override_keeps_a_folder_scan_failed_beside_a_missing_reference assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") -def _compact_verdict(results: list[ValidationResult], tmp_path: Path) -> str: - """Render the compact ``validate`` view's final box for these Tier 1 results.""" - from io import StringIO - - from rich.console import Console - - from skillevaluator.cli import _finish_pipeline_view - from skillevaluator.reporting.console_ui import ValidateView - - output = StringIO() - view = ValidateView("demo", [(1, "Tier 1", "")], console=Console(file=output, width=200, color_system=None)) - _finish_pipeline_view( - view, - tier_gate_results=results, - tier3_result=None, - gate_failed=True, - output_dir=tmp_path, - basename="report", - report_formats=(), - target_path=tmp_path, - agent_eval=False, - ) - return output.getvalue() - - -class TestCompactValidateVerdict: - @pytest.mark.parametrize("policy", [False, True], ids=["no-policy", "hook-check-info"]) - @pytest.mark.parametrize("case", ["timeout-parse-limit", "folder-job-missing-reference"]) - @patch("skillevaluator.validators.security.Tools") - def test_the_verdict_says_the_check_failed_beside_another_gap( - self, mock_tools, tmp_path: Path, case: str, policy: bool - ) -> None: - """The final box names the hook gate failure as a failed check, not as a scan that did not run. - - The scan is recorded as incomplete, so publication eligibility stays - Incomplete, but the check's reported status is FAIL. - """ - if case == "timeout-parse-limit": - result = _validate(mock_tools, _timeout_plugin(tmp_path), _report(_TIMEOUT_REPORT)) - else: - folder = tmp_path / "folder" - root = _settings_missing_reference_skill(folder) - validator = SecurityValidator(use_llm=False, content_type="skill", target_root=folder) - result = _validate(mock_tools, root, _report(_settings_missing_reference_report("2.13.4")), validator) - if policy: - overrides = {"SECURITY.skillspector_hook_payload_unverified": Severity.INFO} - apply_policy([result], ValidationPolicy(severity_overrides=overrides)) - # As validate records a Tier 1 check. - result.validator_name = "Security Scan" - result.metadata["gating"] = {"tier": 1, "blocking": True} - _assert_failed_with_incomplete_scan(result) - - panel = _compact_verdict([result], tmp_path) - - assert "Security Scan failed in Tier 1" in panel - assert "didn't run" not in panel - assert "Publication eligibility: Incomplete" in panel - - @patch("skillevaluator.validators.security.Tools") - def test_the_verdict_counts_the_check_as_failed_beside_one_that_did_not_run( - self, mock_tools, tmp_path: Path - ) -> None: - result = _validate(mock_tools, _timeout_plugin(tmp_path), _report(_TIMEOUT_REPORT)) - result.validator_name = "Security Scan" - result.metadata["gating"] = {"tier": 1, "blocking": True} - missing = ValidationResult(validator_name="Code Risk", metadata={"gating": {"tier": 1, "blocking": True}}) - missing.mark_scan_incomplete("bandit") - - panel = _compact_verdict([result, missing], tmp_path) - - assert "Tier 1: 1 failed, 1 didn't run" in panel - - class TestPartlyReadManifests: @pytest.mark.parametrize( ("version", "case"), From 4dd5a1a0d7348dd27993523ea93e0fb5f61b5ad9 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Sat, 14 Nov 2026 04:33:41 -0800 Subject: [PATCH 08/11] revert(tier1): leave the plugin AE1 reference lines to the plugin scan change Revert the change that put the declared skill's directory before the reference lines of a SkillSpector AE1 finding in a plugin scan, along with its test and its CHANGELOG and docs text. On main no command reaches that plugin attribution path yet; the open #394 adds the caller, so the fix belongs with it. This branch keeps only the hook gate fix. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 +++---- docs/tier1-validation.mdx | 2 +- src/skillevaluator/tier1/plugin_checks.py | 16 ++++------ .../test_skillspector_reference_summary.py | 30 ------------------- 4 files changed, 11 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d45a4183a..e7b843e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,12 +114,10 @@ All notable changes to SkillEvaluator are documented in this file. SkillSpector gives, such as `static_parse_limit (static_patterns_tool_misuse)`, with any line and limits, and the finding's metadata records them under `skillspector_evidence` and - `skillspector_occurrences`, whose reference lines name the skill's - directory in a plugin, like the finding's own path. The suggestion leaves out - the run time and the time budget (`observed_seconds`, `limit_seconds`), - which differ from run to run, so a finding keeps its `finding_id` from run - to run; because the suggestion text is new, each AE1 `finding_id` changes - once with this release. + `skillspector_occurrences`. The suggestion leaves out the run time and the + time budget (`observed_seconds`, `limit_seconds`), which differ from run to + run, so a finding keeps its `finding_id` from run to run; because the + suggestion text is new, each AE1 `finding_id` changes once with this release. Before, the finding said only `Referenced artifact was not completely inspected`, and its reason had to be matched by hand against the incomplete-analysis error, which lists at most diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 39df76b2d..f26470cb9 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -341,7 +341,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice - v2.13.4 reports `observed_records` and `limit_records` on the row. SkillEvaluator accepts the row only when `observed_records` equals the BH1 `declaration_count` and does not exceed `limit_records`. A manifest with more records than SkillSpector reads, or with a hook handler it counted but could not parse, therefore stays `INCOMPLETE`. So does a settings file with permission rules, `env` or other settings beside its hooks, because SkillSpector counts those records too. A part it does not count, such as a hook group that is not an object, is not visible and gets the Critical. - v2.13.3 does not report them. SkillEvaluator then refuses only a BH1 that counts 2,048 or more declarations, because SkillSpector may have cut that manifest short. A manifest that SkillSpector parsed only in part, such as one with a malformed handler beside a valid one, gets the same Critical as a manifest it read in full, and still fails. - **Incomplete referenced artifacts.** SkillSpector reports a High **Incomplete referenced artifact analysis (AE1)** finding at each line that names a file it did not completely inspect. Releases before v2.12.0 leave the finding's name empty, so SkillEvaluator names it by its rule instead of `Unknown (AE1)`. A `severity_overrides` entry for these findings uses `SECURITY.Incomplete referenced artifact analysis (AE1)`; one keyed on `SECURITY.Unknown (AE1)` no longer matches. The finding's suggestion names the file, its disposition (`partial`, `failed`, `out_of_scope` or `uninspected`) and each reason SkillSpector gives: the reason code, such as `static_parse_limit` or `read_error`, the analyzers, the line in the file, the message and any limits, such as `limit_characters=8000`. The suggestion is part of the finding's `finding_id`, so it leaves out the run time and the time budget (`observed_seconds`, `limit_seconds`), which differ from run to run; the metadata keeps them. Reasons that differ only in the analyzer, the run time or the time budget are listed once. SkillSpector's own remedy is kept. Releases before v2.12.0 give no reasons in the finding and a generic remedy that says to make the file available: SkillEvaluator then reads the reasons from the report's `analysis_completeness` rows for that file and gives a remedy for a parse limit, a read error, or any other reason. Without such a row the finding keeps SkillSpector's text. The finding's metadata records the file, its disposition and up to 16 reasons under `skillspector_evidence`, with `reasons_truncated` when SkillSpector gave more, and up to 128 reference lines under `skillspector_occurrences`. In a folder of skills each reference line's `file` starts with the skill's `[name]` prefix, and in a plugin with the declared skill's directory, such as `skills/perl-helper/SKILL.md`, like the finding's own path; `target_path` stays relative to that skill. Text with control characters is left out, credential-shaped text is masked, and a path outside the scanned target is dropped. + **Incomplete referenced artifacts.** SkillSpector reports a High **Incomplete referenced artifact analysis (AE1)** finding at each line that names a file it did not completely inspect. Releases before v2.12.0 leave the finding's name empty, so SkillEvaluator names it by its rule instead of `Unknown (AE1)`. A `severity_overrides` entry for these findings uses `SECURITY.Incomplete referenced artifact analysis (AE1)`; one keyed on `SECURITY.Unknown (AE1)` no longer matches. The finding's suggestion names the file, its disposition (`partial`, `failed`, `out_of_scope` or `uninspected`) and each reason SkillSpector gives: the reason code, such as `static_parse_limit` or `read_error`, the analyzers, the line in the file, the message and any limits, such as `limit_characters=8000`. The suggestion is part of the finding's `finding_id`, so it leaves out the run time and the time budget (`observed_seconds`, `limit_seconds`), which differ from run to run; the metadata keeps them. Reasons that differ only in the analyzer, the run time or the time budget are listed once. SkillSpector's own remedy is kept. Releases before v2.12.0 give no reasons in the finding and a generic remedy that says to make the file available: SkillEvaluator then reads the reasons from the report's `analysis_completeness` rows for that file and gives a remedy for a parse limit, a read error, or any other reason. Without such a row the finding keeps SkillSpector's text. The finding's metadata records the file, its disposition and up to 16 reasons under `skillspector_evidence`, with `reasons_truncated` when SkillSpector gave more, and up to 128 reference lines under `skillspector_occurrences`. In a folder of skills each reference line's `file` starts with the skill's `[name]` prefix, like the finding's own path, and `target_path` stays relative to that skill. Text with control characters is left out, credential-shaped text is masked, and a path outside the scanned target is dropped. When the check fails, the terminal output, the `references` row of the terminal summary, and the Markdown and HTML reports add one line, such as `skillspector could not completely inspect 1 referenced artifact(s) across 2 reference occurrence(s); each AE1 finding names the artifact and any reasons SkillSpector gave`. The HTML and Markdown reports that the CI workflow renders again from the JSON report show the same line. The JSON report records the counts for every result, passed or failed, in `skillspector_reference_summary`: `affected_artifacts`, `reference_occurrences`, and `reference_occurrences_truncated`, which is `true` when SkillSpector listed more than 128 lines for one finding, so the count is a lower bound. For a folder of skills the counts are totals. None of this changes the finding's severity or whether the scan is complete. A gate changes only where a policy lowered `SECURITY.Unknown (AE1)` and that was what let the check pass. diff --git a/src/skillevaluator/tier1/plugin_checks.py b/src/skillevaluator/tier1/plugin_checks.py index a7b216dd5..350863bd3 100644 --- a/src/skillevaluator/tier1/plugin_checks.py +++ b/src/skillevaluator/tier1/plugin_checks.py @@ -191,16 +191,12 @@ def _attribute_scan_result(result: ValidationResult, unit: str, view: Path, root location = Path(finding.file_path) if finding.file_path and not location.is_absolute() and not finding.file_path.startswith(("<", "[")): finding.file_path = (Path(unit) / location).as_posix() - # Grouped repeats (occurrences) and the reference lines of a - # SkillSpector AE1 finding (skillspector_occurrences) name files - # like file_path, so they get the same member directory. - for key in ("occurrences", "skillspector_occurrences"): - occurrences = finding.metadata.get(key, []) - for occurrence in occurrences if isinstance(occurrences, list) else []: - if isinstance(occurrence, dict) and isinstance(occurrence.get("file"), str): - file = Path(occurrence["file"]) - if not file.is_absolute(): - occurrence["file"] = (Path(unit) / file).as_posix() + occurrences = finding.metadata.get("occurrences", []) + for occurrence in occurrences if isinstance(occurrences, list) else []: + if isinstance(occurrence, dict) and isinstance(occurrence.get("file"), str): + file = Path(occurrence["file"]) + if not file.is_absolute(): + occurrence["file"] = (Path(unit) / file).as_posix() _rebase(result, view, root / unit) diff --git a/tests/reporting/test_skillspector_reference_summary.py b/tests/reporting/test_skillspector_reference_summary.py index c9372505f..10d503c80 100644 --- a/tests/reporting/test_skillspector_reference_summary.py +++ b/tests/reporting/test_skillspector_reference_summary.py @@ -214,36 +214,6 @@ def test_folder_reference_lines_name_their_skill(tmp_path: Path, monkeypatch: py } == {"scripts/helper.pl"} -def test_plugin_member_reference_lines_name_their_directory(tmp_path: Path) -> None: - """A plugin scan puts the declared skill's directory before each reference line, like the finding's own path.""" - from skillevaluator.tier1.plugin_checks import _attribute_scan_result - - view = tmp_path / "view" / "perl-helper" - _write_skill(view) - result = ValidationResult(validator_name="Security Scan") - report = json.loads(_REPORT.read_text(encoding="utf-8")) - SecurityValidator(use_llm=False)._process_skillspector_cli_result(report, result, source_root=view) - - _attribute_scan_result(result, "skills/perl-helper", view, tmp_path / "plugin") - - exported = json.loads(JSONReporter(include_timestamp=False).render(result)) - located = sorted( - (finding["file_path"], finding["line_number"], finding["metadata"]["skillspector_occurrences"]) - for finding in exported["findings"] - if finding["check_name"].endswith("(AE1)") - ) - assert located == [ - ("skills/perl-helper/SKILL.md", line, [{"file": "skills/perl-helper/SKILL.md", "start_line": line}]) - for line in (6, 8) - ] - # The referenced file stays relative to the skill, as in a folder. - assert { - finding["metadata"]["skillspector_evidence"]["target_path"] - for finding in exported["findings"] - if finding["check_name"].endswith("(AE1)") - } == {"scripts/helper.pl"} - - def test_a_cut_occurrence_list_is_a_lower_bound(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: result = _validate(tmp_path, monkeypatch, skills=("alpha", "beta"), lines=129) From 8932c3b13727ace6217690b3b4fb7bb0f43f9454 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Sat, 14 Nov 2026 21:52:30 -0800 Subject: [PATCH 09/11] fix(tier1): name the hook gate failure in the Tier 1 summary beside an incomplete scan A check that failed beside an incomplete scan, such as a hook gate failure next to a SkillSpector parse-limit row or a missing reference, listed only its first gate failure in the terminal Tier 1 summary. That is often the error for the gap, so the "what to fix" line hid the hook gate failure that keeps the check failed. For such a check the line now names every gate failure. A check whose scan is complete still shows its first error. The hook surface tests now check the summary wherever a hook gate fails beside an incomplete scan, with and without a --policy override: the check is counted under failed, not as a check that did not run, no --skip is suggested, and the fix line names the hook gate failure. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++- src/skillevaluator/reporting/console_ui.py | 5 +++- .../test_skillspector_hook_surface.py | 28 +++++++++++++++++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f632cc0a..fddff045a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -625,7 +625,10 @@ All notable changes to SkillEvaluator are documented in this file. failure are a confirmed failure, also when a `--policy` override lowers the Critical. With SkillSpector v2.13.4, a hook with a `"timeout"` key also gets a `static_parse_limit` row on the manifest, so that scan is recorded as - incomplete in the same way. + incomplete in the same way. In the terminal Tier 1 summary, the "what to + fix" line for a check that failed beside an incomplete scan names every gate + failure, not only the first one, so it shows the hook gate failure beside + the error for the gap. - `validate` no longer repeats its header box in short terminal windows or when a log warning prints mid-run. Only the tier that is still running is diff --git a/src/skillevaluator/reporting/console_ui.py b/src/skillevaluator/reporting/console_ui.py index 5bc40ea29..1c4f8a536 100644 --- a/src/skillevaluator/reporting/console_ui.py +++ b/src/skillevaluator/reporting/console_ui.py @@ -1275,7 +1275,10 @@ def summarize_tier1(results: list[ValidationResult], lineup: list[str] | None = def _tier1_fix(result: ValidationResult) -> FixItem: - problem = _first_error(result) or f"{result.validator_name} failed" + # A check that failed beside an incomplete scan names every gate failure, so + # a failure that outranks the gap, such as the hook gate, is not hidden by it. + gates = "; ".join(dict.fromkeys(result.gate_failures)) if result.is_incomplete else "" + problem = gates or _first_error(result) or f"{result.validator_name} failed" action = next((f.suggestion for f in result.findings if f.message == problem and f.suggestion), None) if action is None and not result.gate_failures: action = first_fix([result]) diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 99e75eac4..ef3f26193 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -49,6 +49,7 @@ import pytest +from skillevaluator.reporting.console_ui import summarize_tier1 from skillevaluator.reporting.json_reporter import JSONReporter from skillevaluator.reporting.run_status import Status, resolve_run_status from skillevaluator.utils.tool_runner import ToolResult @@ -362,8 +363,9 @@ def _assert_failed_with_incomplete_scan(result: ValidationResult, stage: str = " """The scan is recorded as incomplete, but the check is reported as failed. A confirmed failure, such as the Critical, takes precedence over missing - evidence in the reported status, so the check shows FAIL, not INCOMPLETE. - Only the incomplete scans and publication eligibility say incomplete. + evidence in the reported status, so the check shows FAIL, not INCOMPLETE, + also in the terminal Tier 1 summary. Only the incomplete scans and + publication eligibility say incomplete. """ assert result.incomplete_scans == [stage] run = resolve_run_status([result]) @@ -371,6 +373,27 @@ def _assert_failed_with_incomplete_scan(result: ValidationResult, stage: str = " assert run.headline == Status.FAILED assert run.missing == (stage,) assert run.publication == Status.INCOMPLETE + _assert_tier1_summary_reports_the_hook_gate(result) + + +def _assert_tier1_summary_reports_the_hook_gate(result: ValidationResult) -> None: + """The terminal Tier 1 summary counts the check as failed and names its hook gate failure. + + Beside a gap that records the scan as incomplete, the fix line names every + gate failure, so the hook gate is not hidden behind the gap. The summary + neither counts the check as not run nor suggests skipping it. + """ + ok, rows = summarize_tier1([result], lineup=["security"]) + assert not ok + [summary] = [row for row in rows if row.label == "summary"] + counts = [chunk for chunk, _style in summary.segments] + assert "1 failed" in counts + assert not [chunk for chunk in counts if "didn't run" in chunk or "incomplete" in chunk] + assert not [row for row in rows if row.label == "setup"] + assert not [row for row in rows if any("--skip" in chunk for chunk, _style in row.segments)] + [fix] = [row for row in rows if row.glyph == "1"] + assert [chunk for chunk, _style in fix.segments] == ["; ".join(result.gate_failures)] + assert [gate for gate in result.gate_failures if "could not model these hooks" in gate] class TestCapturedReports: @@ -490,6 +513,7 @@ def test_policy_overrides_cannot_pass_the_hooks( assert result.status == "failed" assert result.errors == [_gate("hooks/hooks.json")] assert resolve_run_status([result]).of(result) == Status.FAILED + _assert_tier1_summary_reports_the_hook_gate(result) exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") From 78a6ae089d7e4342b9b18cff32481803775105e7 Mon Sep 17 00:00:00 2001 From: Christopher Kevin Date: Sun, 15 Nov 2026 03:34:33 -0800 Subject: [PATCH 10/11] test(tier1): pin the terminal summary for a hook gate under a policy override The tests for the hook gate under a --policy override checked the run status and the JSON report but not the Tier 1 terminal summary. Check there that the check is counted as failed, not as one that did not run, that no scanner install or --skip advice is given, and that the "what to fix" item is one of the result's gate failures. This covers a complete scan, an incomplete scan with a parse-limit row, and a folder scan. Signed-off-by: Christopher Kevin --- .../test_skillspector_hook_surface.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 99e75eac4..f1f9dd421 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -49,6 +49,7 @@ import pytest +from skillevaluator.reporting.console_ui import summarize_tier1 from skillevaluator.reporting.json_reporter import JSONReporter from skillevaluator.reporting.run_status import Status, resolve_run_status from skillevaluator.utils.tool_runner import ToolResult @@ -373,6 +374,32 @@ def _assert_failed_with_incomplete_scan(result: ValidationResult, stage: str = " assert run.publication == Status.INCOMPLETE +def _assert_terminal_summary_lists_a_failure(result: ValidationResult) -> None: + """The Tier 1 terminal summary counts the check as failed and points at a gate failure. + + A check that is not counted as a confirmed failure is listed as one that + "didn't run", with advice to install the scanner or skip the check. The + scanners row and the single "what to fix" line follow the rules for any + incomplete scan, so this does not pin the scanners row, or which of + several gate failures comes first. + """ + result.validator_name = "Security Scan" # run_validation names the result this way + passed, rows = summarize_tier1([result], lineup=["security"]) + shown = {row.label: "".join(text for text, _style in row.segments) for row in rows} + everything = "\n".join(shown.values()) + + assert not passed + assert shown["checks"] == "โœ— security" + assert shown["summary"].startswith("0/1 checks passed") + assert " ยท 1 failed" in shown["summary"] + assert "didn't run" not in shown["summary"] + [fix] = [row for row in rows if row.glyph == "1"] + assert fix.label == "security" + assert "".join(text for text, _style in fix.segments) in result.gate_failures + assert "--skip" not in everything + assert "not installed" not in everything + + class TestCapturedReports: @pytest.mark.parametrize(("name", "build", "manifest"), _CAPTURES, ids=[name for name, _b, _m in _CAPTURES]) def test_captured_report_matches_its_tree( @@ -492,6 +519,7 @@ def test_policy_overrides_cannot_pass_the_hooks( assert resolve_run_status([result]).of(result) == Status.FAILED exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") + _assert_terminal_summary_lists_a_failure(result) @patch("skillevaluator.validators.security.Tools") def test_llm_verification_cannot_downgrade_the_hook_critical(self, mock_tools, tmp_path: Path) -> None: @@ -788,6 +816,7 @@ def test_a_policy_override_keeps_a_folder_scan_failed_beside_a_missing_reference _assert_failed_with_incomplete_scan(result) exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") + _assert_terminal_summary_lists_a_failure(result) class TestPartlyReadManifests: From 220e834e1145221d6be6fdf699b572be4cca47b9 Mon Sep 17 00:00:00 2001 From: Narendran Raghavan Date: Mon, 16 Nov 2026 03:13:06 -0800 Subject: [PATCH 11/11] fix(tier1): list each gate failure of a check beside an incomplete scan A check that failed beside an incomplete scan, such as a hook gate failure next to a SkillSpector parse-limit row or a missing reference, showed only its first gate failure in the "what to fix" section of the terminal Tier 1 summary. That first failure is often the error for the gap, so the section hid the hook gate failure that keeps the check failed. The section now also lists the other gate failures of such a check, after the items it already showed: the check's first gate failure and the unresolved file reference item stay first and in the same order, so the hook gate failure follows them instead of replacing them. A check whose scan is complete is listed as before. This replaces the earlier change that joined every gate failure into one line. The hook surface tests check, wherever a hook gate fails beside an incomplete scan, that the first item is still the first gate failure, that an unresolved reference keeps its item next, and that the hook gate failure is listed. The summary counts and advice for a hook gate under a --policy override are checked by the existing terminal summary helper, so the duplicate checks are removed. Signed-off-by: Narendran Raghavan Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 8 ++-- src/skillevaluator/reporting/console_ui.py | 19 ++++++--- .../test_skillspector_hook_surface.py | 39 ++++++++----------- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb511db6d..eb67e8560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -787,10 +787,10 @@ All notable changes to SkillEvaluator are documented in this file. failure are a confirmed failure, also when a `--policy` override lowers the Critical. With SkillSpector v2.13.4, a hook with a `"timeout"` key also gets a `static_parse_limit` row on the manifest, so that scan is recorded as - incomplete in the same way. In the terminal Tier 1 summary, the "what to - fix" line for a check that failed beside an incomplete scan names every gate - failure, not only the first one, so it shows the hook gate failure beside - the error for the gap. + incomplete in the same way. In the terminal Tier 1 summary, "what to fix" + for a check that failed beside an incomplete scan also lists its other gate + failures, after its first one and any unresolved file reference, so it + shows the hook gate failure, not only the error for the gap. - `validate` no longer repeats its header box in short terminal windows or when a log warning prints mid-run. Only the tier that is still running is diff --git a/src/skillevaluator/reporting/console_ui.py b/src/skillevaluator/reporting/console_ui.py index 09feeb14e..72fe17e9c 100644 --- a/src/skillevaluator/reporting/console_ui.py +++ b/src/skillevaluator/reporting/console_ui.py @@ -1272,6 +1272,7 @@ def summarize_tier1(results: list[ValidationResult], lineup: list[str] | None = ) items = [item for r in broken for item in _tier1_fixes(r)] items += [item for r in failed for item in _unresolved_reference_fixes(r)] + items += [item for r in broken for item in _later_gate_fixes(r)] if setup := [r for r in incomplete if not _only_llm_stages_missing(r) and not _unresolved_reference_fixes(r)]: items.append(_setup_fix(setup)) if llm := [r for r in incomplete if _only_llm_stages_missing(r)]: @@ -1299,6 +1300,17 @@ def _unresolved_reference_fixes(result: ValidationResult) -> list[FixItem]: return [] +def _later_gate_fixes(result: ValidationResult) -> list[FixItem]: + """One item for each gate failure after the first of a check that failed beside an incomplete scan. + + The check's own item names only its first gate failure, which is often the error for the gap. Listing + the others keeps a failure that outranks the gap, such as the hook gate, from being hidden behind it. + """ + if not result.is_incomplete: + return [] + return [_tier1_fix(result, gate) for gate in list(dict.fromkeys(result.gate_failures))[1:]] + + def _tier1_fixes(result: ValidationResult) -> list[FixItem]: """One item per distinct critical/high finding, so a check that failed on several shows each one.""" serious = [ @@ -1316,11 +1328,8 @@ def _tier1_fixes(result: ValidationResult) -> list[FixItem]: return items -def _tier1_fix(result: ValidationResult) -> FixItem: - # A check that failed beside an incomplete scan names every gate failure, so - # a failure that outranks the gap, such as the hook gate, is not hidden by it. - gates = "; ".join(dict.fromkeys(result.gate_failures)) if result.is_incomplete else "" - problem = gates or _first_error(result) or f"{result.validator_name} failed" +def _tier1_fix(result: ValidationResult, problem: str = "") -> FixItem: + problem = problem or _first_error(result) or f"{result.validator_name} failed" action = next((f.suggestion for f in result.findings if f.message == problem and f.suggestion), None) if action is None and not result.gate_failures: action = first_fix([result]) diff --git a/tests/validators/test_skillspector_hook_surface.py b/tests/validators/test_skillspector_hook_surface.py index 2676f7816..cc10bfc0e 100644 --- a/tests/validators/test_skillspector_hook_surface.py +++ b/tests/validators/test_skillspector_hook_surface.py @@ -363,9 +363,8 @@ def _assert_failed_with_incomplete_scan(result: ValidationResult, stage: str = " """The scan is recorded as incomplete, but the check is reported as failed. A confirmed failure, such as the Critical, takes precedence over missing - evidence in the reported status, so the check shows FAIL, not INCOMPLETE, - also in the terminal Tier 1 summary. Only the incomplete scans and - publication eligibility say incomplete. + evidence in the reported status, so the check shows FAIL, not INCOMPLETE. + Only the incomplete scans and publication eligibility say incomplete. """ assert result.incomplete_scans == [stage] run = resolve_run_status([result]) @@ -373,27 +372,24 @@ def _assert_failed_with_incomplete_scan(result: ValidationResult, stage: str = " assert run.headline == Status.FAILED assert run.missing == (stage,) assert run.publication == Status.INCOMPLETE - _assert_tier1_summary_reports_the_hook_gate(result) + _assert_what_to_fix_lists_the_hook_gate(result) -def _assert_tier1_summary_reports_the_hook_gate(result: ValidationResult) -> None: - """The terminal Tier 1 summary counts the check as failed and names its hook gate failure. +def _assert_what_to_fix_lists_the_hook_gate(result: ValidationResult) -> None: + """The "what to fix" items of the Tier 1 terminal summary show the hook gate failure. - Beside a gap that records the scan as incomplete, the fix line names every - gate failure, so the hook gate is not hidden behind the gap. The summary - neither counts the check as not run nor suggests skipping it. + The check's own item names its first gate failure, which beside a gap that + records the scan as incomplete is often the error for the gap. An + unresolved reference keeps its item next, and each later gate failure + follows, so the hook gate failure is not hidden behind the gap. """ - ok, rows = summarize_tier1([result], lineup=["security"]) - assert not ok - [summary] = [row for row in rows if row.label == "summary"] - counts = [chunk for chunk, _style in summary.segments] - assert "1 failed" in counts - assert not [chunk for chunk in counts if "didn't run" in chunk or "incomplete" in chunk] - assert not [row for row in rows if row.label == "setup"] - assert not [row for row in rows if any("--skip" in chunk for chunk, _style in row.segments)] - [fix] = [row for row in rows if row.glyph == "1"] - assert [chunk for chunk, _style in fix.segments] == ["; ".join(result.gate_failures)] - assert [gate for gate in result.gate_failures if "could not model these hooks" in gate] + _passed, rows = summarize_tier1([result], lineup=["security"]) + fixes = ["".join(text for text, _style in row.segments) for row in rows if row.glyph.isdigit()] + gates = list(dict.fromkeys(result.gate_failures)) + references = [fix for fix in fixes if fix.startswith("SkillSpector ran, but couldn't resolve the file reference")] + assert bool(references) == any("[reference_resolution; reference_missing]" in gate for gate in gates) + assert fixes == [gates[0], *references, *gates[1:]][: len(fixes)] + assert [fix for fix in fixes if "could not model these hooks" in fix] def _assert_terminal_summary_lists_a_failure(result: ValidationResult) -> None: @@ -401,7 +397,7 @@ def _assert_terminal_summary_lists_a_failure(result: ValidationResult) -> None: A check that is not counted as a confirmed failure is listed as one that "didn't run", with advice to install the scanner or skip the check. The - scanners row and the single "what to fix" line follow the rules for any + scanners row and the first "what to fix" item follow the rules for any incomplete scan, so this does not pin the scanners row, or which of several gate failures comes first. """ @@ -539,7 +535,6 @@ def test_policy_overrides_cannot_pass_the_hooks( assert result.status == "failed" assert result.errors == [_gate("hooks/hooks.json")] assert resolve_run_status([result]).of(result) == Status.FAILED - _assert_tier1_summary_reports_the_hook_gate(result) exported = json.loads(JSONReporter(include_timestamp=False).render_all([result])) assert (exported["overall_status"], exported["results"][0]["status"]) == ("failed", "failed") _assert_terminal_summary_lists_a_failure(result)