mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[sweep] strip Fxxx audit-ID tokens + trim bloated comments/docstrings + add behavior-change docs
Post-audit sweep over the 135 audit-fix commits since19a474d3: 1. Stripped every # Fxxx: audit-ID token from comments AND every Fxxx token from docstring openings across 211 blocks / ~626 lines. The CEO flagged these twice: audit-issue IDs in code confuse future devs/agents. The descriptive text is preserved; only the Fxxx token is removed (and bloated narrative blocks trimmed to 1-3 lines keeping the one non-obvious invariant). 2. Trimmed bloated comments/docstrings to the concise standard (1-3 lines). 3. Added missing behavior-change docs for the audit-fix batch: prompts/roles (documenter, pr_reviewer, qa), user-facing docs (api auth, websockets, agent-gateway, megatask, merge-model, task-lifecycle, grok, resilience, conventions, panel, security, troubleshooting), and the RAG corpus (cell-pm, main-pm, pr-reviewer, qa roles; conventions; messaging-tools; escalation; megatask; task-claiming workflows). Comment/docstring/prose ONLY — zero code-line edits (verified: the diff contains no def/class/return/if/for/await/assignment/call lines). Gates green: ruff format + ruff check clean, mypy clean on roboco/. The only pytest failures are the pre-existing sync_branch tracing-decision gap (B1,250be5c2) — not sweep-caused and tracked separately.
This commit is contained in:
@@ -265,17 +265,10 @@ def test_verb_extracted_from_path(do_module: types.ModuleType) -> None:
|
||||
def test_dict_shaped_error_does_not_crash(do_module: types.ModuleType) -> None:
|
||||
"""A RobocoError.to_dict()-shaped response must not TypeError the breaker.
|
||||
|
||||
Smoke-7: A2AAccessDeniedError escaped to middleware and was rendered as
|
||||
{'error': {'code': ..., 'message': ..., 'details': ...}}. The circuit
|
||||
breaker's `error in frozenset` check then crashed with
|
||||
`TypeError: unhashable type: 'dict'`.
|
||||
|
||||
F068: a dict-shaped `error` is a retry-storm-worthy rejection (the
|
||||
orchestrator's exception handlers all surface this shape on 4xx/5xx),
|
||||
so the breaker must COUNT it — mapped to a counted kind by the
|
||||
classifier — rather than passing it through silently. The original
|
||||
dict payload still reaches the agent (the breaker only substitutes
|
||||
when open). No TypeError may be raised either way.
|
||||
A dict-shaped `error` is a retry-storm-worthy rejection (the orchestrator's
|
||||
exception handlers surface this shape on 4xx/5xx), so the breaker must count
|
||||
it via the classifier rather than passing it through silently. The original
|
||||
dict payload still reaches the agent (the breaker only substitutes when open).
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -311,10 +304,9 @@ def test_dict_shaped_error_does_not_crash(do_module: types.ModuleType) -> None:
|
||||
def test_422_validation_failure_counts_as_incomplete_input(
|
||||
do_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a 422 validation-failure body (`{"detail": [...], "body": ...}`,
|
||||
no `error` field) must count toward the breaker — a storm of 422s is
|
||||
retry-storm-worthy (the agent keeps re-submitting malformed input).
|
||||
Mapped to `incomplete_input` (the agent's input was incomplete/invalid).
|
||||
"""A 422 validation-failure body (`{"detail": [...], "body": ...}`, no `error`
|
||||
field) must count toward the breaker — a storm of 422s is retry-storm-worthy.
|
||||
Mapped to `incomplete_input`.
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -347,9 +339,8 @@ def test_422_validation_failure_counts_as_incomplete_input(
|
||||
def test_dict_shaped_internal_error_counts_as_invalid_state(
|
||||
do_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a 500 INTERNAL_ERROR dict-shaped response (generic_exception_handler)
|
||||
must count toward the breaker as `invalid_state` — a storm of 500s is
|
||||
retry-storm-worthy and previously bypassed the breaker entirely.
|
||||
"""A 500 INTERNAL_ERROR dict-shaped response (generic_exception_handler) must
|
||||
count toward the breaker as `invalid_state` — a storm of 500s is retry-storm-worthy.
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -379,7 +370,7 @@ def test_dict_shaped_internal_error_counts_as_invalid_state(
|
||||
def test_dict_shaped_invalid_input_counts_as_incomplete_input(
|
||||
do_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a dict-shaped INVALID_INPUT (mapped from 422 by http_exception_handler)
|
||||
"""A dict-shaped INVALID_INPUT (mapped from 422 by http_exception_handler)
|
||||
counts as `incomplete_input` — semantically the agent's input was invalid.
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
@@ -404,19 +395,18 @@ def test_dict_shaped_invalid_input_counts_as_incomplete_input(
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# F069 — a manifest-registered content tool whose route is missing must
|
||||
# return an envelope rejection (not a raw 404 body) so the breaker counts it.
|
||||
# A manifest-registered content tool whose route is missing must return an
|
||||
# envelope rejection (not a raw 404 body) so the breaker counts it.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_missing_route_404_returns_envelope_and_counts(
|
||||
do_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F069: a 404 from the orchestrator (manifest-registered tool with no
|
||||
route) must surface as a proper `invalid_state` Envelope rejection — not
|
||||
FastAPI's raw ``{"detail": "Not Found"}`` body — and the breaker must
|
||||
count it. Without this, the agent retries the missing tool forever and
|
||||
the breaker never trips. Mirrors flow_server's 404 handling.
|
||||
"""A 404 from the orchestrator (manifest-registered tool with no route) must
|
||||
surface as a proper `invalid_state` Envelope rejection — not FastAPI's raw
|
||||
``{"detail": "Not Found"}`` body — and the breaker must count it. Mirrors
|
||||
flow_server's 404 handling.
|
||||
"""
|
||||
captured: list[tuple[str, dict[str, Any] | None]] = []
|
||||
|
||||
|
||||
@@ -432,17 +432,16 @@ def test_task_id_none_is_forwarded_as_null(flow_module: types.ModuleType) -> Non
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# F068 — non-string-error / no-error-field rejection shapes are counted
|
||||
# Non-string-error / no-error-field rejection shapes are counted
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_422_validation_failure_counts_as_incomplete_input(
|
||||
flow_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a 422 validation-failure body (`{"detail": [...]}`, no `error`)
|
||||
must count toward the breaker as `incomplete_input` — a storm of 422s is
|
||||
retry-storm-worthy. Mirrors do_server's classifier (the two servers share
|
||||
the same breaker logic and must stay in parity).
|
||||
"""A 422 validation-failure body (`{"detail": [...]}`, no `error`) must count
|
||||
toward the breaker as `incomplete_input` — a storm of 422s is retry-storm-worthy.
|
||||
Mirrors do_server's classifier (the two servers share the same breaker logic).
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -475,8 +474,8 @@ def test_422_validation_failure_counts_as_incomplete_input(
|
||||
def test_dict_shaped_internal_error_counts_as_invalid_state(
|
||||
flow_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a 500 INTERNAL_ERROR dict-shaped response (generic_exception_handler)
|
||||
counts as `invalid_state` — a storm of 500s previously bypassed the breaker.
|
||||
"""A 500 INTERNAL_ERROR dict-shaped response (generic_exception_handler) counts
|
||||
as `invalid_state` — a storm of 500s is retry-storm-worthy.
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -506,9 +505,8 @@ def test_dict_shaped_internal_error_counts_as_invalid_state(
|
||||
def test_dict_shaped_not_found_does_not_count(
|
||||
flow_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F068: a dict-shaped NOT_FOUND (404 family) does NOT count — parity with
|
||||
the string-error contract that a `not_found` rejection isn't counted
|
||||
(retrying a missing resource won't help until state changes).
|
||||
"""A dict-shaped NOT_FOUND (404 family) does NOT count — parity with the
|
||||
string-error contract that a `not_found` rejection isn't counted.
|
||||
"""
|
||||
factory, captured = _make_client(
|
||||
orchestrator_response={
|
||||
@@ -524,8 +522,8 @@ def test_dict_shaped_not_found_does_not_count(
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# F069 — a manifest-registered verb whose route is missing must return an
|
||||
# envelope rejection (not a raw 404 body) so the breaker counts it.
|
||||
# A manifest-registered verb whose route is missing must return an envelope
|
||||
# rejection (not a raw 404 body) so the breaker counts it.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -570,11 +568,9 @@ def _make_404_client() -> tuple[Any, list[tuple[str, dict[str, Any] | None]]]:
|
||||
def test_missing_route_404_returns_envelope_and_counts(
|
||||
flow_module: types.ModuleType,
|
||||
) -> None:
|
||||
"""F069: a 404 from the orchestrator (manifest-registered verb with no
|
||||
route) must surface as a proper `invalid_state` Envelope rejection — not
|
||||
FastAPI's raw ``{"detail": "Not Found"}`` body — and the breaker must
|
||||
count it. Without this, the agent retries the missing route forever and
|
||||
the breaker never trips.
|
||||
"""A 404 from the orchestrator (manifest-registered verb with no route) must
|
||||
surface as a proper `invalid_state` Envelope rejection — not FastAPI's raw
|
||||
``{"detail": "Not Found"}`` body — and the breaker must count it.
|
||||
"""
|
||||
factory, captured = _make_404_client()
|
||||
with patch("httpx.Client", side_effect=factory):
|
||||
|
||||
Reference in New Issue
Block a user