Repository navigation
fix(octane): keep pending readers attached to accepted work - #1775
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 0b77da8. Configure here.
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
56 other measured values are unchanged. Public-import reachability bundles (bytes)No changes across 105 measured values. |

Summary
Fixes #1763. When an accepted pending derived computation replaces earlier work, transfer its live waiter to the authoritative signal and wake readers of the displaced waiter. Re-evaluate an accepted pending view if its waiter settled or a dependency invalidated it before acceptance. Notify moved consumers and invalidate stale witnesses so readers cannot stay attached to an obsolete pending result.
The equality fast path retains the snapshot only while both waiters are live and the dependency and owner provenance match. Thenables are not assumed to represent the same underlying promise.
Validation
Risk / follow-ups
This affects accepted signal graph promotion and stale waiter handling. #1784 is now integrated and the pending-reader regressions have been checked against its landed implementation. The separate ready-state staged-transition case #1767 remains outside this fix.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core reactive graph promotion and async pending semantics; incorrect waiter transfer could cause infinite retries or missed updates, but change is narrowly scoped with extensive regression tests.
Overview
Fixes pending derived signals when a redeclared computation is accepted over an earlier one: readers must follow the live waiter, not a displaced or already-settled promise.
Signal graph (
graph.ts): Wakeup objects tracksettledand resolve only once. Re-evaluation reuses an unsettled wakeup instead of allocating a new one. The pending “same result” fast path insameViewResultnow requires both waiters to be live and aligned with dependency order—not assuming two thrown thenables share one promise.promoteDeclarationView: On acceptance, transfers the view’s wakeup to the canonical node, resolves the old waiter so stale async readers wake once, and forces retry when the accepted pending view’s waiter already settled or dependencies invalidated it before promotion (dirty flags, subscriber propagation, witness invalidation).Tests: Graph, integration (view transitions), equivalent-pending waiter transfer, race watchdog against microtask loops, and thenable-per-read behavior.
Reviewed by Cursor Bugbot for commit c75ab59. Bugbot is set up for automated code reviews on this repo. Configure here.