{"record":{"id":"3533ba14f4a435f0","repo":"affaan-m/ECC","slug":"incomplete-application-bundle","errorCode":null,"errorMessage":"incomplete application bundle","messagePattern":"incomplete application bundle","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/integration.py","lineNumber":392,"sourceCode":"        _inserts(cfg[\"inserts\"], candidates, cfg, input_hash, edit_hash)\n    for receipt in cfg[\"historical_receipts\"]:\n        _artifact(receipt)\n    result = {**cfg, \"schema_version\": 1, \"mode\": \"preserve_native_timeline\",\n              \"provider_calls\": 0, \"provider_execution\": False, \"dry_run\": True, \"submit\": False,\n              \"provider_input\": copy.deepcopy(compiled_input), \"compiled_input_sha256\": input_hash,\n              \"edit_context_sha256\": edit_hash,\n              \"protected_stack\": stack, \"insert_policy\": \"new_video_track_preserve_baseline_audio\",\n              \"evidence_scope\": \"verified_local_bytes_and_supplied_metadata_only\"}\n    if local_only:\n        result = {**result, \"local_only\": True, \"provider_input_status\": \"not_prepared_local_only\",\n                  \"insert_policy\": \"none_preserve_baseline\"}\n    return {**result, \"bundle_sha256\": _digest(result)}\n\n\ndef validate_application_bundle(bundle: dict) -> None:\n    \"\"\"Recheck all files, derived state and exact flags; no mutation or execution.\"\"\"\n    if not isinstance(bundle, dict) or not (_REQUIRED | _OPTIONAL | {\"provider_input\"}) <= bundle.keys():\n        raise ValueError(\"incomplete application bundle\")\n    cfg = {key: bundle[key] for key in _REQUIRED | _OPTIONAL}\n    expected = build_application_bundle(cfg, bundle[\"provider_input\"],\n                                        local_only=bundle.get(\"local_only\", False))\n    if _canonical(bundle) != _canonical(expected):\n        raise ValueError(\"application bundle differs from its bound evidence\")\n","sourceCodeStart":374,"sourceCodeEnd":398,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/integration.py#L374-L398","documentation":"validate_application_bundle performs a read-only recheck: the bundle dict must be a dict containing at least the union of required keys, optional keys, and 'provider_input'. Missing any of these makes the bundle unverifiable because the full deterministic rebuild cannot be reproduced, so it raises before comparison.","triggerScenarios":"Passing a truncated, hand-stripped, or legacy bundle to validate_application_bundle that lacks _REQUIRED keys, _OPTIONAL keys, or the 'provider_input' key — e.g. a bundle saved before provider_input/local_only were introduced, or a user deleting fields they deemed unneeded.","commonSituations":"Older serialized bundles from a previous schema version; manually pruning 'optional' fields like historical_receipts before validation; partial JSON writes due to interrupted saves; mixing up the bundle with the raw application config (which lacks provider_input).","solutions":["Regenerate the bundle with build_application_bundle so all required, optional and provider_input fields are present","Add back the missing keys (including provider_input, even if null for local-only bundles) from a full backup","If the bundle is from an older schema, rebuild it from the original config rather than patching fields","Check bundle.keys() against _REQUIRED | _OPTIONAL | {'provider_input'} before validating"],"exampleFix":"// before (stripped bundle)\n{\"config\": {...}}\n// after (complete bundle incl. provider_input)\n{...requiredKeys, ...optionalKeys, \"provider_input\": null, \"local_only\": true, \"bundle_sha256\": \"<sha>\"}","handlingStrategy":"validation","validationCode":"REQUIRED_EXTRAS = {\"provider_input\"}\ndef bundle_complete(bundle, required, optional):\n    return isinstance(bundle, dict) and (set(required) | set(optional) | REQUIRED_EXTRAS) <= bundle.keys()","typeGuard":"def is_bundle(d):\n    return isinstance(d, dict) and \"provider_input\" in d and \"source\" in d and \"baseline\" in d","tryCatchPattern":"try:\n    validate_application_bundle(bundle)\nexcept ValueError as e:\n    if \"incomplete application bundle\" in str(e):\n        bundle = rebuild_bundle_from_config(original_cfg)  # regenerate all fields\n        validate_application_bundle(bundle)\n    else:\n        raise","preventionTips":["Never hand-strip fields from bundles before validation","Always round-trip bundles through build_application_bundle for regeneration","Handle old schema versions by rebuilding, not patching","Guard JSON saves against truncation (write temp + atomic rename)"],"tags":["validation","schema","bundle","missing-fields"],"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"}