发布

  • [OPIK-7362] [BE] fix: null-safe PythonEvaluatorService response handling (#7494)

    frostbyte_neo 发布于 2026-07-16 16:24:23 +00:00

    • [OPIK-7362] [BE] fix: null-safe PythonEvaluatorService response handling

    processResponse dereferenced readEntity(...) results directly, so a null or empty
    body (which can occur when the entity is read on the boundedElastic hop after the
    underlying connection is recycled) threw a bare NullPointerException -> HTTP 500
    instead of a clean error. Buffer before reading, null-check the body and scores,
    and on non-2xx surface the backend error text, falling back to the raw body when
    the structured error is blank so the detail is not lost. Adds unit tests for the
    null-body and blank-error cases.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-7362] [BE] Address review: demote expected parse-failure log, bound error text, parameterize tests
    • extractErrorMessage: demote the expected structured-parse fallback to debug (it
      fires on every non-structured body); keep the raw-body read failure at warn.
    • Bound the surfaced backend error text to 500 chars so an oversized payload can't
      bloat the thrown exception, while still surfacing the evaluated metric's own error.
    • Collapse the null-body/null-scores and null/blank-error test pairs into two
      @ParameterizedTest methods (verified they run: 4 invocations, 18/18 total).

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-7362] [BE] test: cover whitespace-blank and >500-char truncation paths

    Review follow-up: the error-path cases used short non-blank strings, leaving the
    StringUtils.isNotBlank() whitespace branch and the MAX_ERROR_MESSAGE_LENGTH cap
    untested. Switch the blank case to whitespace-only and add a test asserting an
    overlong backend body is surfaced truncated to 500 chars.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

    • [OPIK-7362] [BE] Address review: quote statusCode in error messages

    Review nit (andrescrz): surround the printed statusCode with single quotes in the
    InternalServerErrorException messages, matching the codebase convention for
    interpolated values. Update the affected test assertion accordingly.

    Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com


    Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com

    下载附件