Skip to content

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

fix(tier3): read evaluation datasets as UTF-8 (#355)

YMuskrat006d812d2419
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a30baa36..9dede73c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -62,6 +62,9 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
+- Read JSON, JSONL and YAML evaluation datasets as UTF-8 so Unicode prompts and
+ answers load correctly on hosts with a non-UTF-8 default text encoding.
+
- A PII finding no longer keeps its `evidence_sha256` after CI redaction masks
a credential inside the value the finding reports. In 0.8.0 the finding kept
the digest of the unmasked value, so anyone holding the redacted report could
diff --git a/src/skillevaluator/tier3/dataset_utils.py b/src/skillevaluator/tier3/dataset_utils.py
index afed6ca4..201b07a9 100644
--- a/src/skillevaluator/tier3/dataset_utils.py
+++ b/src/skillevaluator/tier3/dataset_utils.py
@@ -152,7 +152,7 @@ def _normalize_entry(entry: dict[str, Any], *, skill_name: Any | None = None) ->
def _load_jsonl(path: Path) -> list[dict[str, Any]]:
entries: list[dict[str, Any]] = []
- with path.open() as f:
+ with path.open(encoding="utf-8") as f:
for line in f:
line = line.strip()
if line:
@@ -161,10 +161,10 @@ def _load_jsonl(path: Path) -> list[dict[str, Any]]:
def _load_yaml(path: Path) -> Any:
- with path.open() as f:
+ with path.open(encoding="utf-8") as f:
return yaml.safe_load(f)
def _load_json(path: Path) -> Any:
- with path.open() as f:
+ with path.open(encoding="utf-8") as f:
return json.load(f)
diff --git a/tests/tier3/test_dataset_utils.py b/tests/tier3/test_dataset_utils.py
new file mode 100644
index 00000000..a3d5edca
--- /dev/null
+++ b/tests/tier3/test_dataset_utils.py
@@ -0,0 +1,74 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Dataset text must preserve authored Unicode independently of the host locale."""
+
+from __future__ import annotations
+
+import json
+import os
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+import yaml
+
+from skillevaluator.tier3.dataset_utils import load_dataset_entries
+
+
[email protected]("suffix", [".json", ".jsonl", ".yaml", ".yml"])
+def test_load_utf8_dataset_under_non_utf8_locale(tmp_path: Path, suffix: str) -> None:
+ entry = {
+ "id": "unicode-001",
+ "question": "R\u00e9sumez ce document en fran\u00e7ais. \u65e5\u672c\u8a9e",
+ "ground_truth": "R\u00e9sum\u00e9 fid\u00e8le \u2014 \u2713",
+ "expected_behavior": ["Conserver le texte : \u00e9\u00e8\u00e0"],
+ }
+ dataset_path = tmp_path / f"evals{suffix}"
+ content = (
+ yaml.safe_dump([entry], allow_unicode=True)
+ if suffix in {".yaml", ".yml"}
+ else json.dumps(entry if suffix == ".jsonl" else [entry], ensure_ascii=False)
+ )
+ dataset_path.write_text(content + "\n", encoding="utf-8")
+ environment = {
+ **os.environ,
+ "LC_ALL": "C",
+ "LANG": "C",
+ "PYTHONUTF8": "0",
+ "PYTHONCOERCECLOCALE": "0",
+ "PYTHONPATH": str(Path(__file__).resolve().parents[2] / "src"),
+ }
+ script = """
+import json
+import locale
+import os
+import sys
+from pathlib import Path
+from skillevaluator.tier3.dataset_utils import load_dataset_entries
+
+if os.name == "posix":
+ assert locale.getencoding().lower() in {"ascii", "us-ascii", "ansi_x3.4-1968"}
+print(json.dumps(load_dataset_entries(Path(sys.argv[1])), ensure_ascii=True))
+"""
+ result = subprocess.run(
+ [sys.executable, "-c", script, str(dataset_path)],
+ env=environment,
+ capture_output=True,
+ text=True,
+ encoding="utf-8",
+ timeout=20,
+ check=False,
+ )
+ assert result.returncode == 0, result.stderr
+ assert json.loads(result.stdout) == [entry]
+
+
[email protected]("suffix", [".json", ".jsonl", ".yaml", ".yml"])
+def test_invalid_utf8_dataset_is_rejected(tmp_path: Path, suffix: str) -> None:
+ dataset_path = tmp_path / f"evals{suffix}"
+ dataset_path.write_bytes(b'[{"question": "\xff"}]')
+
+ with pytest.raises(UnicodeDecodeError):
+ load_dataset_entries(dataset_path)