In raising this issue, I confirm the following:
My familiarity with the project is as follows:
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
- CCExtractorTester reports a negative
runTime value due to timestamp calculation issues
- The value is passed to
finish_type_request() in mod_ci/controllers.py
- 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.
In raising this issue, I confirm the following:
My familiarity with the project is as follows:
Problem
TestResult.runtimestores the value ofrunTimefrom 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
runTimevalue due to timestamp calculation issuesfinish_type_request()inmod_ci/controllers.pyEnvironment
master(local dev)mod_ci/controllers.py::finish_type_requestExpected 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
Proposed Solution
Add input validation in
finish_type_request()before constructing theTestResultrecord. Negative values should be clamped to 0 and a warning should be logged with the test ID and original value for diagnostic purposes.