Skip to content

[codex] Fix user API environment toggle paths#145

Merged
basit3407 merged 2 commits intomainfrom
codex/fix-user-api-env-toggle
Apr 26, 2026
Merged

[codex] Fix user API environment toggle paths#145
basit3407 merged 2 commits intomainfrom
codex/fix-user-api-env-toggle

Conversation

@basit3407
Copy link
Copy Markdown
Collaborator

Summary

  • Normalize user-related API docs paths before environment detection and equivalent-page checks.
  • Add regression coverage for Docusaurus trailing slash routes.

Root Cause

Docusaurus serves docs with trailing slashes while the docs metadata used by the switcher stores paths without them. The environment toggle compared those strings directly, so equivalent pages could be treated as missing.

Validation

  • node --test tests\user-related-env-paths.test.cjs
  • yarn test
@basit3407 basit3407 marked this pull request as ready for review April 26, 2026 05:33
@basit3407 basit3407 requested a review from Copilot April 26, 2026 05:33
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 26, 2026

Deploying qf-api-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5fb2e95
Status: ✅  Deploy successful!
Preview URL: https://a74ce2a5.qf-api-docs.pages.dev
Branch Preview URL: https://codex-fix-user-api-env-toggl.qf-api-docs.pages.dev

View logs

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: 268abdce57

ℹ️ 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 thread src/components/UserRelatedApiEnvironmentNotice/paths.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the user-related API docs environment toggle so it correctly recognizes and maps equivalent pages even when Docusaurus routes include a trailing slash, aligning runtime routing behavior with stored doc metadata paths.

Changes:

  • Normalize user-related doc paths (strip trailing slashes) before environment detection and route mapping.
  • Make “equivalent doc exists” checks tolerant to both trailing-slash and non-trailing-slash variants.
  • Add regression tests covering trailing-slash route inputs and trailing-slash entries in docs metadata.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/user-related-env-paths.test.cjs Adds regression coverage for trailing-slash route inputs and normalized available-path extraction.
src/components/UserRelatedApiEnvironmentNotice/paths.js Normalizes paths prior to environment detection/mapping and makes available-path checks slash-variant tolerant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@basit3407
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ 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".

@basit3407 basit3407 merged commit 3efcd3c into main Apr 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants