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:
@@ -1,17 +1,8 @@
|
||||
"""F107 — Redis bus publish must be deferred until the DB commit lands.
|
||||
"""Redis bus publish must be deferred until the DB commit lands so a rollback
|
||||
drops the event (no phantom notification for a row that never became durable).
|
||||
|
||||
`NotificationDeliveryService.deliver` historically published
|
||||
``NOTIFICATION_SENT`` to the Redis event bus *before* the caller committed
|
||||
the notification row. A commit failure (DB hiccup, constraint, asyncpg error)
|
||||
rolled the row back but left the bus event behind — connected WebSocket
|
||||
clients received a push for an id that no longer existed (a phantom
|
||||
notification). The fix defers the bus publish to the session's
|
||||
``after_commit`` so a rollback drops it; the row is durable by the time the
|
||||
event fires.
|
||||
|
||||
These tests need a real ``AsyncSession`` (the deferral uses SQLAlchemy
|
||||
session commit/rollback events) plus a recording bus stand-in, so they are
|
||||
integration tests against the migrated Postgres test DB.
|
||||
Integration tests against the migrated Postgres DB: the deferral uses
|
||||
SQLAlchemy ``after_commit`` events and a recording bus stand-in.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -129,12 +120,8 @@ async def _seed_agents_and_notification(
|
||||
async def test_deliver_does_not_publish_before_commit(
|
||||
db_session: AsyncSession, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""The bus event must NOT fire until the session commits (F107).
|
||||
|
||||
Currently RED: ``deliver`` publishes immediately, so the bus is non-empty
|
||||
before any commit — the phantom window. With the deferred-publish fix,
|
||||
``deliver`` only schedules; the event fires on commit.
|
||||
"""
|
||||
"""The bus event must NOT fire until the session commits — ``deliver``
|
||||
only schedules; the event fires on commit."""
|
||||
bus = _RecordingBus()
|
||||
monkeypatch.setattr(
|
||||
"roboco.services.notification_delivery.get_event_bus", lambda: bus
|
||||
@@ -152,7 +139,7 @@ async def test_deliver_does_not_publish_before_commit(
|
||||
async def test_deliver_publishes_after_commit(
|
||||
db_session: AsyncSession, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Commit drains the deferred publish — one event per recipient (F107)."""
|
||||
"""Commit drains the deferred publish — one event per recipient."""
|
||||
bus = _RecordingBus()
|
||||
monkeypatch.setattr(
|
||||
"roboco.services.notification_delivery.get_event_bus", lambda: bus
|
||||
@@ -179,7 +166,7 @@ async def test_deliver_rollback_drops_phantom(
|
||||
db_session: AsyncSession, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""A rollback instead of commit drops the pending publish — no phantom
|
||||
event for a row that never became durable (F107)."""
|
||||
event for a row that never became durable."""
|
||||
bus = _RecordingBus()
|
||||
monkeypatch.setattr(
|
||||
"roboco.services.notification_delivery.get_event_bus", lambda: bus
|
||||
|
||||
Reference in New Issue
Block a user