Skip to content

🐛 Fix String values becoming tuples in latex transformation middlewares#560

Merged
MiWeiss merged 1 commit into
mainfrom
529-string-latex-tuple
Jun 12, 2026
Merged

🐛 Fix String values becoming tuples in latex transformation middlewares#560
MiWeiss merged 1 commit into
mainfrom
529-string-latex-tuple

Conversation

@MiWeiss

@MiWeiss MiWeiss commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

_PyStringTransformerMiddleware.transform_string assigned the (value, error) tuple returned by _transform_python_value_string directly to string.value, instead of unpacking it like transform_entry does. As a result:

  • After LatexDecodingMiddleware/LatexEncodingMiddleware, String.value was a tuple, not a str.
  • Transformation errors on @string blocks were silently swallowed (no MiddlewareErrorBlock, unlike for entries).

Fix

transform_string now unpacks the tuple and, on error, returns a MiddlewareErrorBlock wrapping a PartialMiddlewareException — mirroring the transform_entry behavior.

Tests

  • En-/decoding a String block yields a str with the transformed value.
  • A failing transformation on a String block surfaces as a MiddlewareErrorBlock in library.failed_blocks.

Fixes #529

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MiWeiss MiWeiss merged commit e2e5425 into main Jun 12, 2026
31 checks passed
@MiWeiss MiWeiss deleted the 529-string-latex-tuple branch June 12, 2026 12:18
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.

String.value becomes a tuple after LatexEncoding/LatexDecodingMiddleware

1 participant