fix(api): report checkpoint deletion failures and classify SSE errors
Delete checkpoints before removing business fields. Suppress only an explicit CheckpointNotFoundError; propagate storage failures and cancellation so the endpoint cannot report false success. Prefer async checkpoint deletion and fail clearly when cleanup is unsupported. Classify SSE error events as 401 for authentication, 429 for rate limits, and 500 for other failures, using the same fixed messages as non-stream responses. Errors terminate the stream without a success done event or provider exception text in the response. Validation: 286 offline tests passed (19 added), including failed-delete HTTP retry with preserved business/checkpoint state, explicit missing threads, cancellation, missing cleanup capability, and HTTP SSE errors before and after text output.
This commit is contained in:
@@ -211,8 +211,10 @@ async def test_delete_clears_business_state_and_is_idempotent():
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_tolerates_missing_checkpoint():
|
||||
from src.services.repository import CheckpointNotFoundError
|
||||
|
||||
async def missing(_session_id):
|
||||
raise RuntimeError("no such thread")
|
||||
raise CheckpointNotFoundError("no such thread")
|
||||
|
||||
service, _ = make_service()
|
||||
await service.set_info("s1", "xm1", "王五")
|
||||
|
||||
Reference in New Issue
Block a user