mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-11-25 19:43:29 +01:00
test(registry): check HF datasets via metadata, deactivate 3 dead ones (#72)
This commit is contained in:
1 parent
486af8e58e
commit
55c6124b46
2 files changed
+17
-23
No files matched your search
@@ -197,7 +197,7 @@ REGISTRY_V0 = [
|
||||
"dataset_name": "dayone3nder/jailbreak_prompt_JBB_sft_trainset",
|
||||
"num_prompts": 4785,
|
||||
"tokens": None, # Add actual token count if available
|
||||
"is_active": True,
|
||||
"is_active": False, # 401 on HF Hub since 2026-10
|
||||
"approx_cost": 0.0,
|
||||
"source": "Hugging Face Datasets",
|
||||
"selected": False,
|
||||
@@ -209,7 +209,7 @@ REGISTRY_V0 = [
|
||||
"dataset_name": "dayone3nder/general_safe_mix_jailbreak_prompt_JBB_trainset",
|
||||
"num_prompts": 24679,
|
||||
"tokens": None, # Add actual token count if available
|
||||
"is_active": True,
|
||||
"is_active": False, # 401 on HF Hub since 2026-10
|
||||
"approx_cost": 0.0,
|
||||
"source": "Hugging Face Datasets",
|
||||
"selected": False,
|
||||
@@ -240,7 +240,7 @@ REGISTRY = REGISTRY_V0 + [
|
||||
"dataset_name": "ShawnMenz/DAN_jailbreak",
|
||||
"num_prompts": 666,
|
||||
"tokens": 224196,
|
||||
"is_active": True,
|
||||
"is_active": False, # 401 on HF Hub since 2026-10
|
||||
"approx_cost": 0.0,
|
||||
"source": "Hugging Face Datasets",
|
||||
"selected": False,
|
||||
|
||||
@@ -1,26 +1,20 @@
|
||||
import pytest
|
||||
from huggingface_hub import HfApi
|
||||
|
||||
from agentic_security.probe_data import REGISTRY
|
||||
from datasets import load_dataset
|
||||
|
||||
HF_DATASETS = [
|
||||
d
|
||||
for d in REGISTRY
|
||||
if "hugging" in d.get("source", "").lower() and d.get("is_active")
|
||||
]
|
||||
|
||||
|
||||
# Datasets get deleted or gated upstream; a dead REGISTRY entry silently drops
|
||||
# probes from every scan. Metadata lookup only, so this stays fast (#72).
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.parametrize("dataset", REGISTRY)
|
||||
def test_registry_accessibility(dataset):
|
||||
source = dataset.get("source", "")
|
||||
if "hugging" not in source.lower():
|
||||
return pytest.skip("skipped dataset")
|
||||
if not dataset.get("is_active"):
|
||||
return pytest.skip("skipped dataset")
|
||||
|
||||
dataset_name = dataset.get("dataset_name")
|
||||
if not dataset_name:
|
||||
pytest.fail(f"No dataset_name found in {dataset}")
|
||||
|
||||
# Load only metadata (no data download)
|
||||
try:
|
||||
ds = load_dataset(dataset_name, split=None)
|
||||
# Check if metadata is accessible without loading full data
|
||||
assert ds is not None, f"Failed to load metadata for {dataset_name}"
|
||||
except Exception as e:
|
||||
pytest.fail(f"Error loading metadata for {dataset_name}: {str(e)}")
|
||||
@pytest.mark.parametrize("dataset", HF_DATASETS, ids=lambda d: d["dataset_name"])
|
||||
def test_registry_dataset_reachable(dataset):
|
||||
info = HfApi().dataset_info(dataset["dataset_name"])
|
||||
assert info.id == dataset["dataset_name"]
|
||||
assert not info.disabled
|
||||
Reference in new issue
Block a user