Files
cleveragents-core/asv/benchmarks/tui_reference_fuzzy_bench.py
aditya d9e51d98f8 fix(tui,cli,tests): harden persona/input modes and stabilize parallel test execution
- Add shell safety controls for REPL/TUI (`looks_dangerous`, confirmation gate, timeout handling, and env-based shell disable guard).
- Secure persona workflows with strict name/path validation, safe import/export resolution, atomic+locked registry writes, and malformed YAML resilience.
- Unify persona models and wiring by reusing canonical TUI schema/registry, adding DI providers, and lazy-loading TUI exports to avoid circular imports.
- Improve reference discovery with ignored-directory filtering, symlink-safe walking, and TTL caching for CLI/TUI reference catalogs.
- Expand Behave/Robot coverage for safety/error paths and parallel-isolation behavior; add shared `features/mocks/fake_repl_input.py` helper.
- Fix parallel-run flakiness via deterministic cleanup/reload patterns and watchdog polling fallback when inotify limits are reached.

ISSUES CLOSED: #695
2026-03-18 10:09:06 +00:00

27 lines
803 B
Python

"""ASV benchmark for TUI fuzzy reference ranking."""
from __future__ import annotations
from typing import ClassVar
from cleveragents.tui.search.fuzzy import rank_candidates
class TuiReferenceFuzzyBench:
"""Bench weighted fuzzy ranking on a medium candidate set."""
params: ClassVar[list[list[object]]] = [
[1_000, 10_000],
["module_42/file_42", "zzzzzz-no-match-query"],
]
param_names: ClassVar[list[str]] = ["candidate_count", "query"]
def setup(self, candidate_count: int) -> None:
self.values = [
f"src/module_{idx}/file_{idx}.py" for idx in range(candidate_count)
]
def time_rank_candidates(self, candidate_count: int, query: str) -> None:
del candidate_count
rank_candidates(query, self.values, limit=20)