Repository navigation
🐛 Preserve enclosing demand in value-transforming middlewares - #606
Merged
Merged
Conversation
MiWeiss
force-pushed
the
fix/value-transform-enclosing
branch
3 times, most recently
from
September 2, 2026 20:00
c0b3db7 to
76a7a79
Compare
The `Field.value` / `String.value` setters intentionally reset `enclosing` to `None`. The latex de-/encoding and the name middlewares reassign the value in place without changing what the value *is*, and thereby dropped the `no-enclosing` demand set by `RemoveEnclosingMiddleware` on unresolved string references (`month = jan`) and concatenations (`pages = intro # outro`). `AddEnclosingMiddleware` then wrapped those in braces on write, silently turning a reference into a literal. Save and restore the enclosing around these in-place value assignments, and add regression tests for fields, `@string` blocks and roundtrips. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MiWeiss
force-pushed
the
fix/value-transform-enclosing
branch
from
September 2, 2026 20:03
76a7a79 to
0fecfb3
Compare
Collaborator
Author
|
lgtm |
MiWeiss
force-pushed
the
fix/value-transform-enclosing
branch
from
September 2, 2026 20:38
55cce31 to
ed320dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same root cause as #605, at two more call sites. Middlewares that rewrite a value's representation lose the
no-enclosingdemand through theField.valuesetter, so references get braced into literals.Affects
LatexEncodingMiddleware,LatexDecodingMiddlewareand the four name middlewares.Fix: save and restore the enclosing around the assignment. The
NamePartsbranch mutates in place and never hits the setter, so it is left alone.model.pyuntouched.Known gap, out of scope: latex encoding still escapes the content of unenclosed values, so
intro # outrobecomesintro \# outro.Tests: 31 cases, all fail before. Suite 2607 passed, from 2576.
🤖 Generated with Claude Code