Skip to content

fix: compare unchanged translation against translate_input.unicode - #621

Closed
Morningstar202604 wants to merge 1 commit into
funstory-ai:mainfrom
Morningstar202604:fix/post-translate-unchanged-comparison
Closed

Morningstar202604 wants to merge 1 commit into
funstory-ai:mainfrom
Morningstar202604:fix/post-translate-unchanged-comparison

Conversation

@Morningstar202604

@Morningstar202604 Morningstar202604 commented Sep 28, 2026 •

Copy link
Copy Markdown

post_translate_paragraph compares the translated string with the TranslateInput object:

if translated_text == translate_input:

A str never equals a TranslateInput, so the unchanged-output branch is unreachable even when the translator returns translate_input.unicode verbatim. The paragraph is then re-typeset through parse_translate_output, dropping its original layout objects, and set_placeholder_full_match() is never called on the LLM tracker.

This is the direct type mismatch described in #610.

Fix: compare against the string payload (translate_input.unicode), consistent with the surrounding code in the same file (pre_translate_paragraph sets text = translate_input.unicode).

Verification — extracted TranslateInput and post_translate_paragraph from the patched file and ran both conditions against a stub tracker/paragraph:

  • old condition, output == input → returns True, layout rebuilt (the unreachable-branch bug)
  • new condition, output == input → returns False, layout preserved
  • new condition, output != input → returns True (unchanged behaviour)

ruff check, ruff format --check and py_compile pass on the modified file.

Refs #610


Summary by cubic

Fixes the unchanged-output branch in post_translate_paragraph so verbatim translations preserve the original layout instead of being re-typeset.

Previously the branch compared a str against a TranslateInput object, so it was unreachable even when the translator returned the input unchanged. The comparison now targets translate_input.unicode, matching how pre_translate_paragraph extracts the string, which also lets the LLM tracker's set_placeholder_full_match() fire correctly.

Written for commit 62bc8e8. Summary will update on new commits.

Review in cubic

post_translate_paragraph compared the translated string with the
TranslateInput object itself, so the unchanged-output branch could never
be taken: even when the translator returns translate_input.unicode
verbatim, the paragraph was re-typeset and its original layout objects
were dropped. Compare against the string payload instead.

Ref: funstory-ai#610

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@Morningstar202604
Morningstar202604 deleted the fix/post-translate-unchanged-comparison branch October 20, 2026 01:26
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