Fix uncached var deduplication after delta filtering

Closed
FA
1mo ago
+438-132

Fixes #7212. Related alternative: #7216.

A downstream get_delta filter could withhold an uncached computed var after its value had already been recorded as sent. Lifting the filter then left the frontend stale. Deduplication now runs on the final delta after the complete get_delta override chain and coroutine resolution, so withheld values remain eligible for the next update and replacements are compared using the value actually included in the update.

The final pass visits only state branches containing uncached vars and reuses the existing client-token comparison and persisted memo. Shared-state suppression remains supported. Bare get_delta() calls build deltas without recording values as sent; this is documented. The async deduplication wrapper and its drop sentinel are no longer needed.

Regression coverage includes root and child filters, dropped keys and states, redacted and copied values, async filtering, failed resolution, suppression, client tokens, and serialized memos. Eight regression cases failed on upstream before the fix. Existing deduplication tests now exercise the resolved-delta path.

Validation:

  • Full unit suite: 9,704 passed, 19 skipped; 78.96% coverage.
  • uv run ruff check ., uv run ruff format --check ., and uv run pyright reflex tests passed.
  • All applicable pre-commit hooks passed, including stub generation and both type checkers.
  • Every added executable line in reflex/state.py is covered.
  • The issue's browser-free probe, using the framework's resolved-delta path, delivers the withheld value immediately after login and then deduplicates the next unchanged update.
  • Final adversarial review found no additional issues.

Scope: recording still occurs before socket emission. This fixes downstream get_delta filtering and failed coroutine resolution; it does not add transport acknowledgements or retries for failed delivery.