Commit
Β·
f9576ce
1
Parent(s):
92ee4ec
docs: Address CodeRabbit review findings
Browse files- SPEC-20: Check implementation checklist items (all completed)
- SPEC-21: Add language specifiers to fenced code blocks (text)
- SPEC-21: Fix type hints for `next` parameter (Callable[[ChatContext], Awaitable[None]])
- p3-ms-framework-gaps: Add language specifiers to exception hierarchy blocks
docs/bugs/p3-ms-framework-gaps.md
CHANGED
|
@@ -217,7 +217,7 @@ class AggregateContextProvider(ContextProvider):
|
|
| 217 |
## Gap 6: Exception Granularity (LOW VALUE)
|
| 218 |
|
| 219 |
**What MS Framework Has:**
|
| 220 |
-
```
|
| 221 |
AgentFrameworkException (base)
|
| 222 |
βββ AgentException
|
| 223 |
β βββ AgentExecutionException
|
|
@@ -239,7 +239,7 @@ AgentFrameworkException (base)
|
|
| 239 |
```
|
| 240 |
|
| 241 |
**What DeepBoner Has:**
|
| 242 |
-
```
|
| 243 |
DeepBonerError (base)
|
| 244 |
βββ SearchError
|
| 245 |
β βββ RateLimitError
|
|
|
|
| 217 |
## Gap 6: Exception Granularity (LOW VALUE)
|
| 218 |
|
| 219 |
**What MS Framework Has:**
|
| 220 |
+
```text
|
| 221 |
AgentFrameworkException (base)
|
| 222 |
βββ AgentException
|
| 223 |
β βββ AgentExecutionException
|
|
|
|
| 239 |
```
|
| 240 |
|
| 241 |
**What DeepBoner Has:**
|
| 242 |
+
```text
|
| 243 |
DeepBonerError (base)
|
| 244 |
βββ SearchError
|
| 245 |
β βββ RateLimitError
|
docs/specs/SPEC-20-PUBMED-JSON-FIX.md
CHANGED
|
@@ -69,13 +69,13 @@ pmids = search_data.get("esearchresult", {}).get("idlist", [])
|
|
| 69 |
|
| 70 |
## Implementation Checklist
|
| 71 |
|
| 72 |
-
- [
|
| 73 |
-
- [
|
| 74 |
-
- [
|
| 75 |
-
- [
|
| 76 |
-
- [
|
| 77 |
-
- [
|
| 78 |
-
- [
|
| 79 |
|
| 80 |
---
|
| 81 |
|
|
|
|
| 69 |
|
| 70 |
## Implementation Checklist
|
| 71 |
|
| 72 |
+
- [x] Add `import json` at top of file (if not present)
|
| 73 |
+
- [x] Move `search_resp.json()` inside try block (line ~88)
|
| 74 |
+
- [x] Add `except json.JSONDecodeError` handler
|
| 75 |
+
- [x] Log warning with response preview for debugging
|
| 76 |
+
- [x] Return empty list (graceful degradation)
|
| 77 |
+
- [x] Write unit test: mock response with HTML content
|
| 78 |
+
- [x] Run `make check` (lint + typecheck + test)
|
| 79 |
|
| 80 |
---
|
| 81 |
|
docs/specs/SPEC-21-MIDDLEWARE-ARCHITECTURE.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
|
| 19 |
## Current State (WRONG)
|
| 20 |
|
| 21 |
-
```
|
| 22 |
src/
|
| 23 |
βββ middleware/ β MISLEADING: contains workflow
|
| 24 |
β βββ __init__.py
|
|
@@ -38,7 +38,7 @@ except Exception as e:
|
|
| 38 |
|
| 39 |
## Target State (CORRECT)
|
| 40 |
|
| 41 |
-
```
|
| 42 |
src/
|
| 43 |
βββ workflows/ β RENAMED: now accurate
|
| 44 |
β βββ __init__.py
|
|
@@ -95,7 +95,7 @@ __all__ = ["RetryMiddleware", "TokenTrackingMiddleware"]
|
|
| 95 |
"""Retry middleware for chat clients with exponential backoff."""
|
| 96 |
|
| 97 |
import asyncio
|
| 98 |
-
from typing import
|
| 99 |
|
| 100 |
import structlog
|
| 101 |
from agent_framework._middleware import ChatContext, ChatMiddleware
|
|
@@ -150,7 +150,9 @@ class RetryMiddleware(ChatMiddleware):
|
|
| 150 |
wait = self.min_wait * (2 ** attempt)
|
| 151 |
return min(wait, self.max_wait)
|
| 152 |
|
| 153 |
-
async def process(
|
|
|
|
|
|
|
| 154 |
"""Process the chat request with retry logic."""
|
| 155 |
last_error: Exception | None = None
|
| 156 |
|
|
@@ -198,7 +200,7 @@ class RetryMiddleware(ChatMiddleware):
|
|
| 198 |
"""Token tracking middleware for monitoring API usage."""
|
| 199 |
|
| 200 |
from contextvars import ContextVar
|
| 201 |
-
from typing import
|
| 202 |
|
| 203 |
import structlog
|
| 204 |
from agent_framework._middleware import ChatContext, ChatMiddleware
|
|
@@ -226,7 +228,9 @@ class TokenTrackingMiddleware(ChatMiddleware):
|
|
| 226 |
self.total_output_tokens = 0
|
| 227 |
self.request_count = 0
|
| 228 |
|
| 229 |
-
async def process(
|
|
|
|
|
|
|
| 230 |
"""Process request and track token usage."""
|
| 231 |
await next(context)
|
| 232 |
|
|
|
|
| 18 |
|
| 19 |
## Current State (WRONG)
|
| 20 |
|
| 21 |
+
```text
|
| 22 |
src/
|
| 23 |
βββ middleware/ β MISLEADING: contains workflow
|
| 24 |
β βββ __init__.py
|
|
|
|
| 38 |
|
| 39 |
## Target State (CORRECT)
|
| 40 |
|
| 41 |
+
```text
|
| 42 |
src/
|
| 43 |
βββ workflows/ β RENAMED: now accurate
|
| 44 |
β βββ __init__.py
|
|
|
|
| 95 |
"""Retry middleware for chat clients with exponential backoff."""
|
| 96 |
|
| 97 |
import asyncio
|
| 98 |
+
from typing import Awaitable, Callable
|
| 99 |
|
| 100 |
import structlog
|
| 101 |
from agent_framework._middleware import ChatContext, ChatMiddleware
|
|
|
|
| 150 |
wait = self.min_wait * (2 ** attempt)
|
| 151 |
return min(wait, self.max_wait)
|
| 152 |
|
| 153 |
+
async def process(
|
| 154 |
+
self, context: ChatContext, next: Callable[[ChatContext], Awaitable[None]]
|
| 155 |
+
) -> None:
|
| 156 |
"""Process the chat request with retry logic."""
|
| 157 |
last_error: Exception | None = None
|
| 158 |
|
|
|
|
| 200 |
"""Token tracking middleware for monitoring API usage."""
|
| 201 |
|
| 202 |
from contextvars import ContextVar
|
| 203 |
+
from typing import Awaitable, Callable
|
| 204 |
|
| 205 |
import structlog
|
| 206 |
from agent_framework._middleware import ChatContext, ChatMiddleware
|
|
|
|
| 228 |
self.total_output_tokens = 0
|
| 229 |
self.request_count = 0
|
| 230 |
|
| 231 |
+
async def process(
|
| 232 |
+
self, context: ChatContext, next: Callable[[ChatContext], Awaitable[None]]
|
| 233 |
+
) -> None:
|
| 234 |
"""Process request and track token usage."""
|
| 235 |
await next(context)
|
| 236 |
|