Skip to content

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

Show per-case Tier 3 results and a "what to fix" list (#316)

Christopher Kevin295154859fa9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96c708be..f421a86c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -144,6 +144,11 @@ All notable changes to SkillEvaluator are documented in this file.
LiteLLM wrappers, so generic 500/503 errors do not cause extra attempts.
This applies to ordinary skill evaluations and other host LLM calls as well
as plugin evaluations; retry limits and scoring formulas are unchanged.
+- The compact `validate` view lists every Tier 3 test case with and without
+ the skill, updates the list while trials run, and ends each tier with a short
+ "what to fix" list: the problem, then the action. A required scanner that
+ could not run counts as "didn't run", not as a failed check.
+
- Hosted GitHub reports verify a separate GitHub-signed execution receipt.
Enable `id-token: write` in the scan workflow and refresh its approved blob
when adding hosting; ordinary scans keep their existing read-only permissions.
diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.py
index 3ea19216..2d0b2dac 100644
--- a/src/skillevaluator/cli.py
+++ b/src/skillevaluator/cli.py
@@ -29,6 +29,7 @@ from skillevaluator.logging_config import setup_logging
from skillevaluator.models.result import ValidationResult
from skillevaluator.quality_config import QualityConfigError, load_quality_config
from skillevaluator.reporting.console_ui import (
+ TierRow,
ValidateView,
ViewProgressReporter,
check_ticker_row,
@@ -1544,7 +1545,7 @@ def _finish_pipeline_view(
agent_eval: bool,
) -> None:
"""Render the quiet-mode verdict panel and report footer."""
- from skillevaluator.reporting.console_ui import Verdict, _is_skipped, first_fix
+ from skillevaluator.reporting.console_ui import MUTED, Verdict, _is_skipped, first_fix
ext = {"html": ".html", "json": ".json", "markdown": ".md", "sarif": ".sarif.json"}
links: list[tuple[str, str]] = [
@@ -1569,19 +1570,29 @@ def _finish_pipeline_view(
return
failed = [result for result in tier_gate_results if not result.passed and not _is_skipped(result)]
- if failed:
- first = failed[0].validator_name or "validation"
- extra = f" (+{len(failed) - 1} more)" if len(failed) > 1 else ""
- tier_no = (failed[0].metadata.get("gating") or {}).get("tier")
- tier_label = f" in Tier {tier_no}" if tier_no is not None else ""
- headline = f"{first}{extra} failed{tier_label}"
+ if len(failed) == 1:
+ only = failed[0]
+ tier_no = (only.metadata.get("gating") or {}).get("tier")
+ state = "didn't run" if only.is_incomplete else "failed"
+ headline = f"{only.validator_name or 'validation'} {state}" + (
+ f" in Tier {tier_no}" if tier_no is not None else ""
+ )
else:
- headline = "validation failed"
+ by_tier: dict[object, list] = {}
+ for result in failed:
+ by_tier.setdefault((result.metadata.get("gating") or {}).get("tier"), []).append(result)
+ parts = []
+ for tier_no, results in by_tier.items():
+ broken = sum(1 for r in results if not r.is_incomplete)
+ counts = [
+ f"{broken} failed" if broken else "",
+ f"{len(results) - broken} didn't run" if broken < len(results) else "",
+ ]
+ parts.append((f"Tier {tier_no}: " if tier_no is not None else "") + ", ".join(c for c in counts if c))
+ headline = " · ".join(parts) or "validation failed"
rerun = _rerun_hint(target_path, agent_eval)
- view.finish(
- Verdict(passed=False, headline=headline, fix=first_fix(tier_gate_results), rerun=rerun),
- links,
- )
+ fix = [("see what to fix above, then rerun", MUTED)] if failed else first_fix(tier_gate_results)
+ view.finish(Verdict(passed=False, headline=headline, fix=fix, rerun=rerun), links)
def _print_tier_banner(title: str) -> None:
@@ -2283,10 +2294,29 @@ def validate(
[*tier3_config_rows, stage_hint_row("status", "running with-skill and baseline trials…")],
)
+ from threading import Lock
+
+ live_case_rows: list[TierRow] = []
+ engine_tail: list[str] = []
+ progress_lock = Lock() # case rows refresh from a polling thread, engine lines from the runner
+
+ def _show_tier3_progress() -> None:
+ with progress_lock:
+ view.tier_progress(tier3_index, [*tier3_config_rows, *live_case_rows, *engine_feed_rows(engine_tail)])
+
def _on_engine_tail(lines: list[str]) -> None:
- view.tier_progress(tier3_index, [*tier3_config_rows, *engine_feed_rows(lines)])
+ engine_tail[:] = lines
+ _show_tier3_progress()
+
+ def _on_case_rows(rows: list[TierRow]) -> None:
+ live_case_rows[:] = rows
+ _show_tier3_progress()
- reporter = ViewProgressReporter(_on_engine_tail) if quiet else None
+ reporter = (
+ ViewProgressReporter(_on_engine_tail, on_cases=_on_case_rows, pass_threshold=pass_threshold)
+ if quiet
+ else None
+ )
repo_context_exclude_paths = [output_dir] if report_output_required else []
catalog_report_root = click.get_current_context().meta.get("skillevaluator_catalog_report_root")
if isinstance(catalog_report_root, Path) and not paths_refer_to_same_location(
diff --git a/src/skillevaluator/reporting/console_ui.py b/src/skillevaluator/reporting/console_ui.py
index 22e96016..9a0f3009 100644
--- a/src/skillevaluator/reporting/console_ui.py
+++ b/src/skillevaluator/reporting/console_ui.py
@@ -27,10 +27,15 @@ consoles are created with ``emoji=False`` so ``:name:`` codes print literally.
from __future__ import annotations
import math
+import os
+import re
import sys
+import textwrap
+import threading
import time
import unicodedata
from dataclasses import dataclass, field
+from pathlib import Path
from typing import TYPE_CHECKING, TextIO
from rich import box
@@ -53,6 +58,7 @@ MUTED = "#8A8F98" # labels / secondary
FAINT = "#565B66" # chrome, pending, bar remainders
BRIGHT = "#EDEDED" # the actively-running element
INK = "#101403" # pill/badge foreground on green fills
+AMBER = "#E5A33B" # the "what to fix" section only
_TIER2_SCAN_FAILURE_CHECKS = frozenset(
{
@@ -109,18 +115,73 @@ class ViewProgressReporter:
:func:`redact_progress_detail` so secrets never reach the terminal.
"""
- def __init__(self, on_tail, max_lines: int = 4):
+ def __init__(
+ self,
+ on_tail,
+ max_lines: int = 4,
+ *,
+ on_cases=None,
+ pass_threshold: float | None = None,
+ poll_seconds: float = 2.0,
+ ):
self._on_tail = on_tail
self._max_lines = max_lines
self._tail: list[str] = []
self._secrets: set[str] = set()
+ self._on_cases = on_cases
+ self._pass_threshold = 0.5 if pass_threshold is None else pass_threshold
+ self._poll_seconds = poll_seconds
+ self._plan = None
+ self._stop = threading.Event()
+ self._poller: threading.Thread | None = None
@property
def is_active(self) -> bool:
return True
- def start(self, _plan) -> None: # Tier3RunPlan — the view renders its own config rows
- return None
+ def start(self, plan) -> None:
+ """Track the run plan; once it names the run directory, poll case results."""
+ if self._on_cases is None or not getattr(plan, "output_dir", None):
+ return
+ self._plan = plan
+ self.poll_cases()
+ if self._poller is None:
+ self._poller = threading.Thread(target=self._poll_loop, name="tier3-case-poller", daemon=True)
+ self._poller.start()
+
+ def poll_cases(self) -> None:
+ """Push live per-case rows for the current plan to the view."""
+ from skillevaluator.tier3.case_summary import live_case_marks
+
+ plan = self._plan
+ if plan is None or self._on_cases is None:
+ return
+ try:
+ marks, running = live_case_marks(
+ Path(plan.output_dir), list(plan.agents), pass_threshold=self._pass_threshold
+ )
+ except OSError:
+ return
+ done = sum(len(m) for conditions in marks.values() for cases in conditions.values() for m in cases.values())
+ conditions = ("with_skill",) if plan.baseline is False else ("with_skill", "without_skill")
+ rows = tier3_case_rows(
+ marks,
+ agents=list(plan.agents),
+ conditions=conditions,
+ k=plan.attempts,
+ running=running,
+ progress=(done, plan.matrix_trials) if plan.matrix_trials else None,
+ show_agent=False,
+ )
+ if rows:
+ self._on_cases(rows)
+
+ def _poll_loop(self) -> None:
+ while not self._stop.wait(self._poll_seconds):
+ try:
+ self.poll_cases()
+ except Exception: # a display refresh must never break the run
+ continue
def set_secret_values(self, values) -> None:
self._secrets.update(str(v) for v in values if v)
@@ -143,7 +204,10 @@ class ViewProgressReporter:
return None
def close(self) -> None:
- return None
+ self._stop.set()
+ if self._poller is not None:
+ self._poller.join(timeout=5)
+ self._poller = None
def make_view_console(file: TextIO | None = None) -> Console:
@@ -168,6 +232,8 @@ class TierRow:
segments: list[tuple[str, str]]
glyph: str = " "
glyph_style: str = MUTED
+ label_style: str = MUTED
+ fit: str = "" # "wrap": word-wrap the last segment to the panel; "rule": a full-width divider
def detail_row(label: str, value: str, note: str = "") -> TierRow:
@@ -198,6 +264,204 @@ def lift_row(lift: float, with_score: float, baseline: float) -> TierRow:
return TierRow("lift", segments)
+_CASES_PER_LINE = 8
+_FIX_TEXT_LIMIT = 300
+_CONDITION_LABELS = {"with_skill": "with skill", "without_skill": "without"}
+_CASE_STYLES = {"✓": GREEN, "✗": f"bold {RED}", "⊘": RED, "▸": f"bold {BRIGHT}", "·": FAINT}
+
+
+def _case_state(marks: list[str], k: int | None, *, running: bool) -> str:
+ """Case glyph: ✓ every attempt passed, ✗ one failed, ⊘ one did not run, ▸ running, · waiting."""
+ if "✗" in marks:
+ return "✗"
+ if "⊘" in marks:
+ return "⊘"
+ finished = "✓" in marks and not running and ("·" in marks or k is None or len(marks) >= k)
+ if finished:
+ return "✓"
+ return "▸" if running or marks else "·"
+
+
+def _case_prefix(case_ids: list[str]) -> str:
+ """The shared ``name-`` prefix of the case ids, shown once in the agent row."""
+ if len(case_ids) < 2:
+ return ""
+ first, last = min(case_ids), max(case_ids)
+ common = os.path.commonprefix([first, last])
+ cut = common.rfind("-") + 1
+ return common[:cut] if all(len(c) > cut for c in case_ids) else ""
+
+
+def _case_line_rows(label: str, states: dict[str, str], case_ids: list[str], prefix: str) -> list[TierRow]:
+ counts = {glyph: list(states.values()).count(glyph) for glyph in _CASE_STYLES}
+ tally: list[tuple[str, str]] = [
+ (" ", ""),
+ (f"{counts['✓']} passed", GREEN if counts["✓"] else MUTED),
+ (" · ", FAINT),
+ (f"{counts['✗']} failed", f"bold {RED}" if counts["✗"] else MUTED),
+ ]
+ if counts["⊘"]:
+ tally += [(" · ", FAINT), (f"{counts['⊘']} did not run", RED)]
+ if counts["▸"] + counts["·"]:
+ tally += [(" · ", FAINT), (f"{counts['▸'] + counts['·']} to go", MUTED)]
+ rows: list[TierRow] = []
+ for start in range(0, len(case_ids), _CASES_PER_LINE):
+ segments: list[tuple[str, str]] = []
+ for case_id in case_ids[start : start + _CASES_PER_LINE]:
+ glyph = states.get(case_id, "·")
+ name = sanitize_tier3_console_text(case_id[len(prefix) :], limit=24)
+ segments += [(" " if segments else "", ""), (f"{glyph} {name}", _CASE_STYLES[glyph])]
+ rows.append(TierRow(label if not rows else "", segments))
+ rows[0].segments += tally
+ return rows
+
+
+def tier3_case_rows(
+ marks: dict[str, dict[str, dict[str, list[str]]]],
+ *,
+ agents: list[str] | None = None,
+ conditions: tuple[str, ...] = ("with_skill", "without_skill"),
+ k: int | None = None,
+ running: set[tuple[str, str, str]] | None = None,
+ progress: tuple[int, int] | None = None,
+ show_agent: bool = True,
+) -> list[TierRow]:
+ """Tier 1-style case rows: one ✓/✗ per test case and condition, plus passed/failed counts."""
+ running = running or set()
+ agents = [a for a in (agents or list(marks)) if a in marks]
+ case_ids = sorted({c for a in agents for key in conditions for c in marks[a].get(key, {})})
+ if not case_ids:
+ return []
+ prefix = _case_prefix(case_ids)
+ if k is None:
+ k = (
+ max((len(m) for a in agents for key in conditions for m in marks[a].get(key, {}).values()), default=0)
+ or None
+ )
+ names = sanitize_tier3_console_text(", ".join(agents), limit=64)
+ detail = (
+ f" {len(case_ids)} test case{'s' if len(case_ids) != 1 else ''}"
+ + (f" ({prefix}…)" if prefix else "")
+ + (f" · k={k}" if k else "")
+ )
+ header = [(names, TEXT), (detail, MUTED)] if show_agent else [(detail.strip(), TEXT)]
+ rows = [TierRow("agent" if show_agent else "cases", header)]
+ if progress and progress[1] > 0:
+ done, total = min(progress[0], progress[1]), progress[1]
+ filled = round(BAR * done / total)
+ rows.append(
+ TierRow(
+ "progress",
+ [("█" * filled, GREEN), ("░" * (BAR - filled), FAINT), (f" {done}/{total} attempts", MUTED)],
+ )
+ )
+ for agent in agents:
+ indent = ""
+ if len(agents) > 1:
+ rows.append(TierRow(sanitize_tier3_console_text(agent, limit=LABEL - 1), []))
+ indent = " "
+ for key in conditions:
+ cases = marks[agent].get(key, {})
+ states = {c: _case_state(cases.get(c, []), k, running=(agent, key, c) in running) for c in case_ids}
+ rows += _case_line_rows(indent + _CONDITION_LABELS[key], states, case_ids, prefix)
+ return rows
+
+
+_FIX_ITEMS_SHOWN = 3
+
+
+@dataclass
+class FixItem:
+ """One "what to fix" entry: where it is, what is wrong, and the action(s) that fix it."""
+
+ where: str
+ problem: str
+ actions: list[str] = field(default_factory=list)
+
+
+def fix_section_rows(items: list[FixItem]) -> list[TierRow]:
+ """The highlighted "what to fix" section closing a tier box; empty when nothing needs fixing."""
+ if not items:
+ return []
+ rows = [
+ TierRow("", []),
+ TierRow("what to fix", [("─", FAINT)], label_style=f"bold {AMBER}", fit="rule"),
+ ]
+ for number, item in enumerate(items[:_FIX_ITEMS_SHOWN], start=1):
+ rows.append(
+ TierRow(
+ item.where[: LABEL - 1],
+ [(item.problem, TEXT)],
+ glyph=str(number),
+ glyph_style=f"bold {AMBER}",
+ fit="wrap",
+ )
+ )
+ rows += [TierRow("", [("→ ", AMBER), (action, MUTED)], fit="wrap") for action in item.actions]
+ if len(items) > _FIX_ITEMS_SHOWN:
+ rows.append(TierRow("", [(f"+{len(items) - _FIX_ITEMS_SHOWN} more in report.html", FAINT)]))
+ return rows
+
+
+def _case_span(case_ids: list[str]) -> str:
+ """Compact case label: ``001-003`` for a consecutive run, else a list, else a count."""
+ prefix = _case_prefix(case_ids)
+ names = [c[len(prefix) :] for c in case_ids]
+ if len(names) > 2 and all(n.isdigit() for n in names):
+ numbers = [int(n) for n in names]
+ if numbers == list(range(numbers[0], numbers[0] + len(numbers))):
+ return f"{names[0]}-{names[-1]}"
+ label = ", ".join(names)
+ return label if len(label) < LABEL else f"{len(names)} cases"
+
+
+def tier3_fix_rows(findings: list[dict] | None, *, agents: int = 1) -> list[TierRow]:
+ """Tier 3 "How to improve" items as the tier's "what to fix" section."""
+ items = []
+ for finding in findings or []:
+ case_ids = [c.strip() for c in str(finding.get("case", "")).split(",") if c.strip()]
+ kind = sanitize_tier3_console_text(str(finding.get("kind", "")), limit=24)
+ what = sanitize_tier3_console_text(str(finding.get("what", "")).split(": ", 1)[-1], limit=_FIX_TEXT_LIMIT)
+ if agents > 1 and finding.get("scope"):
+ what += f" ({sanitize_tier3_console_text(str(finding.get('scope')), limit=32)})"
+ action = sanitize_tier3_console_text(str(finding.get("action", "")), limit=_FIX_TEXT_LIMIT)
+ items.append(
+ FixItem(
+ sanitize_tier3_console_text(_case_span(case_ids), limit=LABEL - 1) if case_ids else "cases",
+ f"{kind.capitalize()}: {what}" if kind else what,
+ [action] if action else [],
+ )
+ )
+ return fix_section_rows(items)
+
+
+def _fit_row(row: TierRow, room: int) -> list[list[tuple[str, str]]]:
+ """Lay a row out in ``room`` columns so nothing wraps under the label column."""
+ if row.fit == "rule":
+ return [[("─" * room, row.segments[0][1])]]
+ if row.fit != "wrap" or not row.segments:
+ return _wrap_segments(row.segments, room)
+ *prefix, (text, style) = row.segments
+ indent = sum(len(chunk) for chunk, _ in prefix)
+ wrapped = textwrap.wrap(text, max(room - indent, 20), break_on_hyphens=False) or [""]
+ return [[*prefix, (wrapped[0], style)]] + [[(" " * indent + line, style)] for line in wrapped[1:]]
+
+
+def _wrap_segments(segments: list[tuple[str, str]], room: int) -> list[list[tuple[str, str]]]:
+ """Split a row at segment boundaries so it never wraps under the label column."""
+ lines: list[list[tuple[str, str]]] = [[]]
+ used = 0
+ for chunk, style in segments:
+ if used and used + len(chunk) > room:
+ lines.append([])
+ used = 0
+ if chunk.strip() in {"·", ""}:
+ continue
+ lines[-1].append((chunk, style))
+ used += len(chunk)
+ return lines
+
+
@dataclass
class TierBlock:
"""State of one pipeline tier as the run progresses."""
@@ -431,13 +695,15 @@ class ValidateView:
(block.name, f"bold {TEXT}"),
)
lines = []
+ room = self.width - 8 - LABEL
for row in block.rows:
- t = Text()
- t.append(f"{row.glyph} ", style=row.glyph_style)
- t.append(f"{strip_terminal_controls(row.label):<{LABEL}}", style=MUTED)
- for chunk, style in row.segments:
- t.append(strip_terminal_controls(chunk), style=style)
- lines.append(t)
+ for i, segments in enumerate(_fit_row(row, room)):
+ t = Text()
+ t.append(f"{row.glyph if i == 0 else ' '} ", style=row.glyph_style)
+ t.append(f"{strip_terminal_controls(row.label if i == 0 else ''):<{LABEL}}", style=row.label_style)
+ for chunk, style in segments:
+ t.append(strip_terminal_controls(chunk), style=style)
+ lines.append(t)
body = Group(*lines) if lines else Text("…", style=FAINT)
return Panel(
body,
@@ -732,6 +998,8 @@ def summarize_tier1(results: list[ValidationResult], lineup: list[str] | None =
"""
total = len(results)
failed = [r for r in results if not r.passed and not _is_skipped(r)]
+ incomplete = [r for r in failed if r.is_incomplete]
+ broken = [r for r in failed if not r.is_incomplete]
# Warnings from passing validators surface as advisories below; only the
# failing validators' warnings belong on the headline checks row.
warnings = sum(len(r.warnings) for r in failed)
@@ -744,23 +1012,14 @@ def summarize_tier1(results: list[ValidationResult], lineup: list[str] | None =
if lineup:
rows.append(final_check_ticker_row(lineup, results))
checks_segments: list[tuple[str, str]] = [(f"{total - len(failed)}/{total} passed", TEXT)]
- if failed:
- checks_segments += [(" · ", FAINT), (f"{len(failed)} failed", f"bold {RED}")]
+ if broken:
+ checks_segments += [(" · ", FAINT), (f"{len(broken)} failed", f"bold {RED}")]
+ if incomplete:
+ checks_segments += [(" · ", FAINT), (f"{len(incomplete)} didn't run", f"bold {RED}")]
if warnings:
checks_segments += [(" · ", FAINT), (f"{warnings} warning{'s' if warnings != 1 else ''}", MUTED)]
rows.append(TierRow("summary" if lineup else "checks", checks_segments))
- for r in failed:
- reason = _first_error(r)
- rows.append(
- TierRow(
- "failed",
- [(r.validator_name, f"bold {TEXT}"), (f" — {reason}" if reason else "", RED)],
- glyph="✗",
- glyph_style=f"bold {RED}",
- )
- )
-
if advisory:
detail = " · ".join(f"{name} {count}" for name, count in sorted(advisory.items(), key=lambda kv: -kv[1]))
rows.append(TierRow("advisories", [(str(sum(advisory.values())), TEXT), (f" {detail}", MUTED)]))
@@ -769,7 +1028,37 @@ def summarize_tier1(results: list[ValidationResult], lineup: list[str] | None =
if quality:
grade, score = quality
rows.append(TierRow("quality", [(grade, f"bold {GREEN}"), (f" {score:.1f} / 100", TEXT)]))
- return not failed, rows
+ items = [_tier1_fix(r) for r in broken]
+ if incomplete:
+ items.append(_setup_fix(incomplete))
+ return not failed, rows + fix_section_rows(items)
+
+
+def _tier1_fix(result: ValidationResult) -> FixItem:
+ problem = _first_error(result) or f"{result.validator_name} failed"
+ action = next((f.suggestion for f in result.findings if f.message == problem and f.suggestion), None)
+ if action is None and not result.gate_failures:
+ action = first_fix([result])
+ action = action[0][0] if action else None
+ where = _short_name(result.validator_name)
+ return FixItem(where, problem, [action] if action and action != problem else [])
+
+
+_INSTALL_HINT = re.compile(r"\b[Ii]nstall(?: [\w-]+)*? with: (.+?)\.?$")
+
+
+def _setup_fix(results: list[ValidationResult]) -> FixItem:
+ """One item for checks that could not run because a scanner is not installed."""
+ scanners = list(dict.fromkeys(name for r in results for name in r.incomplete_scans))
+ hints = []
+ for r in results:
+ for text in r.warnings:
+ match = _INSTALL_HINT.search(str(text))
+ if match and match.group(1) not in hints:
+ hints.append(match.group(1))
+ checks = ", ".join(dict.fromkeys(_short_name(r.validator_name) for r in results))
+ missing = ", ".join(scanners) or "a required scanner"
+ return FixItem("setup", f"{checks} didn't run: {missing} not installed", hints)
def summarize_tier2(results: list[ValidationResult]) -> tuple[bool, bool, list[TierRow], str]:
@@ -804,27 +1093,36 @@ def summarize_tier2(results: list[ValidationResult]) -> tuple[bool, bool, list[T
found_duplicates = any(label == "duplicate" for label, _message in details)
headline = "duplicates found" if found_duplicates else "scan failed"
rows.append(TierRow("context", [(headline, f"bold {RED}")]))
- # Show the actual overlaps, or the errors that stopped the scan.
- shown = 0
- for label, message in details:
- if shown >= 3:
- continue
- rows.append(
- TierRow(
- label,
- [(message[:110], TEXT)],
- glyph="✗",
- glyph_style=f"bold {RED}",
- )
- )
- shown += 1
- if len(details) > shown:
- rows.append(TierRow("", [(f"… {len(details) - shown} more — see the report", MUTED)]))
+ errors = [message for label, message in details if label == "error"]
+ for message in errors[:3]:
+ rows.append(TierRow("error", [(message[:110], TEXT)], glyph="✗", glyph_style=f"bold {RED}"))
+ if len(errors) > 3:
+ rows.append(TierRow("", [(f"… {len(errors) - 3} more — see the report", MUTED)]))
+ duplicates = [
+ finding for result in failed for finding in result.findings if not _tier2_finding_is_scan_failure(finding)
+ ]
+ fix_rows = fix_section_rows([_tier2_fix(finding) for finding in duplicates])
else:
+ fix_rows = []
rows.append(TierRow("context", [("clean", TEXT), (" no duplicate guidance", MUTED)]))
if advisories:
rows.append(TierRow("advisories", [(str(advisories), TEXT), (" catalog", MUTED)]))
- return True, not failed, rows, ""
+ return True, not failed, rows + fix_rows, ""
+
+
+_DUPLICATE_SECTION = re.compile(r'^(?:vs )?"(?P<title>.+)" in (?P<file>\S+) \(lines (?P<lines>[\d-]+)\)$')
+
+
+def _tier2_fix(finding) -> FixItem:
+ """A duplicate finding as a fix item; the section list collapses to ``"Title" lines a-b`` parts."""
+ first, *rest = [line.strip() for line in str(finding.message).splitlines() if line.strip()] or [""]
+ sections = [_DUPLICATE_SECTION.match(line) for line in rest]
+ if rest and all(sections):
+ first = first.rstrip(":") + ": " + " · ".join(f'"{m["title"]}" lines {m["lines"]}' for m in sections)
+ elif rest:
+ first = " ".join([first, *rest])
+ where = Path(str(finding.file_path or "")).name or "context"
+ return FixItem(where, first, [str(finding.suggestion)] if finding.suggestion else [])
def _tier2_finding_is_scan_failure(finding: object) -> bool:
@@ -832,6 +1130,28 @@ def _tier2_finding_is_scan_failure(finding: object) -> bool:
return check_name in _TIER2_SCAN_FAILURE_CHECKS or check_name.endswith("_limit") or check_name.endswith("_error")
+def _tier3_run_dir(payload: dict) -> Path | None:
+ provenance = payload.get("provenance")
+ raw = provenance.get("run_dir") if isinstance(provenance, dict) else None
+ path = Path(raw).resolve() if isinstance(raw, str) and raw else None
+ return path if path is not None and path.is_dir() else None
+
+
+def _tier3_final_marks(run_dir: Path) -> dict[str, dict[str, dict[str, list[str]]]]:
+ from skillevaluator.tier3.case_summary import load_case_marks
+
+ try:
+ return load_case_marks(run_dir)
+ except OSError:
+ return {}
+
+
+def _tier3_findings(run_dir: Path) -> list[dict] | None:
+ from skillevaluator.tier3.case_summary import load_case_findings
+
+ return load_case_findings(run_dir)
+
+
def _tier2_finding_is_advisory_refusal(finding: object) -> bool:
# A policy can raise a refusal to a blocking severity; it then reads as a scan failure.
if getattr(finding, "check_name", None) != CONTENT_DEDUP_LLM_REFUSED_CHECK:
@@ -855,12 +1175,15 @@ def summarize_tier3(result: ValidationResult) -> tuple[bool, bool, list[TierRow]
agents = _tier3_string_list(raw_agents)
agent_label = sanitize_tier3_console_text(", ".join(agents)) or "n/a"
agent_segments: list[tuple[str, str]] = [(agent_label, TEXT)]
+ run_dir = _tier3_run_dir(payload)
+ case_rows = tier3_case_rows(_tier3_final_marks(run_dir), agents=agents or None) if run_dir else []
case_list = payload.get("cases")
- if isinstance(case_list, list) and case_list:
- # A plain count: per-case pass/fail lives in the report, and rendering
- # a fabricated N/N ratio here would overstate what we measured.
- agent_segments.append((f" eval cases {len(case_list)}", MUTED))
- rows = [TierRow("agent", agent_segments)]
+ if case_rows:
+ rows = case_rows
+ else:
+ if isinstance(case_list, list) and case_list:
+ agent_segments.append((f" eval cases {len(case_list)}", MUTED))
+ rows = [TierRow("agent", agent_segments)]
if payload.get("verdict") == "inconclusive" or summary.get("verdict") == "inconclusive":
rows.append(TierRow("verdict", [("INCONCLUSIVE: skill never activated", TEXT)]))
lift = _tier3_finite_number(summary.get("overall_lift"))
@@ -874,6 +1197,9 @@ def summarize_tier3(result: ValidationResult) -> tuple[bool, bool, list[TierRow]
baseline = with_score - lift
if 0.0 <= baseline <= 1.0:
rows.append(lift_row(lift, with_score, baseline))
+ if case_rows and len(agents) > 1:
+ rows = [row for row in rows if row.label != "lift"]
+ fix_rows = tier3_fix_rows(_tier3_findings(run_dir), agents=len(agents)) if run_dir else []
exec_status = payload.get("execution_status") or summary.get("execution_status")
ok = bool(result.passed) and exec_status in (None, "succeeded")
if not ok:
@@ -889,7 +1215,7 @@ def summarize_tier3(result: ValidationResult) -> tuple[bool, bool, list[TierRow]
glyph_style=f"bold {RED}",
)
)
- return True, ok, rows, ""
+ return True, ok, rows + fix_rows, ""
def _first_error(result: ValidationResult) -> str:
diff --git a/src/skillevaluator/tier3/case_summary.py b/src/skillevaluator/tier3/case_summary.py
index 748a05f1..9cc34824 100644
--- a/src/skillevaluator/tier3/case_summary.py
+++ b/src/skillevaluator/tier3/case_summary.py
@@ -1150,3 +1150,93 @@ def _baseline_saturated(agents: Mapping[str, Mapping[str, Any]]) -> dict[str, An
"conventions or domain rules) so the eval measures the skill's value."
),
}
+
+
+# ---------------------------------------------------------------- validate panel data
+
+
+def case_marks(result: Mapping[str, Any]) -> dict[str, dict[str, dict[str, list[str]]]]:
+ """Final attempt marks per agent, condition (``with_skill``/``without_skill``) and case."""
+ agents = result.get("agents") if isinstance(result, Mapping) else None
+ marks: dict[str, dict[str, dict[str, list[str]]]] = {}
+ for name, agent in (agents or {}).items():
+ if isinstance(agent, Mapping):
+ marks[str(name)] = {
+ key: {str(case_id): _marks(case) for case_id, case in _cases(agent, key).items()}
+ for key, _ in _VARIANTS
+ }
+ return marks
+
+
+def load_case_marks(run_dir: Path) -> dict[str, dict[str, dict[str, list[str]]]]:
+ """Final attempt marks read from a finished run's ``result.json``."""
+ result = _load_json(run_dir / "result.json", root=run_dir)
+ return case_marks(result) if isinstance(result, Mapping) else {}
+
+
+_LIVE_VARIANTS = {"with": "with_skill", "without": "without_skill"}
+
+
+def _harbor_job_owner(job_name: str, agents: list[str]) -> tuple[str, str] | None:
+ for agent in sorted(agents, key=len, reverse=True):
+ match = re.search(rf"-{re.escape(agent)}-(with|without)(?:-|$)", job_name)
+ if match:
+ return agent, _LIVE_VARIANTS[match.group(1)]
+ return None
+
+
+def _live_mark(trial: Path, run_dir: Path, pass_threshold: float) -> str | None:
+ """``None`` while the trial runs, else its attempt mark."""
+ result = _load_json(trial / "result.json", root=run_dir)
+ if not isinstance(result, Mapping) or not result.get("finished_at"):
+ return None
+ verifier = result.get("verifier_result")
+ rewards = verifier.get("rewards") if isinstance(verifier, Mapping) else None
+ score = rewards.get("overall") if isinstance(rewards, Mapping) else None
+ if isinstance(score, int | float) and not isinstance(score, bool):
+ return PASS if score >= pass_threshold else FAIL
+ return ERROR
+
+
+def live_case_marks(
+ run_dir: Path, agents: list[str], *, pass_threshold: float = 0.5
+) -> tuple[dict[str, dict[str, dict[str, list[str]]]], set[tuple[str, str, str]]]:
+ """Attempt marks of an in-flight run, read from its Harbor job directories.
+
+ Returns ``(marks, running)``: every staged case appears (with no marks
+ until an attempt finishes), and ``running`` holds the
+ ``(agent, condition, case)`` triples with an unfinished trial.
+ """
+ marks: dict[str, dict[str, dict[str, list[str]]]] = {}
+ running: set[tuple[str, str, str]] = set()
+ for agent in agents:
+ for variant, key in _LIVE_VARIANTS.items():
+ staged = run_dir / "_harbor-tasks" / agent / variant
+ if staged.is_dir() and not staged.is_symlink():
+ cases = marks.setdefault(agent, {}).setdefault(key, {})
+ for task in sorted(staged.iterdir()):
+ if task.is_dir() and not task.is_symlink() and _SAFE_TRIAL.match(task.name):
+ cases.setdefault(task.name, [])
+ jobs = run_dir / "_harbor-jobs"
+ if not jobs.is_dir() or jobs.is_symlink():
+ return marks, running
+ seen: set[tuple[str, str, str]] = set()
+ for job in islice(sorted(jobs.iterdir()), _MAX_TRIAL_PATHS_SCANNED):
+ owner = _harbor_job_owner(job.name, agents) if job.is_dir() and not job.is_symlink() else None
+ if owner is None:
+ continue
+ agent, key = owner
+ for trial in islice(sorted(job.iterdir()), _MAX_TRIAL_PATHS_SCANNED):
+ if "__" not in trial.name or not _SAFE_TRIAL.match(trial.name) or trial.is_symlink():
+ continue
+ case_id = trial.name.split("__", 1)[0]
+ if (agent, key, trial.name) in seen or not trial.is_dir():
+ continue
+ seen.add((agent, key, trial.name))
+ mark = _live_mark(trial, run_dir, pass_threshold)
+ case = marks.setdefault(agent, {}).setdefault(key, {}).setdefault(case_id, [])
+ if mark is None:
+ running.add((agent, key, case_id))
+ else:
+ case.append(mark)
+ return marks, running
diff --git a/src/skillevaluator/validators/secrets.py b/src/skillevaluator/validators/secrets.py
index b73bc8ee..418bc186 100644
--- a/src/skillevaluator/validators/secrets.py
+++ b/src/skillevaluator/validators/secrets.py
@@ -233,6 +233,7 @@ regexes = [
message=message,
file_path=file_path,
line_number=line,
+ suggestion=f"Remove the secret from {file_path}, revoke it, and read it from an environment variable",
),
is_error=severity.is_error(),
)
diff --git a/tests/reporting/test_rich_markup_escaping.py b/tests/reporting/test_rich_markup_escaping.py
index 9739f9c9..2d11b191 100644
--- a/tests/reporting/test_rich_markup_escaping.py
+++ b/tests/reporting/test_rich_markup_escaping.py
@@ -727,10 +727,10 @@ def test_validate_view_strips_terminal_controls(
output = capsys.readouterr().out
_assert_no_controls_or_emoji(output)
assert f" skill: {HOSTILE_VISIBLE} " in output # header pill
- assert f"SECURITY — {HOSTILE_VISIBLE}" in output # failed check row
+ assert "1 security" in output and HOSTILE_VISIBLE in " ".join(output.split()) # what-to-fix item
assert f"{'dataset':<12}{HOSTILE_VISIBLE}" in output
assert f"{'skipped':<12}{HOSTILE_VISIBLE}" in output
- assert f"fix {HOSTILE_VISIBLE}" in output
+ assert "fix see what to fix above, then rerun" in output
assert f"skillevaluator validate {Path('skills') / HOSTILE_PATH_PART_VISIBLE}" in output # rerun hint
assert f"{'report':<12}{Path('reports') / (HOSTILE_PATH_PART_VISIBLE + '.html')}" in output
diff --git a/tests/reporting/test_tier3_validate_cases.py b/tests/reporting/test_tier3_validate_cases.py
new file mode 100644
index 00000000..b26186c5
--- /dev/null
+++ b/tests/reporting/test_tier3_validate_cases.py
@@ -0,0 +1,171 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+import json
+from pathlib import Path
+from types import SimpleNamespace
+
+from skillevaluator.reporting.console_ui import ViewProgressReporter, _fit_row, tier3_case_rows, tier3_fix_rows
+from skillevaluator.tier3.case_summary import live_case_marks
+
+
+def _text(rows):
+ return "\n".join(f"{r.label:<12}" + "".join(chunk for chunk, _ in r.segments) for r in rows)
+
+
+def _marks(with_skill, without):
+ ids = [f"pdf-00{i}" for i in range(1, len(with_skill) + 1)]
+ return {
+ "claude-code": {
+ "with_skill": dict(zip(ids, with_skill, strict=True)),
+ "without_skill": dict(zip(ids, without, strict=True)),
+ }
+ }
+
+
+def test_final_rows_list_every_case_with_counts():
+ rows = tier3_case_rows(_marks([["✓", "✓"], ["✗", "✓"], ["✓", "·"]], [["✗", "✗"], ["✓", "✓"], ["⊘", "✓"]]))
+ text = _text(rows)
+ assert "3 test cases (pdf-…) · k=2" in text
+ assert "with skill ✓ 001 ✗ 002 ✓ 003 2 passed · 1 failed" in text
+ assert "without ✗ 001 ✓ 002 ⊘ 003 1 passed · 1 failed · 1 did not run" in text
+
+
+def test_live_rows_mark_running_and_waiting_cases():
+ marks = _marks([["✓", "✓"], ["✓"], []], [["✗"], [], []])
+ running = {("claude-code", "with_skill", "pdf-002")}
+ text = _text(tier3_case_rows(marks, k=2, running=running, progress=(4, 12)))
+ assert "4/12 attempts" in text
+ assert "✓ 001 ▸ 002 · 003 1 passed · 0 failed · 2 to go" in text
+ assert "✗ 001 · 002 · 003 0 passed · 1 failed · 2 to go" in text
+
+
+def test_multi_agent_rows_and_long_case_lists_wrap():
+ ids = [f"case-{i:03d}" for i in range(10)]
+ agent = {"with_skill": {c: ["✓"] for c in ids}, "without_skill": {c: ["✗"] for c in ids}}
+ rows = tier3_case_rows({"a": agent, "b": agent}, k=1)
+ labels = [r.label for r in rows]
+ assert labels == ["agent", "a", " with skill", "", " without", "", "b", " with skill", "", " without", ""]
+ assert "10 passed · 0 failed" in _text(rows)
+
+
+def test_no_cases_renders_nothing():
+ assert tier3_case_rows({}) == []
+
+
+def test_fix_rows():
+ assert tier3_fix_rows(None) == []
+ assert tier3_fix_rows([]) == []
+ finding = {
+ "case": "pdf-001, pdf-002",
+ "kind": "goal not met",
+ "scope": "claude-code",
+ "what": "x: asked for a file",
+ "action": "add the file",
+ }
+ rows = tier3_fix_rows([finding] * 4)
+ text = _text(rows)
+ assert rows[1].label == "what to fix"
+ assert [r.label for r in rows if r.glyph in "123" and r.glyph != " "] == ["001, 002"] * 3
+ assert "Goal not met: asked for a file" in text and "claude-code" not in text
+ assert "→ add the file" in text and "+1 more in report.html" in text
+ assert "(claude-code)" in _text(tier3_fix_rows([finding], agents=2))
+ long = {
+ **finding,
+ "case": "pdf-001, pdf-002, pdf-003",
+ "what": "x: " + "missing input " * 12,
+ "action": "add the files " * 12,
+ }
+ rows = tier3_fix_rows([long])
+ assert rows[2].label == "001-003"
+ for room in (40, 76):
+ lines = [line for r in rows[1:] for line in _fit_row(r, room)]
+ assert all(len("".join(c for c, _ in line)) <= room for line in lines)
+ assert "".join(c for c, _ in lines[0]) == "─" * room
+ assert _text(rows).count("missing input") == 12
+
+
+def test_fix_section_for_tier1_and_tier2():
+ from skillevaluator.models.result import Finding, Severity, ValidationResult
+ from skillevaluator.reporting.console_ui import summarize_tier1, summarize_tier2
+
+ schema = ValidationResult(validator_name="Schema & Repository Governance", passed=False)
+ schema.add_finding(
+ Finding(
+ "SCHEMA",
+ Severity.HIGH,
+ "author",
+ "Author not specified in metadata",
+ "SKILL.md",
+ suggestion="Add 'metadata.author'",
+ )
+ )
+ secrets = ValidationResult(
+ validator_name="Secrets Detection", passed=False, metadata={"incomplete_scans": ["gitleaks"]}
+ )
+ secrets.warnings.append("gitleaks not installed - secrets scanning skipped. Install with: brew install gitleaks")
+ clean = ValidationResult(validator_name="Version Check", passed=True)
+ _ok, rows = summarize_tier1([schema, secrets, clean])
+ text = _text(rows)
+ assert "1/3 passed · 1 failed · 1 didn't run" in text
+ assert "Author not specified in metadata\n" + " " * 12 + "→ Add 'metadata.author'" in text
+ assert "secrets didn't run: gitleaks not installed\n" + " " * 12 + "→ brew install gitleaks" in text
+ assert [r.label for r in rows if r.glyph in {"1", "2"}][1] == "setup"
+ assert summarize_tier1([clean])[1][-1].label != ""
+
+ dup = ValidationResult(validator_name="Context Deduplication", passed=False)
+ dup.add_finding(
+ Finding(
+ "CONTENT_DEDUP",
+ Severity.HIGH,
+ "context_dedup",
+ 'Duplicate content found within forms.md:\n "### A.4: Boxes" in forms.md (lines 1-2)\n vs "## Step 2" in forms.md (lines 9-10)',
+ "skill/forms.md",
+ suggestion="Keep it under Step 2",
+ )
+ )
+ rows = summarize_tier2([dup])[2]
+ flat = " ".join("".join(c for c, _ in r.segments) for r in rows)
+ assert 'within forms.md: "### A.4: Boxes" lines 1-2 · "## Step 2" lines 9-10' in flat
+ assert "→ Keep it under Step 2" in _text(rows)
+ assert next(r.label for r in rows if r.glyph == "1") == "forms.md"
+ assert not any(r.label == "what to fix" for r in summarize_tier2([ValidationResult(validator_name="d")])[2])
+
+
+def _trial(job: Path, name: str, result: dict | None) -> None:
+ trial = job / name
+ trial.mkdir(parents=True)
+ if result is not None:
+ (trial / "result.json").write_text(json.dumps(result))
+
+
+def test_live_case_marks_reads_harbor_jobs(tmp_path):
+ for variant in ("with", "without"):
+ for case in ("pdf-001", "pdf-002"):
+ (tmp_path / "_harbor-tasks" / "claude-code" / variant / case).mkdir(parents=True)
+ jobs = tmp_path / "_harbor-jobs"
+ done = {"finished_at": "t", "verifier_result": {"rewards": {"overall": 0.8}}}
+ _trial(jobs / "pdf-claude-code-with", "pdf-001__a", done)
+ _trial(jobs / "pdf-claude-code-with", "pdf-001__b", {**done, "verifier_result": {"rewards": {"overall": 0.2}}})
+ _trial(jobs / "pdf-claude-code-with", "pdf-002__c", {"finished_at": None})
+ _trial(jobs / "pdf-claude-code-without", "pdf-001__d", {"finished_at": "t", "exception_info": {"x": 1}})
+ marks, running = live_case_marks(tmp_path, ["claude-code"])
+ assert marks["claude-code"]["with_skill"] == {"pdf-001": ["✓", "✗"], "pdf-002": []}
+ assert marks["claude-code"]["without_skill"] == {"pdf-001": ["⊘"], "pdf-002": []}
+ assert running == {("claude-code", "with_skill", "pdf-002")}
+
+
+def test_reporter_pushes_case_rows_once_run_dir_is_known(tmp_path):
+ (tmp_path / "_harbor-tasks" / "claude-code" / "with" / "pdf-001").mkdir(parents=True)
+ pushed = []
+ reporter = ViewProgressReporter(lambda _lines: None, on_cases=pushed.append, poll_seconds=60)
+ reporter.start(SimpleNamespace(output_dir=None, agents=("claude-code",)))
+ assert pushed == []
+ plan = SimpleNamespace(
+ output_dir=str(tmp_path), agents=("claude-code",), baseline=False, attempts=2, matrix_trials=2
+ )
+ reporter.start(plan)
+ reporter.close()
+ assert "cases 1 test case · k=2" in _text(pushed[-1])
+ assert "with skill · pdf-001 0 passed · 0 failed · 1 to go" in _text(pushed[-1])
+ assert "without" not in _text(pushed[-1])
diff --git a/tests/test_commands.py b/tests/test_commands.py
index ad8a5c2c..cc78160d 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -2951,8 +2951,9 @@ def test_summarize_tier2_lists_duplicate_details() -> None:
rendered = ["".join(chunk for chunk, _style in row.segments) for row in rows]
assert any("duplicates found" in line for line in rendered)
assert any("Sections 'Setup 0'" in line for line in rendered)
- duplicate_rows = [row for row in rows if row.label == "duplicate"]
+ duplicate_rows = [row for row in rows if row.glyph in {"1", "2", "3"}]
assert len(duplicate_rows) == 3
+ assert any(row.label == "what to fix" for row in rows)
assert any("2 more" in line for line in rendered)
diff --git a/tests/test_quality_policy_gate.py b/tests/test_quality_policy_gate.py
index 077f8243..7f4c29bb 100644
--- a/tests/test_quality_policy_gate.py
+++ b/tests/test_quality_policy_gate.py
@@ -74,8 +74,8 @@ def test_pipeline_explains_minimum_score_failure(below_threshold_skill: Path) ->
passed, rows = summarize_tier1([result])
assert not passed
- failure_row = next(row for row in rows if row.label == "failed")
- assert result.gate_failures[0] in "".join(text for text, _style in failure_row.segments)
+ fix_text = " ".join("".join(text for text, _style in row.segments) for row in rows if row.glyph != "✓")
+ assert "".join(result.gate_failures[0].split()) in "".join(fix_text.split())
fix = first_fix([result])
assert fix is not None
assert "67.8/100 is below the required 70/100" in fix[0][0]