From b65646ada7e4031e03b4899953b903b9f1a7a481 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Tue, 3 Nov 2026 08:42:07 -0700 Subject: [PATCH 01/16] feat(quality): load Reliability error-handling rules from quality config Add an error_handling section to quality-default.yaml for the three Reliability error-handling rules: the SKILL.md mention check, the scripts check, and the lib check. Each rule carries points, message, suggestion, and its terms or markers. A custom --quality-config file may set any subset of the section. Omitted blocks and keys keep the packaged values, and a list replaces the packaged list. The packaged section is validated with every key required. Invalid content exits with the file and field named. The config digest now covers error_handling, so every quality_config digest changes, packaged and custom. The custom-file provenance test now derives its expected digest from the loaded config. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- .../config/quality-default.yaml | 23 ++++ src/skillevaluator/quality_config.py | 113 ++++++++++++++-- tests/test_quality_config.py | 122 ++++++++++++++++++ tests/validators/test_quality_score.py | 2 +- 4 files changed, 246 insertions(+), 14 deletions(-) diff --git a/src/skillevaluator/config/quality-default.yaml b/src/skillevaluator/config/quality-default.yaml index a036afac3..9862fca29 100644 --- a/src/skillevaluator/config/quality-default.yaml +++ b/src/skillevaluator/config/quality-default.yaml @@ -20,3 +20,26 @@ expected_headers: points: 5 message: "No troubleshooting section documented" suggestion: "Add '## Troubleshooting' with Error/Cause/Solution patterns" + +# Reliability error-handling rules. A custom file may set any subset of these; +# omitted blocks and keys keep the values below. Set points to 0 to turn a rule off. +error_handling: + # SKILL.md mentions none of the terms (whole word, any case). + mentioned: + points: 10 + message: "No mention of error handling or validation" + suggestion: "Document expected errors and how to handle them" + terms: [error, errors, exception, exceptions, invalid, fail, fails, failed, failure, failures, failing, + validate, validates, validated, validating, validation, validations] + # A script has neither try/except nor any marker (case-sensitive substring). + scripts: + points: 5 + message: "Scripts may lack error handling" + suggestion: "Scripts should handle errors explicitly" + markers: ["if not ", "if error", "raise", "assert", "ValueError", "FileNotFoundError"] + # A lib module has neither try/except nor any marker (case-sensitive substring). + lib: + points: 5 + message: "Lib modules may lack error handling" + suggestion: "Library code should handle errors explicitly with try/except or raise" + markers: ["raise", "assert", "ValueError", "TypeError", "RuntimeError"] diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index 38cfcee2d..6d5d6ec29 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -16,8 +16,10 @@ DEFAULT_QUALITY_CONFIG = files("skillevaluator.config").joinpath("quality-default.yaml") _ATX_HEADING_RE = re.compile(r"^(#{1,6})[ \t]+(.+?)(?:[ \t]+#+)?[ \t]*$") -_TOP_LEVEL_KEYS = frozenset({"expected_headers"}) +_TOP_LEVEL_KEYS = frozenset({"expected_headers", "error_handling"}) _EXPECTED_HEADER_KEYS = frozenset({"heading", "alternatives", "points", "message", "suggestion"}) +# Each error-handling rule's list key: whole-word "terms" for SKILL.md, substring "markers" for code. +_ERROR_HANDLING_LIST_KEYS = {"mentioned": "terms", "scripts": "markers", "lib": "markers"} class QualityConfigError(ValueError): @@ -34,10 +36,37 @@ class ExpectedHeader(TypedDict): suggestion: str +class MentionedRule(TypedDict): + """Deduction when SKILL.md mentions none of the error-handling terms (whole word, any case).""" + + points: int | float + message: str + suggestion: str + terms: list[str] + + +class CodeErrorHandlingRule(TypedDict): + """Deduction for Python files with neither try/except nor any marker (case-sensitive substring).""" + + points: int | float + message: str + suggestion: str + markers: list[str] + + +class ErrorHandlingConfig(TypedDict): + """Reliability error-handling rules; a rule with points 0 is skipped.""" + + mentioned: MentionedRule + scripts: CodeErrorHandlingRule + lib: CodeErrorHandlingRule + + class QualityConfig(TypedDict): """Validated deterministic quality configuration.""" expected_headers: list[ExpectedHeader] + error_handling: ErrorHandlingConfig class QualityConfigProvenance(TypedDict): @@ -64,6 +93,67 @@ def _reject_unknown_keys(mapping: dict, allowed: frozenset[str], source: str, lo ) +def _validate_points(points: object, source: str, location: str) -> int | float: + try: + valid_points = ( + not isinstance(points, bool) and isinstance(points, (int, float)) and isfinite(points) and points >= 0 + ) + except OverflowError: # isfinite() on an int too large for a float + valid_points = False + if not valid_points: + raise QualityConfigError(f"{source}: {location}.points must be a non-negative number") + return points + + +def _validate_text(value: object, source: str, location: str) -> str: + if not isinstance(value, str) or not value.strip(): + raise QualityConfigError(f"{source}: {location} must be a non-empty string when set") + return value + + +def _validate_entries(value: object, source: str, location: str, *, ignore_case: bool) -> list[str]: + if not isinstance(value, list) or not value: + raise QualityConfigError(f"{source}: {location} must be a non-empty list") + seen: set[str] = set() + for index, entry in enumerate(value): + if not isinstance(entry, str) or not entry.strip(): + raise QualityConfigError(f"{source}: {location}[{index}] must be a non-blank string") + key = entry.casefold() if ignore_case else entry + if key in seen: + raise QualityConfigError(f"{source}: duplicate entry '{entry}' in {location}") + seen.add(key) + return list(value) + + +def _parse_error_handling(raw: object, source: str, base: ErrorHandlingConfig | None) -> ErrorHandlingConfig: + """Validate error_handling. Without a base every key is required; with one, omitted blocks and keys keep it.""" + if not isinstance(raw, dict): + raise QualityConfigError(f"{source}: error_handling must be a mapping") + _reject_unknown_keys(raw, frozenset(_ERROR_HANDLING_LIST_KEYS), source, "error_handling") + parsed = {} + for name, list_key in _ERROR_HANDLING_LIST_KEYS.items(): + location = f"error_handling.{name}" + block = raw.get(name, {}) if base else raw.get(name) + if not isinstance(block, dict): + raise QualityConfigError(f"{source}: {location} must be a mapping") + allowed = frozenset({"points", "message", "suggestion", list_key}) + _reject_unknown_keys(block, allowed, source, location) + if base is None: + missing = sorted(allowed - block.keys()) + if missing: + raise QualityConfigError(f"{source}: {location} is missing key(s): {', '.join(missing)}") + merged = {**(base[name] if base else {}), **block} + parsed[name] = { + "points": _validate_points(merged["points"], source, location), + "message": _validate_text(merged["message"], source, f"{location}.message"), + "suggestion": _validate_text(merged["suggestion"], source, f"{location}.suggestion"), + list_key: _validate_entries( + merged[list_key], source, f"{location}.{list_key}", ignore_case=list_key == "terms" + ), + } + return parsed # type: ignore[return-value] + + class _UniqueKeySafeLoader(yaml.SafeLoader): """SafeLoader that rejects repeated mapping keys instead of keeping the last value.""" @@ -129,15 +219,7 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: _normalize_heading(value, source, f"{location}.alternatives[{alternative_index}]") for alternative_index, value in enumerate(raw_alternatives) ] - points = rule.get("points", 5) - try: - valid_points = ( - not isinstance(points, bool) and isinstance(points, (int, float)) and isfinite(points) and points >= 0 - ) - except OverflowError: # isfinite() on an int too large for a float - valid_points = False - if not valid_points: - raise QualityConfigError(f"{source}: {location}.points must be a non-negative number") + points = _validate_points(rule.get("points", 5), source, location) # message and suggestion are optional; omitted ones get generic text naming the headings. accepted_display = " or ".join(f"'{accepted}'" for accepted in (heading, *alternatives)) message = rule.get("message", f"Missing expected heading: {accepted_display}") @@ -146,8 +228,7 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: f"Add a {accepted_display} section" if not alternatives else f"Add one of these sections: {accepted_display}", ) for field, value in (("message", message), ("suggestion", suggestion)): - if not isinstance(value, str) or not value.strip(): - raise QualityConfigError(f"{source}: {location}.{field} must be a non-empty string when set") + _validate_text(value, source, f"{location}.{field}") for accepted in (heading, *alternatives): if accepted in seen_headings: @@ -166,7 +247,13 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: } ) - return {"expected_headers": expected_headers} + # expected_headers replaces the packaged list; error_handling overlays the packaged rules. + if path is None: + error_handling = _parse_error_handling(raw.get("error_handling"), source, base=None) + else: + packaged = load_quality_config()["error_handling"] + error_handling = _parse_error_handling(raw.get("error_handling", {}), source, base=packaged) + return {"expected_headers": expected_headers, "error_handling": error_handling} def quality_config_digest(config: QualityConfig) -> str: diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index 350163265..b4d23fe43 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -246,3 +246,125 @@ def test_quality_config_provenance_names_custom_file_without_its_directory(tmp_p "digest": quality_config_digest(config), } assert quality_config_provenance(None, load_quality_config())["file"] is None + + +PACKAGED_ERROR_HANDLING = { + "mentioned": { + "points": 10, + "message": "No mention of error handling or validation", + "suggestion": "Document expected errors and how to handle them", + "terms": [ + "error", + "errors", + "exception", + "exceptions", + "invalid", + "fail", + "fails", + "failed", + "failure", + "failures", + "failing", + "validate", + "validates", + "validated", + "validating", + "validation", + "validations", + ], + }, + "scripts": { + "points": 5, + "message": "Scripts may lack error handling", + "suggestion": "Scripts should handle errors explicitly", + "markers": ["if not ", "if error", "raise", "assert", "ValueError", "FileNotFoundError"], + }, + "lib": { + "points": 5, + "message": "Lib modules may lack error handling", + "suggestion": "Library code should handle errors explicitly with try/except or raise", + "markers": ["raise", "assert", "ValueError", "TypeError", "RuntimeError"], + }, +} + + +def _write_config(tmp_path: Path, body: str) -> Path: + config_path = tmp_path / "quality.yaml" + config_path.write_text("expected_headers: []\n" + body, encoding="utf-8") + return config_path + + +def test_packaged_error_handling_rules_match_former_hard_coded_values() -> None: + error_handling = load_quality_config()["error_handling"] + + assert error_handling == PACKAGED_ERROR_HANDLING + assert all(type(block["points"]) is int for block in error_handling.values()) + + +def test_custom_file_without_error_handling_keeps_packaged_rules(tmp_path: Path) -> None: + config = load_quality_config(_write_config(tmp_path, "")) + + assert config["expected_headers"] == [] + assert config["error_handling"] == PACKAGED_ERROR_HANDLING + + +def test_custom_error_handling_overlays_packaged_rules_key_by_key(tmp_path: Path) -> None: + config_path = _write_config(tmp_path, "error_handling:\n scripts:\n points: 2\n mentioned:\n terms: [oops]\n") + + error_handling = load_quality_config(config_path)["error_handling"] + + assert error_handling["scripts"] == {**PACKAGED_ERROR_HANDLING["scripts"], "points": 2} + assert error_handling["mentioned"] == {**PACKAGED_ERROR_HANDLING["mentioned"], "terms": ["oops"]} + assert error_handling["lib"] == PACKAGED_ERROR_HANDLING["lib"] + + +@pytest.mark.parametrize( + ("body", "match"), + [ + ("error_handling: []\n", r"error_handling must be a mapping"), + ("error_handling:\n retries: {}\n", r"unknown key\(s\) in error_handling: retries"), + ( + "error_handling:\n mentioned:\n point: 3\n", + r"unknown key\(s\) in error_handling\.mentioned: point \(allowed: message, points, suggestion, terms\)", + ), + ("error_handling:\n scripts:\n terms: [raise]\n", r"unknown key\(s\) in error_handling\.scripts: terms"), + ("error_handling:\n lib: [raise]\n", r"error_handling\.lib must be a mapping"), + ("error_handling:\n scripts:\n points: -1\n", r"error_handling\.scripts\.points must be a non-negative"), + ("error_handling:\n scripts:\n points: true\n", r"error_handling\.scripts\.points must be a non-negative"), + ('error_handling:\n scripts:\n points: "5"\n', r"error_handling\.scripts\.points must be a non-negative"), + ('error_handling:\n lib:\n message: " "\n', r"error_handling\.lib\.message must be a non-empty string"), + ("error_handling:\n lib:\n suggestion: 3\n", r"error_handling\.lib\.suggestion must be a non-empty string"), + ("error_handling:\n scripts:\n markers: []\n", r"error_handling\.scripts\.markers must be a non-empty list"), + ("error_handling:\n scripts:\n markers: raise\n", r"error_handling\.scripts\.markers must be a non-empty list"), + ('error_handling:\n scripts:\n markers: [""]\n', r"error_handling\.scripts\.markers\[0\] must be a non-blank"), + ("error_handling:\n lib:\n markers: [raise, 3]\n", r"error_handling\.lib\.markers\[1\] must be a non-blank"), + ("error_handling:\n scripts:\n markers: [raise, raise]\n", r"duplicate entry 'raise' in error_handling\.scripts\.markers"), + ("error_handling:\n mentioned:\n terms: [Error, error]\n", r"duplicate entry 'error' in error_handling\.mentioned\.terms"), + ], +) +def test_quality_config_rejects_invalid_error_handling(tmp_path: Path, body: str, match: str) -> None: + config_path = _write_config(tmp_path, body) + + with pytest.raises(QualityConfigError, match=rf"^{tmp_path}.*{match}"): + load_quality_config(config_path) + + +def test_error_handling_markers_are_case_sensitive_so_case_variants_are_distinct(tmp_path: Path) -> None: + config_path = _write_config(tmp_path, "error_handling:\n lib:\n markers: [Raise, raise]\n") + + assert load_quality_config(config_path)["error_handling"]["lib"]["markers"] == ["Raise", "raise"] + + +def test_quality_config_digest_covers_error_handling(tmp_path: Path) -> None: + compact = tmp_path / "compact.yaml" + compact.write_text("expected_headers: []\nerror_handling: {mentioned: {points: 9}}\n", encoding="utf-8") + verbose = tmp_path / "verbose.yaml" + verbose.write_text( + "# team rules\nexpected_headers: []\nerror_handling:\n mentioned:\n points: 9\n", encoding="utf-8" + ) + packaged_headings_only = _write_config(tmp_path, "") + + digest = quality_config_digest(load_quality_config(compact)) + + assert quality_config_digest(load_quality_config(verbose)) == digest + assert quality_config_digest(load_quality_config(packaged_headings_only)) != digest diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.py index c1470bea6..732282989 100644 --- a/tests/validators/test_quality_score.py +++ b/tests/validators/test_quality_score.py @@ -670,7 +670,7 @@ def test_result_records_custom_quality_config_file_name_only(self, tmp_path: Pat assert result.metadata["quality_config"] == { "source": "custom", "file": "team-quality.yaml", - "digest": quality_config_digest({"expected_headers": []}), + "digest": quality_config_digest(load_quality_config(config_path)), "min_score": 80, } From dbb0ed12c858f44d69acc725b6747178792798b5 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Tue, 3 Nov 2026 09:19:09 -0700 Subject: [PATCH 02/16] feat(quality): score Reliability error handling from quality config The Reliability mention, scripts, and lib checks now read their points, message, suggestion, terms, and markers from the quality config instead of inline literals. The packaged values reproduce today's scores and findings. Terms match as whole words in any case. Any Unicode letter or digit counts as part of a word, as the old regex did. A try/except pair always counts as handling errors. A rule with points 0 adds no finding, and has_error_handling is still recorded. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- .../validators/quality_score.py | 97 ++++------- tests/validators/test_quality_score.py | 154 ++++++++++++++++++ 2 files changed, 185 insertions(+), 66 deletions(-) diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index fdc3833f6..b3c8648f6 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -37,7 +37,7 @@ from skillevaluator.models.quality import QualityScoreResult from skillevaluator.models.result import Finding, Severity, ValidationResult from skillevaluator.models.skill import XML_TAG_RE -from skillevaluator.quality_config import load_quality_config, quality_config_provenance +from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config, quality_config_provenance from skillevaluator.validators.base import ValidatorBase from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.markdown import markdown_link_targets @@ -46,11 +46,6 @@ _WORD_CHAR = r"A-Za-z0-9_" _URL_EDGE_C0_OR_SPACE_RE = re.compile(r"^[\x00-\x20]+|[\x00-\x20]+$") -_ERROR_HANDLING_RE = re.compile( - r"\b(?:errors?|exceptions?|invalid|fail(?:s|ed|ure|ures|ing)?|" - r"validat(?:e|es|ed|ing|ion|ions))\b", - re.IGNORECASE, -) def _contains_term(text: str, term: str) -> bool: @@ -69,6 +64,12 @@ def _contains_any_term(text: str, terms: Iterable[str]) -> bool: return any(_contains_term(text, term) for term in terms) +def _contains_any_word(text: str, words: Iterable[str]) -> bool: + """Whole-word, case-insensitive match where any Unicode letter or digit counts as part of a word.""" + pattern = "|".join(re.escape(word) for word in words) + return bool(re.search(rf"\b(?:{pattern})\b", text, re.IGNORECASE)) + + def _has_api_documentation(content: str) -> bool: api_patterns = ( r"\bimport\s+[A-Za-z_][A-Za-z0-9_.]*", @@ -658,81 +659,45 @@ def _check_reliability( skill_path: Path, ) -> None: dim = qs.reliability + error_handling = self.quality_config["error_handling"] - if _ERROR_HANDLING_RE.search(content): - qs.has_error_handling = True - else: - dim.deduct( - 10, - "info", - "No mention of error handling or validation", - "Document expected errors and how to handle them", - ) + mentioned = error_handling["mentioned"] + qs.has_error_handling = _contains_any_word(content, mentioned["terms"]) + # A rule with points 0 is turned off, so it adds no finding. + if not qs.has_error_handling and mentioned["points"]: + dim.deduct(mentioned["points"], "info", mentioned["message"], mentioned["suggestion"]) # Type-aware code quality if qs.skill_type in ("script-based", "hybrid"): - self._check_script_reliability(dim, skill_path) + scripts = self._executable_files(skill_path, patterns=("*.py",)) + self._check_code_error_handling(dim, scripts, error_handling["scripts"]) elif qs.skill_type == "lib-based": - self._check_lib_reliability(dim, skill_path) + lib_dir = QualityScoreValidator.find_lib_module(skill_path) + if lib_dir: + modules = [py for py in lib_dir.rglob("*.py") if py.name != "__init__.py"] + self._check_code_error_handling(dim, modules, error_handling["lib"]) for expected in self.quality_config["expected_headers"]: accepted_headings = [expected["heading"], *expected["alternatives"]] if not any(heading in content for heading in accepted_headings): dim.deduct(expected["points"], "info", expected["message"], expected["suggestion"]) - def _check_script_reliability(self, dim, skill_path: Path) -> None: - no_error_handling = [] - for script in self._executable_files(skill_path, patterns=("*.py",)): - try: - sc = script.read_text(encoding="utf-8") - except Exception: - continue - has_try = "try:" in sc and "except" in sc - has_err = any( - p in sc - for p in [ - "if not ", - "if error", - "raise", - "assert", - "ValueError", - "FileNotFoundError", - ] - ) - if not (has_try or has_err): - no_error_handling.append(script.name) - - if no_error_handling: - dim.deduct( - 5, - "info", - f"Scripts may lack error handling: {', '.join(no_error_handling[:3])}", - "Scripts should handle errors explicitly", - ) - - def _check_lib_reliability(self, dim, skill_path: Path) -> None: - lib_dir = QualityScoreValidator.find_lib_module(skill_path) - if not lib_dir: + @staticmethod + def _check_code_error_handling(dim, files: list[Path], rule: CodeErrorHandlingRule) -> None: + """Deduct once when files have neither a try/except pair nor any configured marker.""" + if not rule["points"]: return - no_err = [] - for py in lib_dir.rglob("*.py"): - if py.name == "__init__.py": - continue + unhandled = [] + for path in files: try: - pc = py.read_text(encoding="utf-8") + code = path.read_text(encoding="utf-8") except Exception: continue - has_try = "try:" in pc and "except" in pc - has_err = any(p in pc for p in ["raise", "assert", "ValueError", "TypeError", "RuntimeError"]) - if not (has_try or has_err): - no_err.append(py.name) - if no_err: - dim.deduct( - 5, - "info", - f"Lib modules may lack error handling: {', '.join(no_err[:3])}", - "Library code should handle errors explicitly with try/except or raise", - ) + has_try = "try:" in code and "except" in code + if not (has_try or any(marker in code for marker in rule["markers"])): + unhandled.append(path.name) + if unhandled: + dim.deduct(rule["points"], "info", f"{rule['message']}: {', '.join(unhandled[:3])}", rule["suggestion"]) # ----------------------------------------------------------------- # Efficiency dimension (weight: 0.15) diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.py index 732282989..b13a6292f 100644 --- a/tests/validators/test_quality_score.py +++ b/tests/validators/test_quality_score.py @@ -1245,3 +1245,157 @@ def test_task_list_imperatives_are_clear_action_verbs(self, tmp_path: Path, acti ) assert "Instructions lack clear action verbs" not in messages + + +ERROR_HANDLING_TERMS = [ + "error", + "errors", + "exception", + "exceptions", + "invalid", + "fail", + "fails", + "failed", + "failure", + "failures", + "failing", + "validate", + "validates", + "validated", + "validating", + "validation", + "validations", +] +MENTION_MESSAGE = "No mention of error handling or validation" + + +def _validate_with(skill_dir: Path, tmp_path: Path, config_body: str | None = None): + config_path = None + if config_body is not None: + config_path = tmp_path / "quality.yaml" + config_path.write_text(config_body, encoding="utf-8") + return QualityScoreValidator(min_score=0, quality_config=config_path).validate(skill_dir) + + +def _reliability_issues(result) -> list[tuple[str, float]]: + issues = result.metadata["quality_scores"]["dimensions"]["reliability"]["issues"] + return [(issue["message"], issue["deduction"]) for issue in issues] + + +def _write_script_skill(tmp_path: Path, script: str) -> Path: + skill_dir = _write_issue_skill(tmp_path) + (skill_dir / "scripts").mkdir() + (skill_dir / "scripts" / "run.py").write_text(script, encoding="utf-8") + return skill_dir + + +class TestReliabilityErrorHandlingConfig: + @pytest.mark.parametrize("term", ERROR_HANDLING_TERMS) + def test_each_packaged_term_records_error_handling(self, tmp_path: Path, term: str): + skill_dir = _write_issue_skill(tmp_path, troubleshooting=f"Report the {term} to the owner.") + + result = _validate_with(skill_dir, tmp_path) + + assert result.metadata["quality_scores"]["metrics"]["has_error_handling"] is True + assert MENTION_MESSAGE not in [message for message, _ in _reliability_issues(result)] + + @pytest.mark.parametrize("text", ["errorless", "failsafe", "validator", "éerror", "处理error时", "error٣"]) + def test_terms_inside_other_words_do_not_record_error_handling(self, tmp_path: Path, text: str): + skill_dir = _write_issue_skill(tmp_path, troubleshooting=f"Report {text} output to the owner.") + + result = _validate_with(skill_dir, tmp_path) + + assert result.metadata["quality_scores"]["metrics"]["has_error_handling"] is False + assert (MENTION_MESSAGE, 10) in _reliability_issues(result) + + def test_custom_terms_replace_packaged_terms(self, tmp_path: Path): + config = "expected_headers: []\nerror_handling:\n mentioned:\n terms: [rollback]\n message: No rollback plan\n" + rollback_skill = _write_issue_skill(tmp_path, name="probe-a", troubleshooting="Use rollback on failure.") + error_skill = _write_issue_skill(tmp_path, name="probe-b", troubleshooting="Report the error.") + + rollback_result = _validate_with(rollback_skill, tmp_path, config) + error_result = _validate_with(error_skill, tmp_path, config) + + assert rollback_result.metadata["quality_scores"]["metrics"]["has_error_handling"] is True + assert ("No rollback plan", 10) not in _reliability_issues(rollback_result) + assert error_result.metadata["quality_scores"]["metrics"]["has_error_handling"] is False + assert ("No rollback plan", 10) in _reliability_issues(error_result) + + def test_mentioned_points_zero_skips_the_finding(self, tmp_path: Path): + silent_skill = _write_issue_skill(tmp_path, name="probe-a", troubleshooting="Check the output directory.") + mentioning_skill = _write_issue_skill(tmp_path, name="probe-b", troubleshooting="Report the error.") + + silent = _validate_with(silent_skill, tmp_path, "expected_headers: []\nerror_handling: {mentioned: {points: 0}}\n") + mentioning = _validate_with(mentioning_skill, tmp_path, "expected_headers: []\n") + + assert MENTION_MESSAGE not in [message for message, _ in _reliability_issues(silent)] + assert silent.metadata["quality_scores"]["metrics"]["has_error_handling"] is False + reliability = lambda result: result.metadata["quality_scores"]["dimensions"]["reliability"]["score"] # noqa: E731 + assert reliability(silent) == reliability(mentioning) + + def test_scripts_points_zero_skips_the_finding(self, tmp_path: Path): + skill_dir = _write_script_skill(tmp_path, "print('hi')\n") + + packaged = _validate_with(skill_dir, tmp_path) + disabled = _validate_with(skill_dir, tmp_path, "expected_headers: []\nerror_handling: {scripts: {points: 0}}\n") + + assert ("Scripts may lack error handling: run.py", 5) in _reliability_issues(packaged) + assert not [message for message, _ in _reliability_issues(disabled) if message.startswith("Scripts may lack")] + + def test_heading_rule_with_zero_points_still_reports_a_zero_deduction(self, tmp_path: Path): + skill_dir = _write_issue_skill(tmp_path) + config = 'expected_headers:\n - heading: "## Rollback"\n points: 0\n message: No rollback section\n' + + result = _validate_with(skill_dir, tmp_path, config) + + assert ("No rollback section", 0) in _reliability_issues(result) + + def test_script_markers_come_from_config(self, tmp_path: Path): + skill_dir = _write_script_skill(tmp_path, "def main():\n raise SystemExit(1)\n") + config = ( + "expected_headers: []\nerror_handling:\n scripts:\n markers: [sys.exit]\n" + " message: Scripts skip sys.exit\n" + ) + + packaged = _validate_with(skill_dir, tmp_path) + custom = _validate_with(skill_dir, tmp_path, config) + + assert not [message for message, _ in _reliability_issues(packaged) if message.startswith("Scripts may lack")] + assert ("Scripts skip sys.exit: run.py", 5) in _reliability_issues(custom) + + def test_try_except_pair_counts_regardless_of_markers(self, tmp_path: Path): + skill_dir = _write_script_skill(tmp_path, "try:\n main()\nexcept OSError:\n pass\n") + config = "expected_headers: []\nerror_handling:\n scripts:\n markers: [sys.exit]\n" + + result = _validate_with(skill_dir, tmp_path, config) + + assert not [message for message, _ in _reliability_issues(result) if message.startswith("Scripts may lack")] + + def test_lib_finding_lists_at_most_three_modules(self, tmp_path: Path): + skill_dir = _write_issue_skill(tmp_path) + module = skill_dir / "probe" + module.mkdir() + (module / "__init__.py").write_text("") + for name in ("a", "b", "c", "d"): + (module / f"{name}.py").write_text("VALUE = 1\n") + + result = _validate_with(skill_dir, tmp_path) + + lib_issues = [(m, d) for m, d in _reliability_issues(result) if m.startswith("Lib modules may lack error handling: ")] + assert len(lib_issues) == 1 and lib_issues[0][1] == 5 + names = lib_issues[0][0].removeprefix("Lib modules may lack error handling: ").split(", ") + assert len(names) == 3 and set(names) < {"a.py", "b.py", "c.py", "d.py"} + + def test_lib_markers_come_from_config(self, tmp_path: Path): + skill_dir = _write_issue_skill(tmp_path) + module = skill_dir / "probe" + module.mkdir() + (module / "__init__.py").write_text("") + (module / "core.py").write_text("def run():\n raise RuntimeError('x')\n") + config = "expected_headers: []\nerror_handling:\n lib:\n markers: [logger.exception]\n points: 7\n" + + packaged = _validate_with(skill_dir, tmp_path) + custom = _validate_with(skill_dir, tmp_path, config) + + assert not [m for m, _ in _reliability_issues(packaged) if m.startswith("Lib modules may lack")] + assert ("Lib modules may lack error handling: core.py", 7) in _reliability_issues(custom) From 70580c1e8520b7887d192d1fbdf39f2aa8214959 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Tue, 3 Nov 2026 09:19:10 -0700 Subject: [PATCH 03/16] docs(quality): document error_handling in the quality config Describe the error_handling section, how it merges with packaged values, and how terms differ from markers. Note in the CHANGELOG that every quality_config digest changes after upgrade while scores stay the same. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- CHANGELOG.md | 8 ++++++++ docs/tier1-validation.mdx | 23 +++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4544224..acbed9a4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,14 @@ All notable changes to SkillEvaluator are documented in this file. approved reusable workflow wrappers. Direct callers retain the existing setup; signed evaluator identity and exact consumer workflow approvals remain required. +- Add an `error_handling` section to the `--quality-config` file for + Reliability's three error-handling rules: the `SKILL.md` mention check and + the `scripts` and `lib` code checks. Each sets `points`, `message`, + `suggestion`, and its `terms` or `markers`; `points: 0` turns a rule off. + The section is optional and merges with the packaged values. Without a + custom file, scores and findings are unchanged. Every recorded + `quality_config` digest changes, packaged and custom, because the digest now + covers the error-handling rules, so digests from earlier runs won't match. - Include `skillevaluator ci init`, `ci status` and `ci demo` in the Python package. Guided GitHub onboarding discovers skills, configures checks and optional public hosted reports, and opens a reviewable setup PR. An optional diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index c9b54d81b..f370dec12 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -268,7 +268,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice If a quality score changes unexpectedly, inspect the finding message rather than adding keywords. The checker rewards usable instructions and evidence in their relevant context, not vocabulary alone. - **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to use your own list instead. The file replaces the packaged defaults rather than merging with them, so copy any default entries you want to keep. + **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to use your own list instead. The `expected_headers` list replaces the packaged list rather than merging with it, so copy any default entries you want to keep. A custom file must include `expected_headers`, even as `expected_headers: []`. ```yaml title="quality.yaml" expected_headers: @@ -303,7 +303,26 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice An entry is satisfied when the heading or any alternative appears anywhere in `SKILL.md` as text, so `## Security` also matches `### Security Notes` or a heading inside a code block. - The file is checked before any validation runs. A file that is missing, unreadable, not UTF-8, invalid YAML, has an unknown key (such as `point` instead of `points`), or lists the same heading twice is a usage error: the command exits with code 2 and names the file and the problem. `validate` checks the file even when `--checks` leaves out `quality`. + **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. Unlike `expected_headers`, this section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. + + ```yaml title="quality.yaml" + expected_headers: [] + error_handling: + mentioned: + terms: [error, failure, rollback, retry] + scripts: + points: 0 + ``` + + | Rule | Deducts when | Packaged points | List field | + | --- | --- | --- | --- | + | `mentioned` | `SKILL.md` contains none of the `terms` | `10` | `terms`: whole words, any case. `error` matches `Error` but not `errorless` | + | `scripts` | A `.py` file under `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | + | `lib` | A module in the skill's Python package has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | + + Each rule also takes `message` and `suggestion`. The `scripts` and `lib` findings append up to three file names to the message, as in `Scripts may lack error handling: run.py`. The `try:`/`except` pair always counts as error handling and is not configurable. See the packaged `quality-default.yaml` for every default term and marker. + + The file is checked before any validation runs. A file that is missing, unreadable, not UTF-8, invalid YAML, has an unknown key (such as `point` instead of `points`), lists the same heading twice, has a negative or non-numeric `points`, an empty `terms` or `markers` list, or a repeated entry in one of those lists is a usage error: the command exits with code 2 and names the file and the problem. `validate` checks the file even when `--checks` leaves out `quality`. ```text title="Example error" Error: Invalid value for '--quality-config': quality.yaml: unknown key(s) in expected_headers[0]: point (allowed: alternatives, heading, message, points, suggestion) From 3f16fddf60c0d72d8ee6b50fb3d23d0bef6761bc Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Tue, 3 Nov 2026 09:21:27 -0700 Subject: [PATCH 04/16] refactor(quality): tidy error_handling loading Use one explicit check for whether a packaged base is present, and drop comments that restate the code. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- src/skillevaluator/quality_config.py | 7 ++----- src/skillevaluator/validators/quality_score.py | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index 6d5d6ec29..dce5900be 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -18,7 +18,6 @@ _ATX_HEADING_RE = re.compile(r"^(#{1,6})[ \t]+(.+?)(?:[ \t]+#+)?[ \t]*$") _TOP_LEVEL_KEYS = frozenset({"expected_headers", "error_handling"}) _EXPECTED_HEADER_KEYS = frozenset({"heading", "alternatives", "points", "message", "suggestion"}) -# Each error-handling rule's list key: whole-word "terms" for SKILL.md, substring "markers" for code. _ERROR_HANDLING_LIST_KEYS = {"mentioned": "terms", "scripts": "markers", "lib": "markers"} @@ -126,14 +125,13 @@ def _validate_entries(value: object, source: str, location: str, *, ignore_case: def _parse_error_handling(raw: object, source: str, base: ErrorHandlingConfig | None) -> ErrorHandlingConfig: - """Validate error_handling. Without a base every key is required; with one, omitted blocks and keys keep it.""" if not isinstance(raw, dict): raise QualityConfigError(f"{source}: error_handling must be a mapping") _reject_unknown_keys(raw, frozenset(_ERROR_HANDLING_LIST_KEYS), source, "error_handling") parsed = {} for name, list_key in _ERROR_HANDLING_LIST_KEYS.items(): location = f"error_handling.{name}" - block = raw.get(name, {}) if base else raw.get(name) + block = raw.get(name) if base is None else raw.get(name, {}) if not isinstance(block, dict): raise QualityConfigError(f"{source}: {location} must be a mapping") allowed = frozenset({"points", "message", "suggestion", list_key}) @@ -142,7 +140,7 @@ def _parse_error_handling(raw: object, source: str, base: ErrorHandlingConfig | missing = sorted(allowed - block.keys()) if missing: raise QualityConfigError(f"{source}: {location} is missing key(s): {', '.join(missing)}") - merged = {**(base[name] if base else {}), **block} + merged = block if base is None else {**base[name], **block} parsed[name] = { "points": _validate_points(merged["points"], source, location), "message": _validate_text(merged["message"], source, f"{location}.message"), @@ -247,7 +245,6 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: } ) - # expected_headers replaces the packaged list; error_handling overlays the packaged rules. if path is None: error_handling = _parse_error_handling(raw.get("error_handling"), source, base=None) else: diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index b3c8648f6..8615496ee 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -65,7 +65,6 @@ def _contains_any_term(text: str, terms: Iterable[str]) -> bool: def _contains_any_word(text: str, words: Iterable[str]) -> bool: - """Whole-word, case-insensitive match where any Unicode letter or digit counts as part of a word.""" pattern = "|".join(re.escape(word) for word in words) return bool(re.search(rf"\b(?:{pattern})\b", text, re.IGNORECASE)) @@ -663,7 +662,6 @@ def _check_reliability( mentioned = error_handling["mentioned"] qs.has_error_handling = _contains_any_word(content, mentioned["terms"]) - # A rule with points 0 is turned off, so it adds no finding. if not qs.has_error_handling and mentioned["points"]: dim.deduct(mentioned["points"], "info", mentioned["message"], mentioned["suggestion"]) @@ -684,7 +682,6 @@ def _check_reliability( @staticmethod def _check_code_error_handling(dim, files: list[Path], rule: CodeErrorHandlingRule) -> None: - """Deduct once when files have neither a try/except pair nor any configured marker.""" if not rule["points"]: return unhandled = [] From a98245952cfa698c766b4da66a6f397913f43ef7 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Tue, 3 Nov 2026 09:29:28 -0700 Subject: [PATCH 05/16] fix(quality): match custom terms that start or end with punctuation A custom term such as "error:" or "C++" never matched, because a word boundary needs a letter or digit on the inside edge. Match the term when no letter or digit sits directly before or after it instead. Packaged terms match exactly as before. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- src/skillevaluator/validators/quality_score.py | 2 +- tests/validators/test_quality_score.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index 8615496ee..4c395a062 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -66,7 +66,7 @@ def _contains_any_term(text: str, terms: Iterable[str]) -> bool: def _contains_any_word(text: str, words: Iterable[str]) -> bool: pattern = "|".join(re.escape(word) for word in words) - return bool(re.search(rf"\b(?:{pattern})\b", text, re.IGNORECASE)) + return bool(re.search(rf"(? bool: diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.py index b13a6292f..8d88d0989 100644 --- a/tests/validators/test_quality_score.py +++ b/tests/validators/test_quality_score.py @@ -1399,3 +1399,12 @@ def test_lib_markers_come_from_config(self, tmp_path: Path): assert not [m for m, _ in _reliability_issues(packaged) if m.startswith("Lib modules may lack")] assert ("Lib modules may lack error handling: core.py", 7) in _reliability_issues(custom) + + @pytest.mark.parametrize(("term", "text"), [("error:", "On error: retry."), ("C++", "Check the C++ build.")]) + def test_custom_terms_with_punctuation_at_the_edge_match(self, tmp_path: Path, term: str, text: str): + skill_dir = _write_issue_skill(tmp_path, troubleshooting=text) + config = f'expected_headers: []\nerror_handling:\n mentioned:\n terms: ["{term}"]\n' + + result = _validate_with(skill_dir, tmp_path, config) + + assert result.metadata["quality_scores"]["metrics"]["has_error_handling"] is True From 8f590f9c3452982e5f8cb88a6a79c6ad8adeff33 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 4 Nov 2026 09:22:03 -0700 Subject: [PATCH 06/16] fix(quality): keep custom quality_config digests stable across packaged changes A custom file's digest now covers only the rules the file sets, not the packaged error_handling values merged into it. Existing custom files keep the digest they had before error_handling existed, and a custom digest changes only when that file's rules change. The packaged digest still covers the whole packaged config. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- CHANGELOG.md | 8 ++- docs/tier1-validation.mdx | 2 +- src/skillevaluator/quality_config.py | 48 +++++++++++---- .../validators/quality_score.py | 5 +- tests/test_quality_config.py | 59 ++++++++++++++++--- tests/validators/test_quality_score.py | 2 +- 6 files changed, 95 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acbed9a4f..8f611e266 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,9 +21,11 @@ All notable changes to SkillEvaluator are documented in this file. the `scripts` and `lib` code checks. Each sets `points`, `message`, `suggestion`, and its `terms` or `markers`; `points: 0` turns a rule off. The section is optional and merges with the packaged values. Without a - custom file, scores and findings are unchanged. Every recorded - `quality_config` digest changes, packaged and custom, because the digest now - covers the error-handling rules, so digests from earlier runs won't match. + custom file, scores and findings are unchanged. The packaged + `quality_config` digest changes once, because `quality-default.yaml` gained + the section. A custom file's digest covers only the rules that file sets, so + existing custom files keep their digests and a digest changes only when the + file's rules change. - Include `skillevaluator ci init`, `ci status` and `ci demo` in the Python package. Guided GitHub onboarding discovers skills, configures checks and optional public hosted reports, and opens a reviewable setup PR. An optional diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index f370dec12..cbe183cec 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -320,7 +320,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice | `scripts` | A `.py` file under `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | | `lib` | A module in the skill's Python package has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | - Each rule also takes `message` and `suggestion`. The `scripts` and `lib` findings append up to three file names to the message, as in `Scripts may lack error handling: run.py`. The `try:`/`except` pair always counts as error handling and is not configurable. See the packaged `quality-default.yaml` for every default term and marker. + Each rule also takes `message` and `suggestion`. The `scripts` and `lib` findings append up to three file names to the message, as in `Scripts may lack error handling: run.py`. The `try:`/`except` pair always counts as error handling and is not configurable. See the packaged `quality-default.yaml` for every default term and marker. The `quality_config` digest in the report covers only the rules your file sets, not the packaged values it leaves out, so the digest changes only when your file's rules change. The file is checked before any validation runs. A file that is missing, unreadable, not UTF-8, invalid YAML, has an unknown key (such as `point` instead of `points`), lists the same heading twice, has a negative or non-numeric `points`, an empty `terms` or `markers` list, or a repeated entry in one of those lists is a usage error: the command exits with code 2 and names the file and the problem. `validate` checks the file even when `--checks` leaves out `quality`. diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index dce5900be..e3005f5f9 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -182,6 +182,26 @@ def _yaml_error_detail(exc: yaml.YAMLError) -> str: def load_quality_config(path: Path | None = None) -> QualityConfig: + """Load and validate the packaged config, or a custom file merged over it.""" + return _load(path)[0] + + +def load_quality_config_with_provenance(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: + """Load the config and describe it. Only the file name is kept, so reports do not leak local paths. + + The digest covers the rules the file itself defines. For a custom file, packaged values it + omits are left out, so its digest changes only when its own rules change. + """ + config, declared = _load(path) + provenance: QualityConfigProvenance = { + "source": "custom" if path else "packaged", + "file": path.name if path else None, + "digest": quality_config_digest(declared), + } + return config, provenance + + +def _load(path: Path | None) -> tuple[QualityConfig, dict]: source = str(path) if path else "packaged quality-default.yaml" try: text = path.read_text(encoding="utf-8") if path else DEFAULT_QUALITY_CONFIG.read_text(encoding="utf-8") @@ -247,22 +267,24 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: if path is None: error_handling = _parse_error_handling(raw.get("error_handling"), source, base=None) - else: - packaged = load_quality_config()["error_handling"] - error_handling = _parse_error_handling(raw.get("error_handling", {}), source, base=packaged) - return {"expected_headers": expected_headers, "error_handling": error_handling} + config: QualityConfig = {"expected_headers": expected_headers, "error_handling": error_handling} + return config, dict(config) + raw_error_handling = raw.get("error_handling", {}) + packaged = load_quality_config()["error_handling"] + error_handling = _parse_error_handling(raw_error_handling, source, base=packaged) + declared: dict = {"expected_headers": expected_headers} + declared_error_handling = { + name: {key: error_handling[name][key] for key in block} + for name, block in raw_error_handling.items() + if block + } + if declared_error_handling: + declared["error_handling"] = declared_error_handling + return {"expected_headers": expected_headers, "error_handling": error_handling}, declared -def quality_config_digest(config: QualityConfig) -> str: +def quality_config_digest(config: QualityConfig | dict) -> str: """Return a stable digest of the normalized rules, independent of file formatting.""" canonical = json.dumps(config, sort_keys=True, separators=(",", ":")).encode() return f"sha256:{hashlib.sha256(canonical).hexdigest()}" - -def quality_config_provenance(path: Path | None, config: QualityConfig) -> QualityConfigProvenance: - """Describe the effective config. Only the file name is kept, so reports do not leak local paths.""" - return { - "source": "custom" if path else "packaged", - "file": path.name if path else None, - "digest": quality_config_digest(config), - } diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index 4c395a062..5ee26fed5 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -37,7 +37,7 @@ from skillevaluator.models.quality import QualityScoreResult from skillevaluator.models.result import Finding, Severity, ValidationResult from skillevaluator.models.skill import XML_TAG_RE -from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config, quality_config_provenance +from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config_with_provenance from skillevaluator.validators.base import ValidatorBase from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.markdown import markdown_link_targets @@ -132,8 +132,7 @@ class QualityScoreValidator(ValidatorBase): def __init__(self, min_score: int = 70, quality_config: Path | None = None) -> None: self.min_score = min_score - self.quality_config = load_quality_config(quality_config) - self.quality_config_provenance = quality_config_provenance(quality_config, self.quality_config) + self.quality_config, self.quality_config_provenance = load_quality_config_with_provenance(quality_config) @property def name(self) -> str: diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index b4d23fe43..caf2561d2 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -8,8 +8,8 @@ from skillevaluator.quality_config import ( QualityConfigError, load_quality_config, + load_quality_config_with_provenance, quality_config_digest, - quality_config_provenance, ) @@ -238,14 +238,13 @@ def test_quality_config_digest_ignores_formatting_but_not_rules(tmp_path: Path) def test_quality_config_provenance_names_custom_file_without_its_directory(tmp_path: Path) -> None: config_path = tmp_path / "team-quality.yaml" config_path.write_text("expected_headers: []\n", encoding="utf-8") - config = load_quality_config(config_path) - assert quality_config_provenance(config_path, config) == { + assert load_quality_config_with_provenance(config_path)[1] == { "source": "custom", "file": "team-quality.yaml", - "digest": quality_config_digest(config), + "digest": quality_config_digest({"expected_headers": []}), } - assert quality_config_provenance(None, load_quality_config())["file"] is None + assert load_quality_config_with_provenance(None)[1]["file"] is None PACKAGED_ERROR_HANDLING = { @@ -364,7 +363,51 @@ def test_quality_config_digest_covers_error_handling(tmp_path: Path) -> None: ) packaged_headings_only = _write_config(tmp_path, "") - digest = quality_config_digest(load_quality_config(compact)) + digest = _digest(compact) - assert quality_config_digest(load_quality_config(verbose)) == digest - assert quality_config_digest(load_quality_config(packaged_headings_only)) != digest + assert _digest(verbose) == digest + assert _digest(packaged_headings_only) != digest + + +def _digest(path: Path | None) -> str: + return load_quality_config_with_provenance(path)[1]["digest"] + + +def test_packaged_digest_covers_the_whole_packaged_config() -> None: + assert _digest(None) == quality_config_digest(load_quality_config()) + + +def test_custom_digest_covers_only_the_rules_the_file_sets(tmp_path: Path) -> None: + def write(name: str, body: str) -> Path: + path = tmp_path / name + path.write_text("expected_headers: []\n" + body, encoding="utf-8") + return path + + headings_only = write("headings-only.yaml", "") + empty_section = write("empty-section.yaml", "error_handling: {mentioned: {}}\n") + one_key = write("one-key.yaml", "error_handling: {mentioned: {points: 9}}\n") + + assert _digest(headings_only) == quality_config_digest({"expected_headers": []}) + assert _digest(empty_section) == _digest(headings_only) + assert _digest(one_key) == quality_config_digest( + {"expected_headers": [], "error_handling": {"mentioned": {"points": 9}}} + ) + + +def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + from skillevaluator import quality_config + + custom = _write_config(tmp_path, "error_handling: {scripts: {points: 2}}\n") + before_config, before = load_quality_config_with_provenance(custom) + changed_default = tmp_path / "changed-default.yaml" + changed_default.write_text( + quality_config.DEFAULT_QUALITY_CONFIG.read_text(encoding="utf-8").replace("points: 10", "points: 11"), + encoding="utf-8", + ) + monkeypatch.setattr(quality_config, "DEFAULT_QUALITY_CONFIG", changed_default) + + after_config, after = load_quality_config_with_provenance(custom) + + assert after_config["error_handling"]["mentioned"]["points"] == 11 # the new default still applies + assert before_config["error_handling"]["mentioned"]["points"] == 10 + assert after["digest"] == before["digest"] diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.py index 8d88d0989..6b8769070 100644 --- a/tests/validators/test_quality_score.py +++ b/tests/validators/test_quality_score.py @@ -670,7 +670,7 @@ def test_result_records_custom_quality_config_file_name_only(self, tmp_path: Pat assert result.metadata["quality_config"] == { "source": "custom", "file": "team-quality.yaml", - "digest": quality_config_digest(load_quality_config(config_path)), + "digest": quality_config_digest({"expected_headers": []}), "min_score": 80, } From 2914166b430505d0589d1b2453fecc1a8d3d2596 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:32:18 -0700 Subject: [PATCH 07/16] feat(quality-config): let a custom file omit expected_headers A custom --quality-config file that leaves out expected_headers now keeps the packaged heading list, the same way error_handling overlays packaged values. A list that is present still replaces the packaged one, and [] still turns heading checks off. The packaged file still requires the key. The digest covers expected_headers only when the file sets it, so an omitted key is not hashed as the file's own rules and existing custom files keep their digests. The docs example no longer needs `expected_headers: []`. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882469 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- CHANGELOG.md | 5 ++- docs/tier1-validation.mdx | 5 ++- src/skillevaluator/quality_config.py | 13 +++++-- tests/test_quality_config.py | 54 ++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08412fbb3..cf6827860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,10 @@ All notable changes to SkillEvaluator are documented in this file. Reliability's three error-handling rules: the `SKILL.md` mention check and the `scripts` and `lib` code checks. Each sets `points`, `message`, `suggestion`, and its `terms` or `markers`; `points: 0` turns a rule off. - The section is optional and merges with the packaged values. Without a + The section is optional and merges with the packaged values. A custom file + may now also omit `expected_headers`, which then falls back to the packaged + heading list; a list you set still replaces it and `[]` still turns heading + checks off. Without a custom file, scores and findings are unchanged. The packaged `quality_config` digest changes once, because `quality-default.yaml` gained the section. A custom file's digest covers only the rules that file sets, so diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 4c13ec9b3..4812d8125 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -338,7 +338,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice If a quality score changes unexpectedly, inspect the finding message rather than adding keywords. The checker rewards usable instructions and evidence in their relevant context, not vocabulary alone. - **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to use your own list instead. The `expected_headers` list replaces the packaged list rather than merging with it, so copy any default entries you want to keep. A custom file must include `expected_headers`, even as `expected_headers: []`. + **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to use your own list instead. `expected_headers` is optional in a custom file: when you omit it, the packaged list applies. A list you set replaces the packaged list rather than merging with it, so copy any default entries you want to keep. Set `expected_headers: []` to turn heading checks off. ```yaml title="quality.yaml" expected_headers: @@ -373,10 +373,9 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice An entry is satisfied when the heading or any alternative appears anywhere in `SKILL.md` as text, so `## Security` also matches `### Security Notes` or a heading inside a code block. - **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. Unlike `expected_headers`, this section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. + **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. This section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. ```yaml title="quality.yaml" - expected_headers: [] error_handling: mentioned: terms: [error, failure, rollback, retry] diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index e3005f5f9..7ee71e22c 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -217,9 +217,16 @@ def _load(path: Path | None) -> tuple[QualityConfig, dict]: raise QualityConfigError(f"{source}: invalid YAML: nesting is too deep") from exc except (ValueError, TypeError, KeyError, AttributeError) as exc: raise QualityConfigError(f"{source}: invalid YAML: cannot parse a value: {exc}") from exc - if not isinstance(raw, dict) or not isinstance(raw.get("expected_headers"), list): + if not isinstance(raw, dict): + raise QualityConfigError(f"{source}: expected_headers must be a list") + # A custom file may omit expected_headers and inherit the packaged list; the packaged file may not. + headers_declared = path is None or "expected_headers" in raw + if headers_declared and not isinstance(raw.get("expected_headers"), list): raise QualityConfigError(f"{source}: expected_headers must be a list") _reject_unknown_keys(raw, _TOP_LEVEL_KEYS, source, "top level") + if not headers_declared: + packaged_config = load_quality_config() + raw = {**raw, "expected_headers": []} expected_headers: list[ExpectedHeader] = [] seen_headings: dict[str, str] = {} @@ -271,8 +278,10 @@ def _load(path: Path | None) -> tuple[QualityConfig, dict]: return config, dict(config) raw_error_handling = raw.get("error_handling", {}) packaged = load_quality_config()["error_handling"] + if not headers_declared: + expected_headers = [dict(rule) for rule in packaged_config["expected_headers"]] # type: ignore[misc] error_handling = _parse_error_handling(raw_error_handling, source, base=packaged) - declared: dict = {"expected_headers": expected_headers} + declared: dict = {"expected_headers": expected_headers} if headers_declared else {} declared_error_handling = { name: {key: error_handling[name][key] for key in block} for name, block in raw_error_handling.items() diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index caf2561d2..f9281c2e1 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -411,3 +411,57 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, assert after_config["error_handling"]["mentioned"]["points"] == 11 # the new default still applies assert before_config["error_handling"]["mentioned"]["points"] == 10 assert after["digest"] == before["digest"] + + +def test_custom_file_without_expected_headers_keeps_the_packaged_list(tmp_path: Path) -> None: + custom = tmp_path / "quality.yaml" + custom.write_text("error_handling: {mentioned: {points: 9}}\n", encoding="utf-8") + + config = load_quality_config(custom) + + assert config["expected_headers"] == load_quality_config()["expected_headers"] + assert len(config["expected_headers"]) == 3 + assert config["error_handling"]["mentioned"]["points"] == 9 + + +def test_explicit_expected_headers_replaces_or_empties_the_packaged_list(tmp_path: Path) -> None: + custom = tmp_path / "quality.yaml" + custom.write_text("expected_headers: []\n", encoding="utf-8") + assert load_quality_config(custom)["expected_headers"] == [] + + custom.write_text('expected_headers:\n - heading: "## Examples"\n', encoding="utf-8") + assert [rule["heading"] for rule in load_quality_config(custom)["expected_headers"]] == ["## Examples"] + + +@pytest.mark.parametrize("body", ["expected_headers:\n", "expected_headers: {}\n", "expected_headers: x\n"]) +def test_present_expected_headers_must_still_be_a_list(tmp_path: Path, body: str) -> None: + custom = tmp_path / "quality.yaml" + custom.write_text(body, encoding="utf-8") + + with pytest.raises(QualityConfigError, match="expected_headers must be a list"): + load_quality_config(custom) + + +def test_packaged_file_must_still_declare_expected_headers(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: + from skillevaluator import quality_config + + broken = tmp_path / "broken-default.yaml" + broken.write_text("error_handling: {}\n", encoding="utf-8") + monkeypatch.setattr(quality_config, "DEFAULT_QUALITY_CONFIG", broken) + + with pytest.raises(QualityConfigError, match="expected_headers must be a list"): + load_quality_config() + + +def test_digest_does_not_declare_packaged_headings_when_the_key_is_omitted(tmp_path: Path) -> None: + omitted = tmp_path / "omitted.yaml" + omitted.write_text("error_handling: {mentioned: {points: 9}}\n", encoding="utf-8") + empty = tmp_path / "empty.yaml" + empty.write_text("expected_headers: []\nerror_handling: {mentioned: {points: 9}}\n", encoding="utf-8") + bare = tmp_path / "bare.yaml" + bare.write_text("{}\n", encoding="utf-8") + + assert _digest(omitted) == quality_config_digest({"error_handling": {"mentioned": {"points": 9}}}) + assert _digest(omitted) != _digest(empty) + assert _digest(bare) == quality_config_digest({}) + assert _digest(bare) != _digest(None) From 176e75338dd7b60ecb47a2d78ed1527bf6627009 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:32:18 -0700 Subject: [PATCH 08/16] docs(quality): explain that points: 0 differs between the two sections An error_handling rule with points: 0 is turned off and reports nothing. An expected_headers entry with points: 0 still reports a zero-point advisory finding. Say so in both places so readers don't expect the same behavior. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882477 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- docs/tier1-validation.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 4812d8125..cc4db30f1 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -365,7 +365,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice | --- | --- | --- | | `heading` | Yes | A single ATX Markdown heading, such as `## Security` | | `alternatives` | No | Other headings that satisfy the same entry | - | `points` | No (default `5`) | Non-negative number deducted from Reliability when no accepted heading is found | + | `points` | No (default `5`) | Non-negative number deducted from Reliability when no accepted heading is found. With `points: 0` the missing heading is still reported as a zero-point (advisory) finding, but the score does not change | | `message` | No | Finding message reported when the heading is missing. Defaults to `Missing expected heading: '## Examples'`, listing any alternatives | | `suggestion` | No | Fix suggestion attached to the finding. Defaults to `Add a '## Examples' section`, or `Add one of these sections: ...` when there are alternatives | @@ -373,7 +373,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice An entry is satisfied when the heading or any alternative appears anywhere in `SKILL.md` as text, so `## Security` also matches `### Security Notes` or a heading inside a code block. - **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. This section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. + **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. This section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. This differs from `expected_headers`, where an entry with `points: 0` still reports a zero-point finding that does not change the score. ```yaml title="quality.yaml" error_handling: From ca287e4af065eb6b007b70cecc0c873f388ba73d Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:32:19 -0700 Subject: [PATCH 09/16] docs(quality): narrow the scripts and lib rows to the files checked The scripts rule checks only .py files directly in scripts/ or tools/, and the lib rule runs only for lib-based skills, which have no .py or .sh files in scripts/ or tools/. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882481 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- docs/tier1-validation.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index cc4db30f1..172e8d5eb 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -386,8 +386,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice | Rule | Deducts when | Packaged points | List field | | --- | --- | --- | --- | | `mentioned` | `SKILL.md` contains none of the `terms` | `10` | `terms`: whole words, any case. `error` matches `Error` but not `errorless` | - | `scripts` | A `.py` file under `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | - | `lib` | A module in the skill's Python package has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | + | `scripts` | A `.py` file directly in `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | + | `lib` | A module in the skill's Python package, for skills with no `.py` or `.sh` files in `scripts/` or `tools/`, has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | Each rule also takes `message` and `suggestion`. The `scripts` and `lib` findings append up to three file names to the message, as in `Scripts may lack error handling: run.py`. The `try:`/`except` pair always counts as error handling and is not configurable. See the packaged `quality-default.yaml` for every default term and marker. The `quality_config` digest in the report covers only the rules your file sets, not the packaged values it leaves out, so the digest changes only when your file's rules change. From 8f939cbc4f0afb8e3d0953c8f7085f2e87b100a9 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:32:19 -0700 Subject: [PATCH 10/16] fix(quality): match multi-word error-handling terms across whitespace A custom term such as `exit code` now matches when its words are split by a line break or several spaces. Packaged terms are single words, so default scores are unchanged. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882487 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- docs/tier1-validation.mdx | 2 +- .../validators/quality_score.py | 3 ++- tests/validators/test_quality_score.py | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index 172e8d5eb..f5e87526c 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -385,7 +385,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice | Rule | Deducts when | Packaged points | List field | | --- | --- | --- | --- | - | `mentioned` | `SKILL.md` contains none of the `terms` | `10` | `terms`: whole words, any case. `error` matches `Error` but not `errorless` | + | `mentioned` | `SKILL.md` contains none of the `terms` | `10` | `terms`: whole words, any case. `error` matches `Error` but not `errorless`. A term with spaces, such as `exit code`, also matches when its words are split by a line break or several spaces | | `scripts` | A `.py` file directly in `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | | `lib` | A module in the skill's Python package, for skills with no `.py` or `.sh` files in `scripts/` or `tools/`, has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index 4775dad14..f770e272c 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -182,7 +182,8 @@ def _contains_any_term(text: str, terms: Iterable[str]) -> bool: def _contains_any_word(text: str, words: Iterable[str]) -> bool: - pattern = "|".join(re.escape(word) for word in words) + # Whitespace inside a multi-word term matches any run of whitespace, so wrapped text still matches. + pattern = "|".join(r"\s+".join(map(re.escape, word.split())) for word in words) return bool(re.search(rf"(? Date: Wed, 11 Nov 2026 06:32:19 -0700 Subject: [PATCH 11/16] docs(quality): describe the quality config file as a whole Add a short overview of the --quality-config file before the per-section details, and update the --quality-config flag rows in the CLI reference, which still said the file replaces the expected-heading rules. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- docs/cli-reference.mdx | 6 +++--- docs/tier1-validation.mdx | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/cli-reference.mdx b/docs/cli-reference.mdx index 744d0c710..2e346d73f 100644 --- a/docs/cli-reference.mdx +++ b/docs/cli-reference.mdx @@ -149,7 +149,7 @@ errors, such as an option the workflow does not accept, exit `2`. | `--skip CHECKS` | none | Comma-separated checks to leave out, e.g. `secrets` for the Gitleaks scan. Skipped checks are shown and reported as skipped, nothing is installed for them, and the run cannot certify Tier 1 for publication | | `--llm / --no-llm` | Enabled when a provider is configured | Enable or skip rubric, LLM security, and finding verification; explicit `--llm` requires valid provider configuration | | `--min-score INTEGER` | `70` | Minimum passing quality and rubric score, from 0 to 100; quality severity overrides cannot waive the minimum | -| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that replaces the quality check's expected-heading rules. See [Tier 1: Validation](tier1-validation.mdx#the-checks). | +| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that adjusts the quality check's expected headings and error-handling rules; settings it omits keep their packaged values. See [Tier 1: Validation](tier1-validation.mdx#the-checks). | | `--pii-waivers PATH` | none | Reviewed, expiring PII waivers applied by the `pii` check. See [PII waivers](tier1-validation.mdx#pii-waivers). | | `--profile TEXT` | `SKILLEVALUATOR_PROFILE`, then `default` | Validation policy; `external` is a compatibility alias | | `--previous-version TEXT` | `SKILLEVALUATOR_PREVIOUS_VERSION`, else unset | Previous version for version checks | @@ -301,7 +301,7 @@ Static checks; LLM-free by default. Tier 1 gates the exit code and always runs. | `--llm-verify` | off | Run a second LLM pass to suppress false-positive findings. | | `--skillspector-baseline FILE` | unset | Audited SkillSpector suppression baseline for the `security` check; never discovered from the skill. See [Audited SkillSpector baselines](tier1-validation.mdx#audited-skillspector-baselines). | | `--min-score INTEGER` | `70` | Minimum quality score (0–100) required per skill when the `quality` check runs; policy severity overrides cannot waive this gate. | -| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that replaces the quality check's expected-heading rules. See [Tier 1: Validation](tier1-validation.mdx#the-checks). | +| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that adjusts the quality check's expected headings and error-handling rules; settings it omits keep their packaged values. See [Tier 1: Validation](tier1-validation.mdx#the-checks). | | `--pii-waivers PATH` | none | Reviewed, expiring PII waivers applied by the `pii` check; forwarded to each skill of a catalog run. See [PII waivers](tier1-validation.mdx#pii-waivers). | ### Tier 2 · Deduplication @@ -372,7 +372,7 @@ skillevaluator quality-check ./my-skill | Flag | Default | Effect | | --- | --- | --- | | `--min-score INTEGER` | `70` | Minimum composite score required per skill; passing also requires no HIGH or CRITICAL quality findings. | -| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file with expected section headers and rules for grading. | +| `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that adjusts the expected headings and error-handling rules used for grading; settings it omits keep their packaged values. | Plus the standard report options. A collection's displayed average does not replace the minimum required of each skill. Scoring weights, grade bands, the diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index f5e87526c..e57eb54f7 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -338,7 +338,9 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice If a quality score changes unexpectedly, inspect the finding message rather than adding keywords. The checker rewards usable instructions and evidence in their relevant context, not vocabulary alone. - **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to use your own list instead. `expected_headers` is optional in a custom file: when you omit it, the packaged list applies. A list you set replaces the packaged list rather than merging with it, so copy any default entries you want to keep. Set `expected_headers: []` to turn heading checks off. + **Quality config file.** Pass `--quality-config PATH` to `quality-check`, `tier1`, or `validate` to adjust the Reliability rules below. The file has two optional sections, `expected_headers` and `error_handling`. Anything you leave out keeps its packaged value from `quality-default.yaml`, and any list you set replaces the packaged list rather than merging with it. + + **Expected headings.** Reliability deducts points when `SKILL.md` lacks an expected heading. The packaged `quality-default.yaml` expects `## Prerequisites` (or `## Requirements`), `## Limitations`, and `## Troubleshooting` (or `## Common Issues` or `## FAQ`), each worth 5 points. Omit `expected_headers` to keep that list. A list you set replaces it, so copy any default entries you want to keep. Set `expected_headers: []` to turn heading checks off. ```yaml title="quality.yaml" expected_headers: @@ -373,7 +375,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice An entry is satisfied when the heading or any alternative appears anywhere in `SKILL.md` as text, so `## Security` also matches `### Security Notes` or a heading inside a code block. - **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. This section is optional and merges with the packaged values: an omitted rule or key keeps its packaged value, and a list you set replaces the packaged list. Set `points: 0` to turn a rule off; it then adds no finding. This differs from `expected_headers`, where an entry with `points: 0` still reports a zero-point finding that does not change the score. + **Error-handling checks.** Reliability also runs three error-handling rules, set in the `error_handling` section of the same file. An omitted rule, or an omitted key within a rule, keeps its packaged value. Set `points: 0` to turn a rule off; it then adds no finding. This differs from `expected_headers`, where an entry with `points: 0` still reports a zero-point finding that does not change the score. ```yaml title="quality.yaml" error_handling: From 61eb0385dc0de876e852e84d353971dc079a036e Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:32:19 -0700 Subject: [PATCH 12/16] refactor(quality-config): rename load_quality_config_with_provenance Rename it to load_quality_config_and_overlay_defaults. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- src/skillevaluator/quality_config.py | 2 +- src/skillevaluator/validators/quality_score.py | 4 ++-- tests/test_quality_config.py | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index 7ee71e22c..c14b9844a 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -186,7 +186,7 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: return _load(path)[0] -def load_quality_config_with_provenance(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: +def load_quality_config_and_overlay_defaults(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: """Load the config and describe it. Only the file name is kept, so reports do not leak local paths. The digest covers the rules the file itself defines. For a custom file, packaged values it diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index f770e272c..cea9646a2 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -37,7 +37,7 @@ from skillevaluator.models.quality import QualityScoreResult from skillevaluator.models.result import Finding, Severity, ValidationResult from skillevaluator.models.skill import XML_TAG_RE -from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config_with_provenance +from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config_and_overlay_defaults from skillevaluator.validators.base import ValidatorBase from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.markdown import markdown_link_targets @@ -250,7 +250,7 @@ class QualityScoreValidator(ValidatorBase): def __init__(self, min_score: int = 70, quality_config: Path | None = None) -> None: self.min_score = min_score - self.quality_config, self.quality_config_provenance = load_quality_config_with_provenance(quality_config) + self.quality_config, self.quality_config_provenance = load_quality_config_and_overlay_defaults(quality_config) @property def name(self) -> str: diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index f9281c2e1..c170a4040 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -8,7 +8,7 @@ from skillevaluator.quality_config import ( QualityConfigError, load_quality_config, - load_quality_config_with_provenance, + load_quality_config_and_overlay_defaults, quality_config_digest, ) @@ -239,12 +239,12 @@ def test_quality_config_provenance_names_custom_file_without_its_directory(tmp_p config_path = tmp_path / "team-quality.yaml" config_path.write_text("expected_headers: []\n", encoding="utf-8") - assert load_quality_config_with_provenance(config_path)[1] == { + assert load_quality_config_and_overlay_defaults(config_path)[1] == { "source": "custom", "file": "team-quality.yaml", "digest": quality_config_digest({"expected_headers": []}), } - assert load_quality_config_with_provenance(None)[1]["file"] is None + assert load_quality_config_and_overlay_defaults(None)[1]["file"] is None PACKAGED_ERROR_HANDLING = { @@ -370,7 +370,7 @@ def test_quality_config_digest_covers_error_handling(tmp_path: Path) -> None: def _digest(path: Path | None) -> str: - return load_quality_config_with_provenance(path)[1]["digest"] + return load_quality_config_and_overlay_defaults(path)[1]["digest"] def test_packaged_digest_covers_the_whole_packaged_config() -> None: @@ -398,7 +398,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, from skillevaluator import quality_config custom = _write_config(tmp_path, "error_handling: {scripts: {points: 2}}\n") - before_config, before = load_quality_config_with_provenance(custom) + before_config, before = load_quality_config_and_overlay_defaults(custom) changed_default = tmp_path / "changed-default.yaml" changed_default.write_text( quality_config.DEFAULT_QUALITY_CONFIG.read_text(encoding="utf-8").replace("points: 10", "points: 11"), @@ -406,7 +406,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, ) monkeypatch.setattr(quality_config, "DEFAULT_QUALITY_CONFIG", changed_default) - after_config, after = load_quality_config_with_provenance(custom) + after_config, after = load_quality_config_and_overlay_defaults(custom) assert after_config["error_handling"]["mentioned"]["points"] == 11 # the new default still applies assert before_config["error_handling"]["mentioned"]["points"] == 10 From 0c04fab2a1dba73000b1defe8e3ecd354979d0df Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:46:51 -0700 Subject: [PATCH 13/16] refactor(quality-config): restore the quality_config_provenance name Rename load_quality_config_and_overlay_defaults back to the released name, quality_config_provenance, to match the QualityConfigProvenance record it returns. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- src/skillevaluator/quality_config.py | 2 +- src/skillevaluator/validators/quality_score.py | 4 ++-- tests/test_quality_config.py | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index c14b9844a..138d21380 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -186,7 +186,7 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: return _load(path)[0] -def load_quality_config_and_overlay_defaults(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: +def quality_config_provenance(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: """Load the config and describe it. Only the file name is kept, so reports do not leak local paths. The digest covers the rules the file itself defines. For a custom file, packaged values it diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index cea9646a2..304d78ff9 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -37,7 +37,7 @@ from skillevaluator.models.quality import QualityScoreResult from skillevaluator.models.result import Finding, Severity, ValidationResult from skillevaluator.models.skill import XML_TAG_RE -from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config_and_overlay_defaults +from skillevaluator.quality_config import CodeErrorHandlingRule, quality_config_provenance from skillevaluator.validators.base import ValidatorBase from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.markdown import markdown_link_targets @@ -250,7 +250,7 @@ class QualityScoreValidator(ValidatorBase): def __init__(self, min_score: int = 70, quality_config: Path | None = None) -> None: self.min_score = min_score - self.quality_config, self.quality_config_provenance = load_quality_config_and_overlay_defaults(quality_config) + self.quality_config, self.quality_config_provenance = quality_config_provenance(quality_config) @property def name(self) -> str: diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index c170a4040..01c88753a 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -8,8 +8,8 @@ from skillevaluator.quality_config import ( QualityConfigError, load_quality_config, - load_quality_config_and_overlay_defaults, quality_config_digest, + quality_config_provenance, ) @@ -239,12 +239,12 @@ def test_quality_config_provenance_names_custom_file_without_its_directory(tmp_p config_path = tmp_path / "team-quality.yaml" config_path.write_text("expected_headers: []\n", encoding="utf-8") - assert load_quality_config_and_overlay_defaults(config_path)[1] == { + assert quality_config_provenance(config_path)[1] == { "source": "custom", "file": "team-quality.yaml", "digest": quality_config_digest({"expected_headers": []}), } - assert load_quality_config_and_overlay_defaults(None)[1]["file"] is None + assert quality_config_provenance(None)[1]["file"] is None PACKAGED_ERROR_HANDLING = { @@ -370,7 +370,7 @@ def test_quality_config_digest_covers_error_handling(tmp_path: Path) -> None: def _digest(path: Path | None) -> str: - return load_quality_config_and_overlay_defaults(path)[1]["digest"] + return quality_config_provenance(path)[1]["digest"] def test_packaged_digest_covers_the_whole_packaged_config() -> None: @@ -398,7 +398,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, from skillevaluator import quality_config custom = _write_config(tmp_path, "error_handling: {scripts: {points: 2}}\n") - before_config, before = load_quality_config_and_overlay_defaults(custom) + before_config, before = quality_config_provenance(custom) changed_default = tmp_path / "changed-default.yaml" changed_default.write_text( quality_config.DEFAULT_QUALITY_CONFIG.read_text(encoding="utf-8").replace("points: 10", "points: 11"), @@ -406,7 +406,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, ) monkeypatch.setattr(quality_config, "DEFAULT_QUALITY_CONFIG", changed_default) - after_config, after = load_quality_config_and_overlay_defaults(custom) + after_config, after = quality_config_provenance(custom) assert after_config["error_handling"]["mentioned"]["points"] == 11 # the new default still applies assert before_config["error_handling"]["mentioned"]["points"] == 10 From ac48cf10d3e71cbb911bafa6158430e80e13dc93 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:46:52 -0700 Subject: [PATCH 14/16] docs(changelog): note the quality_config_provenance signature change The function now takes only path and returns (config, provenance), so calls written as quality_config_provenance(path, config) need updating. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882494 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6827860..951923daf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -195,6 +195,13 @@ All notable changes to SkillEvaluator are documented in this file. ### Changed +- `skillevaluator.quality_config.quality_config_provenance` now loads the + config itself. It takes only `path` and returns a `(config, provenance)` + tuple, so calls written as `quality_config_provenance(path, config)` must + become `quality_config_provenance(path)` and unpack both values. The report's + `quality_config` field keeps its shape; a custom file's digest now covers only + the rules that file sets. + - Name Skill Lift as the headline comparison and label pass@k differences as supporting reliability across reports and terminal output. From a5d7f3624a4b1f3684197166ecdc1f51fe552749 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:54:51 -0700 Subject: [PATCH 15/16] refactor(quality-config): name the loader load_quality_config_with_provenance Rename the loader back to load_quality_config_with_provenance and replace the CHANGELOG entry: quality_config_provenance(path, config) is removed, and the ### Changed entry names load_quality_config_with_provenance(path) as its replacement. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882494 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- CHANGELOG.md | 10 ++++------ src/skillevaluator/quality_config.py | 3 ++- src/skillevaluator/validators/quality_score.py | 4 ++-- tests/test_quality_config.py | 13 +++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 951923daf..96988a710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -195,12 +195,10 @@ All notable changes to SkillEvaluator are documented in this file. ### Changed -- `skillevaluator.quality_config.quality_config_provenance` now loads the - config itself. It takes only `path` and returns a `(config, provenance)` - tuple, so calls written as `quality_config_provenance(path, config)` must - become `quality_config_provenance(path)` and unpack both values. The report's - `quality_config` field keeps its shape; a custom file's digest now covers only - the rules that file sets. +- Remove `skillevaluator.quality_config.quality_config_provenance(path, config)`. + Use `load_quality_config_with_provenance(path)` instead: it loads the config + and returns `(config, provenance)`, and its digest covers only the rules a + custom file sets. The report's `quality_config` field keeps its shape. - Name Skill Lift as the headline comparison and label pass@k differences as supporting reliability across reports and terminal output. diff --git a/src/skillevaluator/quality_config.py b/src/skillevaluator/quality_config.py index 138d21380..7fcfd0d9d 100644 --- a/src/skillevaluator/quality_config.py +++ b/src/skillevaluator/quality_config.py @@ -186,7 +186,7 @@ def load_quality_config(path: Path | None = None) -> QualityConfig: return _load(path)[0] -def quality_config_provenance(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: +def load_quality_config_with_provenance(path: Path | None = None) -> tuple[QualityConfig, QualityConfigProvenance]: """Load the config and describe it. Only the file name is kept, so reports do not leak local paths. The digest covers the rules the file itself defines. For a custom file, packaged values it @@ -201,6 +201,7 @@ def quality_config_provenance(path: Path | None = None) -> tuple[QualityConfig, return config, provenance + def _load(path: Path | None) -> tuple[QualityConfig, dict]: source = str(path) if path else "packaged quality-default.yaml" try: diff --git a/src/skillevaluator/validators/quality_score.py b/src/skillevaluator/validators/quality_score.py index 304d78ff9..f770e272c 100644 --- a/src/skillevaluator/validators/quality_score.py +++ b/src/skillevaluator/validators/quality_score.py @@ -37,7 +37,7 @@ from skillevaluator.models.quality import QualityScoreResult from skillevaluator.models.result import Finding, Severity, ValidationResult from skillevaluator.models.skill import XML_TAG_RE -from skillevaluator.quality_config import CodeErrorHandlingRule, quality_config_provenance +from skillevaluator.quality_config import CodeErrorHandlingRule, load_quality_config_with_provenance from skillevaluator.validators.base import ValidatorBase from skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN from skillevaluator.validators.markdown import markdown_link_targets @@ -250,7 +250,7 @@ class QualityScoreValidator(ValidatorBase): def __init__(self, min_score: int = 70, quality_config: Path | None = None) -> None: self.min_score = min_score - self.quality_config, self.quality_config_provenance = quality_config_provenance(quality_config) + self.quality_config, self.quality_config_provenance = load_quality_config_with_provenance(quality_config) @property def name(self) -> str: diff --git a/tests/test_quality_config.py b/tests/test_quality_config.py index 01c88753a..3cb33f802 100644 --- a/tests/test_quality_config.py +++ b/tests/test_quality_config.py @@ -8,8 +8,8 @@ from skillevaluator.quality_config import ( QualityConfigError, load_quality_config, + load_quality_config_with_provenance, quality_config_digest, - quality_config_provenance, ) @@ -239,12 +239,13 @@ def test_quality_config_provenance_names_custom_file_without_its_directory(tmp_p config_path = tmp_path / "team-quality.yaml" config_path.write_text("expected_headers: []\n", encoding="utf-8") - assert quality_config_provenance(config_path)[1] == { + assert load_quality_config_with_provenance(config_path)[1] == { "source": "custom", "file": "team-quality.yaml", "digest": quality_config_digest({"expected_headers": []}), } - assert quality_config_provenance(None)[1]["file"] is None + assert load_quality_config_with_provenance(None)[1]["file"] is None + PACKAGED_ERROR_HANDLING = { @@ -370,7 +371,7 @@ def test_quality_config_digest_covers_error_handling(tmp_path: Path) -> None: def _digest(path: Path | None) -> str: - return quality_config_provenance(path)[1]["digest"] + return load_quality_config_with_provenance(path)[1]["digest"] def test_packaged_digest_covers_the_whole_packaged_config() -> None: @@ -398,7 +399,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, from skillevaluator import quality_config custom = _write_config(tmp_path, "error_handling: {scripts: {points: 2}}\n") - before_config, before = quality_config_provenance(custom) + before_config, before = load_quality_config_with_provenance(custom) changed_default = tmp_path / "changed-default.yaml" changed_default.write_text( quality_config.DEFAULT_QUALITY_CONFIG.read_text(encoding="utf-8").replace("points: 10", "points: 11"), @@ -406,7 +407,7 @@ def test_custom_digest_ignores_packaged_defaults_the_file_omits(tmp_path: Path, ) monkeypatch.setattr(quality_config, "DEFAULT_QUALITY_CONFIG", changed_default) - after_config, after = quality_config_provenance(custom) + after_config, after = load_quality_config_with_provenance(custom) assert after_config["error_handling"]["mentioned"]["points"] == 11 # the new default still applies assert before_config["error_handling"]["mentioned"]["points"] == 10 From 461b56084958e3b398772de4589aaa6bbf6493e0 Mon Sep 17 00:00:00 2001 From: Weston Platter Date: Wed, 11 Nov 2026 06:59:49 -0700 Subject: [PATCH 16/16] docs(quality): say lib skips only for .py or .sh files directly in scripts/ or tools/ A script in a subfolder of scripts/ or tools/ does not make a skill script-based or hybrid, so the lib check still runs. Addresses review feedback on #336: https://github.com/NVIDIA/SkillEvaluator/pull/336#discussion_r4486882481 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Weston Platter --- docs/tier1-validation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdx index e57eb54f7..bde36013d 100644 --- a/docs/tier1-validation.mdx +++ b/docs/tier1-validation.mdx @@ -389,7 +389,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice | --- | --- | --- | --- | | `mentioned` | `SKILL.md` contains none of the `terms` | `10` | `terms`: whole words, any case. `error` matches `Error` but not `errorless`. A term with spaces, such as `exit code`, also matches when its words are split by a line break or several spaces | | `scripts` | A `.py` file directly in `scripts/` or `tools/` has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: case-sensitive text found anywhere in the file, such as `raise` or `if not ` | - | `lib` | A module in the skill's Python package, for skills with no `.py` or `.sh` files in `scripts/` or `tools/`, has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | + | `lib` | A module in the skill's Python package, for skills with no `.py` or `.sh` files directly in `scripts/` or `tools/`, has neither a `try:`/`except` pair nor any of the `markers` | `5` | `markers`: as for `scripts` | Each rule also takes `message` and `suggestion`. The `scripts` and `lib` findings append up to three file names to the message, as in `Scripts may lack error handling: run.py`. The `try:`/`except` pair always counts as error handling and is not configurable. See the packaged `quality-default.yaml` for every default term and marker. The `quality_config` digest in the report covers only the rules your file sets, not the packaged values it leaves out, so the digest changes only when your file's rules change.