deer-flow/backend/tests/test_skills_bundled.py
Roli Bosch 61ae228b0e
fix(skills): align Vercel deploy name and mounted script path (#5656)
* fix(skills): align Vercel deploy path

* test: align shard duration key with vercel-deploy rename

* docs: align demo transcript with vercel-deploy mount path

* test: keep duration baseline surgical after skill rename

* test(skills): align Vercel demo and strengthen path coverage

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-09-22 22:39:49 +08:00

55 lines
2.3 KiB
Python

"""Validate every bundled SKILL.md under skills/public/.
Catches regressions like #2443 — a SKILL.md whose YAML front-matter fails to
parse (e.g. an unquoted description containing a colon, which YAML interprets
as a nested mapping). Each bundled skill is checked individually so the
failure message identifies the exact file.
"""
from pathlib import Path
import pytest
from deerflow.skills.package_paths import is_eval_fixture_skill_md
from deerflow.skills.storage import get_or_new_skill_storage
from deerflow.skills.validation import _validate_skill_frontmatter
SKILLS_PUBLIC_DIR = Path(__file__).resolve().parents[2] / "skills" / "public"
BUNDLED_SKILL_DIRS = sorted(p.parent for p in SKILLS_PUBLIC_DIR.rglob("SKILL.md") if not is_eval_fixture_skill_md(p.relative_to(SKILLS_PUBLIC_DIR)))
@pytest.mark.parametrize(
"skill_dir",
BUNDLED_SKILL_DIRS,
ids=lambda p: str(p.relative_to(SKILLS_PUBLIC_DIR)),
)
def test_bundled_skill_frontmatter_is_valid(skill_dir: Path) -> None:
valid, msg, name = _validate_skill_frontmatter(skill_dir)
assert valid, f"{skill_dir.relative_to(SKILLS_PUBLIC_DIR)}: {msg}"
assert name, f"{skill_dir.relative_to(SKILLS_PUBLIC_DIR)}: no name extracted"
assert name == skill_dir.name, f"{skill_dir.relative_to(SKILLS_PUBLIC_DIR)}: frontmatter name {name!r} must match directory name {skill_dir.name!r}"
def test_skills_public_dir_has_skills() -> None:
assert BUNDLED_SKILL_DIRS, f"no SKILL.md found under {SKILLS_PUBLIC_DIR}"
def test_vercel_deploy_commands_use_the_mounted_script_path() -> None:
skills = get_or_new_skill_storage(skills_path=SKILLS_PUBLIC_DIR.parent).load_skills(enabled_only=False)
skill = next(skill for skill in skills if skill.name == "vercel-deploy")
mounted_script = f"{skill.get_container_path()}/scripts/deploy.sh"
content = skill.skill_file.read_text(encoding="utf-8")
assert content.count(mounted_script) == 4
assert content.count("deploy.sh") == content.count(mounted_script)
def test_runtime_registry_excludes_skill_reviewer_eval_fixtures() -> None:
skills = get_or_new_skill_storage(skills_path=SKILLS_PUBLIC_DIR.parent).load_skills(enabled_only=False)
names = {skill.name for skill in skills}
assert "skill-reviewer" in names
assert all("evals/fixtures" not in skill.skill_file.as_posix() for skill in skills)