Skip to content

Speed up canonical ref redirects#117

Merged
goransle merged 3 commits into
masterfrom
perf/canonical-ref-redirects
Jul 23, 2026
Merged

Speed up canonical ref redirects#117
goransle merged 3 commits into
masterfrom
perf/canonical-ref-redirects

Conversation

@goransle

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves public CDN routing so requests that include non-canonical refs (branches/tags/short SHAs) are resolved and redirected to a canonical full-commit SHA URL early, avoiding unnecessary downstream file/build work and (optionally) avoiding esbuild detection during redirects.

Changes:

  • Add early 302 redirect flow in the public router when an explicit ref resolves to a different canonical commit SHA, with no-store caching.
  • Thread a detectEsbuild flag through the resolver call chain so redirects can skip esbuild detection work.
  • Extend router + downloader tests to cover canonical ref redirects, SHA direct serving, and strict detectEsbuild handling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/router.js Adds canonical-ref redirect path, ref explicitness helper, and conditional esbuild-detection skipping for redirects.
app/downloader-service.js Skips branch/commit metadata lookup for full SHAs and allows disabling esbuild detection via context.
downloader-server.js Passes detectEsbuild through /v1/resolve with a strict boolean check.
test/router.js Adds/updates cases for canonical redirects vs direct canonical SHA serving and validates detectEsbuild behavior.
test/downloader-service.js Adds coverage for strict detectEsbuild propagation and SHA resolver behavior.

Comment thread app/downloader-service.js
Comment thread app/router.js
Comment on lines +145 to +150
if (url !== req.url) {
startTrace(commit)
setPublicHeaders(res, 302, rate)
res.set({ 'Cache-Control': 'no-store', 'CDN-Cache-Control': 'no-store' })
if (rate.limit !== undefined) res.set('X-GitHub-RateLimit-Limit', String(rate.limit))
return res.redirect(302, url)
@goransle
goransle marked this pull request as ready for review July 23, 2026 09:23
@goransle
goransle merged commit c734b28 into master Jul 23, 2026
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.

2 participants