Skip to content

Prevent stale developer playground PR previews - #8556

Merged
cknitt merged 2 commits into
masterfrom
codex/fix-dev-playground-preview-cache
Aug 17, 2026
Merged

Prevent stale developer playground PR previews#8556
cknitt merged 2 commits into
masterfrom
codex/fix-dev-playground-preview-cache

Conversation

@cknitt

@cknitt cknitt commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

Add a per-page cache-busting parameter to compiler and library assets loaded for PR previews.

Configured compiler versions and local bundles retain their existing cache behavior.

Motivation

PR preview bundles are uploaded repeatedly to the same URLs. Because the CDN caches these assets for several hours, the developer playground can continue loading an older compiler or library bundle after a successful upload.

The existing cache=false option only bypasses the playground's in-memory script cache; it does not bypass the browser or CDN cache.

Verification

  • Ran yarn workspace dev-playground build.
  • Built the playground with the preview CDN configured.
  • Loaded a deployed PR bundle and confirmed that the compiler, built-in library, and React library URLs share a per-page cacheBust parameter.
  • Confirmed that the playground initializes and compiles successfully.

Signed-off-by: Christoph Knittel <ck@cca.io>
@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8556

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8556

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8556

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8556

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8556

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8556

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8556

commit: dc43ce5

@github-actions

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review August 17, 2026 07:28

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d15a81fabb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +177 to +180
let versionAssetUrl = (version, path) => {
let url = `${versionRoot(version)}/${path}`
version->isPreviewVersion ? `${url}?cacheBust=${previewCacheBust}` : url
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add regression coverage for preview asset cache busting

Add an automated test covering this URL-generation behavior: a pr-123 selection should apply the same cache-busting value to compiler.js and both runtime-library scripts, while configured and local versions remain unchanged. The commit currently relies only on manual verification, so a later loader refactor could silently restore the stale-preview behavior this bug fix addresses.

AGENTS.md reference: AGENTS.md:L169-L174

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The developer playground does not currently have an automated test harness. Adding one would require introducing and wiring up new test infrastructure, which feels outside the scope of this targeted cache fix.

Comment thread packages/dev-playground/src/CompilerApi.res
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt requested a review from fhammerschmidt August 17, 2026 08:16
@cknitt
cknitt merged commit 3f1843d into master Aug 17, 2026
29 checks passed
@cknitt
cknitt deleted the codex/fix-dev-playground-preview-cache branch August 17, 2026 08:50
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