Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(tier1): require complete missing-reference evidence (#483)

Narendran Raghavan7a379154725b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd4e79c5..c846132c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -826,8 +826,12 @@ All notable changes to SkillEvaluator are documented in this file.
(`reference_unresolved` from v2.12.0), a fatal or other ledger row, an
uninspected file, a degraded analyzer, a limitation, or fewer findings
counted after filtering than before still leaves the scan `INCOMPLETE`.
-
-- Missing-reference coverage checks retain standalone shell wildcards while ignoring leading Markdown bullets, so commands cannot hide uninspected files.
+ Every missing reference must match an accepted ledger location; ambiguous
+ references, unknown completeness fields and truncated evidence remain
+ `INCOMPLETE`. Nonfatal exclusions must name real uninspected paths. Line
+ checks retain standalone shell wildcards and recognize escaped spaces, and
+ accepted-reference warnings survive static/LLM finding deduplication. A
+ refused reference includes a short acceptance hint and documentation link.
- Estimate Tier 1 instruction tokens from the parsed Markdown body, so `---`
inside YAML values or comments does not count frontmatter as instructions.
diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx
index f8ee09b3..bc684857 100644
--- a/docs/tier1-validation.mdx
+++ b/docs/tier1-validation.mdx
@@ -252,15 +252,15 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice
SkillSpector also reports the analysis as `partial` when the skill's instructions name a file that it did not scan, such as a file the skill writes at run time (`output/notes.md`) or a source file elsewhere in the repository. SkillEvaluator accepts that gap with a warning instead of `INCOMPLETE` when each such reference meets all of these conditions:
- It is a nonfatal `reference_resolution` row for one line of a file that the report lists once as a component and that is a regular, single-link file of at most 1,000,000 bytes inside the skill, not reached through a symlink.
- - The report's `references` list records a `missing` reference on that line, quotes part of the line, and records no `ambiguous` reference there.
+ - The report's complete `references` list records a `missing` reference on that line and quotes part of the line. Every `missing` entry must have an accepted ledger row at the same source path and line; an `ambiguous` entry anywhere, a truncation marker, or an unknown completeness field leaves the scan `INCOMPLETE`.
- The line, at most 10,000 characters long, names nothing in the skill that SkillSpector did not inspect: a symlink, a file the report does not list, a directory that holds no listed file, such as `versions/`, `node_modules/` or `evals/results/`, which SkillEvaluator leaves out of the scanned copy, anything inside such a directory, or a directory that holds any of these, even beside listed files. A `.git` directory counts by its own name, by its Git hooks other than `*.sample` templates, and by every other entry in it that is not part of Git's own layout, such as a script placed there, with everything inside that entry. Git's own files, such as `HEAD`, `config`, `index`, `packed-refs` or `ORIG_HEAD`, and what its `objects`, `refs`, `logs` and `info` directories hold, such as branch names, do not count. Names are compared without regard to case or Unicode normalization, in the line as written and as a Markdown renderer or a reader of file paths may read it: with backslash escapes of ASCII punctuation (such as `node\_modules`) removed, HTML character references (such as `v`) resolved and percent-escapes decoded, up to three of these steps in any order. A skill with more than 50,000 files and directories, or nested more than 64 directories deep, is not checked, and its scan stays `INCOMPLETE`. The work of checking a report's lines is also bounded: when it would take longer, such as for many long lines beside thousands of files left out of the scan, the scan stays `INCOMPLETE`.
- - A word in the line that a shell, cmd.exe, PowerShell or Windows would expand or unquote is read as a pattern, and none of those names may match it. In the pattern, quotes and escapes are removed, a group such as `(v)` stands for what it holds, also right after `]` as in `[v](e)rsions`, each expansion, set of alternatives, extended glob or numeric range may stand for any text, and each bracket expression for any one character. The word is read the way POSIX shells read globs, brace and parameter expansions, `$(...)` and quotes (`v*/*.sh`, `vers?ons`, `v[e]rsions`, `v{e,x}rsions`, `$DIR/run.sh`, `ver""sions`); the way zsh reads groups (`(v)ersions`, `(v|x)ersions`), numeric ranges (`run<1-9>.sh`), the `EXTENDED_GLOB` operators `^`, `#` and `~` (`ver^x`, `verr#sions`, and `v*~x`, read as `v*`), where `x#` as a whole part, such as `C#`, matches only names made of `x`, and globbing flags such as `(#a2)` or `(#c1)`, which make the whole word stand for any text (`(#a2)virsions/x`); the way bash and ksh read extended globs (`@(v)ersions`, `!(x)`); the way cmd.exe reads the `^` escape (`ver^sions`), variables (`%DIR%`, `!DIR!`) and batch parameters (`%1`, `%~dp0`); the way PowerShell reads backtick escapes; with `\` as a directory separator (`v*\i*.sh`); and with a Windows short (8.3) name or a Samba mangled name, a path part with text after a `~` such as `NODE_M~1/BOOTST~1.SH`, standing for any name that holds the part's first character, such as any name with an `n` for `NODE_M~1`. So `3~5` is read as written, as `3`, and as any name with a `3`. A span between backticks is read as Markdown code, as written and with its backticks removed, not as a command, so a plural written as `` `topic`s `` is read as `topics`. A word made only of `*`, such as a list marker, is not read this way. Prose with this syntax is read the same way: a price such as `$5`, a list such as `{a,b}`, `%APPDATA%` or a lone `^` stands for any text, so a line with one stays `INCOMPLETE` whenever anything is left out of the scan, and `approx~10` stays `INCOMPLETE` when a name left out holds an `a`.
+ - A word in the line that a shell, cmd.exe, PowerShell or Windows would expand or unquote is read as a pattern, and none of those names may match it. In the pattern, quotes and escapes are removed, a group such as `(v)` stands for what it holds, also right after `]` as in `[v](e)rsions`, each expansion, set of alternatives, extended glob or numeric range may stand for any text, and each bracket expression for any one character. The word is read the way POSIX shells read globs, brace and parameter expansions, `$(...)` and quotes (`v*/*.sh`, `vers?ons`, `v[e]rsions`, `v{e,x}rsions`, `$DIR/run.sh`, `ver""sions`); the way zsh reads groups (`(v)ersions`, `(v|x)ersions`), numeric ranges (`run<1-9>.sh`), the `EXTENDED_GLOB` operators `^`, `#` and `~` (`ver^x`, `verr#sions`, and `v*~x`, read as `v*`), where `x#` as a whole part, such as `C#`, matches only names made of `x`, and globbing flags such as `(#a2)` or `(#c1)`, which make the whole word stand for any text (`(#a2)virsions/x`); the way bash and ksh read extended globs (`@(v)ersions`, `!(x)`); the way cmd.exe reads the `^` escape (`ver^sions`), variables (`%DIR%`, `!DIR!`) and batch parameters (`%1`, `%~dp0`); the way PowerShell reads backtick escapes; with `\` as a directory separator (`v*\i*.sh`); and with a Windows short (8.3) name or a Samba mangled name, a path part with text after a `~` such as `NODE_M~1/BOOTST~1.SH`, standing for any name that holds the part's first character, such as any name with an `n` for `NODE_M~1`. So `3~5` is read as written, as `3`, and as any name with a `3`. A span between backticks is read as Markdown code, as written and with its backticks removed, not as a command, so a plural written as `` `topic`s `` is read as `topics`. Only a leading Markdown `* ` list marker is ignored; a standalone shell wildcard elsewhere, such as `bash *`, still counts. Prose with this syntax is read the same way: a price such as `$5`, a list such as `{a,b}`, `%APPDATA%` or a lone `^` stands for any text, so a line with one stays `INCOMPLETE` whenever anything is left out of the scan, and `approx~10` stays `INCOMPLETE` when a name left out holds an `a`.
- The check reads names that are written in the reported line, in the spellings above. It does not read other lines and does not run commands, so it does not detect a name on another line, such as `DIR=node_modules` set on one line and used as `sh $DIR/run.sh` on the next, or a name that a command prints or builds, such as `printf` output in backticks, a list piped into `xargs sh`, `find -exec`, or a PowerShell string joined with `+`. It is meant to keep an instruction that names a left-out file `INCOMPLETE`, not to catch a skill written to hide one. Without this check, such a skill passes whenever SkillSpector reports no missing reference in it; with it, the skill also passes when every line SkillSpector reports is another missing reference, such as `output/notes.md`. SkillSpector's own analyzers, not this check, assess the instructions it scanned.
- When the target is a single file, such as `skillevaluator security-scan path/to/SKILL.md`, SkillSpector scans that file alone, so every other file and directory beside it counts as not inspected. A line in it that names a file beside it, such as `scripts/install.sh`, keeps the scan `INCOMPLETE`.
- Tier 3 output in its default location, `<skill>/evals/results`, is left out of the scanned copy too, so it counts as not inspected. The rest of `evals/`, such as `evals/evals.json` and input fixtures in `evals/files`, is scanned. After a Tier 3 run, a line that names `results`, a file the run leaves there, such as `report.html` or `summary.json`, or, when the run used `--harbor-keep-jobs`, any bundled file (the kept Harbor tasks hold a copy of the skill) keeps the scan `INCOMPLETE`, although the same line passed before the run. Writing Tier 3 results outside the skill, with `--results-dir` or `SKILLEVALUATOR_RESULTS_DIR`, keeps a run from changing the result.
- The scan covers the whole target. When the target is a folder or a plugin that holds skills, such as `skillevaluator security-scan path/to/skills/`, `skillevaluator validate path/to/skills/` (which checks each skill as its own job) or `validate` on a plugin, each skill in it is scanned on its own, and a line may name a file elsewhere in the target that the skill's scan did not inspect, so those skills' missing references keep their scans `INCOMPLETE`.
- Any other gap must be a referenced image that SkillEvaluator accepts as described above, and the scan then carries both warnings. Without such images, the report must also show no partially or entirely uninspected file, no limitation and no fatal scope exclusion, and every analyzer must have completed or be not applicable or disabled. In either case the report must count as many findings after filtering as before it. The warning names the file and line of up to three of the references; it does not quote the referenced path. Files not in the scan, including any outside the scanned path, are not inspected.
+ Every nonfatal scope exclusion must name an actual uninspected entry under the target. Accepted missing-reference warnings remain visible after the static and LLM stages deduplicate their findings. Any other gap must be a referenced image that SkillEvaluator accepts as described above, and the scan then carries both warnings. Without such images, the report must also show no partially or entirely uninspected file, no limitation and no fatal scope exclusion, and every analyzer must have completed or be not applicable or disabled. In either case the report must count as many findings after filtering as before it. The warning names the file and line of up to three of the references; it does not quote the referenced path. Files not in the scan, including any outside the scanned path, are not inspected.
SkillSpector v2.12.0 to v2.13.3 report these references as `reference_missing`, and v2.10 and v2.11 as `reference_unresolved`, which SkillEvaluator accepts under the same conditions. A v2.13.3 report whose only gaps are such references is also accepted from the report alone as a missing-reference caveat: an INFO finding that keeps SkillSpector's `partial` status and is recorded as `skillspector_reference_caveats` in the JSON report. It replaces the warning above, and whenever the scan has a known target, as through `validate`, `tier1` or `security-scan`, it is accepted only when the conditions above hold too. A reference that matches several bundled files (`reference_unresolved` from v2.12.0, `ambiguous` in the `references` list before it) still leaves the scan `INCOMPLETE`.
diff --git a/src/skillevaluator/skillspector_reference_caveats.py b/src/skillevaluator/skillspector_reference_caveats.py
index 4bb0b422..eb8662e3 100644
--- a/src/skillevaluator/skillspector_reference_caveats.py
+++ b/src/skillevaluator/skillspector_reference_caveats.py
@@ -11,7 +11,7 @@ adapter must still validate findings, risk, inventory and requested LLM work.
from collections.abc import Mapping, Set
from pathlib import PurePosixPath
-_COMPLETENESS_FIELDS = frozenset(
+REFERENCE_COMPLETENESS_FIELDS = frozenset(
{
"total_components",
"scanned_components",
@@ -66,7 +66,7 @@ def reference_caveat_metadata(
completeness = data.get("analysis_completeness")
if (
not isinstance(completeness, dict)
- or set(completeness) != _COMPLETENESS_FIELDS
+ or set(completeness) != REFERENCE_COMPLETENESS_FIELDS
or data.get("execution_successful") is not True
or completeness.get("execution_successful") is not True
or completeness.get("status") != "partial"
diff --git a/src/skillevaluator/validators/security.py b/src/skillevaluator/validators/security.py
index ec88f3d0..ed88453e 100644
--- a/src/skillevaluator/validators/security.py
+++ b/src/skillevaluator/validators/security.py
@@ -58,7 +58,7 @@ from skillevaluator.provider_config import (
)
from skillevaluator.skillspector_diagnostics import completeness_record, merge_completeness
from skillevaluator.skillspector_provenance import SKILLSPECTOR_LLM_ANALYZERS, sanitize_skillspector_llm_provenance
-from skillevaluator.skillspector_reference_caveats import reference_caveat_metadata
+from skillevaluator.skillspector_reference_caveats import REFERENCE_COMPLETENESS_FIELDS, reference_caveat_metadata
from skillevaluator.spdx import is_spdx_only_html_comment
from skillevaluator.utils.path_security import matches_filesystem_name
from skillevaluator.utils.scanner_install import prepare_skillspector
@@ -1195,6 +1195,12 @@ def _skillspector_runtime_limit_hint(ledger_exceptions: Iterable[Mapping[str, ob
return " ".join(hints) or None
+_SKILLSPECTOR_REFERENCE_REJECTION_HINT = (
+ "Missing references require a standalone target with complete, matching reference and scan evidence. "
+ "See https://docs.nvidia.com/skills/skillevaluator/tier1-validation."
+)
+
+
def _skillspector_incomplete_analysis_error(status: str, ledger_exceptions: list[dict]) -> str:
"""Describe a partial SkillSpector analysis with example gaps and, for runtime limits, a remedy."""
message = f"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status '{status}')"
@@ -1210,6 +1216,8 @@ def _skillspector_incomplete_analysis_error(status: str, ledger_exceptions: list
)
message = f"{message}; security scan did not complete"
hint = _skillspector_runtime_limit_hint(ledger_exceptions)
+ if not hint and ledger_exceptions and all(row.get("phase") == "reference_resolution" for row in ledger_exceptions):
+ hint = _SKILLSPECTOR_REFERENCE_REJECTION_HINT
return f"{message}. {hint}" if hint else message
@@ -1574,10 +1582,10 @@ _SKILLSPECTOR_REFERENCE_SOURCE_MAX_BYTES = 1_000_000
# which a missing reference is no longer accepted.
_SKILLSPECTOR_REFERENCE_TREE_MAX_ENTRIES = 50_000
_SKILLSPECTOR_REFERENCE_LINE_MAX_CHARS = 10_000
-# A Markdown backslash escape of an ASCII punctuation character, which a
-# renderer resolves in text and in a link destination alike. SkillSpector
-# itself removes only ``\\``, ``\(``, ``\)``, ``\<`` and ``\>``.
-_SKILLSPECTOR_MARKDOWN_ESCAPE_RE = re.compile(r"\\([!-/:-@\[-`{-~])")
+# Markdown escapes of ASCII punctuation, and shell-escaped spaces, can hide
+# a path's spelling. SkillSpector itself removes only ``\\``, ``\(``, ``\)``,
+# ``\<`` and ``\>``.
+_SKILLSPECTOR_MARKDOWN_ESCAPE_RE = re.compile(r"\\([ !-/:-@\[-`{-~])")
# Removing Markdown escapes, resolving HTML character references and decoding
# percent-escapes can each reveal another; a reference's line is also read
# after up to this many of them, in any order.
@@ -1763,15 +1771,13 @@ def _skillspector_references_on_line(references: list, path: object, line: int)
]
-def _skillspector_unscanned_names(scanned_root: Path, components: object) -> set[str] | None:
- """Names on the paths of the entries that SkillSpector did not inspect, else ``None``.
+def _skillspector_unscanned_paths(scanned_root: Path, components: object) -> set[str] | None:
+ """Relative paths of entries that SkillSpector did not inspect, else ``None``.
An entry is uninspected when it is a link, a junction or another
non-regular file, a regular file that no ``components`` entry lists, or a
directory that holds no listed file, such as an artifact directory left out
- of a staged scan, with everything inside it. Every part of an uninspected
- entry's path is a name, so a directory that holds one is named even when it
- also holds listed files. Links are not followed.
+ of a staged scan, with everything inside it. Links are not followed.
A ``.git`` directory that holds no listed file counts by its own name, by
every entry outside Git's own layout (:data:`_SKILLSPECTOR_GIT_FILE_RE`,
@@ -1845,7 +1851,17 @@ def _skillspector_unscanned_names(scanned_root: Path, components: object) -> set
uninspected.add(relative)
except OSError:
return None
- return {part for relative in uninspected for part in relative.split("/")}
+ return uninspected
+
+
+def _skillspector_unscanned_names(scanned_root: Path, components: object) -> set[str] | None:
+ """Every path part of an uninspected entry, or ``None`` when the bounded walk fails.
+
+ A directory that holds an uninspected entry is named even when it also
+ holds listed files. The paths come from :func:`_skillspector_unscanned_paths`.
+ """
+ paths = _skillspector_unscanned_paths(scanned_root, components)
+ return None if paths is None else {part for relative in paths for part in relative.split("/")}
def _skillspector_name_keys(names: Iterable[str]) -> frozenset[str]:
@@ -2278,6 +2294,7 @@ def _skillspector_missing_reference_notes(
references: object,
skillspector_version: tuple[int, int, int] | None,
reference_root: Path | None,
+ analysis_completeness: Mapping[str, object],
) -> list[str] | None:
"""Warnings for a ``partial`` analysis whose gaps are references to files not bundled, else ``None``.
@@ -2293,9 +2310,12 @@ def _skillspector_missing_reference_notes(
skill that SkillSpector did not inspect (:func:`_skillspector_unscanned_names`,
:func:`_skillspector_reference_line_avoids`, with one work budget for all
of the report's lines), such as a link or a file in an artifact directory
- left out of a staged scan, and there is no fatal scope exclusion. Any
- other ledger rows must be referenced images that
- :func:`_skillspector_passive_raster_note` accepts, which then accounts for
+ left out of a staged scan, and there is no fatal scope exclusion.
+ Every missing reference must have an accepted ledger row at its source
+ location, and no reference may be ambiguous. Unknown completeness fields,
+ including truncation markers, are not accepted. Nonfatal scope exclusions
+ must name actual uninspected paths. Any other ledger rows must be referenced
+ images that :func:`_skillspector_passive_raster_note` accepts, which then accounts for
the counts, analyzers and limitations, and its note follows. Without them,
no file is partially or entirely uninspected, no finding was filtered out,
there is no limitation, every analyzer is ``completed``, ``not_applicable``
@@ -2313,6 +2333,11 @@ def _skillspector_missing_reference_notes(
``complete_with_caveats`` instead; :func:`_skillspector_reference_caveat_notes`
applies the same rules to it.
"""
+ # A bounded subset cannot establish that every reference was checked.
+ # Keep unknown evidence fields (including truncation markers) outside the
+ # same report contract used by the report-only reference-caveat gate.
+ if set(analysis_completeness) != REFERENCE_COMPLETENESS_FIELDS:
+ return None
reference_rows = [row for row in ledger_exceptions if row.get("phase") == "reference_resolution"]
other_rows = [row for row in ledger_exceptions if row.get("phase") != "reference_resolution"]
if (
@@ -2330,6 +2355,15 @@ def _skillspector_missing_reference_notes(
):
return None
+ locations = {(row["path"], row.get("start_line")) for row in reference_rows}
+ for reference in references:
+ if not isinstance(reference, dict) or reference.get("status") == "ambiguous":
+ return None
+ if reference.get("status") == "missing":
+ path, line = reference.get("source_path"), reference.get("line")
+ if not isinstance(path, str) or type(line) is not int or (path, line) not in locations:
+ return None
+
notes = [_skillspector_missing_reference_warning(reference_rows)]
if other_rows:
image_note = _skillspector_passive_raster_note(
@@ -2346,10 +2380,12 @@ def _skillspector_missing_reference_notes(
or not _skillspector_universal_analyzers_completed(analyzer_statuses, counts["total_components"])
):
return None
- unscanned = _skillspector_unscanned_names(scanned_root, components)
- if unscanned is None:
+ unscanned_paths = _skillspector_unscanned_paths(scanned_root, components)
+ if unscanned_paths is None or any(
+ not isinstance(row.get("path"), str) or row["path"] not in unscanned_paths for row in scope_exclusions
+ ):
return None
- keys = _skillspector_name_keys(unscanned)
+ keys = _skillspector_name_keys(part for path in unscanned_paths for part in path.split("/"))
budget = _SkillspectorMatchBudget()
sources: dict[str, bytes] = {}
checked: set[tuple[str, object]] = set()
@@ -2418,6 +2454,7 @@ def _skillspector_reference_caveat_notes(
references: object,
skillspector_version: tuple[int, int, int] | None,
reference_root: Path | None,
+ analysis_completeness: Mapping[str, object],
) -> list[str] | None:
"""Warnings for a ``complete_with_caveats`` analysis, else ``None``.
@@ -2443,6 +2480,7 @@ def _skillspector_reference_caveat_notes(
references=references,
skillspector_version=skillspector_version,
reference_root=reference_root,
+ analysis_completeness=analysis_completeness,
)
@@ -2458,6 +2496,7 @@ def _skillspector_reference_caveat_error(ledger_exceptions: list[dict]) -> str:
"without a caveat; security scan did not complete"
)
rows = [row for row in ledger_exceptions if not _skillspector_row_is_reference_caveat(row)]
+ only_missing_references = not rows
description = "caveats other than missing references"
if not rows:
rows = ledger_exceptions
@@ -2469,7 +2508,8 @@ def _skillspector_reference_caveat_error(ledger_exceptions: list[dict]) -> str:
)
if len(rows) > len(shown):
message = f"{message}; and {len(rows) - len(shown)} more"
- return f"{message}; security scan did not complete"
+ message = f"{message}; security scan did not complete"
+ return f"{message}. {_SKILLSPECTOR_REFERENCE_REJECTION_HINT}" if only_missing_references else message
class SecurityValidator(ValidatorBase):
@@ -3056,8 +3096,16 @@ class SecurityValidator(ValidatorBase):
seen.add(key)
unique.append(finding)
if len(unique) != len(result.findings):
+ errors = result.independent_errors()
+ warnings = result.independent_warnings()
result.findings = unique
result.recalculate_from_findings()
+ for error in errors:
+ if error not in result.errors:
+ result.add_error(error)
+ for warning in warnings:
+ if warning not in result.warnings:
+ result.add_warning(warning)
@staticmethod
def _validate_skillspector_report(
@@ -3655,6 +3703,7 @@ class SecurityValidator(ValidatorBase):
references=analysis_completeness.get("references"),
skillspector_version=skillspector_version,
reference_root=reference_root,
+ analysis_completeness=analysis_completeness,
)
if caveat_notes is None:
# As for a partial report's gaps, the findings are
@@ -3687,6 +3736,7 @@ class SecurityValidator(ValidatorBase):
references=analysis_completeness.get("references"),
skillspector_version=skillspector_version,
reference_root=reference_root,
+ analysis_completeness=analysis_completeness,
)
if accepted_reference_caveats is not None and reference_root is not None and gap_notes is None:
# reference_caveat_metadata reads only the report. When
diff --git a/tests/validators/test_security.py b/tests/validators/test_security.py
index 9902b739..226f6569 100644
--- a/tests/validators/test_security.py
+++ b/tests/validators/test_security.py
@@ -9185,10 +9185,17 @@ def _missing_reference_notes(payload: dict, scanned_root: Path | None, **options
scanned_root,
references=completeness.get("references"),
skillspector_version=version,
+ analysis_completeness=completeness,
**options,
)
+_REFERENCE_REJECTION_HELP = (
+ ". Missing references require a standalone target with complete, matching reference and scan evidence. "
+ "See https://docs.nvidia.com/skills/skillevaluator/tier1-validation."
+)
+
+
def _missing_reference_warning(labels: str, count: int = 1) -> str:
return (
f"SkillSpector reported {count} reference(s) to files the skill does not bundle ({labels}); "
@@ -9285,6 +9292,175 @@ class _InlineCatalogExecutor:
class TestSkillspectorMissingReferences:
"""SkillSpector records a reference to a file the skill does not bundle as a ``partial`` analysis."""
+ def test_finding_deduplication_preserves_independent_errors_and_gates(self) -> None:
+ from skillevaluator.models.result import Finding, Severity, ValidationResult
+
+ result = ValidationResult()
+ finding = Finding(
+ category="SECURITY", severity=Severity.LOW, check_name="advisory", message="Repeated", file_path="SKILL.md"
+ )
+ result.add_structured_finding(finding)
+ result.add_structured_finding(finding)
+ result.fail_gate("Required scope failed")
+ result.add_error("Scanner omitted evidence")
+ result.mark_scan_incomplete("skillspector")
+
+ SecurityValidator._deduplicate_skillspector_findings(result)
+
+ assert len(result.findings) == 1
+ assert result.errors == ["Required scope failed", "Scanner omitted evidence"]
+ assert result.summary.errors == 2
+ assert result.is_incomplete
+ assert not result.passed
+
+ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])
+ @pytest.mark.parametrize(
+ "gap",
+ [
+ "unmapped-missing",
+ "unmapped-ambiguous",
+ "ledger-truncated",
+ "references-truncated",
+ "unknown-field",
+ "unknown-exclusion",
+ ],
+ )
+ @patch("skillevaluator.validators.security.Tools")
+ def test_missing_reference_requires_complete_report_evidence(
+ self, mock_tools, tmp_path: Path, version: str, gap: str
+ ) -> None:
+ files = dict(_NOTES_WRITER_FILES)
+ payload = _reference_report(version)
+ completeness = payload["analysis_completeness"]
+ if gap.startswith("unmapped-"):
+ line = "Run `versions/install.sh` before writing the notes."
+ files["SKILL.md"] += line + "\n"
+ files["versions/install.sh"] = "#!/bin/sh\nexit 0\n"
+ payload["components"][0].update(lines=11, size_bytes=len(files["SKILL.md"].encode()))
+ completeness["references"].append(
+ {
+ **completeness["references"][-1],
+ "line": 11,
+ "evidence": line,
+ "status": "missing" if gap == "unmapped-missing" else "ambiguous",
+ }
+ )
+ elif gap == "ledger-truncated":
+ completeness["ledger_exceptions_truncated"] = True
+ elif gap == "references-truncated":
+ completeness["references_truncated"] = True
+ elif gap == "unknown-field":
+ completeness["unknown_evidence"] = False
+ else:
+ completeness["scope_exclusions"].append(
+ {"path": "not-an-unscanned-entry", "outcome": "out_of_scope", "fatal": False}
+ )
+ skill = _write_skill(tmp_path / "notes-writer", files)
+
+ result = _validate_skillspector_payload(mock_tools, skill, payload)
+
+ assert not result.passed
+ assert result.incomplete_scans == ["skillspector"]
+ assert not any("does not bundle" in warning for warning in result.warnings)
+ assert "skillspector_reference_caveats" not in result.metadata
+
+ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])
+ @patch("skillevaluator.validators.security.Tools")
+ def test_nonfatal_exclusion_must_name_an_actual_unscanned_entry(
+ self, mock_tools, tmp_path: Path, version: str
+ ) -> None:
+ skill = _write_skill(
+ tmp_path / "notes-writer", {**_NOTES_WRITER_FILES, "versions/install.sh": "#!/bin/sh\nexit 0\n"}
+ )
+ payload = _reference_report(version)
+ payload["analysis_completeness"]["scope_exclusions"].append(
+ {"path": "versions/install.sh", "outcome": "out_of_scope", "fatal": False}
+ )
+
+ result = _validate_skillspector_payload(mock_tools, skill, payload)
+
+ assert result.passed
+ assert not result.is_incomplete
+ assert any("does not bundle" in warning for warning in result.warnings)
+
+ @pytest.mark.parametrize("version", ["2.12.0", "2.13.3", "2.13.4"])
+ @patch("skillevaluator.validators.security.Tools")
+ def test_refused_missing_reference_explains_acceptance_requirements(
+ self, mock_tools, tmp_path: Path, version: str
+ ) -> None:
+ skill = _write_skill(tmp_path / "notes-writer", _NOTES_WRITER_FILES)
+ payload = _reference_report(version)
+ payload["analysis_completeness"]["references_truncated"] = True
+
+ result = _validate_skillspector_payload(mock_tools, skill, payload)
+
+ assert result.is_incomplete
+ assert any("standalone target" in error for error in result.errors)
+ assert any("https://docs.nvidia.com/skills/skillevaluator/tier1-validation" in error for error in result.errors)
+
+ @pytest.mark.skipif(os.name == "nt", reason="POSIX shell escapes and symlinks")
+ @pytest.mark.parametrize("version", ["2.11.2", "2.12.0", "2.13.3", "2.13.4"])
+ @patch("skillevaluator.validators.security.Tools")
+ def test_shell_escaped_space_cannot_hide_an_uninspected_name(
+ self, mock_tools, tmp_path: Path, version: str
+ ) -> None:
+ original = "Write the summary to `output/notes.md` and keep it short."
+ line = r"Run `bash my\ script.sh` then write the summary to `output/notes.md`."
+ skill = _write_skill(
+ tmp_path / "notes-writer",
+ {**_NOTES_WRITER_FILES, "SKILL.md": _NOTES_WRITER_FILES["SKILL.md"].replace(original, line)},
+ )
+ outside = tmp_path / "outside.sh"
+ outside.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")
+ (skill / "my script.sh").symlink_to(outside)
+ payload = _reference_report(version)
+ for reference in payload["analysis_completeness"]["references"]:
+ if reference.get("evidence") == original:
+ reference["evidence"] = line
+
+ result = _validate_skillspector_payload(mock_tools, skill, payload)
+
+ assert not result.passed
+ assert result.incomplete_scans == ["skillspector"]
+
+ @pytest.mark.parametrize("version", ["2.11.2", "2.12.0", "2.13.3", "2.13.4"])
+ @patch("skillevaluator.validators.security.Tools")
+ def test_reference_warning_survives_deduplicated_static_and_llm_findings(
+ self, mock_tools, tmp_path: Path, version: str
+ ) -> None:
+ skill = _write_skill(tmp_path / "notes-writer", _NOTES_WRITER_FILES)
+ static, enriched = _reference_report(version), _reference_report(version)
+ for report in (static, enriched):
+ report["issues"] = [
+ {
+ "id": "TM1",
+ "finding_id": "finding-reference-advisory",
+ "match_fingerprint": "reference-advisory-fingerprint",
+ "severity": "LOW",
+ "confidence": 1.0,
+ "finding": "Duplicate low finding",
+ "location": {"file": "SKILL.md", "start_line": 8},
+ }
+ ]
+ report["risk_assessment"].update(score=10, max_issue_severity="LOW")
+ report["analysis_completeness"].update(findings_before_filtering=1, findings_after_filtering=1)
+ enriched["metadata"].update(llm_requested=True, llm_available=True)
+ for status in enriched["analysis_completeness"]["analyzer_statuses"]:
+ if status["status"] == "disabled":
+ status.update(status="completed", planned_work=1, completed=1, reason_code=None)
+ mock_tools.skillspector.is_available = True
+ mock_tools.skillspector.run.side_effect = [
+ ToolResult(success=True, stdout=json.dumps(report), stderr="", exit_code=0) for report in (static, enriched)
+ ]
+
+ result = SecurityValidator(use_llm=True).validate_security_only(skill)
+
+ assert result.passed
+ assert not result.is_incomplete
+ assert len([finding for finding in result.findings if finding.message == "Duplicate low finding"]) == 1
+ marker = "missing-reference caveat" if version == "2.13.3" else "does not bundle"
+ assert any(marker in warning for warning in result.warnings)
+
@pytest.mark.parametrize("version", ["2.11.2", "2.12.0", "2.13.3", "2.13.4"])
@pytest.mark.parametrize(
("line", "complete"),
@@ -9370,7 +9546,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert result.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
- "SKILL.md:8 [reference_resolution; reference_unresolved]; security scan did not complete"
+ "SKILL.md:8 [reference_resolution; reference_unresolved]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert not result.warnings
@@ -9598,7 +9774,7 @@ class TestSkillspectorMissingReferences:
assert result.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
"SKILL.md:8 [reference_resolution; reference_missing]; "
- "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete"
+ "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert not result.warnings
@@ -9699,7 +9875,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert result.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
- "SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete"
+ "SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert not result.warnings
@@ -9757,7 +9933,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert result.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
- "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete"
+ "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert not result.warnings
@@ -9955,7 +10131,7 @@ class TestSkillspectorMissingReferences:
assert rerun.incomplete_scans == ["skillspector"]
assert rerun.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
- "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete"
+ "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert not rerun.warnings
@@ -9979,7 +10155,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert result.errors == [
"[setup-helper] skillspector JSON field 'analysis_completeness' reports incomplete analysis "
- "(status 'partial'): SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete"
+ "(status 'partial'): SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert _missing_reference_notes(payload, skill.resolve(), reference_root=root.resolve()) is None
assert _missing_reference_notes(payload, skill.resolve(), reference_root=skill.resolve()) is not None
@@ -10023,7 +10199,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert (
"[setup-helper] skillspector JSON field 'analysis_completeness' reports incomplete analysis "
- "(status 'partial'): SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete"
+ "(status 'partial'): SKILL.md:8 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
) in result.errors
assert not any("does not bundle" in warning for warning in result.warnings)
# The folder is the reference root only while it is scanned; the skill on its own still passes.
@@ -10095,7 +10271,7 @@ class TestSkillspectorMissingReferences:
assert result.incomplete_scans == ["skillspector"]
assert result.errors == [
"skillspector JSON field 'analysis_completeness' reports incomplete analysis (status 'partial'): "
- "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete"
+ "SKILL.md:10 [reference_resolution; reference_missing]; security scan did not complete" + _REFERENCE_REJECTION_HELP
]
assert _missing_reference_notes(payload, skill, reference_root=None) is None
assert validator.validate_security_only(skill).incomplete_scans == []
@@ -10542,10 +10718,11 @@ _OVERRIDE_NOTES_SKILL = (
def _caveat_error(labels: str, *, description: str = "caveats that SkillEvaluator does not accept") -> str:
- return (
+ message = (
f"skillspector JSON field 'analysis_completeness' reports {description} "
f"(status 'complete_with_caveats'): {labels}; security scan did not complete"
)
+ return message + _REFERENCE_REJECTION_HELP if description == "caveats that SkillEvaluator does not accept" else message
def _other_caveat_error(labels: str) -> str:
@@ -10989,6 +11166,7 @@ class TestSkillspectorCompleteWithCaveats:
references=completeness["references"],
skillspector_version=(2, 13, 4),
reference_root=skill,
+ analysis_completeness=completeness,
)
row = completeness["ledger_exceptions"][0]