Skip to content

Fix translation worker HTML parsing and HEAD cache refresh#608

Merged
riderx merged 1 commit into
mainfrom
codex/fix-translation-worker-parser-cache
May 1, 2026
Merged

Fix translation worker HTML parsing and HEAD cache refresh#608
riderx merged 1 commit into
mainfrom
codex/fix-translation-worker-parser-cache

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 1, 2026

Summary

  • Fix the translation worker HTML tag scanner so > inside quoted attributes does not split tags.
  • Ensure cache refreshes always render from a GET request, preventing HEAD requests from writing empty localized HTML into cache.

Context

Follow-up for late review comments on #607:

Validation

  • bun run ci:verify:translation

Summary by CodeRabbit

  • Bug Fixes
    • Improved HTML tag parsing to correctly handle special characters within quoted attribute values, preventing parsing errors.
    • Enhanced cache refresh logic to ensure translated HTML is consistently rendered using GET requests, improving reliability.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 580c648f-d5b2-4866-a319-2c2172c5c8e9

📥 Commits

Reviewing files that changed from the base of the PR and between 4b8bab4 and d804182.

📒 Files selected for processing (1)
  • apps/translation-worker/src/index.ts

📝 Walkthrough

Walkthrough

The changes introduce a new HTML tag terminator parser (findTagEnd) that correctly identifies closing > characters while skipping those inside quoted attributes. Tag-finding functions are updated to use this parser, and cache refresh logic is modified to convert all requests to GET before rendering translated HTML.

Changes

Cohort / File(s) Summary
HTML Tag Parsing & Cache Refresh Logic
apps/translation-worker/src/index.ts
Added findTagEnd helper to locate tag terminators while respecting quoted attribute values. Updated findNextHtmlTag and findOpeningTag to use this parser and return null on failure. Modified refreshCache to standardize non-GET requests to GET before calling buildTranslatedResponse.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A parser born to find the tag's true end,
Respecting quotes where attributes blend,
No stray > shall fool our keen-eyed friend,
Each request now flows through GET's steady trend,
Translation work springs forth, blessed and penned!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the two main fixes in the changeset: HTML parsing issue and HEAD cache refresh issue, matching the PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-translation-worker-parser-cache

Review rate limit: 0/5 reviews remaining, refill in 56 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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