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:
@@ -1065,16 +1065,10 @@ async def test_ensure_branch_raises_when_neither_project_nor_product() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_finalize_claim_rollback_emits_reversal_audit() -> None:
|
||||
"""F060: when branch creation fails mid-claim, the rollback must emit a
|
||||
REVERSAL audit row (CLAIMED -> original) so the audit journey doesn't
|
||||
diverge from the real (rolled-back) task state.
|
||||
|
||||
The audit service writes on its own connection (fire-and-forget), so the
|
||||
forward `task.claimed` row committed at the pre-branch flush is NOT undone
|
||||
by the rollback's flush. Without a matching reversal row, the journey's
|
||||
last event stays `task.claimed` while the task is back to PENDING — the
|
||||
audit trail diverges from real state and corrupts every downstream metric
|
||||
reconstructed from `task.<status>` events (cycle time, bottlenecks).
|
||||
"""When branch creation fails mid-claim, the rollback must emit a REVERSAL
|
||||
audit row (CLAIMED -> original) so the audit journey matches the real
|
||||
(rolled-back) task state. The audit service writes on its own connection, so
|
||||
the forward `task.claimed` row is NOT undone by the rollback's flush.
|
||||
"""
|
||||
session = MagicMock()
|
||||
session.flush = AsyncMock()
|
||||
@@ -1121,19 +1115,11 @@ async def test_finalize_claim_rollback_emits_reversal_audit() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_emit_status_transition_audit_writes_in_session_atomically() -> None:
|
||||
"""F061/F073/F075: the status-transition audit row is written into the
|
||||
CALLER's session (same transaction as the transition), not fire-and-forget
|
||||
on a separate connection.
|
||||
|
||||
Fire-and-forget decouples the audit commit from the transition commit:
|
||||
a transition that rolls back inside a verb savepoint leaves a PHANTOM audit
|
||||
row (F075), and a swallowed persist failure means a committed transition
|
||||
can have NO audit row (F073) — silently corrupting the cycle-time /
|
||||
bottleneck metrics reconstructed from ``task.<status>`` events (F061).
|
||||
Writing the row in-session makes it commit/roll back atomically with the
|
||||
transition, closing all three. Asserted at the unit level: the row is
|
||||
``session.add``-ed (same txn) with the metric-reconstruction details, and
|
||||
NO fire-and-forget background task is spawned.
|
||||
"""The status-transition audit row is written into the CALLER's session (same
|
||||
transaction as the transition), not fire-and-forget on a separate connection,
|
||||
so it commits/rolls back atomically with the transition and cannot diverge
|
||||
from real state. Asserted at the unit level: the row is ``session.add``-ed
|
||||
(same txn) and NO fire-and-forget background task is spawned.
|
||||
"""
|
||||
session = MagicMock()
|
||||
added: list[object] = []
|
||||
|
||||
Reference in New Issue
Block a user