Skip to content

[BUG] : Negative runtime values are stored in test results #1072

@Hell1213

Description

@Hell1213

In raising this issue, I confirm the following:

  • I have read and understood the contributors guide.
  • I have checked that the bug-fix I am reporting can be replicated.
  • I have checked that the issue I'm posting isn't already reported.
  • I have checked that the issue I'm posting isn't already solved and no duplicates exist in closed issues and in opened issues.
  • I have checked the pull requests tab for existing solutions/implementations to my issue.

My familiarity with the project is as follows:

  • I have used the platform extensively, but have not contributed previously.

Problem

TestResult.runtime stores the value of runTime from CCExtractorTester without validation. CCExtractorTester can report negative values due to a timestamp calculation bug in that tool. These invalid values are written directly to the database and displayed on test result pages.

Steps to Reproduce

  1. CCExtractorTester reports a negative runTime value due to timestamp calculation issues
  2. The value is passed to finish_type_request() in mod_ci/controllers.py
  3. The negative value is stored directly in the database without validation

Environment

  • Sample Platform: current master (local dev)
  • Affected code: mod_ci/controllers.py::finish_type_request

Expected Behavior

Runtime values should be validated and negative values should be handled appropriately (e.g., clamped to 0 with a warning logged).

Actual Behavior

Negative runtime values are stored directly in the database and displayed on test result pages.

Impact

  • Invalid data in the database
  • Confusing display of negative runtime values to users
  • No diagnostic information about the underlying CCExtractorTester bug

Proposed Solution

Add input validation in finish_type_request() before constructing the TestResult record. Negative values should be clamped to 0 and a warning should be logged with the test ID and original value for diagnostic purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions