fix(reactive)!: don't call poll_func when @poll() is applied #2576
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 391 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.357
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2576"
general
weight: 0.35
pcbeingused333
reactive.poll()accepts anasyncpoll_func(the docstring says "Both regular functions and co-routine functions are allowed", and the polling effect awaits it). Butpoll()seeded its last value withreactive.Value(poll_func()), so for anasyncfunction that value was a coroutine object that is never awaited.The first run of the polling effect then called
equals(old, new)with that coroutine asold. With the default==this is just "not equal", but a customequalsthat reads the value, for examplelambda old, new: old["version"] == new["version"], raises.poll()turns that into its "couldn't be compared with a previously returned object"TypeErrorand stores it. Because the last value is only replaced after a successful comparison, every later poll fails the same way, and the data never loads.Change. For both
asyncand syncpoll_func, the last value now starts unset;poll_funcis not called when@poll()is applied. The polling effect reads the first value and stores it without callingequals.poll_functhe polling effect (priority=1by default) sets the value before outputs render, so outputs see data on their first render, as before. With anasyncpoll_functhat waits on I/O, outputs stay empty until it returns.poll_funcruns one fewer time per session, since the setup call is gone.test_pollexpects one fewerpoll_funccall at each step; thevalue_funccounts are unchanged.reactive.file_reader()with a missing file no longer raises when the decorator is applied. TheFileNotFoundErroris raised when the value is read, and the next poll recovers once the file exists.Breaking change. Reading a
@poll()or@file_reader()value outside the reactive runtime before the first poll, for example inreactive.isolate()while the server function runs, now raises a silent exception instead of returning the value. Reads from outputs, calcs, and effects wait for the first poll.CHANGELOG.mdlists this under breaking changes.The
model-scoreexample did this: itsdeduplicate()helper read a calc built on@poll()insidereactive.isolate()while the server function ran, so the first session after the server started never finished starting.deduplicate()now starts its value unset and lets its effect set it.Tests.
test_poll_async_poll_func_with_custom_equals: anasyncpoll_funcwith anequalsthat reads a key. Nothing is polled when@poll()runs, and the value can be read after the first poll and after the next interval.test_poll_reader_runs_before_first_poll(sync and async): a reader that runs before the polling effect waits for the first poll and doesn't make the read function run twice.test_poll_first_poll_raises: when the first poll raises, readers get that error, not a silent exception, and a later good poll recovers.test_file_reader_missing_file: the missing-file behavior above.This change was made with Claude Code.