Implement request-safe assessment cache with TTL and tests - #6
Merged
Conversation
- Replaced the module-level discovery promise with a plain resolved assessment configuration cache. - Added a 15-minute TTL gate that only returns cached configuration when it is still valid. - Updated cache initialization to avoid storing in-flight discovery promises and prevent cross-request context errors.
- Added a regression test that verifies sequential submissions reuse warmed assessment configuration. - Added a regression test for concurrent cold-cache calls that independently discover and do not share an in-flight request promise. - Added a regression test that verifies failed discovery is not cached and is retried on the next request.
nicolasgioanni
commented
Jul 28, 2026
nicolasgioanni
left a comment
Collaborator
Author
There was a problem hiding this comment.
Fix implemented
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.
This pull request refactors the assessment configuration caching logic in
gohighlevel-assessment.tsto avoid sharing in-flight asynchronous discovery operations between parallel requests. It also adds new tests to ensure that assessment configuration discovery is not shared and that failed discoveries are retried correctly. The changes improve cache safety, correctness, and test coverage.Assessment Configuration Caching Improvements
AssessmentConfigurationobject directly instead of a promise, ensuring that parallel calls do not share in-flight discovery operations. Now, each call togetAssessmentConfigurationwill independently trigger discovery if the cache is expired or empty, preventing accidental sharing of incomplete or failed discoveries.assessmentConfigurationvariable instead of the removed promise.Test Coverage Enhancements