Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
feat(quality): configure Reliability error handling in the quality config (#336)
Weston Platterb64e351fcb6b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3b9d774a..de691b25 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,19 @@ All notable changes to SkillEvaluator are documented in this file.### Added+- 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. 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+ existing custom files keep their digests and a digest changes only when the+ file's rules change.- Tier 3 reports show token usage per case, per agent and over all agents, asa measurement that is not scored. The JSON payload gains `token_usage`;`BENCHMARK.md` gains a **Token Usage** section; the Markdown report, the HTML@@ -268,6 +281,10 @@ All notable changes to SkillEvaluator are documented in this file.### Changed+- 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.- Upgrade the Tier 3 backend to Harbor 0.25.0. Align supported sandboxconstructor options with the release while reserving automatic mounts andhost Compose environment forwarding for evaluator policy. Preserve localdiff --git a/docs/cli-reference.mdx b/docs/cli-reference.mdxindex cfb04cad..2553354f 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 |@@ -303,7 +303,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@@ -375,7 +375,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 notreplace the minimum required of each skill. Scoring weights, grade bands, thediff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex 18ba3c6c..1bce9b5e 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -369,7 +369,9 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `liceIf 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.</Tip>- **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.+ **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:@@ -396,7 +398,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 |@@ -404,7 +406,25 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `liceAn 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. 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:+ 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`. 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 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.++ 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)diff --git a/src/skillevaluator/config/quality-default.yaml b/src/skillevaluator/config/quality-default.yamlindex a036afac..9862fca2 100644--- a/src/skillevaluator/config/quality-default.yaml+++ b/src/skillevaluator/config/quality-default.yaml@@ -20,3 +20,26 @@ expected_headers:points: 5message: "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.pyindex 38cfcee2..7fcfd0d9 100644--- a/src/skillevaluator/quality_config.py+++ b/src/skillevaluator/quality_config.py@@ -16,8 +16,9 @@ import yamlDEFAULT_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"})+_ERROR_HANDLING_LIST_KEYS = {"mentioned": "terms", "scripts": "markers", "lib": "markers"}class QualityConfigError(ValueError):@@ -34,10 +35,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: ErrorHandlingConfigclass QualityConfigProvenance(TypedDict):@@ -64,6 +92,66 @@ 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:+ 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 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})+ _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 = 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"),+ "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."""@@ -94,6 +182,27 @@ 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")@@ -109,9 +218,16 @@ def load_quality_config(path: Path | None = None) -> QualityConfig:raise QualityConfigError(f"{source}: invalid YAML: nesting is too deep") from excexcept (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] = {}@@ -129,15 +245,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 +254,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,19 +273,28 @@ def load_quality_config(path: Path | None = None) -> QualityConfig:})- return {"expected_headers": expected_headers}+ if path is None:+ error_handling = _parse_error_handling(raw.get("error_handling"), source, base=None)+ 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"]+ 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} 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()+ 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.pyindex 211986c5..f770e272 100644--- a/src/skillevaluator/validators/quality_score.py+++ b/src/skillevaluator/validators/quality_score.py@@ -37,7 +37,7 @@ from skillevaluator.logging_config import get_loggerfrom skillevaluator.models.quality import QualityScoreResultfrom skillevaluator.models.result import Finding, Severity, ValidationResultfrom 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_with_provenancefrom skillevaluator.validators.base import ValidatorBasefrom skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERNfrom skillevaluator.validators.markdown import markdown_link_targets@@ -78,11 +78,6 @@ _ARGUMENT_CHOICE_RE = re.compile(r"\S+|\"[^\"]*\"|'[^']*'")# or ``>=`` before a number after a space or bracket (``<n> > 0``, ``<count> (>0)``)._ARGUMENT_ARROW_OR_COMPARISON_RE = re.compile(r"(?<!\S)(?:->|=>|>=)(?!\S)|(?<![^\s(\[])>=? ?\d+(?:\.\d+)?(?![^\s)\],])")_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 _is_argument_placeholder(body: str) -> bool:@@ -186,6 +181,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:+ # 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"(?<!\w)(?:{pattern})(?!\w)", text, re.IGNORECASE))++def _has_api_documentation(content: str) -> bool:api_patterns = (r"\bimport\s+[A-Za-z_][A-Za-z0-9_.]*",@@ -249,8 +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 = 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)@propertydef name(self) -> str:@@ -784,81 +784,43 @@ class QualityScoreValidator(ValidatorBase):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"])+ if not qs.has_error_handling and mentioned["points"]:+ dim.deduct(mentioned["points"], "info", mentioned["message"], mentioned["suggestion"])# Type-aware code qualityif 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:+ 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/test_quality_config.py b/tests/test_quality_config.pyindex 35016326..3cb33f80 100644--- a/tests/test_quality_config.py+++ b/tests/test_quality_config.py@@ -8,8 +8,8 @@ import pytestfrom skillevaluator.quality_config import (QualityConfigError,load_quality_config,+ load_quality_config_with_provenance,quality_config_digest,- quality_config_provenance,)@@ -238,11 +238,231 @@ 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 = {+ "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"]+++ ("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 = _digest(compact)++ 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"]+++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"]++[email protected]("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)diff --git a/tests/validators/test_quality_score.py b/tests/validators/test_quality_score.pyindex 5ec6c61a..ce2fa6dd 100644--- a/tests/validators/test_quality_score.py+++ b/tests/validators/test_quality_score.py@@ -1484,6 +1484,193 @@ class TestQualityScoreDeterministicContracts: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)++ @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++ @pytest.mark.parametrize("text", ["Check the exit\ncode first.", "Check the exit code first.", "Check the exit\r\n code."])+ def test_multi_word_custom_terms_match_across_wrapped_or_repeated_whitespace(self, tmp_path: Path, text: str):+ skill_dir = _write_issue_skill(tmp_path, troubleshooting=text)+ config = 'expected_headers: []\nerror_handling:\n mentioned:\n terms: ["exit code"]\n'++ result = _validate_with(skill_dir, tmp_path, config)++ assert result.metadata["quality_scores"]["metrics"]["has_error_handling"] is True++ def test_multi_word_custom_term_still_needs_whole_words(self, tmp_path: Path):+ skill_dir = _write_issue_skill(tmp_path, troubleshooting="Check the exit codes first.")+ config = 'expected_headers: []\nerror_handling:\n mentioned:\n terms: ["exit code"]\n'++ result = _validate_with(skill_dir, tmp_path, config)++ assert result.metadata["quality_scores"]["metrics"]["has_error_handling"] is False++ def test_packaged_single_word_terms_behave_as_before(self):+ from skillevaluator.validators.quality_score import _contains_any_word++ assert _contains_any_word("An Error occurred.", ["error"])+ assert not _contains_any_word("This is errorless.", ["error"])+ assert not _contains_any_word("nothing here", ["error", "failure"])++@pytest.mark.parametrize("newline", ["\n", "\r\n"])@pytest.mark.parametrize("extra_yaml",