Fix module-loader cache expiry and concurrency - #1753
Open
Zetazzz wants to merge 3 commits into
Open
Conversation
Zetazzz
force-pushed
the
agent/express-context-loader-bounds
branch
from
September 6, 2026 01:51
e8438de to
d5dac4d
Compare
Zetazzz
force-pushed
the
test/performance-harness-core
branch
from
September 6, 2026 01:51
45cbb07 to
658736e
Compare
Zetazzz
force-pushed
the
test/performance-harness-core
branch
from
September 7, 2026 03:22
658736e to
f7c63ec
Compare
Zetazzz
marked this pull request as ready for review
September 7, 2026 03:23
|
Review complete. No issues found — approved ✅. This PR introduces two new capabilities: an LRU-cached, coalescing module loader in
Reviewed commit: d5dac4d |
Zetazzz
force-pushed
the
agent/express-context-loader-bounds
branch
from
September 7, 2026 03:23
d5dac4d to
ca37b7c
Compare
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
Frequent cache hits could keep module configuration alive indefinitely by extending its TTL. Concurrent misses also started duplicate queries, and invalidation could be undone when an older query completed.
Use a hard TTL, coalesce concurrent misses for the same logical key, and prevent invalidated in-flight work from repopulating the cache or removing newer pending work. The existing default limit of 100 completed entries is retained.
Related: constructive-io/constructive-planning#1693 (F11). This PR targets
mainand has no dependency on #1716.Design decisions
databaseId:apiIdwhen an API ID is present, otherwisedatabaseId. Logical database IDs already distinguish tenant databases. Pool identities and routing schemas are not added; expanding cache identity is not required for these lifecycle improvements.invalidate(databaseId?). A database ID clears its plain key and all API entries; omitting it clears every entry. Registry invalidation forwards the same operation to each loader. Additional invalidation parameters are not needed.undefinedand PostgreSQL42P01results remain uncached so later calls can discover new configuration. Concurrent callers can share an in-flight absence check. Other errors propagate without being cached; negative caching is not needed.The README records these deliberate scope decisions. The changes stay within the express-context loader cache and its documentation/tests.
Validation
git diff --checkpassed.724b4400183a: 17/17 jobs passed, including Linux, Windows, PostgreSQL, MinIO integration, and Ollama. The cloud run also confirmed all 120 express-context tests passed.Owner tests cover logical database/API isolation on shared pools, reuse and concurrent coalescing for the same logical key across contexts, plain-key/API invalidation while preserving other databases, hard TTL, the default 100-entry bound, both completion orders for invalidated in-flight queries, uncached absence/42P01 rediscovery, propagated errors, and registry forwarding.