Skip to content

[codex] finish Algolia env split and search fallback#1273

Merged
jderochervlk merged 3 commits intovlk/fix-algoliafrom
codex/pr-1231-finishup
Apr 25, 2026
Merged

[codex] finish Algolia env split and search fallback#1273
jderochervlk merged 3 commits intovlk/fix-algoliafrom
codex/pr-1231-finishup

Conversation

@jderochervlk
Copy link
Copy Markdown
Collaborator

Summary

This finishes the Algolia environment split on top of vlk/fix-algolia and makes missing-search builds degrade cleanly.

It also fixes the pre-existing DocsonLazy / PlaygroundLazy compile blockers so the branch can build and be verified again.

Changes

  • centralize public VITE_ALGOLIA_* and private publisher ALGOLIA_* parsing in AlgoliaConfig
  • disable the search UI explicitly when public Algolia config is missing, with visible copy and no modal hotkeys
  • log a clear startup/build warning when public Algolia vars are absent
  • make the search indexing script skip cleanly with explicit missing private-var logs
  • update deploy.yml to inject dev_ / prod_ Algolia settings from repo vars and secrets
  • remove tracked Algolia values from .env
  • add focused tests for env parsing, disabled search UI, and the Algolia env warning script
  • replace the broken lazy wrappers with direct component aliases so the branch compiles again

Verification

  • yarn build:res
  • yarn build:scripts
  • yarn vitest --run --browser.headless __tests__/AlgoliaConfig_.test.jsx __tests__/Search_.test.jsx
  • node --test scripts/__tests__/log_algolia_env_status.test.mjs
  • yarn check:algolia-public-env
  • env -i PATH="$PATH" HOME="$HOME" VITE_VERSION_LATEST=12.0.0 VITE_VERSION_NEXT=13.0.0 yarn build:search-index

Notes

  • fork PR builds still receive no Algolia config and should show the disabled search state
  • pull request builds target the Algolia dev_ index; production stays on prod_

- 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
@jderochervlk jderochervlk marked this pull request as ready for review April 25, 2026 15:00
@jderochervlk
Copy link
Copy Markdown
Collaborator Author

@codex

@github-actions
Copy link
Copy Markdown

Cloudflare deployment

Deployement ID: 32637e3f-bdb4-4d7a-acaa-a6948fbedb08
Deployment Environment: preview

⛅️ wrangler 4.63.0 (update available 4.85.0)
─────────────────────────────────────────────
✨ Compiled Worker successfully
Uploading... (8008/8010)
Uploading... (8009/8010)
Uploading... (8010/8010)
✨ Success! Uploaded 2 files (8008 already uploaded) (2.10 sec)

✨ Uploading _redirects
✨ Uploading Functions bundle
🌎 Deploying...
✨ Deployment complete! Take a peek over at https://32637e3f.rescript-lang.pages.dev
✨ Deployment alias URL: https://codex-pr-1231-finishup.rescript-lang.pages.dev

@jderochervlk jderochervlk merged commit 6480ca3 into vlk/fix-algolia Apr 25, 2026
5 checks passed
@jderochervlk jderochervlk deleted the codex/pr-1231-finishup branch April 25, 2026 15:03
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 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".

Comment on lines +63 to +66
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"
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 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 👍 / 👎.

Comment thread package.json
"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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

1 participant