Skip to content

Require GFM adjacency for translate table detection#1087

Closed
feruzm wants to merge 1 commit into
developfrom
fix/translate-table-adjacency
Closed

Require GFM adjacency for translate table detection#1087
feruzm wants to merge 1 commit into
developfrom
fix/translate-table-adjacency

Conversation

@feruzm

@feruzm feruzm commented Jul 6, 2026

Copy link
Copy Markdown
Member

Parity port of the tightening that shipped in the mobile compose-translation review (ecency/ecency-mobile#3325): translateMarkdown classified a block as a table when any line had a pipe and any other line looked like a |---| separator, so prose containing pipe characters near a separator-like line was silently skipped by translation. The separator row must now sit directly below a pipe-containing row (the GFM shape).

Two regression tests added (real table still skipped; pipes-in-prose now translates); suite 30/30.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@feruzm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a49f934b-1d57-4c2b-9f26-e34a50f377f2

📥 Commits

Reviewing files that changed from the base of the PR and between 071f467 and 138c58b.

📒 Files selected for processing (2)
  • apps/web/src/api/translation.ts
  • apps/web/src/specs/api/translate-markdown.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/translate-table-adjacency

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

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

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown

Greptile Summary

This PR tightens markdown table detection in the translation path. The main changes are:

  • Requires a table separator row to be directly below a pipe row.
  • Keeps real GFM tables out of the translation batch.
  • Adds tests for table preservation and pipe-containing prose translation.

Confidence Score: 5/5

This looks safe to merge after a small edge-case cleanup.

  • The main GFM table path is covered by tests.
  • Pipe-containing prose now follows the intended translation path.
  • A separator-only block can still be translated when blank lines split it away from nearby table-like content.

apps/web/src/api/translation.ts

Important Files Changed

Filename Overview
apps/web/src/api/translation.ts Updates table-skipping detection to require GFM-style adjacency, with one edge case around separator-only blocks.
apps/web/src/specs/api/translate-markdown.spec.ts Adds focused tests for the intended table and prose translation behavior.

Fix All in Claude Code

Reviews (1): Last reviewed commit: "fix(publish): require GFM adjacency for ..." | Re-trigger Greptile

Comment on lines +270 to 277
return lines.some(
(line, i) =>
i > 0 &&
line.includes("|") &&
line.includes("-") &&
TABLE_SEPARATOR_LINE.test(line) &&
lines[i - 1].includes("|")
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Standalone Separator Blocks Translate

When a separator row is split into its own block, such as a table-like block with blank lines around |---|, the new i > 0 check can no longer preserve that marker. That block now goes through translation and may come back with the pipe/dash structure changed, while the previous predicate skipped the separator-only block.

Suggested change
return lines.some(
(line, i) =>
i > 0 &&
line.includes("|") &&
line.includes("-") &&
TABLE_SEPARATOR_LINE.test(line) &&
lines[i - 1].includes("|")
);
return lines.some(
(line, i) =>
line.includes("|") &&
line.includes("-") &&
TABLE_SEPARATOR_LINE.test(line) &&
(lines.length === 1 || (i > 0 && lines[i - 1].includes("|")))
);

Fix in Claude Code

@feruzm feruzm closed this Jul 6, 2026
@feruzm feruzm deleted the fix/translate-table-adjacency branch July 6, 2026 19:43
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