fix(ci): Restore Algolia indexing under tsx and smoke-test it on PRs#18265
Open
sergical wants to merge 4 commits into
Open
fix(ci): Restore Algolia indexing under tsx and smoke-test it on PRs#18265sergical wants to merge 4 commits into
sergical wants to merge 4 commits into
Conversation
The Bun->tsx runner swap (#17772) broke the Algolia index workflow on master. tsx loads scripts/algolia.ts via Node's CJS resolver, which fails on rehype-prism-diff (imported transitively via src/mdx.ts) because that package's `exports` map only declares an "import" condition: ERR_PACKAGE_PATH_NOT_EXPORTED. Bun tolerated this; tsx does not. Every docs-touching push has failed this step since the swap. Alias rehype-prism-diff to its real dist file in a scoped scripts/tsconfig.json so tsx resolves it as a plain file and bypasses the exports map, without affecting the Next.js build. The workflow only ran on push to master, so the regression had no pre-merge signal. Add a pull_request trigger gated to the indexing machinery (workflow, script, tsconfig, src/mdx.ts, package.json, lockfile) that builds and dry-runs the indexer with no secrets, so a future runner/dependency change is caught in PR CI. Add an ALGOLIA_DRY_RUN guard to the script to support this without mutating the production index. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The PR smoke test ran the indexer over the full ~10k-page corpus with a cold cache, exhausting the heap. The real (push) job survives because its .next/cache/algolia-records content-hash cache stays warm across runs; a cold PR run does not. The smoke test only needs to prove the script builds and its import graph resolves, so cap dry-run processing to a bounded page sample, skip stale-cache cleanup in dry-run (a partial run must not delete real cache entries), and drop the shared cache step from the smoke job so it can never read or poison the push job's warm cache. Co-Authored-By: Claude <noreply@anthropic.com>
The smoke test ran a full ~10k-page `next build` (6-8 min) before the dry-run, but the regression it guards against -- the script and its import graph failing to resolve under the runner -- happens at module load, with no build required. Build-output correctness is already covered by Vercel's PR preview deploy. Run only the dry-run script (with ALGOLIA_SKIP_ON_ERROR so the absent .next HTML is tolerated). The job drops from minutes to ~1 minute while still catching runner/dependency-resolution regressions. Co-Authored-By: Claude <noreply@anthropic.com>
chargome
approved these changes
Jun 5, 2026
| run: npx tsx --tsconfig ./scripts/tsconfig.json ./scripts/algolia.ts | ||
| env: | ||
| ALGOLIA_DRY_RUN: 'true' | ||
| ALOGOLIA_SKIP_ON_ERROR: 'true' |
Member
There was a problem hiding this comment.
There's a typo in here (not introduced by you) but let's fix it.
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.
DESCRIBE YOUR PR
Restores the Update Algolia index workflow, which has been failing on
masterfor every docs-touching push since the Bun→tsx runner swap in #17772.Root cause: tsx loads
scripts/algolia.tsthrough Node's CJS resolver. The script transitively importsrehype-prism-diff(viasrc/mdx.ts), and that package'sexportsmap declares only an"import"condition — so the CJS resolver fails withERR_PACKAGE_PATH_NOT_EXPORTED. Bun tolerated this; tsx does not. (The earlier OOM fixes — #17283/#17711/#17722 — addressed a different, now-resolved failure mode.)Why it kept slipping through: the workflow only ran on
push: master, so there was never any PR-time signal. #17772 touched only the workflow file and landed green.Changes
scripts/tsconfig.json(new): scoped tsconfig that aliasesrehype-prism-diffto its realdist/index.js, so tsx resolves it as a plain file and bypasses theimport-onlyexportsmap. Doesn't touch the Next.js build.algolia-index.yml: bothtsxinvocations now pass--tsconfig ./scripts/tsconfig.json.pull_requesttrigger gated to the indexing machinery (workflow, script, tsconfig,src/mdx.ts,package.json, lockfile) that builds + dry-runs the indexer with no secrets and no upload. The very PR that broke this would have failed under this setup.scripts/algolia.ts: added anALGOLIA_DRY_RUNguard powering the smoke test; the real upload path is unchanged when the flag is unset.Verification
--tsconfigresolves the full import graph.🧪 Dry run … ✅ Done).prettier+eslintclean on changed files. (Note:lint:tshas 3 preexisting errors insrc/instrumentation*.tsunrelated to this PR.)IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: