fix: enforce translated runtime responses#609
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe translation worker now implements query parameter-based cache versioning, enforces strict no-store cache controls on translated responses, adds 503 responses for translation failures, validates translation batch counts with error handling, and shifts language-selector handling from client-side script injection to server-side DOM rewriting with locale-aware href updates. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 0/5 reviews remaining, refill in 59 minutes and 16 seconds. Comment |
3697d17 to
1ee0d01
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3697d173db
ℹ️ 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".
1ee0d01 to
153be1c
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 153be1cf9a
ℹ️ 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".
153be1c to
8fe7065
Compare
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fe70655d3
ℹ️ 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".
| const contentLength = Number.parseInt(originResponse.headers.get('Content-Length') || '0', 10) | ||
| if (Number.isFinite(contentLength) && contentLength > MAX_HTML_BYTES) { | ||
| return withResponseHeaders(originResponse, 'BYPASS') | ||
| throw new Error(`Source HTML is too large to translate: ${contentLength} bytes`) |
There was a problem hiding this comment.
Handle oversized pages without retryable 503s
Throwing on MAX_HTML_BYTES in buildTranslatedResponse now routes every oversized localized page through the top-level catch, which always returns 503 with Retry-After: 60; because page size is deterministic, those requests will never recover on retry and the locale path becomes permanently unavailable on cold misses. This is a regression from the previous bypass behavior and affects any page whose HTML exceeds the size cap.
Useful? React with 👍 / 👎.



What changed
Why
Production
/es/could be served from public edge cache and the worker could cache or return partially English HTML when the model output was invalid or under-translated. Language-selector links were also being rewritten to the current locale before a client-side repair script ran.Validation
bun run ci:verify:translationSummary by CodeRabbit
Release Notes
New Features
Bug Fixes