-
Notifications
You must be signed in to change notification settings - Fork 79
Description
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
- CCExtractorTester reports a negative
runTimevalue due to timestamp calculation issues - The value is passed to
finish_type_request()inmod_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.