Skip to content

Commit 610454e

Browse files
fix(events,ci): Phase E review fixes — DLQ structlog + CI slow-test filter
Two findings from the Phase E batched review: 1. CRITICAL: .github/workflows/pr.yml ran `pytest apps/api/tests` with no marker filter. Task 26's slow integration test (310s sleep for reaper idle-threshold validation) would block every PR CI for 5+ minutes. Added `-m "not slow"` to the api pytest step with an inline comment. 2. Important: dlq.py wrote to the DLQ stream silently. Added structlog `get_logger(__name__)` and a `logger.warning("dlq.routed", ...)` call inside `route()` so DLQ events surface in observability. Tests still pass (3 passed, 1 slow deselected). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 533605f commit 610454e

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ jobs:
127127
- run: uv sync --all-packages --extra dev
128128
- run: uv run --package lockin-api python -m ruff check apps/api
129129
- run: uv run --package lockin-api python -m mypy apps/api/app
130-
- run: uv run --package lockin-api python -m pytest apps/api/tests
130+
# `slow` marker excluded: long-running integration tests (e.g., 5min sleep
131+
# for reaper-idle validation) run only on schedule or manual trigger, not on PRs.
132+
- run: uv run --package lockin-api python -m pytest apps/api/tests -m "not slow"
131133

132134
python-mcp:
133135
needs: detect

apps/api/app/events/dlq.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515

1616
from redis.asyncio import Redis
1717

18+
from app.core.logging import get_logger
1819
from app.events.streams import dlq_stream
1920

21+
logger = get_logger(__name__)
22+
2023
MAX_DELIVERIES = 3
2124

2225

@@ -49,4 +52,14 @@ async def route(
4952
"failure_count": str(failure_count),
5053
"original_payload": json.dumps(original_payload),
5154
}
52-
return str(await self._redis.xadd(dlq_stream(source_stream, consumer_group), entry))
55+
msg_id = str(await self._redis.xadd(dlq_stream(source_stream, consumer_group), entry))
56+
logger.warning(
57+
"dlq.routed",
58+
source_stream=source_stream,
59+
consumer_group=consumer_group,
60+
original_id=original_id,
61+
error_class=type(exc).__name__,
62+
failure_count=failure_count,
63+
dlq_msg_id=msg_id,
64+
)
65+
return msg_id

0 commit comments

Comments
 (0)