You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(#469 review): skip caching workspace_entry results for removed workspaces
Address rchiodo's verified review comment. The generation guard alone
catches the race where configure() runs *during* a parse, but misses
the case where configure() removes a workspace *before* workspace_entry
snapshots the generation:
T1: try_from snapshots state.workspaces = [W, X]
T2: configure removes W, generation = N+1
T1: workspace_entry(W) misses cache, snapshots generation = N+1
T1: parses W, re-acquires lock, generation still matches, inserts W
W now lives in state.parsed as an orphan until the next configure()
clears it.
Add a membership check before insert: if the workspace is no longer in
state.workspaces, return the parsed value (so the in-flight caller can
finish) without caching it. Impact of the prior behaviour was low (cache
gets cleared on next configure and new callers never re-iterate the
removed workspace), but the membership check keeps the cache invariant
clean: parsed only contains entries for currently configured workspaces.
Test: workspace_entry_does_not_cache_for_unconfigured_workspace pins the
contract directly without needing threads.
0 commit comments