deer-flow/backend/tests/test_skill_mutation_package_cost.py
Ryker_Feng d1d0958bea
feat(skills): add guarded evolution host APIs (#5645)
* feat(skills): add guarded evolution host APIs

* docs(agents): avoid growing saturated guidance chains

* fix(skills): address mutation host review findings

* fix(skills): order name fence before projection lock

* fix(skills): preserve composite toggle lock order

* fix(skills): address catalog and pagination review feedback

* docs: keep subagent guidance within merged instruction budget

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-10-18 21:17:02 +08:00

25 lines
1022 B
Python

"""Reproducible local capture measurements; not a model/provider benchmark."""
import statistics
import time
import pytest
from deerflow.skills.mutations.assets import capture_package
@pytest.mark.parametrize("files,size", [(4, 1024), (256, 65535)])
def test_capture_cost_at_typical_and_package_limit(tmp_path, files, size):
(tmp_path / "SKILL.md").write_text("---\nname: example\ndescription: Example\n---\nBody\n", encoding="utf-8")
for index in range(files - 1):
(tmp_path / f"resource-{index:03}.bin").write_bytes(b"x" * size)
timings, digests = [], set()
for _ in range(5):
start = time.perf_counter()
package = capture_package(tmp_path)
digests.add(package.digest)
timings.append((time.perf_counter() - start) * 1000)
assert len(digests) == 1
assert len(package.files) == files
print(f"capture+digest files={files} bytes={sum(len(item.content) for item in package.files)} median_ms={statistics.median(timings):.2f} max_ms={max(timings):.2f}")