Reuse parsed value enclosures by default#593
Draft
claell wants to merge 1 commit into
Draft
Conversation
* Preserve quote, brace, and safe bare styles during ordinary writes. * Fall back to braces when edits make stale bare metadata unsafe. * Retain brace defaults for values created without parser metadata.
This was referenced Jul 16, 2026
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.
Summary
no-enclosingmetadata cannot authorize unsafe text.Closes #592.
Validation
tests/test_entrypoint.py.The safety rule also turns eight formerly skipped matrix combinations into executable assertions because ordinary text with stale bare metadata now has an unambiguous enclosed result.
Review note
This changes default formatting but preserves semantics and reduces unrelated diffs. Callers that require uniform braces can still configure
AddEnclosingMiddleware(reuse_previous_enclosing=False, ...)explicitly.The edited-bare guard is important: blindly applying
no-enclosingparser metadata after a value changes can emit invalid BibTeX. An explicitfield.enclosing = "no-enclosing"demand still takes precedence for callers intentionally supplying a valid bare expression.AI assistance
This pull request was prepared with ChatGPT Codex using GPT-5.6 Sol with high reasoning effort. Codex assisted with default-policy analysis, unsafe-edit discovery, matrix refinement, and validation. Automated validation is not a substitute for maintainer review.