fix(runtime): make proxy routing cross-copy safe - #9
Merged
Conversation
Share a protocol-versioned runtime across compatible package copies, brand proxies with stable identities, and route provider attachments through module execution context. Validate interface implementations atomically, bound missing-provider queues, and make replay and module cleanup failures observable without aborting remaining work.
Member
Author
|
@greptile review |
Member
Author
|
@greptile review |
Member
Author
|
@greptile review |
Integrate explicit ownership invalidation from main with the shared provider-aware execution context. This keeps cross-copy contexts coherent and prevents stale asynchronous work from registering after module destruction. Co-authored-by: Upd4ting <upd4ting@gmail.com>
Member
Author
|
@greptile review |
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.
Summary
globalThisruntime and fail clearly on incompatible runtime protocolsinstanceofdispatch with a stable proxy brand and explicit proxy identitiesAsyncLocalStoragemodule contexts, per-proxy route bindings, and owner+generation leasesImplementInterfaceinputs strictly and atomically, including missing/malformed handlers, cycles, thenables, and cross-realm promisesCompatibility and migration
Existing single-provider direct calls,
InterfaceFunction(), proxy constructors,onCall,onRegister,onUnregister, and parameterlessdetach()remain supported.instanceofstill works within one package copy, whileIsInterfaceProxyis the cross-copy check.Interfaces that can be loaded from duplicate package copies should pass a stable identity to
InterfaceFunction(identity)or proxy constructors. Provider/core integrations can useRunWithModuleContextfrom@antelopejs/interface-core/modules; setproviderfor one route orproviderRouteskeyed byGetInterfaceProxyIdentity(proxy)when one module context uses multiple providers.ImplementInterfacenow rejects missing or malformed proxy handlers before attaching anything. Implementors that previously supplied partial implementation objects must provide every declared async/registering handler. Event proxies and non-proxy constants do not require handlers.Calls without an explicit route continue to use the sole provider. With multiple providers they now reject with
AmbiguousProviderError; an explicit unavailable route rejects withMissingProviderErrorrather than selecting by attachment timing. Unattached queues are capped at 1,000 operations and reject overflow withProviderQueueFullError.Event handler exceptions no longer abort later handlers. They are reported through
internal.runtimeErrorReporter, as are replay and cleanup failures.Verification
corepack pnpm run buildcorepack pnpm run lintcorepack pnpm dlx @antelopejs/core --version→1.4.7corepack pnpm dlx @antelopejs/core module test .→45 passingGreptile Summary
The PR introduces a protocol-versioned global runtime and cross-copy-safe proxy identities while adding provider-aware routing, bounded queues, stricter interface validation, and resilient cleanup.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(runtime): preserve module generation..." | Re-trigger Greptile