Skip to content

feat: Add request-local caching for repeated SCM lookups [1]#255

Merged
minghay merged 2 commits into
masterfrom
feat-request-cache
May 12, 2026
Merged

feat: Add request-local caching for repeated SCM lookups [1]#255
minghay merged 2 commits into
masterfrom
feat-request-cache

Conversation

@yk634
Copy link
Copy Markdown
Contributor

@yk634 yk634 commented May 7, 2026

Context

Webhook handling can repeat the same SCM reads multiple times within a single request.
In scm-github, operations such as repository lookup, file fetches, PR info fetches, and author/commit decoration can re-hit the same GitHub endpoints during one webhook flow, which adds avoidable latency and load.

We want to reuse those repeated results within the scope of a single request without changing behavior across requests.

Objective

Introduce request-local caching in scm-github for repeated SCM operations during the same request.

This PR:

  • adds an AsyncLocalStorage-backed request cache helper
  • caches repeated scm-github lookups such as lookupScmUri, getFile, getOpenedPRs, getRepoInfo, decorateAuthor, decorateCommit, and getPrInfo
  • avoids caching failed lookups and unresolved PR mergeability results
  • keeps cache keys scoped to the request and to the relevant lookup inputs

References

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

Comment thread requestCache.js Outdated
@minghay minghay merged commit 07e641b into master May 12, 2026
2 checks passed
@minghay minghay deleted the feat-request-cache branch May 12, 2026 00:34
@sd-buildbot
Copy link
Copy Markdown

🎉 This PR is included in version 14.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants