Skip to content

Isolate and bound control-plane loader caches - #1753

Draft
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
agent/express-context-loader-bounds
Draft

Isolate and bound control-plane loader caches#1753
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
agent/express-context-loader-bounds

Conversation

@Zetazzz

@Zetazzz Zetazzz commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • isolate module-loader cache entries by the routing pool object, tenant pool object, routing schema, database ID, and API ID
  • retain the existing default 100-entry LRU bound while making TTLs hard expiry limits that cache hits cannot extend
  • coalesce concurrent misses for one exact contract
  • make invalidation safe around in-flight resolutions and optionally target one physical pool/schema contract

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-context module-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 passed
  • pnpm --filter @constructive-io/express-context build
  • targeted ESLint on every changed TypeScript file
  • pnpm install --frozen-lockfile
  • git diff --check

The 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-42P01 errors, and registry forwarding.

pnpm policy:check is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant