Isolate and bound control-plane loader caches - #1753
Draft
Zetazzz wants to merge 1 commit into
Draft
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
This implements F11 from constructive-io/constructive-planning#1693 and is stacked directly on the reusable performance-harness base in #1716.
Why
The previous key used only
databaseId:apiId. Two loader contexts with the same logical IDs but different routing pools, tenant pools, or routing schemas could therefore reuse incompatible metadata. Hot entries also used sliding TTLs, so repeated reads could keep stale control-plane state alive indefinitely, and simultaneous misses issued duplicate resolutions.Scope
The change stays inside the generic
express-contextmodule-loader cache owner. It preserves the existing default maximum of 100 entries and all existing absent-module/error semantics.It does not include F01 pool identity, runtime/control credentials, pool leases, specific security-loader freshness policy, loader SQL changes, or storage metadata work from the original research PR. Pool object identity is sufficient to make this PR independently useful; a later exact pool-identity implementation can remain separately reviewable.
Validation
pnpm --filter @constructive-io/express-context test --runInBand— 38 tests passedpnpm --filter @constructive-io/express-context buildpnpm install --frozen-lockfilegit diff --checkThe owner tests cover physical pool/schema isolation, exact and logical invalidation, concurrent miss coalescing, invalidation during an in-flight resolution, hard TTL expiry, the default 100-entry bound, cached absence, preserved non-
42P01errors, and registry forwarding.pnpm policy:checkis currently blocked by pre-existing expired repository exceptions for@typescript-eslint/eslint-plugin,@typescript-eslint/parser, and@types/semver; this PR does not alter those policies.