-
Notifications
You must be signed in to change notification settings - Fork 38
Bug: formalize locator state that must survive refresh boundaries #387
Description
Summary
Issue #383 changed refresh to run against a transient locator graph and then copy back the shared state that later JSONRPC requests still depend on. We currently do that explicitly for Conda and Poetry, but there is no general contract for which locator state is allowed to matter after a refresh completes.
That is fragile: future locator changes can silently regress resolve, find, or telemetry behavior if a locator starts depending on refresh-populated state and nobody also adds a handoff step.
Current examples
Condakeeps discovered environments/managers that are later used bycondaInfoand missing-env telemetry.Poetrykeeps a cachedsearch_resultthat improves laterresolvefidelity.- Other locators also keep mutable state, but under different assumptions:
PipEnvstores the configured executable.Uvstores configured workspace directories.WindowsRegistrycachessearch_result, but can self-hydrate on demand.LinuxGlobalPythoncaches discovered executables for reuse/perf.
The current code has no explicit distinction between:
- config-only state
- refresh-discovered state that must survive for correctness
- performance caches that may be recomputed
Problem
Right now the server logic effectively knows about stateful locators by name. That makes the refresh pipeline harder to reason about and increases the chance that a future locator will accidentally depend on stale or missing state after a transient refresh.
Proposed direction
Audit all locators and define an explicit contract for post-refresh state, for example by doing one of the following:
- Make locators fully stateless apart from configured inputs.
- Make stateful locators self-hydrating on
try_from()/ later requests. - Introduce an explicit interface for state that must be synchronized from transient refresh locators back into the long-lived shared locators.
Acceptance criteria
- Inventory locator state across the current locator set.
- Classify each piece of state as config-only, correctness-critical post-refresh state, or perf-only cache.
- Pick and document the intended contract.
- Add tests covering at least one non-Conda/Poetry stateful locator path so regressions are easier to catch.
Related
- Fixes in Feature: Deduplicate Concurrent Refresh Requests #383 exposed this design gap while moving refresh execution onto transient locators.
- Related race/configuration concerns were also tracked in Bug: configure and refresh can race on shared locator configuration #385.