orchestrata_ultimate.agents.volks.qa._host
Reference › orchestrata_ultimate › agents › volks › qa › _host
_host declares _QaHost, a Protocol that lists the attributes and methods the QA mixins expect their host, QaVolk (volk), to provide: workspace, review cycle, created test files, alias, graph context and fix history, the mock-pattern list, _call_llm, and the virtualenv helpers (_venv_env, _get_venv_python, _get_import_hint, _ensure_init_files, _rewrite_relative_imports). It has no internal imports; the mixin modules _autofix, _context, _dep_install and _testgen use it to type their self.
At a glance
| Source | src/orchestrata_ultimate/agents/volks/qa/_host.py |
| Lines of code | 54 |
| Classes | 1 |
| Functions | 0 |
| Imports (internal) | none |
| Imported by | orchestrata_ultimate.agents.volks.qa._autofix, orchestrata_ultimate.agents.volks.qa._context, orchestrata_ultimate.agents.volks.qa._dep_install, orchestrata_ultimate.agents.volks.qa._testgen |
| Tests that import it | none |
Class diagram
Dependency diagram
API
Classes
_QaHost (protocol)
Bases: Protocol · Line 28
Attributes/methods the QA mixins expect their host (QaVolk) to provide.
| Attribute | Type | Default |
|---|---|---|
workspace |
str |
|
review_cycle |
int |
|
test_files_created |
list[str] |
|
alias |
str |
|
_graph_context |
str | None |
|
_fix_history |
list[dict] |
|
_MOCK_PATTERNS |
list[tuple[str, str]] |
| Method | Signature | Summary |
|---|---|---|
_call_llm |
async _call_llm(system_prompt: str, user_message: str, ****kwargs: Any) -> str |
|
_venv_env |
_venv_env() -> dict[str, str] |
|
_get_venv_python |
_get_venv_python() -> str |
|
_get_import_hint |
_get_import_hint(venv_python: str, err_msg: str) -> str |
|
_ensure_init_files |
_ensure_init_files() -> None |
|
_rewrite_relative_imports |
_rewrite_relative_imports() -> None |
Source
"""Typing-only host contract for the U:Qa mixin classes.
``QaVolk`` (``volk.py``) composes several mixins (``AutofixMixin``,
``DepInstallMixin``, ``TestGenMixin``, ``FailureContextMixin``) that each
call attributes/methods defined by a *different* mixin, or by the host
class itself (pydantic ``Field``s on ``QaVolk``, dynamic runtime
attributes, or ``BaseAgent`` methods). Pyright type-checks each mixin
against its own bare ``self`` type, so it cannot see across the
composition and flags every such access as ``reportAttributeAccessIssue``.
``_QaHost`` is a package-local Protocol capturing the full surface each
mixin reaches for on ``self``. Per architecture-standards.md's Protocols
placement policy, this stays package-local (no cross-package consumer) —
it is NOT promoted to ``core/protocols``.
Mixins inherit from it ONLY under ``TYPE_CHECKING`` (the standard
"mixin self-type" trick: ``_MixinBase = _QaHost if TYPE_CHECKING else
object``) so pyright resolves every ``self.<attr>``/``self.<method>()``
access while the runtime MRO is unchanged — mixins still inherit from
plain ``object`` at runtime, exactly as before this fix.
"""
from __future__ import annotations
from typing import Any, Protocol
class _QaHost(Protocol):
"""Attributes/methods the QA mixins expect their host (QaVolk) to provide."""
# -- pydantic Fields declared on QaVolk (volk.py) --
workspace: str
review_cycle: int
test_files_created: list[str]
alias: str
# -- dynamic attributes QaVolk sets at runtime (not pydantic Fields) --
_graph_context: str | None
_fix_history: list[dict]
_MOCK_PATTERNS: list[tuple[str, str]]
# -- BaseAgent method (agents/volks/base.py) --
async def _call_llm(
self, system_prompt: str, user_message: str, **kwargs: Any
) -> str: ...
# -- DepInstallMixin methods (_dep_install.py), used by the other mixins --
def _venv_env(self) -> dict[str, str]: ...
def _get_venv_python(self) -> str: ...
def _get_import_hint(self, venv_python: str, err_msg: str) -> str: ...
# -- TestGenMixin methods (_testgen.py), used by DepInstallMixin --
def _ensure_init_files(self) -> None: ...
def _rewrite_relative_imports(self) -> None: ...