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
fix(tier1): finish the author and metadata.id review round from #499 (#513)
Narendran Raghavan6000e2810b2f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8fc9c5e6..3a8f89fa 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -164,11 +164,45 @@ All notable changes to SkillEvaluator are documented in this file.### Fixed+- The behavior evidence gate no longer keeps a score for an expectation that+ names an observed artifact but also asks for something only the final answer+ could show. "Writes `report.py` and explains why each column was dropped" was+ treated as settled by the artifact alone, so a case kept a score whose second+ half was never checked. Every clause of an expectation must now name a+ checkable artifact of its own; one that does not keeps the gate, as a wholly+ prose expectation already did.- Accuracy and Behavior judge prompts clarify that explicit final-answer formatsapply to the entire final response, independently of correct values in tooloutput or references. Scoring and thresholds are unchanged; an Accuracy formatfailure alone can still score 0.8 and pass the default threshold.+- An author value is no longer rejected for containing a Unicode joiner. The+ character guard matched all of category `C`, so ZWNJ (U+200C) and ZWJ+ (U+200D), which Persian, Arabic and Devanagari names need to render, plus a+ soft hyphen and any code point unassigned in the running interpreter's+ Unicode data, all failed `SCHEMA.author_format` at HIGH under both bundled+ profiles. The guard now rejects controls, surrogates and private-use code+ points plus the bidirectional marks, embeddings, overrides, isolates and the+ byte-order mark, and its message says so. An unassigned code point no longer+ makes the verdict depend on the interpreter's Unicode version.+- A bare email address whose domain has no dot, such as `root@buildhost`, is+ reported as a malformed author rather than as "Author has no email address".+ The bare-email pattern required a dotted domain, so an intranet address took+ the plain-attribution path. The discriminator is now a word character on each+ side of the `@`, which still leaves a social handle such as+ `Jane Doe (@jdoe)`, a bare `@jdoe` or `Platform Team @ Example` alone, and+ now also catches a non-ASCII local part.+- An advisory carried from a passing skill into a collection result now names+ the skill it came from, in its location and in `metadata.collection_skill`.+ The findings were preserved but attributed to nothing, so a collection run+ could not say which member produced one. The per-skill roll-up also stops+ reporting "All schema and structure checks passed" next to a list of that+ skill's advisories.+- A `catalog-summary.json` entry lists the catalog-wide findings behind its+ verdict under `catalog_findings`. The duplicate `metadata.id` check already+ failed the member and bumped its `severity_counts`, but a catalog validates+ each skill on its own, so nothing in that skill's output said what caused+ either.- Folder validation preserves author and metadata ID advisories from passingskills. Catalog summaries include duplicate ID severity counts and consistentmember verdicts, while explicitly labeling linked reports as single-skilldiff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex c41a2edc..6406974e 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -257,8 +257,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice- The standard hierarchy is `skills/<skill-name>/` or `team-skills/<team>/<skill-name>/`. A nonstandard standalone location is reported as an advisory finding.- Recognized skill-root subdirectories are `agents/`, `references/`, `scripts/`, `assets/`, `evals/`, `tests/`, `tools/`, and `config/`; anything else gets a LOW advisory finding. Extend the set per repository with `SKILLEVALUATOR_SCHEMA_ALLOWED_DIRS` (comma-separated names are added to the defaults, never replace them).- `SKILL.md` should stay at or below 500 lines; larger files receive an advisory finding.- - `metadata.author` is optional under the `default` profile. Use `Name <email@host>` to include a contact address, or a person, team, or organization name such as `NVIDIA cuOpt Team` or `Jane Doe (@jdoe)`. A value that is malformed or unsafe is a HIGH `author_format` finding: a bare email or an email outside `Name <email@host>`, stray angle brackets, control or invisible formatting characters, no letters or digits, or more than 256 characters. The `registry` profile requires the `Name <email@host>` form.- - `metadata.id` is an optional stable skill ID. When present it must be an exact 1–64 character lowercase ASCII slug (`^[a-z0-9]+(-[a-z0-9]+)*$`, no surrounding whitespace); it may differ from `name`. A collection run reports an ID that more than one discovered skill declares; `validate` on a catalog also lists these in `catalog-summary.json` under `metadata_id_conflicts`, and under `registry` each skill that shares an ID fails. Uniqueness is checked only across the skills validated together, never against a registry, and a single-skill run does not claim it. The ID does not change local catalog identity, which stays keyed by content type and relative path.+ - `metadata.author` is optional under the `default` profile. Use `Name <email@host>` to include a contact address, or a person, team, or organization name such as `NVIDIA cuOpt Team` or `Jane Doe (@jdoe)`. A value that is malformed or unsafe is a HIGH `author_format` finding: a bare email or an email outside `Name <email@host>`, stray angle brackets, control, private-use, or bidirectional formatting characters (joiners such as ZWNJ and ZWJ, which Persian, Arabic and Devanagari names need, are accepted), no letters or digits, or more than 256 characters. A bare address counts even when its domain has no dot (`root@buildhost`), while a social handle such as `Jane Doe (@jdoe)` does not. The `registry` profile requires the `Name <email@host>` form.+ - `metadata.id` is an optional stable skill ID. When present it must be an exact 1–64 character lowercase ASCII slug (`^[a-z0-9]+(-[a-z0-9]+)*$`, no surrounding whitespace); it may differ from `name`. A collection run reports an ID that more than one discovered skill declares; `validate` on a catalog also lists these in `catalog-summary.json` under `metadata_id_conflicts`. Under `registry` a shared ID blocks: the run exits nonzero, and each sharing skill's entry is `"passed": false` with the conflict repeated under `catalog_findings` and counted in its `severity_counts`. A catalog validates each skill on its own, so that skill's own report was written before the catalog-wide check ran and keeps its single-skill verdict, which the entry carries alongside as `report_verdict` beside `report_scope: "single_skill"`. Uniqueness is checked only across the skills validated together, never against a registry, and a single-skill run does not claim it. The ID does not change local catalog identity, which stays keyed by content type and relative path.- `metadata.domain` accepts one category string or a list of them, such as `domain: [backend, ai-ml]`. Values are trimmed and deduplicated in order; a blank or null scalar means no domain. A list with more than 16 entries, or a non-string, blank, or over-128-character entry, is a HIGH `Field 'metadata.domain'` finding. The 128-character limit also applies to a single string.**To fix common findings:** rename the directory to match `name`, remove forbidden fields, and move the skill under `skills/`.diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.pyindex 4f92d98d..ff09064c 100644--- a/src/skillevaluator/cli.py+++ b/src/skillevaluator/cli.py@@ -1576,12 +1576,30 @@ def _catalog_skill_entry(def _catalog_entry_with_metadata_id_conflicts(skill: dict[str, object], conflicts: list[dict[str, object]]) -> dict[str, object]:- """Project catalog findings onto a member, retaining its independent report verdict."""+ """Project catalog findings onto a member, retaining its independent report verdict.++ The findings themselves are listed under ``catalog_findings`` so the+ verdict and the severity bump above can be traced back to what caused+ them: a catalog validates each skill on its own, so these findings exist+ nowhere else in that skill's output.+ """entry = dict(skill)+ recorded: list[dict[str, object]] = []for conflict in conflicts:members = conflict.get("skills")if not isinstance(members, list) or entry.get("name") not in members:continue+ names = [str(member) for member in members]+ others = ", ".join(name for name in names if name != entry.get("name"))+ recorded.append(+ {+ "category": "SCHEMA",+ "check_name": "metadata_id_duplicate",+ "severity": conflict.get("severity"),+ "blocking": bool(conflict.get("blocking")),+ "message": f"metadata.id '{conflict.get('metadata_id')}' is also declared by {others}",+ }+ )severity = conflict.get("severity")if severity in ("critical", "high", "medium", "low"):raw_counts = entry.get("severity_counts")@@ -1593,6 +1611,8 @@ def _catalog_entry_with_metadata_id_conflicts(entry["passed"] = Falseentry["overall_passed"] = Falseentry["overall_status"] = "failed"+ if recorded:+ entry["catalog_findings"] = recordedreturn entrydiff --git a/src/skillevaluator/models/result.py b/src/skillevaluator/models/result.pyindex 25f1f866..e3ee89a0 100644--- a/src/skillevaluator/models/result.py+++ b/src/skillevaluator/models/result.py@@ -346,6 +346,48 @@ class ValidationSummary:}+++def prefix_finding(finding: Finding, prefix: str, extra_metadata: dict | None = None) -> Finding:+ """Copy *finding* with *prefix* applied to every location it names.++ Used when a sub-result is folded into a parent result (a skill inside a+ collection, a rule inside a rules file) so a reader can still tell which+ member each finding came from. *extra_metadata* is merged on top, for a+ caller that can also name the member in a machine-readable field.+ """+ metadata = finding.metadata+ for key in ("occurrences", "skillspector_occurrences"):+ listed = metadata.get(key) if isinstance(metadata, dict) else None+ if not isinstance(listed, list):+ continue+ # A check that folds repeats (the PII scan) lists each location+ # in metadata, and a SkillSpector AE1 finding lists the lines+ # that name its file; prefix those like file_path so the+ # finding's own location still matches its first listed one.+ metadata = {+ **metadata,+ key: [+ {**item, "file": f"[{prefix}] {item['file']}"}+ if isinstance(item, dict) and isinstance(item.get("file"), str)+ else item+ for item in listed+ ],+ }+ if extra_metadata:+ metadata = {**metadata, **extra_metadata} if isinstance(metadata, dict) else dict(extra_metadata)+ return Finding(+ category=finding.category,+ severity=finding.severity,+ check_name=finding.check_name,+ message=finding.message,+ file_path=f"[{prefix}] {finding.file_path}",+ line_number=finding.line_number,+ line_content=finding.line_content,+ suggestion=finding.suggestion,+ metadata=metadata,+ )+@dataclassclass ValidationResult:"""Aggregates validation outcomes from a validator.@@ -691,36 +733,7 @@ class ValidationResult:# Prefix findings with skill name in file_pathfor finding in other.findings:- metadata = finding.metadata- for key in ("occurrences", "skillspector_occurrences"):- listed = metadata.get(key) if isinstance(metadata, dict) else None- if not isinstance(listed, list):- continue- # A check that folds repeats (the PII scan) lists each location- # in metadata, and a SkillSpector AE1 finding lists the lines- # that name its file; prefix those like file_path so the- # finding's own location still matches its first listed one.- metadata = {- **metadata,- key: [- {**item, "file": f"[{prefix}] {item['file']}"}- if isinstance(item, dict) and isinstance(item.get("file"), str)- else item- for item in listed- ],- }- prefixed_finding = Finding(- category=finding.category,- severity=finding.severity,- check_name=finding.check_name,- message=finding.message,- file_path=f"[{prefix}] {finding.file_path}",- line_number=finding.line_number,- line_content=finding.line_content,- suggestion=finding.suggestion,- metadata=metadata,- )- self.findings.append(prefixed_finding)+ self.findings.append(prefix_finding(finding, prefix))# Carry over success_details (prefixed) so contributor info is preservedfor detail in other.success_details:@@ -759,6 +772,27 @@ class ValidationResult:self.summary.errors += other.summary.errorsself.summary.warnings += other.summary.warnings+ def merge_advisories_with_prefix(self, other: ValidationResult, prefix: str) -> None:+ """Carry a *passing* sub-result's nonblocking findings into this one.++ ``merge_with_prefix`` is for a sub-result that failed. A member can+ pass and still report advisories (INFO/LOW/MEDIUM findings such as+ ``author_without_email`` or ``metadata_id_format``), and those are+ exactly what a collection run is expected to surface.++ This never touches ``passed``: an advisory from a passing member stays+ advisory and cannot fail the collection. The member is named both in+ the finding's location and in ``metadata.collection_skill``, so a+ consumer does not have to parse the ``[prefix]`` location to tell+ where the finding came from.+ """+ for finding in other.findings:+ self.findings.append(prefix_finding(finding, prefix, {"collection_skill": prefix}))+ self.summary.tally_severity(finding.severity)+ for warning in other.warnings:+ self.warnings.append(f"[{prefix}] {warning}")+ self.summary.warnings += other.summary.warnings+def to_dict(self) -> dict:"""Convert to dictionary for JSON serialization."""result = {diff --git a/src/skillevaluator/tier3/eval_core/atif_helpers.py b/src/skillevaluator/tier3/eval_core/atif_helpers.pyindex f976327e..6b2007e8 100644--- a/src/skillevaluator/tier3/eval_core/atif_helpers.py+++ b/src/skillevaluator/tier3/eval_core/atif_helpers.py@@ -1160,6 +1160,14 @@ def _behavior_evidence_completeness(return not required_missing, required_missing, incomplete+# Clause separators for an expectation. A dot only separates when whitespace+# follows it, so an artifact path such as ``report.py`` is never split apart.+_BEHAVIOR_CLAUSE_SPLIT_RE = re.compile(+ r"(?:\band\b|\bthen\b|\balso\b|\bplus\b|\bas well as\b|\bwhile\b|\bbefore\b|\bafter\b|[;]|\.\s)",+ re.IGNORECASE,+)++def _expected_behaviors_verified(expected_behavior: Any, facts: list[dict[str, Any]]) -> bool:"""Return True when deterministic facts already settle every expected behavior.@@ -1169,17 +1177,37 @@ def _expected_behaviors_verified(expected_behavior: Any, facts: list[dict[str, Abudgeted evidence, and they head the judge's prompt, so for such a casethe judge's answer does not depend on the final response surviving thelimits: withholding the score would discard a result the evidence- supports. An expectation that names nothing checkable (plain prose such- as "explains the trade-offs") is never settled this way, so prose- expectations keep the gate.+ supports.++ Naming an observed artifact is not enough on its own, because an+ expectation routinely asks for more than the artifact: "writes+ ``report.py`` **and explains why each column was dropped**" is settled+ only in its first half, and the half that needs the final response is+ exactly the half the deterministic facts cannot speak to. Every clause+ must therefore name a checkable token of its own. A clause that does not+ — plain prose such as "explains the trade-offs", whether it stands alone+ or is joined to an artifact clause — keeps the gate.++ The split is deliberately generous: an unrecognized clause shape leaves+ the expectation looking like prose and keeps the gate, which withholds a+ score. Lifting the gate wrongly keeps a score the evidence does not+ support, so the two errors are not symmetric."""if not isinstance(expected_behavior, list) or not expected_behavior:return Falseobserved = {str(fact.get("claim")) for fact in facts if fact.get("observed")}for behavior in expected_behavior:- claims = [claim for claim, _mode in _checkable_tokens(behavior)]+ text = str(behavior or "")+ claims = [claim for claim, _mode in _checkable_tokens(text)]if not claims or any(claim not in observed for claim in claims):return False+ for clause in _BEHAVIOR_CLAUSE_SPLIT_RE.split(text):+ # A clause with no letters or digits is punctuation or filler left+ # behind by the split, not something the agent was asked to do.+ if not any(char.isalnum() for char in clause):+ continue+ if not _checkable_tokens(clause):+ return Falsereturn Truediff --git a/src/skillevaluator/validators/schema.py b/src/skillevaluator/validators/schema.pyindex 89bb45f3..4236a44a 100644--- a/src/skillevaluator/validators/schema.py+++ b/src/skillevaluator/validators/schema.py@@ -39,8 +39,32 @@ logger = get_logger(__name__)#: Upper bound for a ``metadata.author`` value; longer values are malformed.AUTHOR_MAX_LENGTH = 256-#: An email address written outside the ``Name <email@host>`` shape.-_BARE_EMAIL_PATTERN = re.compile(r"[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+")+#: An email address written outside the ``Name <email@host>`` shape. The+#: discriminator is ``\w@\w``: an address has a local part, so a word character+#: sits on each side of the ``@``, while a social handle such as+#: ``Jane Doe (@jdoe)`` or a bare ``@jdoe`` does not. The domain needs no dot,+#: so an intranet address such as ``root@buildhost`` is caught as well.+_BARE_EMAIL_PATTERN = re.compile(r"[^\s<>@]*\w@\w[^\s<>@]*")++#: Unicode general categories never usable in an author value: C0/C1 controls,+#: surrogates, and private-use code points.+_UNSAFE_AUTHOR_CATEGORIES = frozenset({"Cc", "Cs", "Co"})++#: Invisible format characters (category ``Cf``) that can make an author value+#: render as something other than what it says: the bidirectional marks,+#: embeddings, overrides and isolates, plus the byte-order mark. The rest of+#: ``Cf`` stays allowed, because ZWNJ (U+200C) and ZWJ (U+200D) are required+#: for Persian, Arabic and Devanagari names to render correctly.+_UNSAFE_AUTHOR_FORMAT_CHARS = frozenset(+ {+ chr(0x061C), # ARABIC LETTER MARK+ chr(0x200E), # LEFT-TO-RIGHT MARK+ chr(0x200F), # RIGHT-TO-LEFT MARK+ *(chr(code) for code in range(0x202A, 0x202F)), # embedding, pop, override+ *(chr(code) for code in range(0x2066, 0x206A)), # isolate controls+ chr(0xFEFF), # ZERO WIDTH NO-BREAK SPACE (byte-order mark)+ }+)#: ``metadata.id`` contract: an exact (unnormalized) lowercase ASCII slug.METADATA_ID_MAX_LENGTH = 64@@ -58,11 +82,21 @@ def author_value_problem(author: str) -> str | None:``NVIDIA cuOpt Team`` or ``Jane Doe (@jdoe)``. Plain attribution may notcontain angle brackets or an email address, because those mean an attemptedbut broken ``Name <email>`` value.++ The character guard rejects controls, surrogates, private-use code points+ and the bidirectional/BOM format characters. It deliberately does not+ reject all of Unicode category ``C``: that also covers the joiners real+ names need (U+200C/U+200D) and every code point unassigned in the running+ interpreter's Unicode data, which makes the verdict depend on the+ interpreter's version rather than on the value."""if len(author) > AUTHOR_MAX_LENGTH:return f"is longer than {AUTHOR_MAX_LENGTH} characters"- if any(unicodedata.category(char).startswith("C") for char in author):- return "contains control or invisible formatting characters"+ if any(+ char in _UNSAFE_AUTHOR_FORMAT_CHARS or unicodedata.category(char) in _UNSAFE_AUTHOR_CATEGORIES+ for char in author+ ):+ return "contains control, private-use, or bidirectional formatting characters"if AUTHOR_SHAPE_PATTERN.fullmatch(author):return Noneif "<" in author or ">" in author:@@ -219,16 +253,23 @@ class SchemaValidator(ValidatorBase):})+ advisories = len(skill_result.findings)result.add_success(check_name=skill_dir.name,- message="All schema and structure checks passed",+ message=(+ "All schema and structure checks passed"+ if not advisories+ else f"No blocking schema or structure findings ({advisories} advisory finding(s))"+ ),checks=check_details,total_checks=len(check_details),+ advisory_findings=advisories,)- # A passing child can still carry policy advisories. Keep its- # findings without merging its successes a second time.- for finding in skill_result.findings:- result.add_finding(finding)+ # A passing child can still carry policy advisories. Keep them+ # named after the skill they came from, without merging its+ # successes a second time; the roll-up above only says that+ # nothing blocked.+ result.merge_advisories_with_prefix(skill_result, skill_dir.name)else:result.merge_with_prefix(skill_result, skill_dir.name)# merge_with_prefix copies errors/warnings, but not severitydiff --git a/tests/golden/test_policy_behavior.py b/tests/golden/test_policy_behavior.pyindex 27a3eff7..521b7550 100644--- a/tests/golden/test_policy_behavior.py+++ b/tests/golden/test_policy_behavior.py@@ -170,6 +170,40 @@ def test_catalog_reports_shared_metadata_id_and_blocks_under_registry(tmp_path:}+def test_a_skill_that_fails_on_its_own_keeps_its_reason_over_the_id_conflict(tmp_path: Path) -> None:+ """A skill with its own failure and a shared ID is counted and reported once.++ Without the `name not in failed` dedup guard in `_record_metadata_id_failures`+ the skill would be listed twice, so the scoreboard and the raised error+ would claim more failures than there are skills, and the conflict reason+ would overwrite the skill's real one in `catalog-summary.json`.+ """+ catalog = tmp_path / "catalog"+ # A bare email is a blocking author_format value, so this skill fails on its own.+ _write_skill_with_id(catalog, "first-skill", "[email protected]", "shared-id")+ _write_skill_with_id(catalog, "second-skill", "Demo Author <[email protected]>", "shared-id")++ result = CliRunner().invoke(+ cli,+ [+ "validate", str(catalog), "--tiers", "1", "--no-llm", "--checks", "schema",+ "-r", "json", "-o", str(tmp_path / "out"), "--profile", "registry",+ ],+ )++ assert result.exit_code == 1+ assert "2/2 skills failed validation" in result.output+ assert "3/2" not in result.output+ summary = json.loads((tmp_path / "out" / "catalog-summary.json").read_text(encoding="utf-8"))+ skills = {skill["name"]: skill for skill in summary["skills"]}+ assert set(skills) == {"first-skill", "second-skill"}+ conflict_reason = "metadata.id 'shared-id' is also declared by"+ assert conflict_reason not in skills["first-skill"]["reason"]+ assert conflict_reason in skills["second-skill"]["reason"]+ assert skills["first-skill"]["passed"] is False+ assert skills["second-skill"]["passed"] is False++def test_catalog_without_shared_ids_records_no_conflicts(tmp_path: Path) -> None:catalog = tmp_path / "catalog"_write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "first-skill")@@ -288,6 +322,21 @@ def test_catalog_conflicts_project_consistent_verdicts_counts_and_leaf_scope(if conflict and severity != "info":expected_counts[severity] += 1assert entry["severity_counts"] == expected_counts+ # The findings behind the verdict and the severity bump are auditable+ # per member, and a member with no conflict carries none.+ if conflict:+ other = "second-skill" if entry["name"] == "first-skill" else "first-skill"+ assert entry["catalog_findings"] == [+ {+ "category": "SCHEMA",+ "check_name": "metadata_id_duplicate",+ "severity": severity,+ "blocking": blocking,+ "message": f"metadata.id 'shared-id' is also declared by {other}",+ }+ ]+ else:+ assert "catalog_findings" not in entryleaf = json.loads((out / entry["report_dir"] / entry["json_report"]).read_text(encoding="utf-8"))assert leaf["overall_passed"] is not own_failureassert leaf["overall_status"] == ("failed" if own_failure else "passed")diff --git a/tests/tier3/test_judge_contracts.py b/tests/tier3/test_judge_contracts.pyindex 28c99383..217f2ddb 100644--- a/tests/tier3/test_judge_contracts.py+++ b/tests/tier3/test_judge_contracts.py@@ -1333,3 +1333,65 @@ def test_judge_header_format_preservation_masks_escaped_secret_suffixes(text: stevidence = eval_template._redact_judge_evidence(text)assert "CANARY_JUDGE_SUFFIX" not in evidenceassert "<redacted>" in evidence+++_GATE_FACTS = [+ {"claim": "report.py", "observed": True},+ {"claim": "summary.md", "observed": True},+]+++ ("expected_behavior", "verified", "why"),+ [+ (["writes `report.py`"], True, "a single observed artifact settles the expectation"),+ (+ ["writes `report.py`, `summary.md`"],+ True,+ "several observed artifacts in one clause still settle it",+ ),+ (["explains the trade-offs"], False, "plain prose names nothing checkable"),+ (["writes `missing.py`"], False, "an unobserved artifact settles nothing"),+ (+ ["writes `report.py` and explains why each column was dropped"],+ False,+ "the prose half needs the final response the limits cut",+ ),+ (["writes `report.py` then explains the result"], False, "clause joined by 'then'"),+ (["writes `report.py`; explains why"], False, "clause joined by a semicolon"),+ (["writes `report.py`. Explains why."], False, "a second sentence"),+ (["writes `report.py`", "explains why"], False, "a prose expectation beside an artifact one"),+ ],+)+def test_expected_behaviors_verified_requires_every_clause_to_be_checkable(+ expected_behavior: list[str], verified: bool, why: str+) -> None:+ # The gate exists to stop a score being withheld when the deterministic+ # facts already settle the expectation. Naming an observed artifact is not+ # enough on its own: an expectation that also asks for prose is settled+ # only in its artifact half, and the other half is exactly what the cut+ # final response would have answered. Keeping the gate withholds a score;+ # lifting it wrongly keeps a score the evidence does not support, so an+ # unrecognized clause shape must fall on the withholding side.+ assert atif_helpers._expected_behaviors_verified(expected_behavior, _GATE_FACTS) is verified, why+++def test_expected_behaviors_verified_mixed_clause_does_not_lift_the_evidence_gate() -> None:+ # End-to-end through behavior_evidence_gap: the mixed expectation must+ # leave the gap in place, so behavior_check still withholds its score.+ omitted = {+ "required_complete": False,+ "required_missing": ["final response"],+ "reason": "final response truncated",+ "expected_behaviors_verified": atif_helpers._expected_behaviors_verified(+ ["writes `report.py` and explains why each column was dropped"], _GATE_FACTS+ ),+ }+ assert omitted["expected_behaviors_verified"] is False+ assert atif_helpers.behavior_evidence_gap(omitted) != ""++ omitted["expected_behaviors_verified"] = atif_helpers._expected_behaviors_verified(+ ["writes `report.py`"], _GATE_FACTS+ )+ assert omitted["expected_behaviors_verified"] is True+ assert atif_helpers.behavior_evidence_gap(omitted) == ""diff --git a/tests/validators/test_schema.py b/tests/validators/test_schema.pyindex 363084e1..c5ebbd7f 100644--- a/tests/validators/test_schema.py+++ b/tests/validators/test_schema.py@@ -1058,10 +1058,16 @@ Example.[("[email protected]", "contains an email address"),("Jane Doe [email protected]", "contains an email address"),+ # An intranet host has no dot, but the value is still only an email.+ ("root@buildhost", "contains an email address"),+ ("jane@example", "contains an email address"),+ ("Jos\[email protected]", "contains an email address"),("Jane Doe <jane>", "angle brackets"),("Jane Doe <[email protected]> and team", "angle brackets"),- ("Jane\u202eDoe", "control or invisible formatting"),- ("Jane\tDoe", "control or invisible formatting"),+ ("Jane\u202eDoe", "control, private-use, or bidirectional formatting"),+ ("Jane\tDoe", "control, private-use, or bidirectional formatting"),+ ("Jane\u2066Doe", "control, private-use, or bidirectional formatting"),+ ("Jane\ue000Doe", "control, private-use, or bidirectional formatting"),("---", "no letters or digits"),("J" * 257, "longer than 256 characters"),],@@ -1123,8 +1129,80 @@ Example.assert len(findings) == 1assert findings[0].severity == Severity.HIGHassert "has no email address matching the required domain" in findings[0].message+ assert findings[0].metadata.get("shape_ok") is Falseassert SchemaValidator(policy=policy).validate(member).passed+ def test_domain_restriction_rejects_well_formed_author_outside_the_domain(self, tmp_path: Path):+ """The other half of the domain branch: a correct shape in the wrong domain still blocks.++ The domain check is the only blocking author rule an organization+ policy keeps, so a regression that accepted any domain has to fail a+ test rather than only the bare-name case above.+ """+ import re++ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import ValidationPolicy, default_policy++ policy = ValidationPolicy(+ profile="org",+ author_email_regex=re.compile(r"@example\.org>$"),+ severity_overrides=dict(default_policy().severity_overrides),+ )+ outsider = self._write_skill(tmp_path, name="org-outsider", author_line="Jane Doe <[email protected]>")++ result = SchemaValidator(policy=policy).validate(outsider)++ findings = [f for f in result.findings if f.check_name == "author_format"]+ assert len(findings) == 1+ assert findings[0].severity == Severity.HIGH+ assert "Author email does not match the required domain" in findings[0].message+ assert findings[0].metadata.get("shape_ok") is True+ assert findings[0].metadata.get("domain_ok") is False+ assert not result.passed++ @pytest.mark.parametrize(+ "author",+ [+ "Jane\u200cDoe", # ZWNJ: required by Persian and Devanagari names+ "Jane\u200dDoe", # ZWJ+ "Jane\u00adDoe", # soft hyphen+ "Jane\u0530Doe", # unassigned in Unicode 16, assigned in some later version+ ],+ )+ def test_joiners_and_unassigned_code_points_are_accepted_in_an_author(self, tmp_path: Path, author: str):+ """The character guard rejects spoofing characters, not every Unicode category C.++ ZWNJ/ZWJ are needed to render Persian, Arabic and Devanagari names, and+ an unassigned code point would make the verdict depend on the running+ interpreter's Unicode data rather than on the value.+ """+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, name="joiner-author", author_line=f'"{author} <[email protected]>"')++ result = SchemaValidator(policy=load_profile("default")).validate(skill_dir)++ assert not [f for f in result.findings if f.check_name.startswith("author")], result.errors+ assert result.passed, result.errors++ @pytest.mark.parametrize(+ "author",+ ["Jane Doe (@jdoe)", "Team (@org-handle)", "@jdoe", "Platform Team @ Example"],+ )+ def test_social_handles_are_not_mistaken_for_a_bare_email(self, tmp_path: Path, author: str):+ """Widening the bare-email pattern must not turn a documented handle into a HIGH finding."""+ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, name="handle-author", author_line=f'"{author}"')++ result = SchemaValidator(policy=load_profile("default")).validate(skill_dir)++ assert result.passed, result.errors+ findings = [f for f in result.findings if f.check_name.startswith("author")]+ assert [(f.check_name, f.severity) for f in findings] == [("author_without_email", Severity.INFO)]+def test_default_validator_uses_public_profile(self, tmp_path: Path):"""Constructing SchemaValidator() without a policy accepts public domains."""@@ -1327,6 +1405,83 @@ Example.assert result.summary.low_count == 1+class TestCollectionAdvisoryIdentity:+ """A preserved advisory must say which skill in the collection produced it.++ Collection validation keeps the advisories of the skills that passed, but+ a consumer reading the collection result also has to be able to attribute+ each one, which a finding carried over unchanged does not allow.+ """++ @staticmethod+ def _write_skill(root: Path, name: str, *, author_line: str, id_line: str | None) -> Path:+ skill_dir = root / name+ skill_dir.mkdir(parents=True)+ id_block = f" id: {id_line}\n" if id_line is not None else ""+ (skill_dir / "SKILL.md").write_text(+ f"""---+name: {name}+description: A skill used by the test suite to check collection-level advisory handling+metadata:+ author: {author_line}+{id_block}---++# {name}++## Instructions++1. Run.++## Examples++Example.+""",+ encoding="utf-8",+ )+ return skill_dir++ def test_carried_advisory_names_its_skill(self, tmp_path: Path):+ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import load_profile++ skills = tmp_path / "skills"+ self._write_skill(skills, "advisory-skill", author_line="Example Team", id_line="INVALID_ID")++ skill_result = SchemaValidator(policy=load_profile("default")).validate(skills / "advisory-skill")+ collection = SchemaValidator(policy=load_profile("default")).validate(tmp_path)++ assert skill_result.passed, skill_result.errors+ carried = {f.check_name: f for f in collection.findings if f.metadata.get("collection_skill")}+ assert carried.keys() >= {"author_without_email", "metadata_id_format"}+ assert carried["author_without_email"].severity == Severity.INFO+ assert carried["metadata_id_format"].severity == Severity.MEDIUM+ for finding in carried.values():+ assert finding.metadata["collection_skill"] == "advisory-skill"+ assert finding.file_path.startswith("[advisory-skill] ")+ assert any("[advisory-skill] " in warning for warning in collection.warnings)+ # An advisory from a passing child stays advisory: it cannot fail the collection.+ assert collection.passed, collection.errors+ assert not collection.errors+ assert not [f for f in collection.findings if f.severity.is_error()]+ # The roll-up must not claim everything passed while advisories exist.+ rollup = next(d for d in collection.success_details if d.check_name == "advisory-skill")+ assert rollup.metadata["advisory_findings"] == len(skill_result.findings)+ assert "advisory finding(s)" in rollup.message++ def test_collection_of_clean_skills_carries_no_advisories(self, tmp_path: Path):+ """Negative case: nothing is invented for a skill with no findings of its own."""+ skills = tmp_path / "skills"+ self._write_skill(skills, "clean-skill", author_line="Jane Doe <[email protected]>", id_line="clean-skill")++ collection = SchemaValidator().validate(tmp_path)++ assert collection.passed, collection.errors+ assert not [f for f in collection.findings if f.metadata.get("collection_skill")]+ rollup = next(d for d in collection.success_details if d.check_name == "clean-skill")+ assert rollup.message == "All schema and structure checks passed"+ assert rollup.metadata["advisory_findings"] == 0++class TestMetadataIdPreviewBounds:"""A rejected ``metadata.id`` must never be rendered by expanding its value."""