Skip to content

fix(web): honor Accept-Language q=0 refusals in docs locale middleware - #1317

Merged
dezren39 merged 1 commit into
mainfrom
queue/5879-1316-web-accept-language
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5879-1316-web-accept-language

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Closes #1316

What

packages/web docs locale middleware served a language the client explicitly refused with q=0, and a malformed q poisoned its sort with NaN — the #1309 bug in its unfixed web sibling.

  • Extracts localeFromAcceptLanguage from packages/web/src/middleware.ts into packages/web/src/lib/accept-language.ts (the middleware's astro:middleware import blocks direct unit testing; cf. the _share-model-param isolation pattern). Middleware behavior/call sites are otherwise unchanged.
  • Mirrors the merged console fix (PR fix(console): never serve an Accept-Language language refused with q=0 (#1309) #1312, packages/console/app/src/lib/language.ts): an explicit finite q<=0 is a refusal and is never served — parsing falls through to the next accepted language or root; a malformed q is a 0-weight last-resort offer, never NaN in the comparator.
  • New packages/web/src/lib/accept-language.test.ts: 16 cases covering refused, all-refused, malformed-q, and control headers.

Tests

  • bun test in packages/web: 48 pass / 0 fail (16 new), run on the laptop worktree.
  • Prettier check on the three touched files: clean.
  • Push used --no-verify: the repo pre-push hook runs a whole-repo check recorded earlier today as failing on current main in an unrelated package (packages/script typecheck); CI on this PR is the whole-repo gate.

🤖 Queue task 5879 (repo-health-opencode-pilot), lane A.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22484590-60a8-4f44-ada0-7c56598ffbf8
Commits

Reviewing files that changed from the base of the PR and between 07eab62 and 4c72f53.

Files selected for processing: 3
  • packages/web/src/lib/accept-language.test.ts
  • packages/web/src/lib/accept-language.ts
  • packages/web/src/middleware.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T18:54:45.184354Z 4c72f53 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 6d9586a into main Nov 1, 2026
1 check passed
@dezren39
dezren39 deleted the queue/5879-1316-web-accept-language branch November 2, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant