{"record":{"id":"451bdde975267e35","repo":"affaan-m/ECC","slug":"native-clip-state-is-incomplete","errorCode":null,"errorMessage":"native clip state is incomplete","messagePattern":"native clip state is incomplete","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":236,"sourceCode":"        if not re.fullmatch(r\"(?:video|audio)[1-9][0-9]*\", track) or not isinstance(clips, list):\n            raise ValueError(\"invalid native snapshot track\")\n        for clip in clips:\n            _check_clip(clip, bounds)\n    return tracks\n\n\ndef _check_clip(clip: Any, bounds: list[int]) -> None:\n    required = {\"path\", \"name\", \"start\", \"end\", \"left_offset\", \"right_offset\", \"enabled\", \"properties\"}\n    if not isinstance(clip, dict) or not required <= clip.keys():\n        raise ValueError(\"native snapshot clip is incomplete\")\n    _range([clip[\"start\"], clip[\"end\"]], bounds)\n    _integer(clip[\"left_offset\"])\n    _integer(clip[\"right_offset\"])\n    if clip[\"path\"] is not None:\n        _text(clip[\"path\"])\n    _text(clip[\"name\"])\n    if type(clip[\"enabled\"]) is not bool or not isinstance(clip[\"properties\"], dict):\n        raise ValueError(\"native clip state is incomplete\")\n\n\ndef _binding(item: Any, tracks: dict, baseline: dict, *, audio: bool = False) -> tuple:\n    _object(item, {\"media\", \"track\", \"clip_index\", \"media_frames\", \"fps\",\n                   \"source_range\", \"timeline_range\"})\n    track, index = _text(item[\"track\"]), _integer(item[\"clip_index\"])\n    if not track.startswith(\"audio\" if audio else \"video\"):\n        raise ValueError(\"wrong source/audio track kind\")\n    if track not in tracks or index >= len(tracks[track]):\n        raise ValueError(\"source binding has no native clip\")\n    clip = tracks[track][index]\n    _artifact(item[\"media\"])\n    if item[\"media\"][\"path\"] != clip[\"path\"]:\n        raise ValueError(\"source path does not match native clip\")\n    if _rate(item[\"fps\"]) != _rate(baseline[\"fps\"]):\n        raise ValueError(\"source fps/retime ambiguity\")\n    duration = clip[\"end\"] - clip[\"start\"]\n    capacity = _integer(item[\"media_frames\"], 1)","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L218-L254","documentation":"Raised by _check_clip after the required keys exist: it verifies that clip['enabled'] is exactly a bool (type() is bool, so 0/1 fail) and that clip['properties'] is a dict. It enforces correct types on clip state fields.","triggerScenarios":"A clip whose 'enabled' is 0/1, an int, a string like 'true', or None; or whose 'properties' is a list, None, or a missing-but-None value that is not a dict.","commonSituations":"Snapshots exported from systems where booleans serialize as ints; clip properties accumulated as a list of key/value tuples; YAML/JSON round-trips converting True to 1.","solutions":["Set clip['enabled'] to a real Python/JSON boolean true or false, not 0/1 or 'true'.","Set clip['properties'] to a dict (even empty {}), not a list or None.","Normalize the snapshot before use: clip['enabled'] = bool(clip['enabled']); clip['properties'] = dict(clip['properties'] or {})."],"exampleFix":"// before\n{'enabled': 1, 'properties': [('speed', 1.0)]}\n// after\n{'enabled': True, 'properties': {'speed': 1.0}}","handlingStrategy":"type-guard","validationCode":"for t, clips in snapshot['timeline_readback'].items():\n    for clip in clips:\n        assert type(clip['enabled']) is bool, f\"{t}: enabled not bool\"\n        assert isinstance(clip['properties'], dict), f\"{t}: properties not dict\"","typeGuard":"def has_valid_clip_state(clip) -> bool:\n    return type(clip.get('enabled')) is bool and isinstance(clip.get('properties'), dict)","tryCatchPattern":"try:\n    bundle = build_application_bundle(...)\nexcept ValueError as e:\n    if 'native clip state is incomplete' in str(e):\n        # coerce then retry once\n        for clips in snapshot['timeline_readback'].values():\n            for c in clips:\n                c['enabled'] = bool(c['enabled'])\n                c['properties'] = dict(c['properties'] or {})\n    raise","preventionTips":["Serialize booleans as true/false, never 0/1","Ensure serializers keep properties as a JSON object, not an array of pairs","Add a snapshot schema test asserting bool/dict types"],"tags":["validation","snapshot","type-mismatch"],"backgroundTag":"type-mismatch","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"}