[PR #13608] fix(console): follow-up for #13108 docs/en routing and locale cookie sync #14734

Open
opened 2026-02-16 18:19:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13608

State: open
Merged: No


Closes #13606
Refs #13108

What does this PR do?
This is a follow-up to #13108.

In production, two issues were still reproducible:

  • /docs/en could return 404
  • English selection could be overridden by an existing non-English oc_locale

This PR fixes the remaining console-side docs routing/cookie sync gap by:

  • handling /docs/<locale> as explicit locale input during request locale resolution
  • canonicalizing /docs/en, /docs/en/, and /docs/en/* to English root docs paths
  • appending Set-Cookie: oc_locale=<resolved-locale> on docs proxy responses

Changed files:

  • packages/console/app/src/lib/language.ts
  • packages/console/app/src/routes/docs/index.ts
  • packages/console/app/src/routes/docs/[...path].ts
  • packages/console/app/src/routes/s/[id].ts

Why this works:

  • docs-path locale is now resolved before cookie/Accept-Language fallback
  • English docs path is normalized to canonical root docs path
  • locale cookie is synchronized on docs proxy responses, so English remains sticky

How did you verify your code works?

  • Ran typecheck:
    • bun run typecheck (in packages/console/app)
  • Ran targeted routing smoke checks:
    • docs("en", "/docs/en") -> /docs
    • docs("en", "/docs/en/") -> /docs/
    • docs("en", "/docs/en/agents") -> /docs/agents
  • Ran locale-resolution precedence checks:
    • request to /docs/en with Cookie: oc_locale=ko resolves locale as en
    • request to /docs/en/agents with Accept-Language: ko resolves locale as en
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13608 **State:** open **Merged:** No --- Closes #13606 Refs #13108 What does this PR do? This is a follow-up to #13108. **In production, two issues were still reproducible:** - `/docs/en` could return 404 - English selection could be overridden by an existing non-English `oc_locale` **This PR fixes the remaining console-side docs routing/cookie sync gap by:** - handling `/docs/<locale>` as explicit locale input during request locale resolution - canonicalizing `/docs/en`, `/docs/en/`, and `/docs/en/*` to English root docs paths - appending `Set-Cookie: oc_locale=<resolved-locale>` on docs proxy responses **Changed files:** - `packages/console/app/src/lib/language.ts` - `packages/console/app/src/routes/docs/index.ts` - `packages/console/app/src/routes/docs/[...path].ts` - `packages/console/app/src/routes/s/[id].ts` **Why this works:** - docs-path locale is now resolved before cookie/Accept-Language fallback - English docs path is normalized to canonical root docs path - locale cookie is synchronized on docs proxy responses, so English remains sticky **How did you verify your code works?** - Ran typecheck: - `bun run typecheck` (in `packages/console/app`) - Ran targeted routing smoke checks: - `docs("en", "/docs/en") -> /docs` - `docs("en", "/docs/en/") -> /docs/` - `docs("en", "/docs/en/agents") -> /docs/agents` - Ran locale-resolution precedence checks: - request to `/docs/en` with `Cookie: oc_locale=ko` resolves locale as `en` - request to `/docs/en/agents` with `Accept-Language: ko` resolves locale as `en`
yindo added the pull-request label 2026-02-16 18:19:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14734