Download data.jsonl from Mobiusi/Mine-Safety-Monitoring-Sensor-Integration-Code-Verification-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/datasets/Mobiusi/Mine-Safety-Monitoring-Sensor-Integration-Code-Verification-Dataset/resolve/main/data.jsonl
- Command line
-
hf download hf://datasets/Mobiusi/Mine-Safety-Monitoring-Sensor-Integration-Code-Verification-Dataset/data.jsonl
-
curl -L -o data.jsonl https://huggingface.co/datasets/Mobiusi/Mine-Safety-Monitoring-Sensor-Integration-Code-Verification-Dataset/resolve/main/data.jsonl
2.35 kB
| {"root_cause": "The comparison uses age_seconds < max_age_seconds to raise the stale-reading error; the condition is reversed for detecting readings that exceed the maximum permitted age.", "source_code": "def validate_reading_time(timestamp, now, max_age_seconds):\n age_seconds = (now - timestamp).total_seconds()\n if age_seconds < max_age_seconds:\n raise ValueError(\"reading is stale\")\n return age_seconds\n", "defect_category": "Stale-reading validation", "validation_result": "Invalid: the age check rejects fresh readings and accepts readings older than the limit.", "validation_explanation": "For a reading younger than the configured limit, the condition is true and the function raises an error. For a reading older than the limit, the condition is false and the age is returned, allowing the stale reading through."} | |
| {"root_cause": "payload.get(\"value\", 0.0) substitutes a numeric default when the value key is absent, and the function returns that value as a parsed reading without indicating that the measurement was missing.", "source_code": "def parse_reading(payload):\n value = float(payload.get(\"value\", 0.0))\n timestamp = int(payload[\"timestamp\"])\n return {\"value\": value, \"timestamp\": timestamp}\n", "defect_category": "Missing-value handling", "validation_result": "Invalid: a reading with a missing value is accepted as 0.0.", "validation_explanation": "When payload has a timestamp but no value key, the lookup returns 0.0 and float conversion succeeds. The function then returns a normal reading, so downstream checks cannot distinguish the absent measurement from an actual zero."} | |
| {"root_cause": "The function checks only whether the value is below lower_bound; it never compares the value with upper_bound.", "source_code": "def validate_reading(reading, lower_bound, upper_bound):\n value = float(reading[\"value\"])\n if value < lower_bound:\n raise ValueError(\"reading is below the permitted range\")\n return value\n", "defect_category": "Out-of-range validation", "validation_result": "Invalid: values above upper_bound are accepted.", "validation_explanation": "A value greater than upper_bound does not satisfy the sole rejection condition, so the function returns it as valid. The range check is incomplete and permits readings above the configured limit."} | |