Latest Results
Group VarData field dependencies by owning state
`field_names` was a flat tuple paired with a single `state`, so merging a
var built from one state's field with a var built from another's dropped
the second: `VarData.merge` kept only the fields whose state matched the
first non-empty one. A computed var depending on such a composite var
never tracked the other state's field and went stale when it changed.
Make the canonical form a `Mapping[str, tuple[str, ...]]` of state to its
field names, unioned across merges, and register dependencies against
every state in it -- in `_add_static_dep`, in `add_dependency`, and in
`DependencyTracker`, all three of which previously collapsed a composite
var to one state. `state`, `field_names` and `field_name` stay as
fallback accessors reporting the first state and its first field, which
is what the remaining readers in `state.py`, `exceptions.py` and the
memoize plugin want.
The mapping is a plain dict rather than a `MappingProxyType`: VarData is
pickled along with the states holding it, and mappingproxy cannot be
pickled. It is built fresh per VarData and never mutated afterwards.
Verified against a var spanning two states: the second state's field
goes from untracked to tracked.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mwk1pagH3KZ884Xw55BNMhclaude/router-vars-refactor-7j1305 Latest Branches
-2%
FarhanAliRaza:farhan/event-chain-interning +1%
claude/router-vars-refactor-7j1305 -3%
FarhanAliRaza:farhan/health-redis-reuse © 2026 CodSpeed Technology