Skip to content

Commit 1db044a

Browse files
SudipSinhaclaude
andcommitted
docs(consumer): restore explanatory comments removed in #160
Addresses review feedback from @RobGeada on PR #160. Three comments were removed during the gzip middleware refactor that document non-obvious behavior: - get_partial_payload() auto-deletes the matched partial on retrieval - Type guard checks are defensive (should never happen at runtime) - Final raise is unreachable due to type annotation (explicit fallback) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sudip Sinha <Sudip.Sinha@RedHat.com>
1 parent 028f93c commit 1db044a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/trustyai_service/endpoints/consumer/consumer_endpoint.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,13 @@ async def process_cloud_event(
483483
)
484484
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail=msg)
485485
logger.info("KServe Inference Input %s received.", payload.id)
486+
# If a match is found, the partial payload is auto-deleted from storage
486487
partial_output = await storage_interface.get_partial_payload(
487488
payload.id, is_input=False, is_modelmesh=False
488489
)
489490
if partial_output is not None:
490491
if not isinstance(partial_output, KServeInferenceResponse):
492+
# Should never happen — indicates storage interface error
491493
raise HTTPException(
492494
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
493495
detail="Invalid payload type from storage",
@@ -514,11 +516,13 @@ async def process_cloud_event(
514516
payload.id,
515517
payload.model_name,
516518
)
519+
# If a match is found, the partial payload is auto-deleted from storage
517520
partial_input = await storage_interface.get_partial_payload(
518521
payload.id, is_input=True, is_modelmesh=False
519522
)
520523
if partial_input is not None:
521524
if not isinstance(partial_input, KServeInferenceRequest):
525+
# Should never happen — indicates storage interface error
522526
raise HTTPException(
523527
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
524528
detail="Invalid payload type from storage",
@@ -534,6 +538,7 @@ async def process_cloud_event(
534538
"message": f"Output payload {payload.id} processed successfully",
535539
}
536540

541+
# Unreachable due to type annotation, but explicit fallback for type safety
537542
raise HTTPException(
538543
status_code=HTTPStatus.BAD_REQUEST,
539544
detail="Payload must be either KServeInferenceRequest or KServeInferenceResponse",

0 commit comments

Comments
 (0)