{"record":{"id":"5ae396c9f11bf456","repo":"affaan-m/ECC","slug":"label-has-invalid-style-evidence","errorCode":null,"errorMessage":"{label} has invalid style evidence","messagePattern":"(.+?) has invalid style evidence","errorType":"validation","errorClass":"ContractError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/contract.py","lineNumber":65,"sourceCode":"        for nested in value:\n            _validate_numeric_evidence(nested, label=label)\n\n\ndef _validate_probe_evidence(probe: Any, source_duration: float, *, label: str) -> None:\n    if not isinstance(probe, dict):\n        raise ContractError(f\"{label} lacks probe evidence\")\n    _validate_numeric_evidence(probe, label=label)\n    if probe.get(\"duration\") != source_duration:\n        raise ContractError(f\"{label} probe duration is not bound to source duration\")\n    for field in (\"sample_times\", \"scene_changes\"):\n        values = probe.get(field, [])\n        if not isinstance(values, list):\n            raise ContractError(f\"{label} has invalid {field}\")\n        for value in values:\n            _validate_media_time(value, source_duration, label=f\"{label} {field}\")\n    samples = probe.get(\"style_samples\", [])\n    if not isinstance(samples, list) or any(not isinstance(sample, dict) for sample in samples):\n        raise ContractError(f\"{label} has invalid style evidence\")\n    for sample in samples:\n        _validate_media_time(sample.get(\"time\"), source_duration, label=f\"{label} style evidence\")\n\n\ndef _sha256(path: Path) -> str:\n    if not hasattr(os, \"O_NOFOLLOW\"):\n        raise ContractError(\"secure receipt validation requires O_NOFOLLOW\")\n    descriptor = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)\n    digest = hashlib.sha256()\n    try:\n        metadata = os.fstat(descriptor)\n        if not stat.S_ISREG(metadata.st_mode):\n            raise ContractError(f\"receipt source is not a regular file: {path}\")\n        while True:\n            chunk = os.read(descriptor, 1024 * 1024)\n            if not chunk:\n                break\n            digest.update(chunk)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/contract.py#L47-L83","documentation":"This error is raised by _validate_probe_evidence in the tasteforge contract module when a probe's 'style_samples' field is malformed. The library requires style_samples to be a list of dictionaries (style evidence objects). It throws to enforce the probe contract before receipt validation proceeds, ensuring downstream style-transfer logic only ever sees well-formed evidence.","triggerScenarios":"Calling validate_artifact_receipt with a receipt whose probe object has style_samples that is not a list (e.g. a dict, string, or null), or a list containing non-dict entries (strings, numbers, nested lists).","commonSituations":"Hand-edited receipts, receipts generated by older script versions that stored style samples in a different shape, JSON round-trips that turned tuples into something unexpected, or probes copied from a different tool's output format.","solutions":["Inspect the probe's style_samples field and make it a list of dicts: [{\"time\": <number>, ...}, ...]","Regenerate the probe/receipt with the current tasteforge script version instead of hand-editing","Validate the JSON with a schema checker before calling validate_artifact_receipt","If migrating from an older format, rename/remap the old style-evidence key to style_samples"],"exampleFix":"// before\nprobe = {\"style_samples\": \"clip1@0.5, clip2@2.0\"}\n// after\nprobe = {\"style_samples\": [{\"time\": 0.5}, {\"time\": 2.0}]}","handlingStrategy":"validation","validationCode":"samples = probe.get(\"style_samples\", [])\nif not isinstance(samples, list) or any(not isinstance(s, dict) for s in samples):\n    raise ValueError(f\"{label}: style_samples must be a list of dicts\")","typeGuard":"def is_style_samples(v) -> bool:\n    return isinstance(v, list) and all(isinstance(s, dict) for s in v)","tryCatchPattern":"try:\n    validate_artifact_receipt(bundle_root)\nexcept ContractError as e:\n    if 'invalid style evidence' in str(e):\n        print(f'Fix probe style_samples shape: {e}')\n    else:\n        raise","preventionTips":["Validate probe JSON against a schema before receipt validation","Never hand-edit receipts; regenerate with the tool","Keep generator and validator versions in sync"],"tags":["validation","schema","contract"],"backgroundTag":"schema-validation-failed","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"}