[codex] finish Algolia env split and search fallback#1273
[codex] finish Algolia env split and search fallback#1273jderochervlk merged 3 commits intovlk/fix-algoliafrom
Conversation
- centralize public and publisher Algolia env parsing - disable search clearly when public env is missing - inject dev/prod Algolia envs in deploy CI - fix the pre-existing lazy wrapper compile blockers
Cloudflare deploymentDeployement ID: 32637e3f-bdb4-4d7a-acaa-a6948fbedb08 ⛅️ wrangler 4.63.0 (update available 4.85.0) ✨ Uploading _redirects |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: baae187023
ℹ️ 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".
| elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.environment }}" == "production" ]]; then | ||
| INDEX_PREFIX="prod" | ||
| SEARCH_KEY="$ALGOLIA_SEARCH_API_KEY_PROD" | ||
| ADMIN_KEY="$ALGOLIA_ADMIN_API_KEY_PROD" |
There was a problem hiding this comment.
Gate production Algolia keys to master in manual deploys
The workflow_dispatch production branch currently selects prod keys based only on inputs.environment == "production", without checking github.ref_name. If someone manually dispatches from a non-master branch and chooses production, this step will still set INDEX_PREFIX="prod" and ALGOLIA_ADMIN_API_KEY_PROD, so that branch build can write to the production Algolia index. This creates a real risk of preview/feature content overwriting production search data.
Useful? React with 👍 / 👎.
| "build:update-index": "yarn build:generate-llms && node _scripts/generate_feed.mjs > public/blog/feed.xml && yarn build:search-index", | ||
| "build:vite": "react-router build", | ||
| "build": "yarn build:res && yarn build:scripts && yarn build:update-index && yarn build:vite", | ||
| "check:algolia-public-env": "node scripts/log_algolia_env_status.mjs", |
There was a problem hiding this comment.
Read env files when checking public Algolia vars
The new check:algolia-public-env command runs node scripts/log_algolia_env_status.mjs without --env-file-if-exists flags, so it ignores values that are configured in .env / .env.local (which other build commands do read). In that setup, build/prepare will emit a false "Algolia search disabled" warning even though Vite will have valid public Algolia config.
Useful? React with 👍 / 👎.
Summary
This finishes the Algolia environment split on top of
vlk/fix-algoliaand makes missing-search builds degrade cleanly.It also fixes the pre-existing
DocsonLazy/PlaygroundLazycompile blockers so the branch can build and be verified again.Changes
VITE_ALGOLIA_*and private publisherALGOLIA_*parsing inAlgoliaConfigdeploy.ymlto injectdev_/prod_Algolia settings from repo vars and secrets.envVerification
yarn build:resyarn build:scriptsyarn vitest --run --browser.headless __tests__/AlgoliaConfig_.test.jsx __tests__/Search_.test.jsxnode --test scripts/__tests__/log_algolia_env_status.test.mjsyarn check:algolia-public-envenv -i PATH="$PATH" HOME="$HOME" VITE_VERSION_LATEST=12.0.0 VITE_VERSION_NEXT=13.0.0 yarn build:search-indexNotes
dev_index; production stays onprod_