DEV Community

SparkLLM
SparkLLM

Posted on

Checking an empty-input defect with Spark-X2.5 and OpenCodeReview locally

Checking an empty-input defect with Spark-X2.5 and OpenCodeReview locally

An empty list crashed a synthetic scoring function that promised 0.0 for empty input. We reproduced the failure, ran a real local OpenCodeReview scan with Spark-X2.5-1.7B, manually added a guard, and checked the same function again.

OpenCodeReview appears in the GitHub Trending monthly snapshot captured at 12:17:22 Asia/Shanghai on 2026-10-14. For this example, its role is to select score.py and collect structured review comments. Spark-X2.5-1.7B supplies the local model review. Python assertions check the function's behavior.

The actual environment is Windows, the official OpenCodeReview v1.13.0 binary, and llama.cpp / llama-server.exe using community Q4_K_M GGUF weights derived from XHToken/Spark-X2.5-1.7B. The tools are connected through a local OpenAI-compatible endpoint.

The reproduced boundary failure

def mean_score(scores):
    """Return the mean score; an empty list must return 0.0."""
    return sum(scores) / len(scores)
Enter fullscreen mode Exit fullscreen mode

The initial public-function test checked [2, 4] successfully, then mean_score([]) raised ZeroDivisionError at the division and the test process exited with code 1.

The native review saved two overlapping comments on score.py lines 1–3. Both include the missing empty-input handling. The following image is taken from the same recording used in the video. The CLI reads back the original response from that completed review, including its exact relevant excerpt and source session. This readback is not a new model call.

Same-review response readback used in the video

The matching test makes this particular concern checkable. Two overlapping comments are treated as one empty-input issue in this example.

Manual change and public-function verification

We manually placed an empty-input branch before division:

def mean_score(scores):
    """Return the mean score; an empty list must return 0.0."""
    if not scores:
        return 0.0
    return sum(scores) / len(scores)
Enter fullscreen mode Exit fullscreen mode

Actual saved empty-input guard used in the video

Calling the same function produced [] → 0.0 and [2, 4] → 3.0; both assertions passed and the process exited 0.

Same actual function verification used in the video

Reuse the verified steps

Concrete inputs and assertions provide a repeatable check for a concrete review comment. Get the official Windows release, Git and a local endpoint that returns valid tool calls. First verify file selection in a test repository:

ocr scan --repo <test-repository> --path score.py --preview
Enter fullscreen mode Exit fullscreen mode

When invoking the downloaded Windows release directly, use its actual filename opencodereview-windows-amd64.exe as the command entry. Once file selection is correct, run scan and check its specific comments with boundary inputs through the public function interface.

Music: “Minuet in G major” (attributed to Georg Böhm); performed and published by Jewgeni Smirnow (digital keyboard); IMSLP #1060512; CC BY 4.0. Excerpt, level adjustment, fades and mix under narration.
Source: https://imslp.org/wiki/Minuet_in_G_major_(B%C3%B6hm,_Georg)#IMSLP1060512
License: https://creativecommons.org/licenses/by/4.0/

Top comments (0)