Add callback request registry - #1066
Open
vegaro wants to merge 4 commits into
Open
Conversation
This was referenced Sep 1, 2026
vegaro
marked this pull request as ready for review
September 2, 2026 12:21
vegaro
force-pushed
the
cesar/callback-registry
branch
from
September 2, 2026 12:28
9b9e452 to
ee34e88
Compare
facumenzella
approved these changes
Sep 2, 2026
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.
Motivation
This is the first part of #1008 which fixes the fact that
Purchasesstores one mutable callback per operation. Two overlapping calls can overwrite each other, so the first response invokes the wrong callback and the other response is dropped.Stack
Note
Low Risk
New internal helper and tests only; no wiring into purchase flows yet.
Overview
Introduces an internal
CallbackRegistryso async operations can stash callbacks under unique request IDs instead of sharing a single mutable slot (foundation for fixing overlappingPurchasescalls in later stack PRs).Register<T>returns a GUID string and stores the callback (including null) with its type;TryTake<T>removes and returns the callback only when the ID exists and the type matches—wrong types leave the entry intact.Cleardrops all pending entries. Access is guarded with a lock.Adds EditMode NUnit tests for out-of-order take, single-use IDs, null callbacks, type mismatch, and clear behavior, plus Unity
.metaassets.Reviewed by Cursor Bugbot for commit ee34e88. Bugbot is set up for automated code reviews on this repo. Configure here.