Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(scenarios): resolve Python citations against pytest's collection, and name each row's ID in its evidence (#2766)

Call White77f7abf54e88
diff --git a/scripts/ci_unit_test_timings.json b/scripts/ci_unit_test_timings.json
index d65bf3216..823057e80 100644
--- a/scripts/ci_unit_test_timings.json
+++ b/scripts/ci_unit_test_timings.json
@@ -1,5 +1,5 @@
{
- "source": "Median per-file launcher elapsed seconds from successful GitHub Actions runs 38350418272 (f73106bd1e0e23bdbd6f85c7df5d382738b0a9e2), 38355727304 (9efb8b95c8e651bc0bb00cba9b5d581687ffdd34); single available sample for new files",
+ "source": "Median per-file launcher elapsed seconds from successful GitHub Actions runs 38350418272 (f73106bd1e0e23bdbd6f85c7df5d382738b0a9e2), 38355727304 (9efb8b95c8e651bc0bb00cba9b5d581687ffdd34); single available sample for new files; tests/scenarios/test_catalog_citations.py from run 38941449093 (ce270754a3e3bb3c7660bf50cfc435b94179ab1c)",
"durations_seconds": {
"tests/agent_core/agent/test_compaction.py": 15.5,
"tests/agent_core/agent/test_context.py": 7.5,
@@ -38,6 +38,7 @@
"tests/scenarios/permissions/test_effective_target_preflight.py": 43.5,
"tests/scenarios/permissions/test_member_instance_operations.py": 12.5,
"tests/scenarios/permissions/test_permissions_scenarios.py": 5.0,
+ "tests/scenarios/test_catalog_citations.py": 57.0,
"tests/test_admin_notifications.py": 2.0,
"tests/test_agent_activity_service.py": 8.0,
"tests/test_agent_auth_service.py": 4.5,
diff --git a/standards/scenario-testing/STANDARD.md b/standards/scenario-testing/STANDARD.md
index 8ee15ded7..8b43df465 100644
--- a/standards/scenario-testing/STANDARD.md
+++ b/standards/scenario-testing/STANDARD.md
@@ -197,8 +197,16 @@ rewrite unnoticed for five days. A pointer key such as `related_tests` may name
bare files precisely because it claims no coverage; anything that does claim
coverage names its case. A pointer that does name a case must still name one
that exists, or a rename leaves it leading nowhere. A pointer may also name a
-group: a test class, or, for a vitest file, every case whose name contains the
-term it names, such as an ID.
+group: every case whose name contains the term it names, such as a test class
+or, for a vitest file, an ID; or, for a pytest file, a scenario ID, which names
+every case whose docstring carries it.
+
+A citation resolves against the suite's own collection of the cited file —
+pytest's for Python, vitest's for UI — so a case the runner would not collect,
+such as one in a suppressed or deselected class, is not evidence. A pytest
+evidence case must also name the citing row's ID in its docstring; a case that
+proves several rows names each of them. Then a case written for something else
+cannot be attached to a row unnoticed.
## 5. Harness Design Rules
diff --git a/tests/e2e/test_codex_runtime_generations_contract.py b/tests/e2e/test_codex_runtime_generations_contract.py
index f30843c8f..6a7e18d8b 100644
--- a/tests/e2e/test_codex_runtime_generations_contract.py
+++ b/tests/e2e/test_codex_runtime_generations_contract.py
@@ -88,6 +88,8 @@ def codex_home_runtime(tmp_path, rejected_external_proxy):
async def test_runtime_gen_019_a_thread_moves_between_app_servers_only_after_release(codex_home_runtime):
+ """RUNTIME-GEN-019: The real Codex CLI moves a thread between two app-servers in one directory only after release, without touching its rollout."""
+
binary, runtime, cwd = codex_home_runtime
old = _Server(binary, runtime, cwd)
new = _Server(binary, runtime, cwd)
diff --git a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
index 852947cd0..c7664db81 100644
--- a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
+++ b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
@@ -250,7 +250,7 @@ def test_setup_completion_uses_the_same_authorized_config_flow(monkeypatch, tmp_
def test_authorized_config_envelope_and_completion_persistence_closed_loop(monkeypatch, tmp_path):
- """Scenario: AUTH-SETUP-122 — the authorized `/api/config` envelope, and completion
+ """AUTH-SETUP-123: Scenario: AUTH-SETUP-122 — the authorized `/api/config` envelope, and completion
persistence that reads back.
This is the producer half of setup's config prerequisite. Unauthenticated remote
@@ -3594,6 +3594,8 @@ class CodexRelayRoundTripScenarioTests(unittest.IsolatedAsyncioTestCase):
_expected_provider_id = "OpenAI"
async def test_codex_oauth_api_key_relay_round_trip_scenario(self) -> None:
+ """AUTH-SETUP-110: Codex OAuth round trip keeps the relay base URL through settings save and relaunch config."""
+
runner = ScenarioRunner(self.harness)
api = self._api_module()
await self._run_round_trip(runner, api)
diff --git a/tests/scenarios/test_catalog_citations.py b/tests/scenarios/test_catalog_citations.py
index 6f5100efe..182f70313 100644
--- a/tests/scenarios/test_catalog_citations.py
+++ b/tests/scenarios/test_catalog_citations.py
@@ -1,4 +1,4 @@
-"""Every case a scenario catalog cites still exists, in every catalog and every key.
+"""Every case a scenario catalog cites is one pytest collects, and names the row citing it.
A row's citations are how a reader gets from a scenario to the code that runs
it: ``test`` and ``partial_evidence`` name the evidence, and the pointer keys
@@ -8,34 +8,43 @@ or deleted tests left nine rows across two catalogs reading ``covered`` while
the case they cited no longer existed. Every catalog's legend defines
``covered`` as automated coverage that exists, so a ``covered`` row must cite it.
-A pytest citation resolves when its file holds a case pytest collects:
-``file::Class::method``, or ``file::name`` naming a module-level test, a test
-class, or a test method of a class in that file, which is how several catalogs
-cite unittest cases. A helper or a plain class is no case. A parametrized id
-resolves through its function. An evidence key names exactly one case per
-entry (STANDARD.md §4): a bare file or a test class stays collected for
-whatever else cites it, so it evidences no row in particular, and a row whose
-contract several cases prove lists each of them under ``test``;
-``partial_evidence.test`` names one. A cited Python file must be one pytest's
-default discovery collects (``test_*.py`` or ``*_test.py``), and an evidence
-case must not be skipped unconditionally on itself, its class or its module.
-Pointer keys may name a bare file, a test class, a function or a method, which
-must exist.
-
-This reads source and applies pytest's default naming rules; it does not
-emulate every collection-time exclusion, such as ``__test__ = False``, a class
-with ``__init__``, or deselection in a hook; it matches exact names only; and it
-leaves conditional skips (``skipif``) to the environment. Resolving against
-pytest's own collection, and execution status against CI's results, is #2565.
-
-UI (vitest) citations are resolved against vitest's own collection by
-``ui/scripts/validate-scenario-catalog.mjs``; here only their file is checked.
+Python citations resolve against pytest's own collection of the cited files,
+as UI citations resolve against vitest's
+(``ui/scripts/validate-scenario-catalog.mjs``; here only their file is
+checked). A source read approximated collection and missed what pytest
+decides: a ``Test*`` class with ``__init__`` or ``__test__ = False``, a
+deselecting hook, a test defined in a branch not taken.
+
+- An evidence key (``test``, ``partial_evidence.test``) names exactly one
+ collected case (STANDARD.md §4): ``file::Class::method``, ``file::name`` for a
+ module-level test or the one method of that name, or either with a
+ parametrized id. A parametrized function is one case. A bare file or a test
+ class stays collected for whatever else cites it, so it evidences no row in
+ particular; a row whose contract several cases prove lists each of them
+ under ``test``, and ``partial_evidence.test`` names one. The case must not be
+ skipped unconditionally (``pytest.mark.skip`` on it, its class or its module,
+ or ``unittest.skip``), and its docstring must name the citing row's ID, so the
+ evidence is greppable by ID and an unrelated test cannot quietly stand in for
+ a row (AGENTS.md §7).
+- A pointer key leads to at least one collected case: a bare file with any, or
+ a name contained in a case's node id -- a class, a function, a method -- or a
+ scenario ID that a case's docstring names, which is the group of cases
+ carrying that row.
+
+A cited Python file must be one pytest's default discovery collects
+(``test_*.py`` or ``*_test.py``). Conditional skips (``skipif``) depend on the
+environment, and whether a case actually ran belongs to CI's results (#2565).
"""
from __future__ import annotations
-import ast
+import json
+import os
import re
+import subprocess
+import sys
+import tempfile
+from dataclasses import dataclass
from functools import cache
from pathlib import Path
@@ -48,109 +57,72 @@ _UI_SUFFIXES = {".ts", ".tsx", ".mts", ".mjs"}
_POINTER_KEYS = ("related_tests", "supporting_tests")
# pytest's default ``python_files``, which this repository does not override.
_DISCOVERED = re.compile(r"(test_.*|.*_test)\.py")
+# One collection of every cited file runs in about 20 s; the bound only stops a hang.
+_COLLECTION_TIMEOUT_SECONDS = 240
-@cache
-def _collectable_cases(path: Path) -> tuple[frozenset[str], dict[str, frozenset[str]]]:
- """The test functions pytest collects from ``path``, and each test class's test methods.
+@dataclass(frozen=True)
+class _Case:
+ """One collected item: its path within the file, its parametrized id, and what it declares."""
- pytest's default naming rules, which this repository does not change: a
- module-level ``test*`` function, and a ``test*`` method of a ``Test*`` class or
- of a ``unittest.TestCase`` subclass, directly or through another class in the
- file. Collection-time exclusions are out of its reach (#2565).
- """
+ path: tuple[str, ...]
+ param: str
+ doc: str
+ skipped: bool
- tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
- classes = {node.name: node for node in tree.body if isinstance(node, ast.ClassDef)}
- def base_names(node: ast.ClassDef) -> list[str]:
- return [base.attr if isinstance(base, ast.Attribute) else getattr(base, "id", "") for base in node.bases]
+class _Recorder:
+ """A pytest plugin that writes what a collection-only run collected, as JSON."""
- def is_test_case(name: str, seen: frozenset[str] = frozenset()) -> bool:
- node = classes.get(name)
- if node is None or name in seen:
- return False
- return any(
- base.endswith("TestCase") or is_test_case(base, seen | {name}) for base in base_names(node)
- )
+ def __init__(self, out: str) -> None:
+ self.out = out
- def test_names(body: list[ast.stmt]) -> frozenset[str]:
- return frozenset(
- node.name
- for node in body
- if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name.startswith("test")
- )
+ def pytest_collection_finish(self, session: pytest.Session) -> None:
+ cases = []
+ for item in session.items:
+ function = getattr(item, "function", None)
+ cases.append(
+ {
+ "nodeid": item.nodeid,
+ "doc": (function.__doc__ if function is not None else None) or "",
+ "skipped": _declares_skip(item),
+ }
+ )
+ Path(self.out).write_text(json.dumps(cases), encoding="utf-8")
- test_classes = {
- name: test_names(node.body)
- for name, node in classes.items()
- if name.startswith("Test") or is_test_case(name)
- }
- return test_names(tree.body), test_classes
+def _declares_skip(item: pytest.Item) -> bool:
+ """Whether the case, its class, its module or its parameter set declares a skip.
-def _is_unconditional_skip(marker: ast.expr) -> bool:
- """``pytest.mark.skip`` or ``unittest.skip``, bare or called; ``skipif`` is a condition and passes."""
+ Only a declared ``skip``: one a hook adds while collecting, such as the
+ e2e suites' opt-in, depends on the run's options as ``skipif`` depends on
+ the environment.
+ """
- target = marker.func if isinstance(marker, ast.Call) else marker
- return (target.attr if isinstance(target, ast.Attribute) else getattr(target, "id", "")) == "skip"
+ function, owner, module = (getattr(item, name, None) for name in ("function", "cls", "module"))
+ marks = list(getattr(getattr(item, "callspec", None), "marks", None) or [])
+ for target in (function, owner, module):
+ declared = getattr(target, "pytestmark", None) or []
+ marks.extend(declared if isinstance(declared, (list, tuple)) else [declared])
+ return any(getattr(mark, "name", None) == "skip" for mark in marks) or any(
+ getattr(target, "__unittest_skip__", False) for target in (function, owner)
+ )
-@cache
-def _unconditionally_skipped(path: Path) -> tuple[bool, frozenset[str]]:
- """Whether the module's ``pytestmark`` skips it, and the functions and classes a skip decorates."""
-
- tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
- module = False
- for node in tree.body:
- if isinstance(node, ast.Assign) and any(getattr(target, "id", "") == "pytestmark" for target in node.targets):
- marks = node.value.elts if isinstance(node.value, (ast.List, ast.Tuple)) else [node.value]
- module = module or any(_is_unconditional_skip(mark) for mark in marks)
- decorated = {
- f"{owner.name}::{node.name}" if owner is not None else node.name
- for owner, node in (
- [(None, node) for node in tree.body]
- + [(cls, node) for cls in tree.body if isinstance(cls, ast.ClassDef) for node in cls.body]
- )
- if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))
- and any(_is_unconditional_skip(decorator) for decorator in node.decorator_list)
- }
- return module, frozenset(decorated)
+def _collect(out: str, files: list[str]) -> int:
+ """Collect ``files`` as CI does, without running them, and record each case in ``out``."""
+ return int(pytest.main(["--collect-only", "-q", "-p", "no:cacheprovider", "-o", "addopts=", *files], plugins=[_Recorder(out)]))
-def _never_runs(path: Path, name: str) -> bool:
- """Whether an unconditional skip on the module, the case's class or the case itself disables it.
- A short ``name`` is a method of the one class holding it, which the caller has
- already established. Conditional skips (``skipif``) are platform scoping and
- depend on the environment; deciding them belongs to CI's results (#2565).
- """
+def _catalogs() -> list[Path]:
+ catalogs = sorted(SCENARIO_ROOT.glob("*/catalog.yaml"))
+ assert catalogs, f"no scenario catalogs under {SCENARIO_ROOT}"
+ return catalogs
+
- module, decorated = _unconditionally_skipped(path)
- if module:
- return True
- parts = name.partition("[")[0].split("::")
- if len(parts) == 2:
- return parts[0] in decorated or "::".join(parts) in decorated
- (case,) = parts
- if case in decorated:
- return True
- _, classes = _collectable_cases(path)
- owner = next((cls for cls, methods in classes.items() if case in methods), None)
- return owner is not None and (owner in decorated or f"{owner}::{case}" in decorated)
-
-
-def _named_cases(path: Path, name: str) -> tuple[int, bool]:
- """How many collected cases ``name`` names in ``path``, and whether it names a test class."""
-
- functions, classes = _collectable_cases(path)
- parts = name.partition("[")[0].split("::")
- if len(parts) == 2:
- return int(parts[1] in classes.get(parts[0], frozenset())), False
- if len(parts) != 1:
- return 0, False
- (case,) = parts
- return int(case in functions) + sum(case in methods for methods in classes.values()), case in classes
+def _rows(catalog: Path) -> list[dict]:
+ return yaml.safe_load(catalog.read_text(encoding="utf-8")).get("scenarios") or []
def _citations(row: dict) -> tuple[list[tuple[str, object]], list[str]]:
@@ -189,17 +161,116 @@ def _citations(row: dict) -> tuple[list[tuple[str, object]], list[str]]:
return cited, malformed
-def _catalogs() -> list[Path]:
- catalogs = sorted(SCENARIO_ROOT.glob("*/catalog.yaml"))
- assert catalogs, f"no scenario catalogs under {SCENARIO_ROOT}"
- return catalogs
+def _collect_cases(files: list[str], cwd: Path) -> dict[str, list[_Case]]:
+ """Every case pytest collects from ``files``, relative to ``cwd``, by file.
+
+ One collection-only run in a child process, with the conftest files that
+ apply there: a nested ``pytest.main`` would share this session's modules and
+ plugins.
+ """
+
+ with tempfile.TemporaryDirectory() as directory:
+ out = Path(directory) / "collected.json"
+ result = subprocess.run(
+ [
+ sys.executable,
+ "-c",
+ "import sys\nfrom tests.scenarios.test_catalog_citations import _collect\n"
+ "sys.exit(_collect(sys.argv[1], sys.argv[2:]))",
+ str(out),
+ *files,
+ ],
+ cwd=cwd,
+ # Without the caller's PYTEST_ADDOPTS, whose selection would drop cited cases.
+ env={
+ **{name: value for name, value in os.environ.items() if name != "PYTEST_ADDOPTS"},
+ "PYTHONPATH": os.pathsep.join(filter(None, [str(REPO_ROOT), os.environ.get("PYTHONPATH")])),
+ },
+ capture_output=True,
+ text=True,
+ timeout=_COLLECTION_TIMEOUT_SECONDS,
+ )
+ assert result.returncode == 0 and out.is_file(), (
+ f"pytest could not collect the cited files (exit {result.returncode}):\n{result.stdout[-4000:]}{result.stderr[-4000:]}"
+ )
+ recorded = json.loads(out.read_text(encoding="utf-8"))
+ cases: dict[str, list[_Case]] = {file: [] for file in files}
+ for entry in recorded:
+ file, _, rest = entry["nodeid"].partition("::")
+ base, bracket, param = rest.partition("[")
+ cases.setdefault(file, []).append(
+ _Case(tuple(base.split("::")), bracket + param, entry["doc"], entry["skipped"])
+ )
+ return cases
+
+
+@cache
+def _collected() -> dict[str, list[_Case]]:
+ """Every case pytest collects from the Python files any catalog cites, by file."""
+
+ files = {
+ reference.partition("::")[0]
+ for catalog in _catalogs()
+ for row in _rows(catalog)
+ for _key, reference in _citations(row)[0]
+ if isinstance(reference, str)
+ }
+ return _collect_cases(
+ sorted(
+ file
+ for file in files
+ if file.endswith(".py") and _DISCOVERED.fullmatch(Path(file).name) and (REPO_ROOT / file).is_file()
+ ),
+ REPO_ROOT,
+ )
+
+
+def _names_id(doc: str, scenario_id: str) -> bool:
+ return re.search(rf"(?<![\w-]){re.escape(scenario_id)}(?![\w-])", doc) is not None
+
+
+def _evidence_problem(cases: list[_Case], name: str, row_id: str) -> str | None:
+ """Why ``name`` is not the one runnable case that evidences row ``row_id``; None when it is."""
+
+ base, bracket, param = name.partition("[")
+ parts = tuple(base.split("::"))
+ matches = [
+ case
+ for case in cases
+ if (case.path == parts or (len(parts) == 1 and case.path[-1] == parts[0]))
+ and (not bracket or case.param == bracket + param)
+ ]
+ named = {case.path for case in matches}
+ if not named:
+ if len(parts) == 1 and any(len(case.path) > 1 and parts[0] in case.path[:-1] for case in cases):
+ return "names a test class, not one case; cite each case that proves the row"
+ return "names no case pytest collects in the file"
+ if len(named) != 1:
+ return f"names {len(named)} cases, expected exactly one; cite it as Class::method"
+ if all(case.skipped for case in matches):
+ return "is skipped unconditionally, so it never runs"
+ if not _names_id(matches[0].doc, row_id):
+ return f"does not name {row_id} in its docstring; state the row's ID there so the evidence is greppable by it"
+ return None
+
+
+def _pointer_leads_somewhere(cases: list[_Case], name: str, scenario_ids: frozenset[str]) -> bool:
+ if not name:
+ return bool(cases)
+ return any(name in "::".join(case.path) + case.param for case in cases) or (
+ name in scenario_ids and any(_names_id(case.doc, name) for case in cases)
+ )
+
+
+@cache
+def _scenario_ids() -> frozenset[str]:
+ return frozenset(row["id"] for catalog in _catalogs() for row in _rows(catalog) if isinstance(row.get("id"), str))
@pytest.mark.parametrize("catalog", _catalogs(), ids=lambda path: path.parent.name)
def test_every_catalog_citation_resolves_to_a_case(catalog: Path) -> None:
- rows = yaml.safe_load(catalog.read_text(encoding="utf-8")).get("scenarios") or []
dead: list[str] = []
- for row in rows:
+ for row in _rows(catalog):
cited, malformed = _citations(row)
dead.extend(f"{row['id']} {problem}" for problem in malformed)
for key, reference in cited:
@@ -216,20 +287,89 @@ def test_every_catalog_citation_resolves_to_a_case(catalog: Path) -> None:
if not path.is_file():
dead.append(f"{where} (no such file)")
continue
+ if path.suffix in _UI_SUFFIXES:
+ continue
if path.suffix == ".py" and not _DISCOVERED.fullmatch(path.name):
dead.append(f"{where} (pytest's default discovery never collects {path.name})")
continue
- if not separator or path.suffix in _UI_SUFFIXES:
- continue
- count, names_class = _named_cases(path, name)
+ cases = _collected().get(path_text, [])
if pointer:
# A pointer claims no evidence, so a class or a group of cases is a fine destination.
- if not count and not names_class:
- dead.append(f"{where} (no such case in the file)")
- elif names_class:
- dead.append(f"{where} (names a test class, not one case; cite each case that proves the row)")
- elif count != 1:
- dead.append(f"{where} (names {count} cases, expected exactly one; cite it as Class::method)")
- elif _never_runs(path, name):
- dead.append(f"{where} (is skipped unconditionally, so it never runs)")
- assert not dead, f"{catalog.relative_to(REPO_ROOT)} has citations that resolve to no case:\n" + "\n".join(dead)
+ if not _pointer_leads_somewhere(cases, name if separator else "", _scenario_ids()):
+ dead.append(f"{where} (leads to no case pytest collects)")
+ continue
+ problem = _evidence_problem(cases, name, row["id"])
+ if problem:
+ dead.append(f"{where} ({problem})")
+ assert not dead, f"{catalog.relative_to(REPO_ROOT)} has citations that resolve to no case of theirs:\n" + "\n".join(dead)
+
+
+# Cases a source read takes for collected, and pytest does not run (#2565).
+_SHAPES = '''
+import pytest
+
+
+class TestSuppressed:
+ __test__ = False
+
+ def test_hidden(self):
+ """ROW-1"""
+
+
+class TestWithInit:
+ def __init__(self):
+ pass
+
+ def test_also_hidden(self):
+ """ROW-1"""
+
+
[email protected](reason="never")
+class TestSkipped:
+ def test_never_runs(self):
+ """ROW-1"""
+
+
+def test_deselected():
+ """ROW-1"""
+
+
[email protected]("value", [1, 2])
+def test_carries_the_row(value):
+ """ROW-1: a case named for the row that cites it."""
+
+
+def test_carries_another_row():
+ """ROW-2"""
+'''
+
+_DESELECTING_CONFTEST = '''
+def pytest_collection_modifyitems(config, items):
+ deselected = [item for item in items if item.name == "test_deselected"]
+ config.hook.pytest_deselected(items=deselected)
+ items[:] = [item for item in items if item not in deselected]
+'''
+
+
+def test_a_citation_resolves_only_to_a_case_pytest_collects_and_runs(tmp_path: Path) -> None:
+ (tmp_path / "pytest.ini").write_text("[pytest]\n", encoding="utf-8")
+ (tmp_path / "conftest.py").write_text(_DESELECTING_CONFTEST, encoding="utf-8")
+ (tmp_path / "test_shapes.py").write_text(_SHAPES, encoding="utf-8")
+
+ cases = _collect_cases(["test_shapes.py"], tmp_path)["test_shapes.py"]
+
+ def problem(name: str, row_id: str = "ROW-1") -> str | None:
+ return _evidence_problem(cases, name, row_id)
+
+ for hidden in ("TestSuppressed::test_hidden", "test_also_hidden", "test_deselected"):
+ assert problem(hidden) == "names no case pytest collects in the file", hidden
+ assert problem("TestSkipped::test_never_runs") == "is skipped unconditionally, so it never runs"
+ assert problem("test_carries_the_row") is None
+ assert problem("test_carries_the_row[2]") is None
+ assert problem("test_carries_another_row") == (
+ "does not name ROW-1 in its docstring; state the row's ID there so the evidence is greppable by it"
+ )
+ # A pointer may name the group of cases that carry a row.
+ ids = frozenset({"ROW-1", "ROW-2", "ROW-3"})
+ assert _pointer_leads_somewhere(cases, "ROW-1", ids)
+ assert not _pointer_leads_somewhere(cases, "ROW-3", ids)
diff --git a/tests/test_agent_run_target.py b/tests/test_agent_run_target.py
index 61e577703..77754d146 100644
--- a/tests/test_agent_run_target.py
+++ b/tests/test_agent_run_target.py
@@ -271,6 +271,8 @@ def test_im_channel_scope_workdir_creates_session_snapshot(tmp_path):
def test_telegram_topic_scope_workdir_wins_over_group(tmp_path):
# Scenario: TELEGRAM-TOPIC-003
+ """TELEGRAM-TOPIC-003: Agent workdir and routing resolve from the topic scope before the group scope."""
+
controller = _controller(tmp_path)
group_workdir = tmp_path / "group"
topic_workdir = tmp_path / "topic"
diff --git a/tests/test_auth_pipeline.py b/tests/test_auth_pipeline.py
index 7d45f29dd..c41378cc5 100644
--- a/tests/test_auth_pipeline.py
+++ b/tests/test_auth_pipeline.py
@@ -182,6 +182,8 @@ def test_require_bind_off_allows_any_channel_member():
def test_telegram_thread_auth_uses_topic_override_before_parent():
# Scenario: TELEGRAM-TOPIC-002
+ """TELEGRAM-TOPIC-002: An unconfigured topic inherits its parent group while a configured topic wins."""
+
store = _Store()
parent = SimpleNamespace(enabled=True, require_bind=False)
topic = SimpleNamespace(enabled=True, require_bind=True)
diff --git a/tests/test_backend_failure.py b/tests/test_backend_failure.py
index 981054501..f8de4a915 100644
--- a/tests/test_backend_failure.py
+++ b/tests/test_backend_failure.py
@@ -242,7 +242,7 @@ class BackendFailureTests(unittest.IsolatedAsyncioTestCase):
async def test_hfr_454_delivery_only_ack_uses_the_routed_target_platform(
self,
) -> None:
- """Transport-only ids are evidence according to where the notify was sent."""
+ """HFR-454: Transport-only ids are evidence according to where the notify was sent."""
for source, target, expected in (
("avibe", "slack", True),
diff --git a/tests/test_claude_agent_initiated_turn.py b/tests/test_claude_agent_initiated_turn.py
index 677e8cca4..1000188a1 100644
--- a/tests/test_claude_agent_initiated_turn.py
+++ b/tests/test_claude_agent_initiated_turn.py
@@ -4596,6 +4596,8 @@ class ActivityRunAttributionTests(unittest.IsolatedAsyncioTestCase):
)
async def test_scheduled_turn_attributes_its_activity_to_its_run(self):
+ """HFR-044: a Harness turn attributes its background Activity to that turn's Run."""
+
agent, _service = _build_agent()
composite_key = "session-scheduled-activity:/tmp/work"
agent._pending_requests[composite_key] = [
diff --git a/tests/test_cloudflare_network.py b/tests/test_cloudflare_network.py
index 5742a9f23..6e0715ea8 100644
--- a/tests/test_cloudflare_network.py
+++ b/tests/test_cloudflare_network.py
@@ -62,6 +62,8 @@ def test_ra_tq_026_route_assessment_is_conservative() -> None:
def test_ra_tq_025_network_path_combines_nodes_ips_and_location(monkeypatch) -> None:
+ """RA-TQ-025: Local status exposes bounded live Cloudflare network-path diagnostics without uploading them."""
+
monkeypatch.setattr(cloudflare_network, "location_catalog", lambda: (_catalog(), False))
monkeypatch.setattr(
cloudflare_network,
diff --git a/tests/test_command_handler_user_names.py b/tests/test_command_handler_user_names.py
index 74b236050..b8679ca0e 100644
--- a/tests/test_command_handler_user_names.py
+++ b/tests/test_command_handler_user_names.py
@@ -692,6 +692,11 @@ class NewCommandStorageIntegrationTests(unittest.IsolatedAsyncioTestCase):
"""
async def test_new_keeps_a_superseded_session_and_its_definitions_but_clears_the_live_one(self):
+ """HFR-242: /new end to end keeps a superseded session and its bound definitions.
+
+ HFR-274: the live session map must keep what the teardown SQL deliberately kept.
+ """
+
from sqlalchemy import select as sa_select
from config.v2_sessions import SessionsStore
diff --git a/tests/test_controller_dispatch_loop.py b/tests/test_controller_dispatch_loop.py
index 7976b21a4..61ea8da35 100644
--- a/tests/test_controller_dispatch_loop.py
+++ b/tests/test_controller_dispatch_loop.py
@@ -369,6 +369,8 @@ async def test_runtime_work_stack_stops_supervisor_after_service_failure() -> No
@pytest.mark.anyio
async def test_hfr_284_runtime_work_stack_joins_controller_lanes_before_service_teardown() -> None:
+ """HFR-284: controller delivery recovery joins before final Turn owner release."""
+
controller = Controller.__new__(Controller)
controller._shutdown_tainted = False
controller._runtime_work_tokens = [object()]
@@ -525,6 +527,8 @@ async def test_runtime_work_stack_does_not_drain_after_task_service_failure() ->
def test_request_shutdown_keeps_loop_owned_supervisor_join_alive_after_grace() -> None:
+ """HFR-178: loop-owned shutdown retains supervisor join past outer grace."""
+
controller = Controller.__new__(Controller)
loop = asyncio.new_event_loop()
controller._loop = loop
diff --git a/tests/test_core_services_dispatch.py b/tests/test_core_services_dispatch.py
index 7536f49dc..16b477d0f 100644
--- a/tests/test_core_services_dispatch.py
+++ b/tests/test_core_services_dispatch.py
@@ -363,7 +363,7 @@ def test_outcome_reports_refused_concurrent_turn():
def test_busy_sibling_thread_does_not_refuse_this_threads_turn():
- """A turn in flight on ANOTHER thread of the same channel must not block this one.
+ """TELEGRAM-TOPIC-005: A turn in flight on ANOTHER thread of the same channel must not block this one.
The field bug: ``dispatch_turn_with_outcome`` keyed its concurrency slot off the
channel-scoped ``_get_session_key``, because
diff --git a/tests/test_delivery_ack_reaction.py b/tests/test_delivery_ack_reaction.py
index 327425f62..91f7d0e41 100644
--- a/tests/test_delivery_ack_reaction.py
+++ b/tests/test_delivery_ack_reaction.py
@@ -205,6 +205,8 @@ class AdmissionAckTests(unittest.IsolatedAsyncioTestCase):
# MESSAGE-DELIVERY-302: the promoted Delivery is re-dispatched with its
# original native message id, so the receipt and the running indicator
# target the same message and must not coexist.
+ """MESSAGE-DELIVERY-302: A queued admission receipt is replaced by the running turn indicator."""
+
im = _FakeIM()
svc = _svc(im)
context = _ctx()
@@ -231,6 +233,8 @@ class AdmissionAckTests(unittest.IsolatedAsyncioTestCase):
# replies) merge into one Turn, but only the first hydrates the dispatch
# context. The rest are accepted as part of that Turn and never
# dispatched, so nothing else would ever take their receipt down.
+ """MESSAGE-DELIVERY-309: One Turn clears the receipt of every Delivery merged into it."""
+
im = _FakeIM()
svc = _svc(im)
first = _ctx(message_id=None)
@@ -287,6 +291,8 @@ class AdmissionAckTests(unittest.IsolatedAsyncioTestCase):
# Both halves await a platform call. Without serialization the add
# records its emoji after start() has looked for one, stranding 👌 next to
# the running indicator.
+ """MESSAGE-DELIVERY-304: A receipt racing the turn start is cleared exactly once."""
+
im = _GatedIM()
svc = _svc(im)
context = _ctx()
diff --git a/tests/test_harness_failure_visibility.py b/tests/test_harness_failure_visibility.py
index ef6fb8b82..2ad28efe0 100644
--- a/tests/test_harness_failure_visibility.py
+++ b/tests/test_harness_failure_visibility.py
@@ -605,7 +605,7 @@ def test_all_deferred_turn_runs_elect_and_propagate_the_first_stable_owner(
def test_hfr_459_deferred_owner_election_reserves_writer_before_reads(
tmp_path: Path,
) -> None:
- """Independent Activity releases serialize before choosing a Turn owner."""
+ """HFR-459: Independent Activity releases serialize before choosing a Turn owner."""
sqlite, requests = _store(tmp_path)
definitions = ["watch-deferred-lock-a", "watch-deferred-lock-b"]
@@ -659,7 +659,7 @@ def test_hfr_459_deferred_owner_election_reserves_writer_before_reads(
def test_hfr_447_fallback_owner_requires_writable_notice_metadata(
tmp_path: Path,
) -> None:
- """Owner election and notice persistence share one eligibility predicate."""
+ """HFR-447: Owner election and notice persistence share one eligibility predicate."""
from sqlalchemy import update as sa_update
@@ -2659,7 +2659,7 @@ def test_visible_send_promotes_the_stable_suppressed_history_row(tmp_path: Path)
def test_hfr_446_promoted_receipt_uses_visible_delivery_order(tmp_path: Path) -> None:
- """Promotion orders the stable row by its visible send, not hidden creation."""
+ """HFR-446: Promotion orders the stable row by its visible send, not hidden creation."""
from storage import messages_service
from storage.models import agent_sessions
@@ -7499,7 +7499,7 @@ def _settle_linked_turn_failures(sqlite, runs, *, delivered: bool) -> None:
def test_hfr_437_visible_turn_failure_suppresses_all_linked_run_notices(
tmp_path: Path,
) -> None:
- """One acknowledged backend error is enough, regardless of Run provenance."""
+ """HFR-437: One acknowledged backend error is enough, regardless of Run provenance."""
_migrated_state_db()
controller, _dispatcher, _touched = _live_turn_dispatcher()
@@ -7520,7 +7520,7 @@ def test_hfr_437_visible_turn_failure_suppresses_all_linked_run_notices(
def test_hfr_438_missing_turn_notification_delivers_one_fallback(tmp_path: Path) -> None:
- """A lost primary elects one Run fallback, not one fallback per definition."""
+ """HFR-438: A lost primary elects one Run fallback, not one fallback per definition."""
_migrated_state_db()
controller, _dispatcher, _touched = _live_turn_dispatcher()
@@ -7546,7 +7546,7 @@ def test_hfr_438_missing_turn_notification_delivers_one_fallback(tmp_path: Path)
def test_hfr_440_one_sibling_callback_suppresses_the_whole_turn_fallback(
tmp_path: Path,
) -> None:
- """A callback reports the shared Turn result, not only its parent Run."""
+ """HFR-440: A callback reports the shared Turn result, not only its parent Run."""
sqlite, requests = _store(tmp_path)
_task(sqlite, "watch-callback-a", deliver_key="slack::channel::C123")
@@ -7620,7 +7620,7 @@ def test_hfr_440_one_sibling_callback_suppresses_the_whole_turn_fallback(
def test_hfr_443_deferred_sibling_callback_blocks_the_turn_fallback(
tmp_path: Path,
) -> None:
- """A deferred participant remains part of the Turn callback snapshot."""
+ """HFR-443: A deferred participant remains part of the Turn callback snapshot."""
from sqlalchemy import update as sa_update
@@ -7683,7 +7683,7 @@ def test_hfr_443_deferred_sibling_callback_blocks_the_turn_fallback(
def test_hfr_448_cancel_requested_callback_does_not_block_turn_fallback(
tmp_path: Path,
) -> None:
- """A stopped deferred participant no longer owns callback membership."""
+ """HFR-448: A stopped deferred participant no longer owns callback membership."""
from sqlalchemy import update as sa_update
@@ -7747,7 +7747,7 @@ def test_hfr_448_cancel_requested_callback_does_not_block_turn_fallback(
def test_hfr_449_canceled_parent_keeps_armed_callback_evidence(
tmp_path: Path,
) -> None:
- """Cancellation removes unarmed parents, not callback work already accepted."""
+ """HFR-449: Cancellation removes unarmed parents, not callback work already accepted."""
sqlite, requests = _store(tmp_path)
_callback_session(sqlite)
@@ -7831,7 +7831,7 @@ def test_hfr_449_canceled_parent_keeps_armed_callback_evidence(
def test_hfr_450_terminal_replay_promotes_new_turn_delivery_evidence(
tmp_path: Path,
) -> None:
- """A same-Turn replay upgrades its notice without resetting drain progress."""
+ """HFR-450: A same-Turn replay upgrades its notice without resetting drain progress."""
import core.scheduled_tasks as scheduled_tasks
@@ -7894,7 +7894,7 @@ def test_hfr_450_terminal_replay_promotes_new_turn_delivery_evidence(
def test_hfr_451_turn_callback_lookup_uses_bounded_ownership(
tmp_path: Path,
) -> None:
- """Turn callback reads use Run ids and indexed Delivery ownership, never JSON scans."""
+ """HFR-451: Turn callback reads use Run ids and indexed Delivery ownership, never JSON scans."""
sqlite, _requests = _store(tmp_path)
_pending_failure(
@@ -7947,7 +7947,7 @@ def test_hfr_451_turn_callback_lookup_uses_bounded_ownership(
def test_hfr_452_callback_children_cannot_own_a_turn_fallback(
tmp_path: Path,
) -> None:
- """Owner election applies every suppression used by the notice writer."""
+ """HFR-452: Owner election applies every suppression used by the notice writer."""
sqlite, requests = _store(tmp_path)
parent = requests.enqueue(
@@ -8013,7 +8013,7 @@ def test_hfr_452_callback_children_cannot_own_a_turn_fallback(
def test_hfr_453_callback_enqueue_arms_the_parent_in_one_transaction(
tmp_path: Path,
) -> None:
- """A durable callback child is never visible without its parent marker."""
+ """HFR-453: A durable callback child is never visible without its parent marker."""
sqlite, requests = _store(tmp_path)
parent = requests.enqueue(
@@ -8071,7 +8071,7 @@ def test_hfr_453_callback_enqueue_arms_the_parent_in_one_transaction(
def test_hfr_455_turn_owner_excludes_same_batch_parent_suppression(
tmp_path: Path,
) -> None:
- """A child cannot own when its earlier parent acquires a notice in the batch."""
+ """HFR-455: A child cannot own when its earlier parent acquires a notice in the batch."""
sqlite, requests = _store(tmp_path)
parent = requests.enqueue(
@@ -8118,7 +8118,7 @@ def test_hfr_455_turn_owner_excludes_same_batch_parent_suppression(
def test_hfr_456_late_canceled_failed_parent_rejects_only_new_callbacks(
tmp_path: Path,
) -> None:
- """Late cancellation blocks new failure callbacks but preserves accepted evidence."""
+ """HFR-456: Late cancellation blocks new failure callbacks but preserves accepted evidence."""
sqlite, requests = _store(tmp_path)
@@ -8190,7 +8190,7 @@ def test_hfr_456_late_canceled_failed_parent_rejects_only_new_callbacks(
def test_hfr_457_missing_turn_participant_does_not_rollback_valid_runs(
tmp_path: Path,
) -> None:
- """A stale attribution id is excluded before ownership and settlement."""
+ """HFR-457: A stale attribution id is excluded before ownership and settlement."""
sqlite, requests = _store(tmp_path)
run = requests.enqueue(
@@ -8229,7 +8229,7 @@ def test_hfr_457_missing_turn_participant_does_not_rollback_valid_runs(
def test_hfr_458_steered_callback_uses_its_shared_turn_output_receipt(
tmp_path: Path,
) -> None:
- """A callback need not be the primary Run named by its persisted result."""
+ """HFR-458: A callback need not be the primary Run named by its persisted result."""
from storage import messages_service
@@ -8294,7 +8294,7 @@ def test_hfr_442_bare_turn_provenance_does_not_enter_the_fallback_lane(
tmp_path: Path,
turn_notification: dict[str, Any] | None,
) -> None:
- """A direct error result has a Turn id but no notification ownership contract."""
+ """HFR-442: A direct error result has a Turn id but no notification ownership contract."""
sqlite, requests = _store(tmp_path)
_task(sqlite, "task-direct-error", deliver_key="slack::channel::C123")
@@ -9264,7 +9264,7 @@ def test_a_watch_reports_processing_health_separately_from_waiter_health(capsys)
def test_hfr_444_first_in_flight_waiter_health_remains_unknown(tmp_path: Path) -> None:
- """Starting a cycle is not evidence that its waiter succeeded."""
+ """HFR-444: Starting a cycle is not evidence that its waiter succeeded."""
sqlite, _requests = _store(tmp_path)
_watch(
@@ -11576,7 +11576,7 @@ def test_hfr_475_restart_notice_is_one_calm_action_without_internal_details(
tmp_path: Path,
language: str,
) -> None:
- """A restart notice names readable work but never exposes an orphaned id."""
+ """HFR-475: A restart notice names readable work but never exposes an orphaned id."""
from types import SimpleNamespace
diff --git a/tests/test_inbox_bridge.py b/tests/test_inbox_bridge.py
index dcce5d2ca..552dcbfdc 100644
--- a/tests/test_inbox_bridge.py
+++ b/tests/test_inbox_bridge.py
@@ -57,6 +57,8 @@ def test_inbox_bridge_tracks_current_status(monkeypatch):
def test_hfr_173_local_event_echo_is_suppressed_once(monkeypatch):
+ """HFR-173: local event fanout and bounded bridge echo dedupe deliver once."""
+
from vibe import inbox_bridge
published = []
diff --git a/tests/test_inbox_events.py b/tests/test_inbox_events.py
index 72c223a87..bc54a573e 100644
--- a/tests/test_inbox_events.py
+++ b/tests/test_inbox_events.py
@@ -272,6 +272,8 @@ def test_hfr_156_sqlite_commit_bridges_run_update_to_controller(tmp_path, monkey
def test_hfr_156_bridge_failure_does_not_rollback_committed_run(tmp_path, monkeypatch):
+ """HFR-156: socket hint failure cannot roll back committed durable work."""
+
from core import inbox_events
from storage.background import SQLiteBackgroundTaskStore
diff --git a/tests/test_internal_server.py b/tests/test_internal_server.py
index 06ab364c0..7b9140559 100644
--- a/tests/test_internal_server.py
+++ b/tests/test_internal_server.py
@@ -3921,7 +3921,7 @@ def test_scheduled_gate_idle_runs_turn_with_lifecycle(monkeypatch, tmp_path):
def test_hfr_482_create_per_run_delivery_adopts_reserved_session(monkeypatch, tmp_path):
- """A create-per-run Run adopts its freshly reserved Session at admission."""
+ """HFR-482: A create-per-run Run adopts its freshly reserved Session at admission."""
from core.scheduled_tasks import TaskExecutionStore
from core.services import sessions as sessions_service
from storage.background import attach_agent_run_delivery_in_connection
@@ -6090,7 +6090,7 @@ def _cancel_run_through_live_turn(controller, session_id, turn_id, run_id):
def test_hfr_476_run_cancel_stops_a_shared_turn(monkeypatch, tmp_path):
- """Canceling a Run steered into a live Turn stops that Turn like Session Stop."""
+ """HFR-476: Canceling a Run steered into a live Turn stops that Turn like Session Stop."""
from core.scheduled_tasks import TaskExecutionStore
from storage.background import attach_agent_run_delivery_in_connection
diff --git a/tests/test_member_management_parity.py b/tests/test_member_management_parity.py
index 1520440d9..626833d9a 100644
--- a/tests/test_member_management_parity.py
+++ b/tests/test_member_management_parity.py
@@ -384,6 +384,8 @@ def test_unauthenticated_remote_management_is_denied(management_http):
def test_member_channel_and_dm_preferences_preserve_access_state(management_http):
+ """PERMISSIONS-013: Instance Member manages settings while preserving access administration."""
+
store = SettingsStore.get_instance()
store.set_channels_for_platform("telegram", {"chat": ChannelSettings(require_bind=True)})
store.set_users_for_platform("telegram", {"bound": UserSettings(is_admin=True, enabled=False, bound_at="old")})
diff --git a/tests/test_message_dispatcher_result_fallback.py b/tests/test_message_dispatcher_result_fallback.py
index d600a88d5..e291e9537 100644
--- a/tests/test_message_dispatcher_result_fallback.py
+++ b/tests/test_message_dispatcher_result_fallback.py
@@ -264,6 +264,8 @@ class MessageDispatcherResultFallbackTests(unittest.IsolatedAsyncioTestCase):
store.get_run.assert_not_called()
async def test_hfr_472_empty_failed_turn_creates_one_shared_fallback_contract(self):
+ """HFR-472: empty failed Turn owns one fallback across all accepted Runs."""
+
controller = self._terminal_lifecycle_controller()
dispatcher = ConsolidatedMessageDispatcher(controller)
dispatcher._collapse_status_bubble = mock.AsyncMock()
diff --git a/tests/test_message_dispatcher_scheduled.py b/tests/test_message_dispatcher_scheduled.py
index 204505d51..9d52fd5ff 100644
--- a/tests/test_message_dispatcher_scheduled.py
+++ b/tests/test_message_dispatcher_scheduled.py
@@ -956,6 +956,8 @@ class MessageDispatcherScheduledTests(unittest.IsolatedAsyncioTestCase):
)
async def test_recovered_durable_message_retries_only_local_settlement_after_restart(self):
+ """HFR-167: accepted Activity output retries local settlement without transport replay."""
+
from core.scheduled_tasks import ScheduledTaskService
class _ActivityStore:
diff --git a/tests/test_message_priority_cutover.py b/tests/test_message_priority_cutover.py
index bbc5df8a7..45f257015 100644
--- a/tests/test_message_priority_cutover.py
+++ b/tests/test_message_priority_cutover.py
@@ -23,6 +23,8 @@ def test_source_policy_has_one_explicit_delivery_intent(
trigger_kind: str,
expected_intent: str,
) -> None:
+ """MESSAGE-DELIVERY-201: Every approved producer class maps to one explicit delivery priority."""
+
from core.message_priority import delivery_intent_for_trigger
assert delivery_intent_for_trigger(trigger_kind) == expected_intent
diff --git a/tests/test_opencode_generations.py b/tests/test_opencode_generations.py
index f6bc0f2c7..544e05194 100644
--- a/tests/test_opencode_generations.py
+++ b/tests/test_opencode_generations.py
@@ -1891,7 +1891,7 @@ def test_adoption_never_holds_a_recorded_lease_longer_than_any_lease_is_granted(
def test_a_controller_starting_with_opencode_disabled_stops_a_crashed_controllers_servers(
isolated_launch, monkeypatch, opencode_enabled
):
- """A controller that crashed left a server recorded. Started with OpenCode
+ """RUNTIME-GEN-025: A controller that crashed left a server recorded. Started with OpenCode
disabled, no agent will ever adopt it, so startup stops it. Started with
OpenCode enabled, the agent adopts it and its restorable runs."""
diff --git a/tests/test_remote_access_vibe_cloud.py b/tests/test_remote_access_vibe_cloud.py
index 70de5464f..3c721516f 100644
--- a/tests/test_remote_access_vibe_cloud.py
+++ b/tests/test_remote_access_vibe_cloud.py
@@ -107,6 +107,8 @@ def _session_cookie(
def test_ra_tq_026_remote_status_uses_cf_ray_on_paired_public_host(monkeypatch, tmp_path):
+ """RA-TQ-026: Only paired-public-host CF-Ray metadata participates in conservative route assessment."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _config()
config.save()
@@ -166,6 +168,8 @@ def test_ra_tq_026_remote_status_ignores_spoofed_cf_ray(monkeypatch, tmp_path):
@pytest.mark.parametrize("role", ["owner", "member"])
def test_ra_tq_032_remote_status_keeps_page_fields_and_drops_host_internals(monkeypatch, tmp_path, role):
+ """RA-TQ-032: Remote status keeps the Remote Access page fields while dropping host internals."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _config()
config.save()
@@ -1225,6 +1229,8 @@ def test_pair_origin_service_uses_ipv6_loopback_for_ipv6_wildcard(monkeypatch, t
def test_ra_tq_007_runtime_status_payload_includes_tunnel_quality(monkeypatch, tmp_path) -> None:
+ """RA-TQ-007: Doctor and avibe.bot consume the same V1 aggregate."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _config()
config.ui.setup_host = "100.97.103.112"
@@ -1268,6 +1274,8 @@ def test_ra_tq_007_runtime_status_payload_includes_tunnel_quality(monkeypatch, t
def test_ra_tq_014_runtime_status_payload_includes_v2_request_path(monkeypatch, tmp_path) -> None:
+ """RA-TQ-014: Local and cloud surfaces consume the bounded V2 aggregate."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _config()
config.save()
@@ -3238,6 +3246,8 @@ def test_cloud_token_endpoint_remote_origin_with_session_mints_token(
def test_ra_tq_029_connector_environment_applies_ip_and_interface_controls() -> None:
+ """RA-TQ-029: Edge IP and outbound-interface controls reach cloudflared only through currently assigned addresses."""
+
config = _config()
cloud = config.remote_access.vibe_cloud
cloud.tunnel_token = "tunnel-token"
@@ -3288,6 +3298,8 @@ def test_ra_tq_029_network_interfaces_exclude_unusable_addresses(monkeypatch) ->
def test_ra_tq_030_connectivity_diagnostics_do_not_guess_quic_reachability(monkeypatch) -> None:
+ """RA-TQ-030: Connectivity diagnostics report proven TCP reachability without guessing unobserved QUIC reachability."""
+
config = _config()
monkeypatch.setattr(
remote_access,
diff --git a/tests/test_runtime_work_supervisor.py b/tests/test_runtime_work_supervisor.py
index 6e3cf80cb..c9610c946 100644
--- a/tests/test_runtime_work_supervisor.py
+++ b/tests/test_runtime_work_supervisor.py
@@ -104,7 +104,7 @@ async def test_hfr_151_supervisor_coalesces_wakes_and_keeps_partition_single_fli
@pytest.mark.anyio
async def test_hfr_170_guarded_noop_uses_partition_backoff() -> None:
- """HFR-151: a stale guarded no-op cannot become a tight retry loop."""
+ """HFR-151, HFR-170: a stale guarded no-op cannot become a tight retry loop."""
attempted = asyncio.Event()
backoff_entered = asyncio.Event()
@@ -269,6 +269,8 @@ async def test_hfr_162_partition_backoff_state_is_lane_bounded() -> None:
@pytest.mark.anyio
async def test_hfr_288_expired_backoff_preserves_forward_scan_before_retry() -> None:
+ """HFR-288: expired partition backoff preserves forward scan before retry rewind."""
+
retry_entered = asyncio.Event()
release_retry = asyncio.Event()
first_window_attempted = asyncio.Event()
@@ -693,7 +695,7 @@ async def test_hfr_151_stale_first_page_does_not_starve_later_partition() -> Non
@pytest.mark.anyio
async def test_hfr_152_supervisor_starts_paused_and_periodic_reconcile_wakes_lane() -> None:
- """HFR-152: startup is paused and periodic reconciliation re-reads work."""
+ """HFR-152, HFR-157: startup is paused and periodic reconciliation re-reads work."""
first_scan = asyncio.Event()
tick_waiting = asyncio.Event()
release_tick = asyncio.Event()
@@ -898,6 +900,8 @@ async def test_hfr_155_events_wake_only_their_durable_lanes(
event_type: str,
expected: set[RuntimeWorkLane],
) -> None:
+ """HFR-155: runtime work hints wake only their mapped durable lanes."""
+
started: set[RuntimeWorkLane] = set()
events = {lane: asyncio.Event() for lane in RuntimeWorkLane}
@@ -982,6 +986,8 @@ async def test_hfr_162_failed_scan_rearms_after_bounded_backoff() -> None:
@pytest.mark.anyio
async def test_hfr_162_wake_during_final_empty_scan_is_not_lost() -> None:
+ """HFR-162: a final-scan wake is retained and rearmed after failure."""
+
processed = asyncio.Event()
holder: dict[str, RuntimeWorkSupervisor] = {}
@@ -1012,6 +1018,8 @@ async def test_hfr_162_wake_during_final_empty_scan_is_not_lost() -> None:
@pytest.mark.anyio
async def test_hfr_159_blocked_store_scan_does_not_block_another_lane() -> None:
+ """HFR-159: blocking store scans do not block the controller loop or other lanes."""
+
scan_entered = threading.Event()
release_scan = threading.Event()
other_processed = asyncio.Event()
@@ -1055,6 +1063,8 @@ async def test_hfr_159_blocked_store_scan_does_not_block_another_lane() -> None:
@pytest.mark.anyio
async def test_hfr_163_lane_capacity_bounds_distinct_partition_workers() -> None:
+ """HFR-163: runtime work lanes enforce global and per-partition single flight."""
+
release = asyncio.Event()
two_started = asyncio.Event()
all_completed = asyncio.Event()
@@ -1110,6 +1120,8 @@ async def test_hfr_163_lane_capacity_bounds_distinct_partition_workers() -> None
async def test_hfr_171_overdue_report_names_lane_partition_and_generation(
caplog,
) -> None:
+ """HFR-171: overdue runtime work identifies lane partition and generation."""
+
release = asyncio.Event()
started = asyncio.Event()
tick = asyncio.Event()
@@ -1753,6 +1765,8 @@ async def test_hfr_165_old_generation_delayed_wake_cannot_rearm_replacement() ->
async def test_hfr_175_global_lease_loss_joins_every_registration(
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-175: global lease loss stops and joins every runtime work registration."""
+
owns_lease = True
scanned = threading.Event()
stop_started = asyncio.Event()
diff --git a/tests/test_scheduled_tasks.py b/tests/test_scheduled_tasks.py
index 0df05ab1d..4f2c44228 100644
--- a/tests/test_scheduled_tasks.py
+++ b/tests/test_scheduled_tasks.py
@@ -490,6 +490,8 @@ def test_hfr_172_task_definition_wake_follows_commit_and_not_rollback(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-172: definition hints follow commit and exclude rollback or losing CAS."""
+
from core import inbox_events
store = ScheduledTaskStore(tmp_path / "scheduled_tasks.json")
@@ -1593,6 +1595,8 @@ def test_hfr_161_scheduler_only_enqueues_one_successor_behind_active_work(
tmp_path: Path,
monkeypatch,
) -> None:
+ """HFR-161: scheduled work admits one queued successor through one request owner."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
store = ScheduledTaskStore()
task = store.add_task(
@@ -1692,6 +1696,8 @@ def test_hfr_158_request_scan_fills_page_across_recovery_and_queued_work(
tmp_path: Path,
monkeypatch,
) -> None:
+ """HFR-158: occupied partitions cannot hide later actionable work."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
request_store = TaskExecutionStore()
recovering = request_store.enqueue_hook_send(
@@ -1885,6 +1891,8 @@ def test_hfr_282_task_reload_waits_for_result_stamp_mirror_commit(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-282: scheduled task mirror mutations serialize with reloads through commit."""
+
store = ScheduledTaskStore(tmp_path / "scheduled_tasks.json")
task = store.add_task(
session_key="slack::channel::C123",
@@ -7102,7 +7110,7 @@ def test_hfr_439_turn_failure_metadata_reaches_every_linked_run(
tmp_path: Path,
monkeypatch,
) -> None:
- """The failed transition and its Turn notification evidence commit together."""
+ """HFR-439: The failed transition and its Turn notification evidence commit together."""
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
request_store = TaskExecutionStore()
@@ -7755,6 +7763,8 @@ def test_agent_run_keeps_output_ledger_but_callbacks_only_terminal_result(
tmp_path: Path,
monkeypatch,
) -> None:
+ """MESSAGE-DELIVERY-005: One Run retains multiple outputs but callbacks only its terminal result once."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
caller_session_id = _make_avibe_session(monkeypatch, tmp_path)
request_store = TaskExecutionStore()
@@ -8233,6 +8243,8 @@ def test_failed_run_records_error_and_enqueues_one_terminal_callback(
tmp_path: Path,
monkeypatch,
) -> None:
+ """HFR-008: a repeated terminal record is no second transition, so the failed Run calls back once."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
caller_session_id = _make_avibe_session(monkeypatch, tmp_path)
request_store = TaskExecutionStore()
@@ -8953,6 +8965,8 @@ def test_hfr_169_recovered_activity_without_run_reaches_its_session(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-169: Activity recovery remains visible without a Run projection."""
+
session_id = _make_avibe_session(monkeypatch, tmp_path)
request_store = TaskExecutionStore()
sqlite_store = request_store.sqlite_backend
@@ -11943,6 +11957,11 @@ def test_hfr_164_hfr_165_service_restart_joins_only_its_harness_lane_generations
tmp_path: Path,
monkeypatch,
) -> None:
+ """HFR-164: service restart joins only its own runtime work registrations.
+
+ HFR-165: repeated service cycles leave one current registration generation.
+ """
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
class _Supervisor:
@@ -12025,6 +12044,8 @@ def test_hfr_176_legacy_file_probes_wake_only_their_mapped_lanes(
tmp_path: Path,
monkeypatch,
) -> None:
+ """HFR-176: legacy file signatures wake only their mapped runtime work lanes."""
+
notifications: list[tuple[RuntimeWorkLane, ...]] = []
service = ScheduledTaskService(
controller=SimpleNamespace(
@@ -12145,6 +12166,8 @@ def test_stale_lane_applies_leaked_lock_cleanup_on_the_controller_loop(
def test_hfr_286_cancellation_wake_is_not_gated_by_stale_sweep_cadence(
tmp_path: Path,
) -> None:
+ """HFR-286: Run cancellation hints bypass stale sweep eligibility."""
+
service = ScheduledTaskService(
controller=SimpleNamespace(platform_settings_managers={}),
store=ScheduledTaskStore(tmp_path / "tasks.json"),
@@ -12512,6 +12535,8 @@ def test_drain_does_not_block_on_hung_execution(tmp_path: Path) -> None:
def test_hfr_177_transport_ready_wakes_requests_and_resumes_skipped_run(
tmp_path: Path,
) -> None:
+ """HFR-177: transport readiness directly resumes skipped request admission."""
+
async def _exercise() -> None:
store = TaskExecutionStore(tmp_path / "reqs")
workbench = store.enqueue_hook_send(session_key="avibe::project::proj_test", prompt="local")
diff --git a/tests/test_session_activities.py b/tests/test_session_activities.py
index ba9cb87c5..1ddcc0bc9 100644
--- a/tests/test_session_activities.py
+++ b/tests/test_session_activities.py
@@ -68,6 +68,8 @@ def test_activity_lifecycle_keeps_state_axes_orthogonal():
def test_hfr_166_recovered_unbound_grace_uses_first_durable_completion(
tmp_path: Path,
) -> None:
+ """HFR-166: recovered Activity batches retain durable live batching grace."""
+
db_path = tmp_path / "state" / "vibe.sqlite"
ensure_sqlite_state(db_path=db_path, primary_platform="avibe")
engine = create_sqlite_engine(db_path)
@@ -175,6 +177,8 @@ def test_hfr_166_recovered_runtime_scan_applies_keyset_limit_in_registry() -> No
def test_hfr_285_deferred_runtime_scan_bounds_raw_rows_and_indexes_deadline() -> None:
+ """HFR-285: deferred Activity recovery scans bounded raw pages with indexed eligibility."""
+
completed_at = datetime.now(timezone.utc).isoformat()
class _Store:
@@ -956,6 +960,8 @@ def test_single_recovery_claim_expands_a_persisted_output_batch():
def test_recovery_marks_an_incomplete_persisted_output_batch_for_fail_closed_emit():
+ """HFR-168: incomplete recovered Activity batches fail closed before transport."""
+
store = SimpleNamespace(
upsert_activity=mock.Mock(),
upsert_activities=mock.Mock(),
diff --git a/tests/test_session_archive.py b/tests/test_session_archive.py
index 8b9964efa..1755d4731 100644
--- a/tests/test_session_archive.py
+++ b/tests/test_session_archive.py
@@ -259,6 +259,8 @@ def test_hfr_287_new_session_teardown_publishes_run_updates_after_commit(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-287: new-session teardown publishes committed Run cancellations."""
+
from storage import background
service = SQLiteSessionsService(tmp_path / "vibe.sqlite")
diff --git a/tests/test_session_delivery_fsm.py b/tests/test_session_delivery_fsm.py
index 17bd82af3..e56fdbede 100644
--- a/tests/test_session_delivery_fsm.py
+++ b/tests/test_session_delivery_fsm.py
@@ -1659,6 +1659,8 @@ def test_fifo_head_mismatch_does_not_bind_session_route(managers) -> None:
def test_im_p1_materializes_only_after_exact_native_acceptance(managers) -> None:
+ """MESSAGE-DELIVERY-202: Ordinary IM input remains outside transcript until exact P1 acceptance."""
+
manager, _other, engine, _engine_b, _starts = managers
async def run() -> tuple[str, str]:
@@ -3355,6 +3357,8 @@ def test_accepted_receipt_recovery_preserves_attempt_batch_and_run_attachment(
def test_missing_restart_evidence_keeps_unknown_without_resteer(
managers,
) -> None:
+ """MESSAGE-DELIVERY-312: Unknown steer evidence remains unreplayed while reconciliation stays conservative."""
+
first, restarted, engine, _engine_b, _starts = managers
turn_id, _ = asyncio.run(_activate(first))
first._active_identity = lambda _b, _s, logical: (logical, f"native-{logical}")
@@ -4972,6 +4976,8 @@ def test_exact_missing_start_attempt_requeues_only_its_own_delivery(managers) ->
@pytest.mark.anyio
async def test_permanent_start_rejection_retires_delivery_without_retry(managers) -> None:
+ """MESSAGE-DELIVERY-020: Permanent native start rejection retires one Delivery and unblocks FIFO."""
+
manager, _other, engine, _engine_b, starts = managers
admitted = await manager.deliver(
DeliveryRequest(session_id="ses_fsm", priority="p3", content="invalid payload"),
@@ -7652,7 +7658,7 @@ def test_hfr_474_startup_collapses_legacy_restart_notices_by_durable_turn(
tmp_path: Path,
sent_before_recovery: bool,
) -> None:
- """Upgrade recovery uses exact Delivery ownership before notices can drain."""
+ """HFR-474: Upgrade recovery uses exact Delivery ownership before notices can drain."""
from core import failure_notices
from core.scheduled_tasks import ScheduledTaskService, TaskExecutionStore
diff --git a/tests/test_skill_observability.py b/tests/test_skill_observability.py
index f20460058..8c742bf82 100644
--- a/tests/test_skill_observability.py
+++ b/tests/test_skill_observability.py
@@ -358,6 +358,8 @@ def test_invalid_observations_do_not_write(engine, mutate):
@pytest.mark.parametrize("role", ["owner", "member", "editor", "viewer", None])
def test_manager_sql_access_including_cte(engine, role):
+ """PERMISSIONS-019: Instance operational diagnostics admit Member and preserve query safety."""
+
from storage.read_only_query import ReadOnlyQueryError, run_read_only_query
from vibe.authorization import AuthorizationContext
diff --git a/tests/test_tunnel_quality.py b/tests/test_tunnel_quality.py
index 491b879af..eb6a29b9a 100644
--- a/tests/test_tunnel_quality.py
+++ b/tests/test_tunnel_quality.py
@@ -47,6 +47,8 @@ def test_request_path_probe_rejects_redirects() -> None:
def test_ra_tq_001_parse_cloudflared_metrics_extracts_quality_inputs() -> None:
+ """RA-TQ-001: Cloudflared metrics produce a bounded quality aggregate."""
+
sample = tunnel_quality.parse_metrics(
"""
# TYPE cloudflared_tunnel_ha_connections gauge
@@ -102,6 +104,8 @@ def test_packet_loss_rate_requires_timeout_growth_on_two_connections() -> None:
def test_ra_tq_002_high_rtt_requires_three_minutes_before_recovery() -> None:
+ """RA-TQ-002: High RTT persists for three minutes before recovery eligibility."""
+
evaluator = tunnel_quality.QualityEvaluator()
now = 10_000.0
for minute in range(15):
@@ -165,6 +169,8 @@ def test_ra_tq_033_unavailable_request_path_is_an_availability_episode() -> None
def test_ra_tq_003_metrics_failure_becomes_unknown_after_45_seconds() -> None:
+ """RA-TQ-003: Missing metrics become unknown without causing route churn."""
+
evaluator = tunnel_quality.QualityEvaluator()
evaluator.update(_sample(100, (70, 75, 80, 85)))
@@ -269,6 +275,8 @@ def test_baseline_state_round_trips_without_raw_samples() -> None:
def test_ra_tq_010_request_path_tail_overrides_good_connector_rtt() -> None:
+ """RA-TQ-010: Request-path tails override a healthy connector RTT grade."""
+
evaluator = tunnel_quality.QualityEvaluator()
snapshot = None
@@ -335,6 +343,8 @@ def test_request_path_degradation_controls_state_when_connector_metrics_are_miss
def test_ra_tq_015_sustained_request_failures_trigger_recovery() -> None:
+ """RA-TQ-015: Sustained public request failures degrade the path and trigger recovery."""
+
evaluator = tunnel_quality.QualityEvaluator()
snapshot = None
@@ -360,6 +370,8 @@ def test_ra_tq_015_sustained_request_failures_trigger_recovery() -> None:
def test_ra_tq_027_optimization_profiles_change_only_recovery_sensitivity() -> None:
+ """RA-TQ-027: User optimization policies change recovery sensitivity without changing path measurements."""
+
evaluator = tunnel_quality.QualityEvaluator()
request_path = {
"status": "healthy",
@@ -397,6 +409,8 @@ def test_ra_tq_027_optimization_profiles_change_only_recovery_sensitivity() -> N
def test_ra_tq_011_http2_uses_request_path_grade_without_rtt() -> None:
+ """RA-TQ-011: HTTP2 receives a request-path grade without QUIC RTT."""
+
evaluator = tunnel_quality.QualityEvaluator()
snapshot = None
@@ -448,6 +462,8 @@ def test_request_path_candidate_accepts_tail_improvement_despite_p50_regression(
def test_ra_tq_020_request_path_candidate_accepts_material_failure_reduction() -> None:
+ """RA-TQ-020: Material request-failure reduction can accept a healthy candidate."""
+
active = tunnel_quality.summarize_request_path_samples(
[
tunnel_quality.RequestPathSample(
diff --git a/tests/test_tunnel_recovery.py b/tests/test_tunnel_recovery.py
index 736a0f8f2..d6ced110a 100644
--- a/tests/test_tunnel_recovery.py
+++ b/tests/test_tunnel_recovery.py
@@ -107,6 +107,8 @@ def _setup_recovery(monkeypatch, tmp_path, candidate_quality: dict):
def test_ra_tq_004_candidate_promotes_before_active_drains(monkeypatch, tmp_path) -> None:
+ """RA-TQ-004: Better candidate is promoted before the active Connector drains."""
+
config, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
drained = []
results = []
@@ -131,6 +133,8 @@ def test_ra_tq_004_candidate_promotes_before_active_drains(monkeypatch, tmp_path
def test_ra_tq_005_non_improving_candidate_keeps_active(monkeypatch, tmp_path) -> None:
+ """RA-TQ-005: Non-improving candidate is removed without changing the active Connector."""
+
config, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(220))
stopped = []
results = []
@@ -188,6 +192,8 @@ def test_ra_tq_028_settings_candidate_failure_keeps_active_config(monkeypatch, t
def test_ra_tq_028_settings_promote_before_draining_previous_connector(monkeypatch, tmp_path) -> None:
+ """RA-TQ-028: Live Tunnel setting changes promote a ready replacement before draining the previous Connector."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _config()
config.remote_access.vibe_cloud.tunnel_token = "tunnel-token"
@@ -436,6 +442,8 @@ def test_ra_tq_028_settings_auto_protocol_falls_back_after_preference_fails(
def test_ra_tq_012_tail_recovery_keeps_better_alternate_protocol(monkeypatch, tmp_path) -> None:
+ """RA-TQ-012: Auto mode keeps a materially better alternate protocol."""
+
config, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
alternate_pid = 333
alive.add(alternate_pid)
@@ -487,6 +495,8 @@ def test_ra_tq_012_tail_recovery_keeps_better_alternate_protocol(monkeypatch, tm
def test_ra_tq_013_tail_recovery_rolls_back_protocol(monkeypatch, tmp_path) -> None:
+ """RA-TQ-013: Non-improving protocol switch rolls back make-before-break."""
+
config, active_pid, first_candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
alternate_pid = 333
rollback_pid = 444
@@ -538,6 +548,8 @@ def test_ra_tq_021_tail_rollback_stays_pending_if_replacement_loses_readiness(
monkeypatch,
tmp_path,
) -> None:
+ """RA-TQ-021: A rollback replacement that loses readiness remains pending for reconciliation."""
+
config, _active_pid, first_candidate_pid, alive = _setup_recovery(
monkeypatch,
tmp_path,
@@ -589,6 +601,8 @@ def test_ra_tq_021_tail_rollback_stays_pending_if_replacement_loses_readiness(
def test_ra_tq_018_tail_candidate_must_pass_connector_error_gates(monkeypatch, tmp_path) -> None:
+ """RA-TQ-018: Tail candidates must pass connector availability and error gates."""
+
config, active_pid, first_candidate_pid, alive = _setup_recovery(
monkeypatch,
tmp_path,
@@ -712,6 +726,8 @@ def test_ra_tq_033_availability_recovery_protocol_follows_route_outage(
expected_protocol,
expected_preference,
) -> None:
+ """RA-TQ-033: A route that serves no public requests recovers over the other transport despite cooldown."""
+
config, active_pid, candidate_pid, alive = _setup_recovery(
monkeypatch,
tmp_path,
@@ -897,6 +913,8 @@ def test_ra_tq_022_public_probe_session_honors_host_network_environment(
monkeypatch,
tmp_path,
) -> None:
+ """RA-TQ-022: Public probes honor the host proxy and CA environment."""
+
ca_bundle = tmp_path / "host-ca.pem"
ca_bundle.write_text("test CA", encoding="utf-8")
monkeypatch.setenv("HTTPS_PROXY", "http://proxy.test:8080")
@@ -1076,6 +1094,8 @@ def test_failed_drain_remains_tracked_for_reconcile(monkeypatch, tmp_path) -> No
def test_ra_tq_016_monitor_lifecycle_retries_failed_drain(monkeypatch, tmp_path) -> None:
+ """RA-TQ-016: Failed old-connector drains are retried during monitor lifecycle reconciliation."""
+
config, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
state = json.loads(remote_access._state_path().read_text(encoding="utf-8"))
state["active"] = remote_access._connector_record(
@@ -1128,6 +1148,8 @@ def test_monitor_lifecycle_preserves_pending_work_after_transient_error(
def test_ra_tq_008_restart_removes_orphan_candidate(monkeypatch, tmp_path) -> None:
+ """RA-TQ-008: Restart removes an orphan candidate while retaining a healthy active Connector."""
+
_, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
state = json.loads(remote_access._state_path().read_text(encoding="utf-8"))
state["candidate"] = remote_access._connector_record(
@@ -1157,6 +1179,8 @@ def test_ra_tq_008_restart_removes_orphan_candidate(monkeypatch, tmp_path) -> No
def test_ra_tq_017_restart_rolls_back_unverified_tail_candidate(monkeypatch, tmp_path) -> None:
+ """RA-TQ-017: Restart rolls back a promoted tail route that was never verified."""
+
config, previous_pid, unverified_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
rollback_pid = 333
state = json.loads(remote_access._state_path().read_text(encoding="utf-8"))
@@ -1212,6 +1236,8 @@ def test_ra_tq_017_restart_rolls_back_unverified_tail_candidate(monkeypatch, tmp
def test_ra_tq_019_live_tail_recovery_owns_pending_rollback(monkeypatch, tmp_path) -> None:
+ """RA-TQ-019: Live tail recovery retains ownership of its pending rollback marker."""
+
_, previous_pid, candidate_pid, _alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
state = json.loads(remote_access._state_path().read_text(encoding="utf-8"))
state["active"] = remote_access._connector_record(
@@ -1255,6 +1281,8 @@ def test_ra_tq_023_status_preserves_rollback_after_promoted_process_exit(
monkeypatch,
tmp_path,
) -> None:
+ """RA-TQ-023: Status cleanup preserves rollback after a promoted process exits."""
+
config, _previous_pid, promoted_pid, alive = _setup_recovery(
monkeypatch,
tmp_path,
@@ -1303,6 +1331,8 @@ def test_ra_tq_024_pinned_protocol_rejects_stale_tail_evidence(
monkeypatch,
tmp_path,
) -> None:
+ """RA-TQ-024: Pinned transport rejects stale comparison evidence from another protocol."""
+
config, active_pid, _candidate_pid, _alive = _setup_recovery(
monkeypatch,
tmp_path,
@@ -1469,6 +1499,8 @@ def test_reconciled_recovery_uses_only_contract_trigger_values(monkeypatch) -> N
def test_ra_tq_009_restart_promotes_ready_candidate(monkeypatch, tmp_path) -> None:
+ """RA-TQ-009: Restart promotes a ready candidate when the previous active Connector is gone."""
+
_, active_pid, candidate_pid, alive = _setup_recovery(monkeypatch, tmp_path, _quality(180))
state = json.loads(remote_access._state_path().read_text(encoding="utf-8"))
state["candidate"] = remote_access._connector_record(
@@ -1537,6 +1569,8 @@ def _wait_connector_exit(timeout: float = 5.0) -> None:
def test_ra_tq_034_connector_exited_before_network_is_restarted_with_backoff(monkeypatch, tmp_path) -> None:
+ """RA-TQ-034: A requested Connector that exits on its own restarts with backoff; a stopped or disabled one stays down."""
+
config, network_up = _setup_exiting_connector(monkeypatch, tmp_path)
schedule = remote_access._ConnectorRestartSchedule()
try:
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index 02c583894..a79125e3d 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -3685,6 +3685,8 @@ def test_telegram_list_chats_returns_discovered_groups(tmp_path, monkeypatch):
def test_telegram_topic_settings_api_and_discovery_payload(tmp_path, monkeypatch):
# Scenario: TELEGRAM-TOPIC-001
+ """TELEGRAM-TOPIC-001: A topic override controls mention, bound-only, agent, and message-type settings."""
+
monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".avibe"))
SettingsStore.reset_instance()
agent_store = VibeAgentStore()
diff --git a/tests/test_ui_server_fastapi.py b/tests/test_ui_server_fastapi.py
index df99a1fbe..d34fc6c76 100644
--- a/tests/test_ui_server_fastapi.py
+++ b/tests/test_ui_server_fastapi.py
@@ -73,6 +73,8 @@ def test_archive_definition_wakes_do_not_block_the_asgi_loop(monkeypatch):
def test_hfr_283_archive_run_cancellations_wake_runtime_consumers(monkeypatch):
+ """HFR-283: session archive wakes cancellation processing after its Run commit."""
+
published: list[tuple[str, dict[str, str], float]] = []
async def _publish(event_type, data, *, timeout): # noqa: ANN001, ANN202
diff --git a/tests/test_watches.py b/tests/test_watches.py
index 2f958f0de..d9435b252 100644
--- a/tests/test_watches.py
+++ b/tests/test_watches.py
@@ -269,6 +269,8 @@ def test_hfr_174_watch_definition_commit_emits_watch_hint(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-174: task and watch definition commits wake separate reconcile owners."""
+
from core import inbox_events
monkeypatch.setattr(inbox_events, "_CONTROLLER_PROCESS", True)
@@ -3168,6 +3170,8 @@ def test_hfr_179_watch_store_phases_are_single_flight_and_apply_on_loop(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
+ """HFR-179: managed-watch store work stays single-flight and applies on loop."""
+
service = ManagedWatchService(
controller=SimpleNamespace(),
store=ManagedWatchStore(tmp_path / "watches.json"),
@@ -3239,7 +3243,7 @@ def test_hfr_485_watch_reconciles_after_another_reader_consumes_reload(
backend: str,
ordering: str,
) -> None:
- """Issue #1995: a refreshed mirror is not an acknowledged scheduling change."""
+ """HFR-485: Issue #1995: a refreshed mirror is not an acknowledged scheduling change."""
monkeypatch.setattr(watches_module, "_publish_watch_definitions_updated", lambda: None)
monkeypatch.setattr(watches_module, "WATCH_RECONCILE_INTERVAL_SECONDS", 0.01)
reader = ManagedWatchStore(tmp_path / "watches.json")
@@ -4760,7 +4764,7 @@ def test_no_teardown_can_commit_between_the_result_stamp_and_its_hook(tmp_path:
def test_a_failed_outbox_write_does_not_retire_the_watch_with_its_hook_lost(
tmp_path: Path, branch: str
) -> None:
- """HFR-269, inverse half — the other thing two commits cost.
+ """HFR-271: HFR-269, inverse half — the other thing two commits cost.
Same scenario id as ``test_no_teardown_can_commit_between_the_result_stamp_and_its_hook``:
one defect (the stamp and its outbox row are not one transaction) with two failure
@@ -4890,7 +4894,7 @@ _WATCH_FIXTURE_PAYLOAD = {
def test_a_hook_queued_after_a_rename_names_an_agent_that_still_exists(tmp_path: Path) -> None:
- """The watch half of SCT-030 -- the completion hook must be claimable.
+ """HFR-281: The watch half of SCT-030 -- the completion hook must be claimable.
``_hook_request`` composes the hook from ``watch.agent_name`` when the cycle ends,
and the row becomes durable inside the stamp's transaction. A rename committed