fix(kida): keep a child write in the caller's context - #198
Merged
Conversation
Only the parent and key reads are untracked now. The write goes out in the caller's context, so the flush it triggers is not mistaken for a quiescent moment and the mount listeners it wakes no longer fire inside the very subscriber that wrote.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
==========================================
+ Coverage 84.73% 84.83% +0.09%
==========================================
Files 140 140
Lines 3125 3125
Branches 586 586
==========================================
+ Hits 2648 2651 +3
+ Misses 339 338 -1
+ Partials 138 136 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
childOperwrapped its whole write path inuntracked— the reads of the parent and the key, and the write back into the parent along with them. Only the reads need it.The write does not create dependencies, so untracking it looks free. It is not:
activeSubis also how the lifecycle queue decides whether the system is quiescent.A write from a subscriber's own body triggers a flush when nothing else holds one open, and
flushends by callingsettle. With the write untracked,activeSubisundefinedat that moment, sosettleconcludes that nobody is running and drains the queue on the spot — and the mount listeners the flush woke fire inside the subscriber that wrote, halfway through its body. With the write left in the caller's context,settlesees a running subscriber and defers them to the real boundary.The gate
where a second effect reaches a
mountablesignal only once that write has landed:start,mounted,endstart,end,mountedTwo gravestones go into
agera's signal spec next to it, pinning what a plain signal already guarantees and what the child now stops obscuring: an effect that writes its own dependency is not woken by its own write, whether it writes directly or throughuntracked.Size
nanoviewsgains 4 B gzip / 3 B brotli on the average-usage bundle — twoletslots the write needs outside theuntrackedblock. That is enough to pushAverage usage (Brotli)past its pin (3998 → 4001 B), so the limit moves4 kB→4.05 kB. Every other pin in the chain stays where it was.