{"record":{"id":"fe80476fa56391a4","repo":"affaan-m/ECC","slug":"local-only-preservation-cannot-accept-provider-input","errorCode":null,"errorMessage":"local-only preservation cannot accept provider input","messagePattern":"local-only preservation cannot accept provider input","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":347,"sourceCode":"                    \"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:\n        raise ValueError(\"local_only must be an exact boolean\")\n    _object(config, _REQUIRED, _OPTIONAL)\n    if len(_canonical(config)) > _MAX_JSON:\n        raise ValueError(\"application config exceeds local size limit\")\n    if local_only:\n        if compiled_input is not None:\n            raise ValueError(\"local-only preservation cannot accept provider input\")\n    else:\n        _object(compiled_input, {\"source_video\", \"compiled_prompt\"})\n        url = urlsplit(_text(compiled_input[\"source_video\"]))\n        if url.scheme != \"https\" or not url.hostname or url.username or url.password:\n            raise ValueError(\"source reference must be HTTPS without embedded credentials\")\n        _text(compiled_input[\"compiled_prompt\"])\n    cfg = copy.deepcopy(config)\n    for key in (\"audio\", \"candidates\", \"inserts\", \"historical_receipts\"):\n        cfg.setdefault(key, [])\n        if not isinstance(cfg[key], list):\n            raise ValueError(\"bundle collections must be lists\")\n    if local_only and (cfg[\"candidates\"] or cfg[\"inserts\"]):\n        raise ValueError(\"local-only preservation cannot contain candidates or inserts\")\n    tracks = _snapshot(cfg[\"baseline\"])\n    _binding(cfg[\"source\"], tracks, cfg[\"baseline\"])\n    audio_keys = [_binding(item, tracks, cfg[\"baseline\"], audio=True) for item in cfg[\"audio\"]]\n    expected_audio = {(t, i) for t, clips in tracks.items() if t.startswith(\"audio\")\n                      for i in range(len(clips))}","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L329-L365","documentation":"When local_only is True, build_application_bundle enforces a pure local preservation mode: compiled_input (the provider-side compilation result) must be None. Passing any provider output while claiming local-only is a contradictory request, so it is rejected to keep hosted-source provenance out of local bundles.","triggerScenarios":"build_application_bundle(cfg, compiled_input=<dict>, local_only=True) — e.g. reusing a previous call site that still passes the compiled input while flipping local_only to True; validate_application_bundle on a bundle whose provider_input is non-null but local_only is true.","commonSituations":"Migrating a script from hosted to local-only mode and forgetting to drop the compiled_input argument; a bundle saved in hosted mode later validated with local_only forced on.","solutions":["Pass compiled_input=None when local_only=True: build_application_bundle(cfg, None, local_only=True)","Remove the provider_input field from the bundle dict before validate_application_bundle in local-only mode","If you actually need the compiled input, call with local_only=False so the HTTPS source checks run instead"],"exampleFix":"// before\nbuild_application_bundle(cfg, compiled_input, local_only=True)\n// after\nbuild_application_bundle(cfg, None, local_only=True)","handlingStrategy":"validation","validationCode":"if local_only and compiled_input is not None:\n    raise ValueError(\"drop compiled_input in local-only mode\")","typeGuard":"def is_valid_mode(ci, local_only):\n    return (local_only and ci is None) or (not local_only and isinstance(ci, dict))","tryCatchPattern":"try:\n    bundle = build_application_bundle(cfg, ci, local_only=local_only)\nexcept ValueError as e:\n    if \"cannot accept provider input\" in str(e):\n        bundle = build_application_bundle(cfg, None, local_only=True)\n    else:\n        raise","preventionTips":["Branch call sites on mode before choosing arguments","Null out provider_input when serializing local-only bundles","Document local_only as exclusive with compiled input","Add an integration test for the local-only path"],"tags":["validation","mutually-exclusive","local-mode"],"backgroundTag":"mutually-exclusive-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"}