{"record":{"id":"ab058f05dfb938c0","repo":"affaan-m/ECC","slug":"insert-overlaps-protected-original-stack","errorCode":null,"errorMessage":"insert overlaps protected original stack","messagePattern":"insert overlaps protected original stack","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":320,"sourceCode":"        expected = {\"source_sha256\": source_hash, \"compiled_input_sha256\": input_hash,\n                    \"candidate_sha256\": item[\"media\"][\"sha256\"], \"source_url\": source_url}\n        if any(evidence.get(key) != value for key, value in expected.items()):\n            raise ValueError(\"historical evidence does not bind the candidate source/input/bytes\")\n        result[name] = item\n    return result\n\n\ndef _inserts(items: list, candidates: dict, config: dict, input_hash: str, edit_hash: str) -> None:\n    occupied = []\n    for item in items:\n        _object(item, {\"candidate_id\", \"candidate_range\", \"timeline_range\", \"retime\", \"approval_file\"})\n        candidate = candidates.get(_text(item[\"candidate_id\"]))\n        if candidate is None or candidate[\"review_status\"] != \"approved\":\n            raise ValueError(\"insert requires an approved, resolved candidate\")\n        target = _range(item[\"timeline_range\"], config[\"baseline\"][\"timeline_range\"])\n        source = _range(item[\"candidate_range\"], [0, candidate[\"media_frames\"]])\n        if any(_overlap(target, p[\"range\"]) for p in config[\"protected_intervals\"]):\n            raise ValueError(\"insert overlaps protected original stack\")\n        if any(_overlap(target, span) for span in occupied):\n            raise ValueError(\"insert proposals overlap\")\n        if (item[\"retime\"] != \"none\" or target[1] - target[0] != source[1] - source[0]\n                or _rate(candidate[\"fps\"]) != _rate(config[\"baseline\"][\"fps\"])):\n            raise ValueError(\"candidate fps/duration/retime ambiguity\")\n        evidence = _artifact(item[\"approval_file\"], parse_json=True)\n        expected = {\"status\": \"approved\", \"candidate_sha256\": candidate[\"media\"][\"sha256\"],\n                    \"source_sha256\": config[\"source\"][\"media\"][\"sha256\"],\n                    \"compiled_input_sha256\": input_hash,\n                    \"edit_context_sha256\": edit_hash,\n                    \"candidate_range\": source, \"timeline_range\": target}\n        if not isinstance(evidence, dict) or any(\n                _canonical(evidence.get(key)) != _canonical(value) for key, value in expected.items()):\n            raise ValueError(\"approval evidence must bind exact source, candidate and placement\")\n        occupied.append(target)\n\n\ndef build_application_bundle(config: dict, compiled_input: dict | None, *, local_only: bool = False) -> dict:","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L302-L338","documentation":"An insert's target timeline_range must not overlap any protected interval from the config. Protected intervals mark regions where original footage must remain untouched; inserting generated footage there would violate that guarantee, so _inserts rejects the proposal.","triggerScenarios":"An insert proposal whose timeline_range [start, end] intersects one of config['protected_intervals'] ranges. Happens when the insert plan was made before protection marks were added, or ranges were nudged after retiming.","commonSituations":"User protects a region after insert proposals were drafted; off-by-one or unit mistakes (seconds vs frames) making ranges appear to overlap; overlapping-by-a-single-frame boundary conditions.","solutions":["Move the insert's timeline_range outside all protected intervals, or shrink it to avoid overlap","Remove the conflicting protected interval if protection is no longer needed there (and rebuild the bundle)","Recompute the insert layout programmatically from the protected intervals so ranges never collide"],"exampleFix":"// before\nprotected: [4000, 4800]; insert timeline_range: [4600, 5400]\n// after\ninsert timeline_range: [4800, 5600]  // starts after protected interval","handlingStrategy":"validation","validationCode":"function assertNoProtectedOverlap(inserts, protectedIntervals) {\n  for (const ins of inserts) {\n    for (const p of protectedIntervals) {\n      if (ins.timeline_range[0] < p.range[1] && p.range[0] < ins.timeline_range[1])\n        throw new Error(`insert ${ins.candidate_id} overlaps protected range`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  buildApplicationBundle(cfg);\n} catch (e) {\n  if (e.message.includes(\"insert overlaps protected original stack\")) {\n    cfg.inserts = relocateOutsideProtected(cfg.inserts, cfg.protected_intervals);\n    return buildApplicationBundle(cfg);\n  }\n  throw e;\n}","preventionTips":["Schedule inserts against the protected-interval map, not before it exists","Keep timeline units consistent (frames vs seconds) across protection and insert planning","Leave guard gaps at protected-interval boundaries to absorb off-by-one errors"],"tags":["protected-regions","overlap","inserts"],"backgroundTag":"conflicting-config-options","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"}