{"record":{"id":"361034383fed0df5","repo":"affaan-m/ECC","slug":"reference-probe-field-must-contain-finite-in-duration-times","errorCode":null,"errorMessage":"reference probe {field} must contain finite in-duration times","messagePattern":"reference probe (.+?) must contain finite in-duration times","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/workflow.py","lineNumber":155,"sourceCode":"                require_finite_evidence(nested)\n        elif isinstance(value, list):\n            for nested in value:\n                require_finite_evidence(nested)\n\n    require_finite_evidence(measured)\n    duration = measured.get(\"duration\")\n    if not _finite_real(duration):\n        raise ValueError(\"reference probe duration must be finite and positive\")\n    duration = cast(float, duration)\n    if float(duration) <= 0:\n        raise ValueError(\"reference probe duration must be finite and positive\")\n    for field in (\"sample_times\", \"scene_changes\"):\n        values = measured.get(field, [])\n        if not isinstance(values, list) or any(\n            not _finite_real(value) or float(value) < 0 or float(value) > float(duration)\n            for value in values\n        ):\n            raise ValueError(f\"reference probe {field} must contain finite in-duration times\")\n    samples = measured.get(\"style_samples\", [])\n    if not isinstance(samples, list) or any(\n        not isinstance(sample, dict)\n        or not _finite_real(sample.get(\"time\"))\n        or float(cast(float, sample[\"time\"])) < 0\n        or float(cast(float, sample[\"time\"])) > float(duration)\n        for sample in samples\n    ):\n        raise ValueError(\"reference style evidence times must be finite and within duration\")\n    return float(duration)\n\n\nclass _SafeOutput:\n    \"\"\"Descriptor-bound output tree with no-follow traversal and atomic writes.\"\"\"\n\n    def __init__(self, root: Path) -> None:\n        self._root_fd = -1\n        if not hasattr(os, \"O_NOFOLLOW\") or not hasattr(os, \"O_DIRECTORY\"):","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/workflow.py#L137-L173","documentation":"_validate_probe requires the 'sample_times' and 'scene_changes' lists of the measured probe to contain only finite real timestamps in [0, duration]. A non-list value, a non-numeric/NaN/inf entry, or a timestamp outside the probe duration triggers this error. It prevents out-of-range times from corrupting style-sampling logic.","triggerScenarios":"run_workflow receiving measured['sample_times'] or measured['scene_changes'] that is not a list, or contains a negative number, a value greater than 'duration', NaN/inf, or a non-numeric element.","commonSituations":"Scene-detection script emitting times in milliseconds while duration is in seconds; negative timestamps from misaligned offsets; nulls in the list where a detector failed to report; times captured before duration was finalized.","solutions":["Clamp/filter all entries to 0 <= t <= duration and drop non-numeric values before calling run_workflow","Fix the unit mismatch (e.g. divide ms values by 1000) in the probe-producing tool","Regenerate the probe so sample_times/scene_changes are plain lists of finite numbers","Pre-validate the lists with math.isfinite and bounds checks at load time"],"exampleFix":"# before\nmeasured['scene_changes'] = [0, 4.2, 17.9]   # duration is 12.0 -> 17.9 out of range\nrun_workflow(measured)\n\n# after\ndur = measured['duration']\nmeasured['scene_changes'] = [t for t in measured['scene_changes']\n                             if isinstance(t, (int, float)) and math.isfinite(t) and 0 <= t <= dur]\nrun_workflow(measured)","handlingStrategy":"validation","validationCode":"import math\ndef validate_times(measured):\n    dur = float(measured['duration'])\n    for field in ('sample_times', 'scene_changes'):\n        vals = measured.get(field, [])\n        if not isinstance(vals, list):\n            return False\n        if any(not isinstance(v, (int, float)) or isinstance(v, bool)\n               or not math.isfinite(v) or not (0 <= v <= dur) for v in vals):\n            return False\n    return True","typeGuard":"def valid_time_list(vals, dur: float) -> bool:\n    return isinstance(vals, list) and all(\n        isinstance(v, (int, float)) and not isinstance(v, bool)\n        and math.isfinite(v) and 0 <= float(v) <= dur for v in vals)","tryCatchPattern":"try:\n    run_workflow(measured)\nexcept ValueError as e:\n    if 'in-duration times' in str(e):\n        field = str(e).split()[2]\n        print(f'Fix {field}: times must be numbers within [0, {measured[\"duration\"]}]')\n    else:\n        raise","preventionTips":["Clamp or filter timestamps against duration before calling the workflow","Check units (seconds vs milliseconds) between detector output and probe duration","Drop null entries from detector lists at ingestion","Write a unit test for probe validation with boundary times 0 and duration"],"tags":["validation","python","input-validation"],"backgroundTag":"value-out-of-range","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}