fix(routes): bind registrations to consumer generations - #17
Open
Upd4ting wants to merge 5 commits into
Open
Conversation
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
UnregisterRoutefor lifetimes shorter than a moduleinternal.routesProxyas a non-enumerable alias of the canonical root proxy instead of a duplicate declaration/facadesWhy
The previous implementation restored consumer context every time API invoked a route callback or computed parameter. It fixed provider selection, but added an unacceptable steady-state HTTP cost.
The resolver now gives each consumer a generation-specific interface facade. API uses that cold context while decorators call
RegisterRoute; the registered callback and computed providers are not wrapped. Derived Auth providers already close over their selected Auth facade, so execution later under API no longer loses provider selection.Identity and lifecycle guarantees
===the controller methodinternal.routesProxyand rootroutesProxyare the same objectValidation
pnpm lintpnpm buildgit diff --checkPerformance
The rejected callback-wrapper design measured approximately -8% to -14% throughput in the final three-way benchmark. The resolver/cold-facade design has no request wrapper.
The isolated A/B gate (Node 24.19.0, pinned server CPU, 8 repetitions, 8-second samples) measured +1.15% JSON c100, +2.46% dynamic routes, +1.68% POST echo, and -0.36% on the last of 1,000 routes. Registered HTTP callbacks are also strict-equal, providing a structural check that no per-request wrapper remains.
Release ordering
Merge #16 first. Release interface-core and Core before publishing this interface-api candidate. No merge or publication is performed by this PR update.