Fix self-hosted bundle cache validation
loading diff…
_loadable_bundle_cache_key that hashes target, layout_version, bundle bytes, manifest entrypoint fields, and signature metadata._entrypoint_cache_key and _remove_loaded_modules to detect and clear mismatched cached modules.JsonBundleLoader.load to compare the requested cache key against the cached entrypoint key and only reuse the cached entrypoint on exact match, otherwise clear the prefix and reload; propagate the cache key into _load so modules get annotated.test_self_hosted_loads_reload_entrypoint_when_bundle_content_changes to verify that two different bundles with the same prefix+entrypoint load distinct code.python -m black mercury/bundling/loaders/base.py tests/test_bundling/test_e2e_bundling.py which completed successfully.uv run pytest -q tests/test_bundling/test_e2e_bundling.py::TestEndToEndBundling::test_self_hosted_loads_reuse_loaded_entrypoint tests/test_bundling/test_e2e_bundling.py::TestEndToEndBundling::test_self_hosted_loads_reload_entrypoint_when_bundle_content_changes tests/test_bundling/test_e2e_bundling.py::TestEndToEndBundling::test_concurrent_loads_for_same_prefix_do_not_see_partial_modules tests/test_bundling/test_e2e_bundling.py::TestEndToEndBundling::test_self_hosted_failed_load_rolls_back_modules_before_next_waiter and all targeted tests passed.uv run pytest -q tests/test_bundling/test_e2e_bundling.py and the suite passed (21 passed, 1 warning).