acoustic-carpenter-78188
05/30/2026, 5:36 AM_cache_scope() now sources `endpoint`/`project`/`domain` from get_init_config() instead of config.auto(), so the local image/bundle cache is scoped to the project/domain the run was actually initialized with (including programmatic overrides like flyte.init(project=..., domain=...)), not just whatever the on-disk config file contains.
• This closes a cache-collision hole: with auto(), two runs that share a config file but override the domain at init time produced the same scope string and shared cache entries.
• Adds a new test module tests/persistence/test_cache_scope.py.
Behavior notes
• endpoint is read from cfg.client.endpoint (empty string when no client is set, e.g. local-only persistence).
• get_init_config() raises InitializationError when flyte.init() has not run; _cache_scope() propagates that. Today the callers (image_builder, code_bundle) run inside the post-init build/run path, so this is fine — but if a pre-init caller is ever added, it should fall back to auto().
Test plan
• uv run pytest tests/persistence/ -q → 56 passed (5 new + 51 existing).
• New tests cover:
• endpoint/project/domain composed from the init config (endpoint:proj:dev)
• empty endpoint when cfg.client is None
• empty project/domain
• init-time overrides are reflected (different domain → different scope) — the case auto() missed
• raises InitializationError when not initialized
• Verified RED first: all 5 tests fail against the previous auto() implementation (the override test shows it read the real config file and ignored overrides), then pass on this change.
flyteorg/flyte-sdkacoustic-carpenter-78188
06/01/2026, 5:49 PM