Repository navigation
Conversation
This branch has not been deployed
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.
Fixes openclaw/openclaw#196183
Problem
Search on docs.openclaw.ai showed "Search is unavailable" after Pagefind moved from 1.5.2 to 1.6.0. The Pagefind entry and worker were served from the fixed paths
/pagefind/pagefind.jsand/pagefind/pagefind-worker.jswithCache-Control: public, max-age=31536000, immutable. Browsers and edges that had cached the 1.5.2 runtime kept using it against the 1.6.0 index, and search failed. Since the file names carry no version, the cached copies could not be invalidated.Fix
scripts/docs-site/pagefind-assets.mjsreads the installed Pagefind version and exposes the output dirpagefind/v<version>. Newpagefind-build.mjswrites the index, entry and worker there, anddocs:buildcalls it instead of the barepagefindcommand.site-js.mjsloads/pagefind/v<version>/pagefind.js, so every Pagefind upgrade gets new URLs.pagefind-normalize.mjsreads the versioned entry and throws if its version differs from the installed runtime.pagefind.jsandpagefind-worker.jsnow get the short mutable cache policy inr2-prepare.mjs(R2 metadata) andworkers/docs-router.ts(isMutableStaticPath). Versioned assets keep the immutable policy, which is safe because their URL changes with the version.smoke.mjsnow requires the versionedpagefind.js,pagefind-worker.jsandpagefind-entry.json.Tests
pagefind-cache.test.mjs(new): a Playwright regression that warms a browser with the old 1.5.2 entry and worker under the immutable policy, then checks that search works against the current build and requests a worker outside the old cache key. The real 1.5.2 worker used for this is intest-fixtures/pagefind-1.5.2/with its license.r2-upload.test.mjsanddocs-router-dotted.test.mjs: assert the cache policy for legacy vs versioned paths.publication-stability.test.mjsandanalytics-behavior.test.mjs: updated forpagefind-build.mjsand the versioned path.Validation
[paste the cacheControl values for the pagefind keys here]
npm run docs:smokepassedNot run locally: the rest of the full suite on my Windows machine (WebKit, symlink permissions, bash-dependent tests, one Windows path assertion), which fail for reasons unrelated to this change. I'm relying on CI for those.
AI assistance
I wrote the fix. I used Codex to help run the test suites and push the branch.