Handle Differences In Ancestor Values When Joining Fiber Refs #8334
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.
This addresses a somewhat degenerate situation where a child fiber obtains a reference to its own parent and inherits
FiberRef
values from its parent.Normally, our logic when inheriting
FiberRef
values is to identify the common ancestor between the "joining" and "joined" fibers and compute the difference between the joined fiber's record of the ancestor value and its current value, reasoning that this represents all the changes that the joined fiber has made that should then be applied to the joining fiber.This works in all cases but one, which is where the joined fiber is actually the parent of the joining fiber and thus the common ancestor is the joined fiber. Since we only track the current value of a
FiberRef
for each fiber, if the parent made a change to itsFiberRef
value after forking the child and then the child inherits from the parent, the child will not pick up this change.We can instead handle this case by reasoning that if the joined fiber is the common ancestor, that is if we are inheriting from our parent, then we are inheriting from the parent after the time it forked us and thus any differences between its current
FiberRef
value and the value we have from when we were forked were made by the parent subsequently and thus are ones that we should apply to ourselves.