{"record":{"id":"76acc61bc8364620","repo":"affaan-m/ECC","slug":"insert-proposals-overlap","errorCode":null,"errorMessage":"insert proposals overlap","messagePattern":"insert proposals overlap","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":322,"sourceCode":"        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:\n    \"\"\"Validate resident evidence and return a new deterministic, offline bundle.\"\"\"\n    if type(local_only) is not bool:","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L304-L340","documentation":"Two insert proposals may not target overlapping spans of the timeline. _inserts tracks every accepted target range in 'occupied' and rejects any new insert whose timeline_range overlaps a previously seen one, since layered inserts are ambiguous (which one wins?) and unsupported.","triggerScenarios":"Two or more insert items in the inserts list whose timeline_range values intersect each other — e.g. [1000, 2000] and [1500, 2500]. Common when generating insert lists in bulk without a layout pass.","commonSituations":"Batch scripts that allocate equal-length slots but drift after one insert is lengthened; merging insert lists from two sessions; boundary-frame arithmetic errors when placing inserts back to back (inclusive vs exclusive end frames).","solutions":["Adjust the second insert's timeline_range so it starts at or after the previous insert's end","Merge overlapping proposals into a single insert referencing one candidate","Add a layout/scheduling step that packs inserts into non-overlapping slots before calling build_application_bundle"],"exampleFix":"// before\ninserts: [{timeline_range: [1000, 2000], ...}, {timeline_range: [1500, 2500], ...}]\n// after\ninserts: [{timeline_range: [1000, 2000], ...}, {timeline_range: [2000, 3000], ...}]","handlingStrategy":"validation","validationCode":"function assertNonOverlappingInserts(inserts) {\n  const sorted = [...inserts].sort((a, b) => a.timeline_range[0] - b.timeline_range[0]);\n  for (let i = 1; i < sorted.length; i++) {\n    if (sorted[i].timeline_range[0] < sorted[i - 1].timeline_range[1])\n      throw new Error(`inserts overlap at ${sorted[i].timeline_range}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  buildApplicationBundle(cfg);\n} catch (e) {\n  if (e.message.includes(\"insert proposals overlap\")) {\n    cfg.inserts = packNonOverlapping(cfg.inserts);\n    return buildApplicationBundle(cfg);\n  }\n  throw e;\n}","preventionTips":["Run a sort-and-pack layout pass over insert ranges before building the bundle","Use half-open [start, end) ranges consistently so adjacent inserts don't collide by one frame","Merge or drop duplicate proposals when merging insert lists from multiple sessions"],"tags":["overlap","inserts","layout"],"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"}